[add] Room 完成

This commit is contained in:
建喵 2023-09-02 22:33:23 +08:00
parent ec44d7a345
commit c43b113e5f
11 changed files with 140 additions and 70 deletions

View File

@ -1,5 +0,0 @@
export interface ReqAccountLogin {
name: string
}
export type ResAccountLogin = number

View File

@ -1,3 +0,0 @@
export type ReqLobbyList = null
export type ResLobbyList = any[]

View File

@ -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
}

5
account/PtlLogin.ts Normal file
View File

@ -0,0 +1,5 @@
export interface ReqLogin {
name: string
}
export type ResLogin = number

1
room/MsgExit.ts Normal file
View File

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

1
room/MsgGoToGame.ts Normal file
View File

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

3
room/PtlCreate.ts Normal file
View File

@ -0,0 +1,3 @@
export interface ReqCreate { null: string }
export type ResCreate = number

3
room/PtlExit.ts Normal file
View File

@ -0,0 +1,3 @@
export interface ReqExit { null: string }
export type ResExit = number

3
room/PtlJoin.ts Normal file
View File

@ -0,0 +1,3 @@
export interface ReqJoin { roomId: number }
export type ResJoin = number

3
room/PtlList.ts Normal file
View File

@ -0,0 +1,3 @@
export interface ReqList { null: string }
export type ResList = any[]

View File

@ -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<ServiceType> = {
"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<ServiceType> = {
}
]
},
"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"
}
}
]
}
}
};