2025-12-14 22:38:09 +08:00
|
|
|
import { ServiceProto } from 'tsrpc-proto';
|
|
|
|
|
import { MsgChat } from './MsgChat';
|
|
|
|
|
import { MsgPlayerJoin } from './MsgPlayerJoin';
|
|
|
|
|
import { MsgPlayerMove } from './MsgPlayerMove';
|
2025-12-18 13:25:04 +08:00
|
|
|
import { MsgReqLogin } from './MsgReqLogin';
|
|
|
|
|
import { MsgReqMove } from './MsgReqMove';
|
|
|
|
|
import { MsgReqSend } from './MsgReqSend';
|
|
|
|
|
import { MsgResLogin } from './MsgResLogin';
|
|
|
|
|
import { MsgResMove } from './MsgResMove';
|
|
|
|
|
import { MsgResSend } from './MsgResSend';
|
2025-12-14 22:38:09 +08:00
|
|
|
|
|
|
|
|
export interface ServiceType {
|
|
|
|
|
api: {
|
2025-12-18 13:25:04 +08:00
|
|
|
|
2025-12-14 22:38:09 +08:00
|
|
|
},
|
|
|
|
|
msg: {
|
|
|
|
|
"Chat": MsgChat,
|
|
|
|
|
"PlayerJoin": MsgPlayerJoin,
|
2025-12-18 13:25:04 +08:00
|
|
|
"PlayerMove": MsgPlayerMove,
|
|
|
|
|
"ReqLogin": MsgReqLogin,
|
|
|
|
|
"ReqMove": MsgReqMove,
|
|
|
|
|
"ReqSend": MsgReqSend,
|
|
|
|
|
"ResLogin": MsgResLogin,
|
|
|
|
|
"ResMove": MsgResMove,
|
|
|
|
|
"ResSend": MsgResSend
|
2025-12-14 22:38:09 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const serviceProto: ServiceProto<ServiceType> = {
|
2025-12-18 16:04:56 +08:00
|
|
|
"version": 6,
|
2025-12-14 22:38:09 +08:00
|
|
|
"services": [
|
|
|
|
|
{
|
|
|
|
|
"id": 0,
|
|
|
|
|
"name": "Chat",
|
|
|
|
|
"type": "msg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 3,
|
|
|
|
|
"name": "PlayerJoin",
|
|
|
|
|
"type": "msg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 4,
|
|
|
|
|
"name": "PlayerMove",
|
|
|
|
|
"type": "msg"
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-12-18 13:25:04 +08:00
|
|
|
"id": 6,
|
|
|
|
|
"name": "ReqLogin",
|
|
|
|
|
"type": "msg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 7,
|
|
|
|
|
"name": "ReqMove",
|
|
|
|
|
"type": "msg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 8,
|
|
|
|
|
"name": "ReqSend",
|
|
|
|
|
"type": "msg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 9,
|
|
|
|
|
"name": "ResLogin",
|
|
|
|
|
"type": "msg"
|
2025-12-14 22:38:09 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-12-18 13:25:04 +08:00
|
|
|
"id": 10,
|
|
|
|
|
"name": "ResMove",
|
|
|
|
|
"type": "msg"
|
2025-12-14 22:38:09 +08:00
|
|
|
},
|
|
|
|
|
{
|
2025-12-18 13:25:04 +08:00
|
|
|
"id": 11,
|
|
|
|
|
"name": "ResSend",
|
|
|
|
|
"type": "msg"
|
2025-12-14 22:38:09 +08:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"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"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
2025-12-18 13:25:04 +08:00
|
|
|
"MsgReqLogin/MsgReqLogin": {
|
2025-12-14 22:38:09 +08:00
|
|
|
"type": "Interface",
|
|
|
|
|
"properties": [
|
|
|
|
|
{
|
2025-12-18 13:25:04 +08:00
|
|
|
"id": 0,
|
2025-12-14 22:38:09 +08:00
|
|
|
"name": "playerId",
|
|
|
|
|
"type": {
|
|
|
|
|
"type": "String"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-12-18 13:25:04 +08:00
|
|
|
"id": 1,
|
2025-12-14 22:38:09 +08:00
|
|
|
"name": "playerName",
|
|
|
|
|
"type": {
|
|
|
|
|
"type": "String"
|
|
|
|
|
},
|
|
|
|
|
"optional": true
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
2025-12-18 13:25:04 +08:00
|
|
|
"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": {
|
2025-12-14 22:38:09 +08:00
|
|
|
"type": "Interface",
|
|
|
|
|
"properties": [
|
|
|
|
|
{
|
|
|
|
|
"id": 0,
|
|
|
|
|
"name": "success",
|
|
|
|
|
"type": {
|
|
|
|
|
"type": "Boolean"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 1,
|
|
|
|
|
"name": "message",
|
|
|
|
|
"type": {
|
|
|
|
|
"type": "String"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-12-18 13:25:04 +08:00
|
|
|
"id": 2,
|
2025-12-14 22:38:09 +08:00
|
|
|
"name": "player",
|
|
|
|
|
"type": {
|
|
|
|
|
"type": "Reference",
|
2025-12-18 13:25:04 +08:00
|
|
|
"target": "MsgResLogin/PlayerInfo"
|
2025-12-14 22:38:09 +08:00
|
|
|
},
|
|
|
|
|
"optional": true
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-12-18 13:25:04 +08:00
|
|
|
"id": 3,
|
2025-12-14 22:38:09 +08:00
|
|
|
"name": "isNewPlayer",
|
|
|
|
|
"type": {
|
|
|
|
|
"type": "Boolean"
|
|
|
|
|
},
|
|
|
|
|
"optional": true
|
2025-12-18 16:04:56 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 4,
|
|
|
|
|
"name": "otherPlayers",
|
|
|
|
|
"type": {
|
|
|
|
|
"type": "Array",
|
|
|
|
|
"elementType": {
|
|
|
|
|
"type": "Reference",
|
|
|
|
|
"target": "MsgResLogin/PlayerInfo"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"optional": true
|
2025-12-14 22:38:09 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
2025-12-18 13:25:04 +08:00
|
|
|
"MsgResLogin/PlayerInfo": {
|
2025-12-14 22:38:09 +08:00
|
|
|
"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"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
2025-12-18 13:25:04 +08:00
|
|
|
"MsgResMove/MsgResMove": {
|
2025-12-14 22:38:09 +08:00
|
|
|
"type": "Interface",
|
|
|
|
|
"properties": [
|
|
|
|
|
{
|
|
|
|
|
"id": 0,
|
|
|
|
|
"name": "success",
|
|
|
|
|
"type": {
|
|
|
|
|
"type": "Boolean"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 1,
|
|
|
|
|
"name": "message",
|
|
|
|
|
"type": {
|
|
|
|
|
"type": "String"
|
2025-12-18 13:25:04 +08:00
|
|
|
}
|
2025-12-14 22:38:09 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 2,
|
|
|
|
|
"name": "position",
|
|
|
|
|
"type": {
|
|
|
|
|
"type": "Reference",
|
|
|
|
|
"target": "base/Position"
|
|
|
|
|
},
|
|
|
|
|
"optional": true
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
2025-12-18 13:25:04 +08:00
|
|
|
"MsgResSend/MsgResSend": {
|
2025-12-14 22:38:09 +08:00
|
|
|
"type": "Interface",
|
|
|
|
|
"properties": [
|
|
|
|
|
{
|
|
|
|
|
"id": 0,
|
|
|
|
|
"name": "time",
|
|
|
|
|
"type": {
|
|
|
|
|
"type": "Date"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|