378 lines
9.9 KiB
TypeScript
378 lines
9.9 KiB
TypeScript
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';
|
|
|
|
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
|
|
}
|
|
}
|
|
|
|
export const serviceProto: ServiceProto<ServiceType> = {
|
|
"version": 3,
|
|
"services": [
|
|
{
|
|
"id": 0,
|
|
"name": "Chat",
|
|
"type": "msg"
|
|
},
|
|
{
|
|
"id": 3,
|
|
"name": "PlayerJoin",
|
|
"type": "msg"
|
|
},
|
|
{
|
|
"id": 4,
|
|
"name": "PlayerMove",
|
|
"type": "msg"
|
|
},
|
|
{
|
|
"id": 2,
|
|
"name": "Login",
|
|
"type": "api"
|
|
},
|
|
{
|
|
"id": 5,
|
|
"name": "Move",
|
|
"type": "api"
|
|
},
|
|
{
|
|
"id": 1,
|
|
"name": "Send",
|
|
"type": "api"
|
|
}
|
|
],
|
|
"types": {
|
|
"MsgChat/MsgChat": {
|
|
"type": "Interface",
|
|
"properties": [
|
|
{
|
|
"id": 0,
|
|
"name": "content",
|
|
"type": {
|
|
"type": "String"
|
|
}
|
|
},
|
|
{
|
|
"id": 1,
|
|
"name": "time",
|
|
"type": {
|
|
"type": "Date"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"MsgPlayerJoin/MsgPlayerJoin": {
|
|
"type": "Interface",
|
|
"properties": [
|
|
{
|
|
"id": 0,
|
|
"name": "playerId",
|
|
"type": {
|
|
"type": "String"
|
|
}
|
|
},
|
|
{
|
|
"id": 1,
|
|
"name": "playerName",
|
|
"type": {
|
|
"type": "String"
|
|
}
|
|
},
|
|
{
|
|
"id": 2,
|
|
"name": "position",
|
|
"type": {
|
|
"type": "Reference",
|
|
"target": "base/Position"
|
|
}
|
|
},
|
|
{
|
|
"id": 3,
|
|
"name": "isNewPlayer",
|
|
"type": {
|
|
"type": "Boolean"
|
|
}
|
|
},
|
|
{
|
|
"id": 4,
|
|
"name": "timestamp",
|
|
"type": {
|
|
"type": "Number"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"base/Position": {
|
|
"type": "Interface",
|
|
"properties": [
|
|
{
|
|
"id": 0,
|
|
"name": "x",
|
|
"type": {
|
|
"type": "Number"
|
|
}
|
|
},
|
|
{
|
|
"id": 1,
|
|
"name": "y",
|
|
"type": {
|
|
"type": "Number"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"MsgPlayerMove/MsgPlayerMove": {
|
|
"type": "Interface",
|
|
"properties": [
|
|
{
|
|
"id": 0,
|
|
"name": "playerId",
|
|
"type": {
|
|
"type": "String"
|
|
}
|
|
},
|
|
{
|
|
"id": 1,
|
|
"name": "playerName",
|
|
"type": {
|
|
"type": "String"
|
|
}
|
|
},
|
|
{
|
|
"id": 2,
|
|
"name": "position",
|
|
"type": {
|
|
"type": "Reference",
|
|
"target": "base/Position"
|
|
}
|
|
},
|
|
{
|
|
"id": 3,
|
|
"name": "timestamp",
|
|
"type": {
|
|
"type": "Number"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"PtlLogin/ReqLogin": {
|
|
"type": "Interface",
|
|
"properties": [
|
|
{
|
|
"id": 1,
|
|
"name": "playerId",
|
|
"type": {
|
|
"type": "String"
|
|
}
|
|
},
|
|
{
|
|
"id": 2,
|
|
"name": "playerName",
|
|
"type": {
|
|
"type": "String"
|
|
},
|
|
"optional": true
|
|
}
|
|
]
|
|
},
|
|
"PtlLogin/ResLogin": {
|
|
"type": "Interface",
|
|
"properties": [
|
|
{
|
|
"id": 0,
|
|
"name": "success",
|
|
"type": {
|
|
"type": "Boolean"
|
|
}
|
|
},
|
|
{
|
|
"id": 1,
|
|
"name": "message",
|
|
"type": {
|
|
"type": "String"
|
|
}
|
|
},
|
|
{
|
|
"id": 4,
|
|
"name": "player",
|
|
"type": {
|
|
"type": "Reference",
|
|
"target": "PtlLogin/PlayerInfo"
|
|
},
|
|
"optional": true
|
|
},
|
|
{
|
|
"id": 5,
|
|
"name": "isNewPlayer",
|
|
"type": {
|
|
"type": "Boolean"
|
|
},
|
|
"optional": true
|
|
}
|
|
]
|
|
},
|
|
"PtlLogin/PlayerInfo": {
|
|
"type": "Interface",
|
|
"properties": [
|
|
{
|
|
"id": 0,
|
|
"name": "id",
|
|
"type": {
|
|
"type": "String"
|
|
}
|
|
},
|
|
{
|
|
"id": 1,
|
|
"name": "name",
|
|
"type": {
|
|
"type": "String"
|
|
}
|
|
},
|
|
{
|
|
"id": 2,
|
|
"name": "position",
|
|
"type": {
|
|
"type": "Reference",
|
|
"target": "base/Position"
|
|
}
|
|
},
|
|
{
|
|
"id": 3,
|
|
"name": "spawnPoint",
|
|
"type": {
|
|
"type": "Reference",
|
|
"target": "base/Position"
|
|
}
|
|
},
|
|
{
|
|
"id": 4,
|
|
"name": "hp",
|
|
"type": {
|
|
"type": "Number"
|
|
}
|
|
},
|
|
{
|
|
"id": 5,
|
|
"name": "maxHp",
|
|
"type": {
|
|
"type": "Number"
|
|
}
|
|
},
|
|
{
|
|
"id": 6,
|
|
"name": "isAlive",
|
|
"type": {
|
|
"type": "Boolean"
|
|
}
|
|
},
|
|
{
|
|
"id": 7,
|
|
"name": "createdAt",
|
|
"type": {
|
|
"type": "Number"
|
|
}
|
|
},
|
|
{
|
|
"id": 8,
|
|
"name": "lastLoginAt",
|
|
"type": {
|
|
"type": "Number"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"PtlMove/ReqMove": {
|
|
"type": "Interface",
|
|
"properties": [
|
|
{
|
|
"id": 0,
|
|
"name": "x",
|
|
"type": {
|
|
"type": "Number"
|
|
}
|
|
},
|
|
{
|
|
"id": 1,
|
|
"name": "y",
|
|
"type": {
|
|
"type": "Number"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"PtlMove/ResMove": {
|
|
"type": "Interface",
|
|
"properties": [
|
|
{
|
|
"id": 0,
|
|
"name": "success",
|
|
"type": {
|
|
"type": "Boolean"
|
|
}
|
|
},
|
|
{
|
|
"id": 1,
|
|
"name": "message",
|
|
"type": {
|
|
"type": "String"
|
|
},
|
|
"optional": true
|
|
},
|
|
{
|
|
"id": 2,
|
|
"name": "position",
|
|
"type": {
|
|
"type": "Reference",
|
|
"target": "base/Position"
|
|
},
|
|
"optional": true
|
|
}
|
|
]
|
|
},
|
|
"PtlSend/ReqSend": {
|
|
"type": "Interface",
|
|
"properties": [
|
|
{
|
|
"id": 0,
|
|
"name": "content",
|
|
"type": {
|
|
"type": "String"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"PtlSend/ResSend": {
|
|
"type": "Interface",
|
|
"properties": [
|
|
{
|
|
"id": 0,
|
|
"name": "time",
|
|
"type": {
|
|
"type": "Date"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}; |