From c43b113e5f499fe7245902835038a84262ce20c9 Mon Sep 17 00:00:00 2001 From: JianMiau Date: Sat, 2 Sep 2023 22:33:23 +0800 Subject: [PATCH] =?UTF-8?q?[add]=20Room=20=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PtlAccountLogin.ts | 5 -- PtlLobbyList.ts | 3 - PtlSend.ts | 10 --- account/PtlLogin.ts | 5 ++ room/MsgExit.ts | 1 + room/MsgGoToGame.ts | 1 + room/PtlCreate.ts | 3 + room/PtlExit.ts | 3 + room/PtlJoin.ts | 3 + room/PtlList.ts | 3 + serviceProto.ts | 173 +++++++++++++++++++++++++++++++------------- 11 files changed, 140 insertions(+), 70 deletions(-) delete mode 100644 PtlAccountLogin.ts delete mode 100644 PtlLobbyList.ts delete mode 100644 PtlSend.ts create mode 100644 account/PtlLogin.ts create mode 100644 room/MsgExit.ts create mode 100644 room/MsgGoToGame.ts create mode 100644 room/PtlCreate.ts create mode 100644 room/PtlExit.ts create mode 100644 room/PtlJoin.ts create mode 100644 room/PtlList.ts diff --git a/PtlAccountLogin.ts b/PtlAccountLogin.ts deleted file mode 100644 index 27079fb..0000000 --- a/PtlAccountLogin.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface ReqAccountLogin { - name: string -} - -export type ResAccountLogin = number \ No newline at end of file diff --git a/PtlLobbyList.ts b/PtlLobbyList.ts deleted file mode 100644 index c98921a..0000000 --- a/PtlLobbyList.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type ReqLobbyList = null - -export type ResLobbyList = any[] \ No newline at end of file diff --git a/PtlSend.ts b/PtlSend.ts deleted file mode 100644 index 6a5d9f6..0000000 --- a/PtlSend.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This is a demo code file -// Feel free to delete it - -export interface ReqSend { - content: string -} - -export interface ResSend { - time: Date -} \ No newline at end of file diff --git a/account/PtlLogin.ts b/account/PtlLogin.ts new file mode 100644 index 0000000..7ef6516 --- /dev/null +++ b/account/PtlLogin.ts @@ -0,0 +1,5 @@ +export interface ReqLogin { + name: string +} + +export type ResLogin = number \ No newline at end of file diff --git a/room/MsgExit.ts b/room/MsgExit.ts new file mode 100644 index 0000000..973931c --- /dev/null +++ b/room/MsgExit.ts @@ -0,0 +1 @@ +export type MsgExit = number \ No newline at end of file diff --git a/room/MsgGoToGame.ts b/room/MsgGoToGame.ts new file mode 100644 index 0000000..931bc7f --- /dev/null +++ b/room/MsgGoToGame.ts @@ -0,0 +1 @@ +export type MsgGoToGame = number \ No newline at end of file diff --git a/room/PtlCreate.ts b/room/PtlCreate.ts new file mode 100644 index 0000000..3114d65 --- /dev/null +++ b/room/PtlCreate.ts @@ -0,0 +1,3 @@ +export interface ReqCreate { null: string } + +export type ResCreate = number \ No newline at end of file diff --git a/room/PtlExit.ts b/room/PtlExit.ts new file mode 100644 index 0000000..b59b7a8 --- /dev/null +++ b/room/PtlExit.ts @@ -0,0 +1,3 @@ +export interface ReqExit { null: string } + +export type ResExit = number \ No newline at end of file diff --git a/room/PtlJoin.ts b/room/PtlJoin.ts new file mode 100644 index 0000000..3992d50 --- /dev/null +++ b/room/PtlJoin.ts @@ -0,0 +1,3 @@ +export interface ReqJoin { roomId: number } + +export type ResJoin = number \ No newline at end of file diff --git a/room/PtlList.ts b/room/PtlList.ts new file mode 100644 index 0000000..a1455ff --- /dev/null +++ b/room/PtlList.ts @@ -0,0 +1,3 @@ +export interface ReqList { null: string } + +export type ResList = any[] \ No newline at end of file diff --git a/serviceProto.ts b/serviceProto.ts index 7b5d7bd..e23dadd 100644 --- a/serviceProto.ts +++ b/serviceProto.ts @@ -1,54 +1,103 @@ import { ServiceProto } from 'tsrpc-proto'; +import { ReqLogin, ResLogin } from './account/PtlLogin'; import { MsgChat } from './MsgChat'; -import { ReqAccountLogin, ResAccountLogin } from './PtlAccountLogin'; -import { ReqLobbyList, ResLobbyList } from './PtlLobbyList'; -import { ReqSend, ResSend } from './PtlSend'; +import { MsgExit } from './room/MsgExit'; +import { MsgGoToGame } from './room/MsgGoToGame'; +import { ReqCreate, ResCreate } from './room/PtlCreate'; +import { ReqExit, ResExit } from './room/PtlExit'; +import { ReqJoin, ResJoin } from './room/PtlJoin'; +import { ReqList, ResList } from './room/PtlList'; export interface ServiceType { api: { - "AccountLogin": { - req: ReqAccountLogin, - res: ResAccountLogin + "account/Login": { + req: ReqLogin, + res: ResLogin }, - "LobbyList": { - req: ReqLobbyList, - res: ResLobbyList + "room/Create": { + req: ReqCreate, + res: ResCreate }, - "Send": { - req: ReqSend, - res: ResSend + "room/Exit": { + req: ReqExit, + res: ResExit + }, + "room/Join": { + req: ReqJoin, + res: ResJoin + }, + "room/List": { + req: ReqList, + res: ResList } }, msg: { - "Chat": MsgChat + "Chat": MsgChat, + "room/Exit": MsgExit, + "room/GoToGame": MsgGoToGame } } export const serviceProto: ServiceProto = { - "version": 4, + "version": 10, "services": [ + { + "id": 4, + "name": "account/Login", + "type": "api" + }, { "id": 0, "name": "Chat", "type": "msg" }, { - "id": 2, - "name": "AccountLogin", + "id": 10, + "name": "room/Exit", + "type": "msg" + }, + { + "id": 11, + "name": "room/GoToGame", + "type": "msg" + }, + { + "id": 6, + "name": "room/Create", "type": "api" }, { - "id": 3, - "name": "LobbyList", + "id": 7, + "name": "room/Exit", "type": "api" }, { - "id": 1, - "name": "Send", + "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": [ @@ -68,54 +117,74 @@ export const serviceProto: ServiceProto = { } ] }, - "PtlAccountLogin/ReqAccountLogin": { + "room/MsgExit/MsgExit": { + "type": "Number" + }, + "room/MsgGoToGame/MsgGoToGame": { + "type": "Number" + }, + "room/PtlCreate/ReqCreate": { "type": "Interface", "properties": [ { - "id": 0, - "name": "name", + "id": 1, + "name": "null", "type": { "type": "String" } } ] }, - "PtlAccountLogin/ResAccountLogin": { + "room/PtlCreate/ResCreate": { "type": "Number" }, - "PtlLobbyList/ReqLobbyList": { - "type": "Literal", - "literal": null + "room/PtlExit/ReqExit": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "null", + "type": { + "type": "String" + } + } + ] }, - "PtlLobbyList/ResLobbyList": { + "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" } - }, - "PtlSend/ReqSend": { - "type": "Interface", - "properties": [ - { - "id": 0, - "name": "content", - "type": { - "type": "String" - } - } - ] - }, - "PtlSend/ResSend": { - "type": "Interface", - "properties": [ - { - "id": 0, - "name": "time", - "type": { - "type": "Date" - } - } - ] } } }; \ No newline at end of file