[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 { ReqLogin, ResLogin } from "./account/PtlLogin";
import { MsgChat } from "./MsgChat";
import { MsgChangeState } from "./room/MsgChangeState";
import { MsgExit } from "./room/MsgExit";
import { MsgGoToGame } from "./room/MsgGoToGame";
import { ReqChangeState, ResChangeState } from "./room/PtlChangeState";
import { ReqCreate, ResCreate } from "./room/PtlCreate";
import { ReqExit, ResExit } from "./room/PtlExit";
import { ReqJoin, ResJoin } from "./room/PtlJoin";
@ -14,6 +16,10 @@ export interface ServiceType {
req: ReqLogin,
res: ResLogin
},
"room/ChangeState": {
req: ReqChangeState,
res: ResChangeState
},
"room/Create": {
req: ReqCreate,
res: ResCreate
@ -33,13 +39,14 @@ export interface ServiceType {
},
msg: {
"Chat": MsgChat,
"room/ChangeState": MsgChangeState,
"room/Exit": MsgExit,
"room/GoToGame": MsgGoToGame
}
}
export const serviceProto: ServiceProto<ServiceType> = {
"version": 10,
"version": 12,
"services": [
{
"id": 4,
@ -51,6 +58,11 @@ export const serviceProto: ServiceProto<ServiceType> = {
"name": "Chat",
"type": "msg"
},
{
"id": 12,
"name": "room/ChangeState",
"type": "msg"
},
{
"id": 10,
"name": "room/Exit",
@ -61,6 +73,11 @@ export const serviceProto: ServiceProto<ServiceType> = {
"name": "room/GoToGame",
"type": "msg"
},
{
"id": 13,
"name": "room/ChangeState",
"type": "api"
},
{
"id": 6,
"name": "room/Create",
@ -117,12 +134,38 @@ export const serviceProto: ServiceProto<ServiceType> = {
}
]
},
"room/MsgChangeState/MsgChangeState": {
"type": "Number"
},
"room/MsgExit/MsgExit": {
"type": "Number"
},
"room/MsgGoToGame/MsgGoToGame": {
"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": {
"type": "Interface",
"properties": [