[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 { ServiceProto } from 'tsrpc-proto';
import { ReqLogin, ResLogin } from './account/PtlLogin';
import { MsgChat } from './MsgChat'; import { MsgChat } from './MsgChat';
import { ReqAccountLogin, ResAccountLogin } from './PtlAccountLogin'; import { MsgExit } from './room/MsgExit';
import { ReqLobbyList, ResLobbyList } from './PtlLobbyList'; import { MsgGoToGame } from './room/MsgGoToGame';
import { ReqSend, ResSend } from './PtlSend'; 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 { export interface ServiceType {
api: { api: {
"AccountLogin": { "account/Login": {
req: ReqAccountLogin, req: ReqLogin,
res: ResAccountLogin res: ResLogin
}, },
"LobbyList": { "room/Create": {
req: ReqLobbyList, req: ReqCreate,
res: ResLobbyList res: ResCreate
}, },
"Send": { "room/Exit": {
req: ReqSend, req: ReqExit,
res: ResSend res: ResExit
},
"room/Join": {
req: ReqJoin,
res: ResJoin
},
"room/List": {
req: ReqList,
res: ResList
} }
}, },
msg: { msg: {
"Chat": MsgChat "Chat": MsgChat,
"room/Exit": MsgExit,
"room/GoToGame": MsgGoToGame
} }
} }
export const serviceProto: ServiceProto<ServiceType> = { export const serviceProto: ServiceProto<ServiceType> = {
"version": 4, "version": 10,
"services": [ "services": [
{
"id": 4,
"name": "account/Login",
"type": "api"
},
{ {
"id": 0, "id": 0,
"name": "Chat", "name": "Chat",
"type": "msg" "type": "msg"
}, },
{ {
"id": 2, "id": 10,
"name": "AccountLogin", "name": "room/Exit",
"type": "msg"
},
{
"id": 11,
"name": "room/GoToGame",
"type": "msg"
},
{
"id": 6,
"name": "room/Create",
"type": "api" "type": "api"
}, },
{ {
"id": 3, "id": 7,
"name": "LobbyList", "name": "room/Exit",
"type": "api" "type": "api"
}, },
{ {
"id": 1, "id": 8,
"name": "Send", "name": "room/Join",
"type": "api"
},
{
"id": 9,
"name": "room/List",
"type": "api" "type": "api"
} }
], ],
"types": { "types": {
"account/PtlLogin/ReqLogin": {
"type": "Interface",
"properties": [
{
"id": 0,
"name": "name",
"type": {
"type": "String"
}
}
]
},
"account/PtlLogin/ResLogin": {
"type": "Number"
},
"MsgChat/MsgChat": { "MsgChat/MsgChat": {
"type": "Interface", "type": "Interface",
"properties": [ "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", "type": "Interface",
"properties": [ "properties": [
{ {
"id": 0, "id": 1,
"name": "name", "name": "null",
"type": { "type": {
"type": "String" "type": "String"
} }
} }
] ]
}, },
"PtlAccountLogin/ResAccountLogin": { "room/PtlCreate/ResCreate": {
"type": "Number" "type": "Number"
}, },
"PtlLobbyList/ReqLobbyList": { "room/PtlExit/ReqExit": {
"type": "Literal", "type": "Interface",
"literal": null "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", "type": "Array",
"elementType": { "elementType": {
"type": "Any" "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"
}
}
]
} }
} }
}; };