Files
rougelike-demo/client/assets/scripts/Shared/protocols/serviceProto.ts
2025-12-18 16:04:56 +08:00

402 lines
11 KiB
TypeScript

import { ServiceProto } from 'tsrpc-proto';
import { MsgChat } from './MsgChat';
import { MsgPlayerJoin } from './MsgPlayerJoin';
import { MsgPlayerMove } from './MsgPlayerMove';
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: {
},
msg: {
"Chat": MsgChat,
"PlayerJoin": MsgPlayerJoin,
"PlayerMove": MsgPlayerMove,
"ReqLogin": MsgReqLogin,
"ReqMove": MsgReqMove,
"ReqSend": MsgReqSend,
"ResLogin": MsgResLogin,
"ResMove": MsgResMove,
"ResSend": MsgResSend
}
}
export const serviceProto: ServiceProto<ServiceType> = {
"version": 6,
"services": [
{
"id": 0,
"name": "Chat",
"type": "msg"
},
{
"id": 3,
"name": "PlayerJoin",
"type": "msg"
},
{
"id": 4,
"name": "PlayerMove",
"type": "msg"
},
{
"id": 6,
"name": "ReqLogin",
"type": "msg"
},
{
"id": 7,
"name": "ReqMove",
"type": "msg"
},
{
"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": {
"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"
}
}
]
},
"MsgReqLogin/MsgReqLogin": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "playerId",
"type": {
"type": "String"
}
},
{
"id": 1,
"name": "playerName",
"type": {
"type": "String"
},
"optional": true
}
]
},
"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": [
{
"id": 0,
"name": "success",
"type": {
"type": "Boolean"
}
},
{
"id": 1,
"name": "message",
"type": {
"type": "String"
}
},
{
"id": 2,
"name": "player",
"type": {
"type": "Reference",
"target": "MsgResLogin/PlayerInfo"
},
"optional": true
},
{
"id": 3,
"name": "isNewPlayer",
"type": {
"type": "Boolean"
},
"optional": true
},
{
"id": 4,
"name": "otherPlayers",
"type": {
"type": "Array",
"elementType": {
"type": "Reference",
"target": "MsgResLogin/PlayerInfo"
}
},
"optional": true
}
]
},
"MsgResLogin/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"
}
}
]
},
"MsgResMove/MsgResMove": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "success",
"type": {
"type": "Boolean"
}
},
{
"id": 1,
"name": "message",
"type": {
"type": "String"
}
},
{
"id": 2,
"name": "position",
"type": {
"type": "Reference",
"target": "base/Position"
},
"optional": true
}
]
},
"MsgResSend/MsgResSend": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "time",
"type": {
"type": "Date"
}
}
]
}
}
};