重构NetManager支持MessagePair,新增TSRPCWsClient。
This commit is contained in:
@@ -2,34 +2,32 @@ import { ServiceProto } from 'tsrpc-proto';
|
||||
import { MsgChat } from './MsgChat';
|
||||
import { MsgPlayerJoin } from './MsgPlayerJoin';
|
||||
import { MsgPlayerMove } from './MsgPlayerMove';
|
||||
import { ReqLogin, ResLogin } from './PtlLogin';
|
||||
import { ReqMove, ResMove } from './PtlMove';
|
||||
import { ReqSend, ResSend } from './PtlSend';
|
||||
import { MsgReqLogin } from './MsgReqLogin';
|
||||
import { MsgReqMove } from './MsgReqMove';
|
||||
import { MsgReqSend } from './MsgReqSend';
|
||||
import { MsgResLogin } from './MsgResLogin';
|
||||
import { MsgResMove } from './MsgResMove';
|
||||
import { MsgResSend } from './MsgResSend';
|
||||
|
||||
export interface ServiceType {
|
||||
api: {
|
||||
"Login": {
|
||||
req: ReqLogin,
|
||||
res: ResLogin
|
||||
},
|
||||
"Move": {
|
||||
req: ReqMove,
|
||||
res: ResMove
|
||||
},
|
||||
"Send": {
|
||||
req: ReqSend,
|
||||
res: ResSend
|
||||
}
|
||||
|
||||
},
|
||||
msg: {
|
||||
"Chat": MsgChat,
|
||||
"PlayerJoin": MsgPlayerJoin,
|
||||
"PlayerMove": MsgPlayerMove
|
||||
"PlayerMove": MsgPlayerMove,
|
||||
"ReqLogin": MsgReqLogin,
|
||||
"ReqMove": MsgReqMove,
|
||||
"ReqSend": MsgReqSend,
|
||||
"ResLogin": MsgResLogin,
|
||||
"ResMove": MsgResMove,
|
||||
"ResSend": MsgResSend
|
||||
}
|
||||
}
|
||||
|
||||
export const serviceProto: ServiceProto<ServiceType> = {
|
||||
"version": 3,
|
||||
"version": 5,
|
||||
"services": [
|
||||
{
|
||||
"id": 0,
|
||||
@@ -47,19 +45,34 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
"type": "msg"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Login",
|
||||
"type": "api"
|
||||
"id": 6,
|
||||
"name": "ReqLogin",
|
||||
"type": "msg"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "Move",
|
||||
"type": "api"
|
||||
"id": 7,
|
||||
"name": "ReqMove",
|
||||
"type": "msg"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Send",
|
||||
"type": "api"
|
||||
"id": 8,
|
||||
"name": "ReqSend",
|
||||
"type": "msg"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"name": "ResLogin",
|
||||
"type": "msg"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"name": "ResMove",
|
||||
"type": "msg"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"name": "ResSend",
|
||||
"type": "msg"
|
||||
}
|
||||
],
|
||||
"types": {
|
||||
@@ -176,18 +189,18 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
]
|
||||
},
|
||||
"PtlLogin/ReqLogin": {
|
||||
"MsgReqLogin/MsgReqLogin": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 1,
|
||||
"id": 0,
|
||||
"name": "playerId",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"id": 1,
|
||||
"name": "playerName",
|
||||
"type": {
|
||||
"type": "String"
|
||||
@@ -196,7 +209,38 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
]
|
||||
},
|
||||
"PtlLogin/ResLogin": {
|
||||
"MsgReqMove/MsgReqMove": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "x",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "y",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"MsgReqSend/MsgReqSend": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "content",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"MsgResLogin/MsgResLogin": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
@@ -214,16 +258,16 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"id": 2,
|
||||
"name": "player",
|
||||
"type": {
|
||||
"type": "Reference",
|
||||
"target": "PtlLogin/PlayerInfo"
|
||||
"target": "MsgResLogin/PlayerInfo"
|
||||
},
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"id": 3,
|
||||
"name": "isNewPlayer",
|
||||
"type": {
|
||||
"type": "Boolean"
|
||||
@@ -232,7 +276,7 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
]
|
||||
},
|
||||
"PtlLogin/PlayerInfo": {
|
||||
"MsgResLogin/PlayerInfo": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
@@ -302,26 +346,7 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
]
|
||||
},
|
||||
"PtlMove/ReqMove": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "x",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "y",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"PtlMove/ResMove": {
|
||||
"MsgResMove/MsgResMove": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
@@ -336,8 +361,7 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
"name": "message",
|
||||
"type": {
|
||||
"type": "String"
|
||||
},
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -350,19 +374,7 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
]
|
||||
},
|
||||
"PtlSend/ReqSend": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "content",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"PtlSend/ResSend": {
|
||||
"MsgResSend/MsgResSend": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user