1 Star 0 Fork 0

Ms.Guo/CSO2014

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
room_service.go 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
libaojie 提交于 2024-10-31 17:38 . 初始化
package client
import (
"context"
"fmt"
"sync"
"gitee.com/wusuitaitou/cso2014/main_service/model/server"
)
type RoomClient interface {
GetServiceList(ctx context.Context) ([]server.Server, error)
GetRoomList(ctx context.Context, ServerIndex, ChannelIndex uint8) ([]server.Room, error)
NewRoom(ctx context.Context, room *server.Room) (*server.Room, error)
UpdateRoom(ctx context.Context, room *server.Room) (*server.Room, error)
JoinRoom(ctx context.Context, userID uint32, roomID uint16) (*server.Room, error)
LeaveRoom(ctx context.Context, userID uint32, roomID uint16) (*server.Room, error)
StartGame(ctx context.Context, userID uint32, roomID uint16) (*server.Room, error)
GetRoomInfo(ctx context.Context, roomID uint16) (*server.Room, error)
UpdateRoomSafe(ctx context.Context, room *server.Room) (*server.Room, error)
SetRoomHost(ctx context.Context, userID uint32, name string, roomID uint16) (*server.Room, error)
DelRoom(ctx context.Context, roomID uint16) error
EndGame(ctx context.Context, userID uint32, roomID uint16) (*server.Room, error)
}
var (
roomClient RoomClient
roomOnce sync.Once
)
func GetRoomClient() RoomClient {
return roomClient
}
func InitRoomClient(client RoomClient) {
roomOnce.Do(
func() {
fmt.Println("Room service connected")
roomClient = client
},
)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wusuitaitou/cso2014.git
git@gitee.com:wusuitaitou/cso2014.git
wusuitaitou
cso2014
CSO2014
v1.0.0

搜索帮助