This commit is contained in:
建喵 2023-09-15 11:13:41 +08:00
parent b65105567d
commit a0c82c96ef
3 changed files with 253 additions and 221 deletions

View File

@ -20,6 +20,9 @@ export enum EGameState {
/** 回合結束 */ /** 回合結束 */
TurnEnd, TurnEnd,
/** 遊戲結束 */
GameOver,
MyReady = 100, MyReady = 100,
MyWait, MyWait,
MyTurnCards, MyTurnCards,

3
room/PtlSendAns.ts Normal file
View File

@ -0,0 +1,3 @@
export interface ReqSendAns { answer: number }
export type ResSendAns = boolean

View File

@ -1,227 +1,253 @@
import { ServiceProto } from "tsrpc-proto"; import { ServiceProto } from 'tsrpc-proto';
import { ReqLogin, ResLogin } from "./account/PtlLogin"; import { ReqLogin, ResLogin } from './account/PtlLogin';
import { MsgChat } from "./MsgChat"; import { MsgChat } from './MsgChat';
import { MsgChangeState } from "./room/MsgChangeState"; import { MsgChangeState } from './room/MsgChangeState';
import { MsgExit } from "./room/MsgExit"; import { MsgExit } from './room/MsgExit';
import { MsgGoToGame } from "./room/MsgGoToGame"; import { MsgGoToGame } from './room/MsgGoToGame';
import { ReqChangeState, ResChangeState } from "./room/PtlChangeState"; import { ReqChangeState, ResChangeState } from './room/PtlChangeState';
import { ReqCreate, ResCreate } from "./room/PtlCreate"; import { ReqCreate, ResCreate } from './room/PtlCreate';
import { ReqExit, ResExit } from "./room/PtlExit"; import { ReqExit, ResExit } from './room/PtlExit';
import { ReqJoin, ResJoin } from "./room/PtlJoin"; import { ReqJoin, ResJoin } from './room/PtlJoin';
import { ReqList, ResList } from "./room/PtlList"; import { ReqList, ResList } from './room/PtlList';
import { ReqSendAns, ResSendAns } from './room/PtlSendAns';
export interface ServiceType { export interface ServiceType {
api: { api: {
"account/Login": { "account/Login": {
req: ReqLogin, req: ReqLogin,
res: ResLogin res: ResLogin
}, },
"room/ChangeState": { "room/ChangeState": {
req: ReqChangeState, req: ReqChangeState,
res: ResChangeState res: ResChangeState
}, },
"room/Create": { "room/Create": {
req: ReqCreate, req: ReqCreate,
res: ResCreate res: ResCreate
}, },
"room/Exit": { "room/Exit": {
req: ReqExit, req: ReqExit,
res: ResExit res: ResExit
}, },
"room/Join": { "room/Join": {
req: ReqJoin, req: ReqJoin,
res: ResJoin res: ResJoin
}, },
"room/List": { "room/List": {
req: ReqList, req: ReqList,
res: ResList res: ResList
} },
}, "room/SendAns": {
msg: { req: ReqSendAns,
"Chat": MsgChat, res: ResSendAns
"room/ChangeState": MsgChangeState, }
"room/Exit": MsgExit, },
"room/GoToGame": MsgGoToGame msg: {
} "Chat": MsgChat,
"room/ChangeState": MsgChangeState,
"room/Exit": MsgExit,
"room/GoToGame": MsgGoToGame
}
} }
export const serviceProto: ServiceProto<ServiceType> = { export const serviceProto: ServiceProto<ServiceType> = {
"services": [ "version": 1,
{ "services": [
"id": 0, {
"name": "account/Login", "id": 0,
"type": "api" "name": "account/Login",
}, "type": "api"
{ },
"id": 1, {
"name": "Chat", "id": 1,
"type": "msg" "name": "Chat",
}, "type": "msg"
{ },
"id": 2, {
"name": "room/ChangeState", "id": 2,
"type": "msg" "name": "room/ChangeState",
}, "type": "msg"
{ },
"id": 3, {
"name": "room/Exit", "id": 3,
"type": "msg" "name": "room/Exit",
}, "type": "msg"
{ },
"id": 4, {
"name": "room/GoToGame", "id": 4,
"type": "msg" "name": "room/GoToGame",
}, "type": "msg"
{ },
"id": 5, {
"name": "room/ChangeState", "id": 5,
"type": "api" "name": "room/ChangeState",
}, "type": "api"
{ },
"id": 6, {
"name": "room/Create", "id": 6,
"type": "api" "name": "room/Create",
}, "type": "api"
{ },
"id": 7, {
"name": "room/Exit", "id": 7,
"type": "api" "name": "room/Exit",
}, "type": "api"
{ },
"id": 8, {
"name": "room/Join", "id": 8,
"type": "api" "name": "room/Join",
}, "type": "api"
{ },
"id": 9, {
"name": "room/List", "id": 9,
"type": "api" "name": "room/List",
} "type": "api"
], },
"types": { {
"account/PtlLogin/ReqLogin": { "id": 10,
"type": "Interface", "name": "room/SendAns",
"properties": [ "type": "api"
{ }
"id": 0, ],
"name": "name", "types": {
"type": { "account/PtlLogin/ReqLogin": {
"type": "String" "type": "Interface",
} "properties": [
} {
] "id": 0,
}, "name": "name",
"account/PtlLogin/ResLogin": { "type": {
"type": "Number" "type": "String"
}, }
"MsgChat/MsgChat": { }
"type": "Interface", ]
"properties": [ },
{ "account/PtlLogin/ResLogin": {
"id": 0, "type": "Number"
"name": "content", },
"type": { "MsgChat/MsgChat": {
"type": "String" "type": "Interface",
} "properties": [
}, {
{ "id": 0,
"id": 1, "name": "content",
"name": "time", "type": {
"type": { "type": "String"
"type": "Date" }
} },
} {
] "id": 1,
}, "name": "time",
"room/MsgChangeState/MsgChangeState": { "type": {
"type": "Array", "type": "Date"
"elementType": { }
"type": "Any" }
} ]
}, },
"room/MsgExit/MsgExit": { "room/MsgChangeState/MsgChangeState": {
"type": "Number" "type": "Array",
}, "elementType": {
"room/MsgGoToGame/MsgGoToGame": { "type": "Any"
"type": "Number" }
}, },
"room/PtlChangeState/ReqChangeState": { "room/MsgExit/MsgExit": {
"type": "Interface", "type": "Number"
"properties": [ },
{ "room/MsgGoToGame/MsgGoToGame": {
"id": 0, "type": "Number"
"name": "state", },
"type": { "room/PtlChangeState/ReqChangeState": {
"type": "Number" "type": "Interface",
} "properties": [
} {
] "id": 0,
}, "name": "state",
"room/PtlChangeState/ResChangeState": { "type": {
"type": "Number" "type": "Number"
}, }
"room/PtlCreate/ReqCreate": { }
"type": "Interface", ]
"properties": [ },
{ "room/PtlChangeState/ResChangeState": {
"id": 0, "type": "Number"
"name": "null", },
"type": { "room/PtlCreate/ReqCreate": {
"type": "String" "type": "Interface",
} "properties": [
} {
] "id": 0,
}, "name": "null",
"room/PtlCreate/ResCreate": { "type": {
"type": "Number" "type": "String"
}, }
"room/PtlExit/ReqExit": { }
"type": "Interface", ]
"properties": [ },
{ "room/PtlCreate/ResCreate": {
"id": 0, "type": "Number"
"name": "null", },
"type": { "room/PtlExit/ReqExit": {
"type": "String" "type": "Interface",
} "properties": [
} {
] "id": 0,
}, "name": "null",
"room/PtlExit/ResExit": { "type": {
"type": "Number" "type": "String"
}, }
"room/PtlJoin/ReqJoin": { }
"type": "Interface", ]
"properties": [ },
{ "room/PtlExit/ResExit": {
"id": 0, "type": "Number"
"name": "roomId", },
"type": { "room/PtlJoin/ReqJoin": {
"type": "Number" "type": "Interface",
} "properties": [
} {
] "id": 0,
}, "name": "roomId",
"room/PtlJoin/ResJoin": { "type": {
"type": "Number" "type": "Number"
}, }
"room/PtlList/ReqList": { }
"type": "Interface", ]
"properties": [ },
{ "room/PtlJoin/ResJoin": {
"id": 0, "type": "Number"
"name": "null", },
"type": { "room/PtlList/ReqList": {
"type": "String" "type": "Interface",
} "properties": [
} {
] "id": 0,
}, "name": "null",
"room/PtlList/ResList": { "type": {
"type": "Array", "type": "String"
"elementType": { }
"type": "Any" }
} ]
} },
} "room/PtlList/ResList": {
"type": "Array",
"elementType": {
"type": "Any"
}
},
"room/PtlSendAns/ReqSendAns": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "answer",
"type": {
"type": "Number"
}
}
]
},
"room/PtlSendAns/ResSendAns": {
"type": "Boolean"
}
}
}; };