From a0c82c96eff88032d121604a042ba0a06ec09944 Mon Sep 17 00:00:00 2001 From: JianMiau Date: Fri, 15 Sep 2023 11:13:41 +0800 Subject: [PATCH] SendAns --- define/enum.ts | 3 + room/PtlSendAns.ts | 3 + serviceProto.ts | 468 ++++++++++++++++++++++++--------------------- 3 files changed, 253 insertions(+), 221 deletions(-) create mode 100644 room/PtlSendAns.ts diff --git a/define/enum.ts b/define/enum.ts index f9d3874..98b79f6 100644 --- a/define/enum.ts +++ b/define/enum.ts @@ -20,6 +20,9 @@ export enum EGameState { /** 回合結束 */ TurnEnd, + /** 遊戲結束 */ + GameOver, + MyReady = 100, MyWait, MyTurnCards, diff --git a/room/PtlSendAns.ts b/room/PtlSendAns.ts new file mode 100644 index 0000000..348ecc2 --- /dev/null +++ b/room/PtlSendAns.ts @@ -0,0 +1,3 @@ +export interface ReqSendAns { answer: number } + +export type ResSendAns = boolean \ No newline at end of file diff --git a/serviceProto.ts b/serviceProto.ts index 105970e..7856ecd 100644 --- a/serviceProto.ts +++ b/serviceProto.ts @@ -1,227 +1,253 @@ -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"; -import { ReqList, ResList } from "./room/PtlList"; +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'; +import { ReqList, ResList } from './room/PtlList'; +import { ReqSendAns, ResSendAns } from './room/PtlSendAns'; export interface ServiceType { - api: { - "account/Login": { - req: ReqLogin, - res: ResLogin - }, - "room/ChangeState": { - req: ReqChangeState, - res: ResChangeState - }, - "room/Create": { - req: ReqCreate, - res: ResCreate - }, - "room/Exit": { - req: ReqExit, - res: ResExit - }, - "room/Join": { - req: ReqJoin, - res: ResJoin - }, - "room/List": { - req: ReqList, - res: ResList - } - }, - msg: { - "Chat": MsgChat, - "room/ChangeState": MsgChangeState, - "room/Exit": MsgExit, - "room/GoToGame": MsgGoToGame - } + api: { + "account/Login": { + req: ReqLogin, + res: ResLogin + }, + "room/ChangeState": { + req: ReqChangeState, + res: ResChangeState + }, + "room/Create": { + req: ReqCreate, + res: ResCreate + }, + "room/Exit": { + req: ReqExit, + res: ResExit + }, + "room/Join": { + req: ReqJoin, + res: ResJoin + }, + "room/List": { + req: ReqList, + res: ResList + }, + "room/SendAns": { + req: ReqSendAns, + res: ResSendAns + } + }, + msg: { + "Chat": MsgChat, + "room/ChangeState": MsgChangeState, + "room/Exit": MsgExit, + "room/GoToGame": MsgGoToGame + } } export const serviceProto: ServiceProto = { - "services": [ - { - "id": 0, - "name": "account/Login", - "type": "api" - }, - { - "id": 1, - "name": "Chat", - "type": "msg" - }, - { - "id": 2, - "name": "room/ChangeState", - "type": "msg" - }, - { - "id": 3, - "name": "room/Exit", - "type": "msg" - }, - { - "id": 4, - "name": "room/GoToGame", - "type": "msg" - }, - { - "id": 5, - "name": "room/ChangeState", - "type": "api" - }, - { - "id": 6, - "name": "room/Create", - "type": "api" - }, - { - "id": 7, - "name": "room/Exit", - "type": "api" - }, - { - "id": 8, - "name": "room/Join", - "type": "api" - }, - { - "id": 9, - "name": "room/List", - "type": "api" - } - ], - "types": { - "account/PtlLogin/ReqLogin": { - "type": "Interface", - "properties": [ - { - "id": 0, - "name": "name", - "type": { - "type": "String" - } - } - ] - }, - "account/PtlLogin/ResLogin": { - "type": "Number" - }, - "MsgChat/MsgChat": { - "type": "Interface", - "properties": [ - { - "id": 0, - "name": "content", - "type": { - "type": "String" - } - }, - { - "id": 1, - "name": "time", - "type": { - "type": "Date" - } - } - ] - }, - "room/MsgChangeState/MsgChangeState": { - "type": "Array", - "elementType": { - "type": "Any" - } - }, - "room/MsgExit/MsgExit": { - "type": "Number" - }, - "room/MsgGoToGame/MsgGoToGame": { - "type": "Number" - }, - "room/PtlChangeState/ReqChangeState": { - "type": "Interface", - "properties": [ - { - "id": 0, - "name": "state", - "type": { - "type": "Number" - } - } - ] - }, - "room/PtlChangeState/ResChangeState": { - "type": "Number" - }, - "room/PtlCreate/ReqCreate": { - "type": "Interface", - "properties": [ - { - "id": 0, - "name": "null", - "type": { - "type": "String" - } - } - ] - }, - "room/PtlCreate/ResCreate": { - "type": "Number" - }, - "room/PtlExit/ReqExit": { - "type": "Interface", - "properties": [ - { - "id": 0, - "name": "null", - "type": { - "type": "String" - } - } - ] - }, - "room/PtlExit/ResExit": { - "type": "Number" - }, - "room/PtlJoin/ReqJoin": { - "type": "Interface", - "properties": [ - { - "id": 0, - "name": "roomId", - "type": { - "type": "Number" - } - } - ] - }, - "room/PtlJoin/ResJoin": { - "type": "Number" - }, - "room/PtlList/ReqList": { - "type": "Interface", - "properties": [ - { - "id": 0, - "name": "null", - "type": { - "type": "String" - } - } - ] - }, - "room/PtlList/ResList": { - "type": "Array", - "elementType": { - "type": "Any" - } - } - } + "version": 1, + "services": [ + { + "id": 0, + "name": "account/Login", + "type": "api" + }, + { + "id": 1, + "name": "Chat", + "type": "msg" + }, + { + "id": 2, + "name": "room/ChangeState", + "type": "msg" + }, + { + "id": 3, + "name": "room/Exit", + "type": "msg" + }, + { + "id": 4, + "name": "room/GoToGame", + "type": "msg" + }, + { + "id": 5, + "name": "room/ChangeState", + "type": "api" + }, + { + "id": 6, + "name": "room/Create", + "type": "api" + }, + { + "id": 7, + "name": "room/Exit", + "type": "api" + }, + { + "id": 8, + "name": "room/Join", + "type": "api" + }, + { + "id": 9, + "name": "room/List", + "type": "api" + }, + { + "id": 10, + "name": "room/SendAns", + "type": "api" + } + ], + "types": { + "account/PtlLogin/ReqLogin": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "name", + "type": { + "type": "String" + } + } + ] + }, + "account/PtlLogin/ResLogin": { + "type": "Number" + }, + "MsgChat/MsgChat": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "content", + "type": { + "type": "String" + } + }, + { + "id": 1, + "name": "time", + "type": { + "type": "Date" + } + } + ] + }, + "room/MsgChangeState/MsgChangeState": { + "type": "Array", + "elementType": { + "type": "Any" + } + }, + "room/MsgExit/MsgExit": { + "type": "Number" + }, + "room/MsgGoToGame/MsgGoToGame": { + "type": "Number" + }, + "room/PtlChangeState/ReqChangeState": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "state", + "type": { + "type": "Number" + } + } + ] + }, + "room/PtlChangeState/ResChangeState": { + "type": "Number" + }, + "room/PtlCreate/ReqCreate": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "null", + "type": { + "type": "String" + } + } + ] + }, + "room/PtlCreate/ResCreate": { + "type": "Number" + }, + "room/PtlExit/ReqExit": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "null", + "type": { + "type": "String" + } + } + ] + }, + "room/PtlExit/ResExit": { + "type": "Number" + }, + "room/PtlJoin/ReqJoin": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "roomId", + "type": { + "type": "Number" + } + } + ] + }, + "room/PtlJoin/ResJoin": { + "type": "Number" + }, + "room/PtlList/ReqList": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "null", + "type": { + "type": "String" + } + } + ] + }, + "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" + } + } }; \ No newline at end of file