client

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DBOnce sync.Once
)

Functions

func InitConfigClient

func InitConfigClient(client ConfigClient)

func InitDBClient

func InitDBClient(client DBClient)

func InitRoomClient

func InitRoomClient(client RoomClient)

func InitUserCacheClient

func InitUserCacheClient(client UserCache)

func InitUserClient

func InitUserClient(client UserClient)

Types

type ConfigClient

type ConfigClient interface {
}

func GetConfigClient

func GetConfigClient() ConfigClient

type DBClient

type DBClient interface {
}

func GetDBClient

func GetDBClient() DBClient

type RoomClient

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

func GetRoomClient

func GetRoomClient() RoomClient

type UserCache

type UserCache interface {
	GetUserByID(ctx context.Context, id uint32) *user.UserCache
	GetUserByUserName(ctx context.Context, username string) *user.UserCache
	GetUserByConnection(ctx context.Context, client net.Conn) *user.UserCache
	GetChannelUsers(ctx context.Context, serverID, channelID uint8) []uint32
	DeleteUserByID(ctx context.Context, id uint32)
	DeleteUserByName(ctx context.Context, username string)
	DeleteUserByConnection(ctx context.Context, client net.Conn)
	SetUser(ctx context.Context, data *user.UserCache) error
	SetUserChannel(ctx context.Context, userID uint32, serverID, channelID uint8) error
	SetUserQuitChannel(ctx context.Context, userID uint32) error
	SetUserRoom(ctx context.Context, userID uint32, roomID uint16, team uint8) error
	SetUserStatus(ctx context.Context, userID uint32, status uint8) error
	QuitUserRoom(ctx context.Context, userID uint32) error
	FlushUserInventory(ctx context.Context, userID uint32, inventory *user.Inventory) error
	FlushUserUDP(ctx context.Context, userID uint32, portId uint16, localPort uint16, externalPort uint16, externalIPAddress, localIpAddress uint32) (uint16, error)
	SetUserIngame(ctx context.Context, userID uint32, ingame bool) error
	ResetKillNum(ctx context.Context, userID uint32) error
	ResetDeadNum(ctx context.Context, userID uint32) error
	ResetAssistNum(ctx context.Context, userID uint32) error
	GetChannelNoRoomUsers(ctx context.Context, serverID, channelID uint8) []uint32
	FlushUserRoomData(ctx context.Context, userID uint32, data []byte) error
	SetNickname(ctx context.Context, userID uint32, nickname string) error
}

func GetUserCacheClient

func GetUserCacheClient() UserCache

type UserClient

type UserClient interface {
	Login(ctx context.Context, username, password string) (*user.UserInfo, int8)
	Register(ctx context.Context, username, password string) (bool, error)
	GetUserInfo(ctx context.Context, userID uint32) (*user.UserInfo, error)
	UserDown(ctx context.Context, userID uint32) (bool, error)
	GetUserFriends(ctx context.Context, userID uint32) ([]user.UserInfo, error)
	AddUserPoints(ctx context.Context, userID, add uint32) (uint32, error)
	AddUserCash(ctx context.Context, userID, add uint32) (uint32, error)
	UserPlayedGame(ctx context.Context, userID, IsWin, Kills, Deaths, HeadShots uint32) (*user.UserInfo, error)
	UserPayPoints(ctx context.Context, userID, used uint32) (uint32, error)
	UserPayCash(ctx context.Context, userID, used uint32) (uint32, error)
	UserAddItem(ctx context.Context, userID, item uint32) (*user.UserInfo, error)
	UserAddFriend(ctx context.Context, userID, friendID uint32) (*user.UserInfo, error)
	UpdateBag(ctx context.Context, UserID uint32, BagID uint16, Slot uint8, ItemID uint16) (*user.UserInfo, error)
	UpdateBuymenu(ctx context.Context, UserID uint32, BuymenuID uint16, Slot uint8, ItemID uint16) (*user.UserInfo, error)
	UpdateCosmetics(ctx context.Context, UserID uint32, CosmeticsID uint8, cosmetics *user.UserCosmetics) (*user.UserInfo, error)
	UpdateCampaign(ctx context.Context, UserID uint32, CampaignID uint8) (*user.UserInfo, error)
	UpdateOptions(ctx context.Context, UserID uint32, options []byte) (*user.UserInfo, error)
	UpdateNickname(ctx context.Context, UserID uint32, nickname string) (*user.UserInfo, error)
}

func GetUserClient

func GetUserClient() UserClient

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL