[add] Room SetReady,ChangeState

This commit is contained in:
建喵 2023-09-10 19:33:38 +08:00
parent 725551854f
commit 14a11e2f3a
4 changed files with 66 additions and 1 deletions

16
define/enum.ts Normal file
View File

@ -0,0 +1,16 @@
export enum EGameState {
Loading,
TurnCards,
ImageViewer,
ChooseCards,
MyLoading = 100,
MyTurnCards,
MyImageViewer,
MyChooseCards,
OtherLoading = 200,
OtherTurnCards = 201,
OtherImageViewer,
OtherChooseCards,
}

1
room/MsgChangeState.ts Normal file
View File

@ -0,0 +1 @@
export type MsgChangeState = number

5
room/PtlChangeState.ts Normal file
View File

@ -0,0 +1,5 @@
export interface ReqChangeState {
state: number;
}
export type ResChangeState = number

View File

@ -1,8 +1,10 @@
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 { 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 { 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";
@ -14,6 +16,10 @@ export interface ServiceType {
req: ReqLogin, req: ReqLogin,
res: ResLogin res: ResLogin
}, },
"room/ChangeState": {
req: ReqChangeState,
res: ResChangeState
},
"room/Create": { "room/Create": {
req: ReqCreate, req: ReqCreate,
res: ResCreate res: ResCreate
@ -33,13 +39,14 @@ export interface ServiceType {
}, },
msg: { msg: {
"Chat": MsgChat, "Chat": MsgChat,
"room/ChangeState": MsgChangeState,
"room/Exit": MsgExit, "room/Exit": MsgExit,
"room/GoToGame": MsgGoToGame "room/GoToGame": MsgGoToGame
} }
} }
export const serviceProto: ServiceProto<ServiceType> = { export const serviceProto: ServiceProto<ServiceType> = {
"version": 10, "version": 12,
"services": [ "services": [
{ {
"id": 4, "id": 4,
@ -51,6 +58,11 @@ export const serviceProto: ServiceProto<ServiceType> = {
"name": "Chat", "name": "Chat",
"type": "msg" "type": "msg"
}, },
{
"id": 12,
"name": "room/ChangeState",
"type": "msg"
},
{ {
"id": 10, "id": 10,
"name": "room/Exit", "name": "room/Exit",
@ -61,6 +73,11 @@ export const serviceProto: ServiceProto<ServiceType> = {
"name": "room/GoToGame", "name": "room/GoToGame",
"type": "msg" "type": "msg"
}, },
{
"id": 13,
"name": "room/ChangeState",
"type": "api"
},
{ {
"id": 6, "id": 6,
"name": "room/Create", "name": "room/Create",
@ -117,12 +134,38 @@ export const serviceProto: ServiceProto<ServiceType> = {
} }
] ]
}, },
"room/MsgChangeState/MsgChangeState": {
"type": "Number"
},
"room/MsgExit/MsgExit": { "room/MsgExit/MsgExit": {
"type": "Number" "type": "Number"
}, },
"room/MsgGoToGame/MsgGoToGame": { "room/MsgGoToGame/MsgGoToGame": {
"type": "Number" "type": "Number"
}, },
"room/PtlChangeState/ReqChangeState": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "state",
"type": {
"type": "Number"
}
},
{
"id": 1,
"name": "data",
"type": {
"type": "Any"
},
"optional": true
}
]
},
"room/PtlChangeState/ResChangeState": {
"type": "Number"
},
"room/PtlCreate/ReqCreate": { "room/PtlCreate/ReqCreate": {
"type": "Interface", "type": "Interface",
"properties": [ "properties": [