From 14a11e2f3a4e2d0d8ac620f55265f2c0a91a9a0e Mon Sep 17 00:00:00 2001 From: JianMiau Date: Sun, 10 Sep 2023 19:33:38 +0800 Subject: [PATCH] [add] Room SetReady,ChangeState --- define/enum.ts | 16 +++++++++++++++ room/MsgChangeState.ts | 1 + room/PtlChangeState.ts | 5 +++++ serviceProto.ts | 45 +++++++++++++++++++++++++++++++++++++++++- 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 define/enum.ts create mode 100644 room/MsgChangeState.ts create mode 100644 room/PtlChangeState.ts diff --git a/define/enum.ts b/define/enum.ts new file mode 100644 index 0000000..036a568 --- /dev/null +++ b/define/enum.ts @@ -0,0 +1,16 @@ +export enum EGameState { + Loading, + TurnCards, + ImageViewer, + ChooseCards, + + MyLoading = 100, + MyTurnCards, + MyImageViewer, + MyChooseCards, + + OtherLoading = 200, + OtherTurnCards = 201, + OtherImageViewer, + OtherChooseCards, +} \ No newline at end of file diff --git a/room/MsgChangeState.ts b/room/MsgChangeState.ts new file mode 100644 index 0000000..12045f1 --- /dev/null +++ b/room/MsgChangeState.ts @@ -0,0 +1 @@ +export type MsgChangeState = number \ No newline at end of file diff --git a/room/PtlChangeState.ts b/room/PtlChangeState.ts new file mode 100644 index 0000000..2a1bf44 --- /dev/null +++ b/room/PtlChangeState.ts @@ -0,0 +1,5 @@ +export interface ReqChangeState { + state: number; +} + +export type ResChangeState = number \ No newline at end of file diff --git a/serviceProto.ts b/serviceProto.ts index a7a73d1..fb4c8d4 100644 --- a/serviceProto.ts +++ b/serviceProto.ts @@ -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 = { - "version": 10, + "version": 12, "services": [ { "id": 4, @@ -51,6 +58,11 @@ export const serviceProto: ServiceProto = { "name": "Chat", "type": "msg" }, + { + "id": 12, + "name": "room/ChangeState", + "type": "msg" + }, { "id": 10, "name": "room/Exit", @@ -61,6 +73,11 @@ export const serviceProto: ServiceProto = { "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 = { } ] }, + "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": [