Documentation
¶
Overview ¶
Package pto provides general zutils definitions that are intended for use by other packages.
This package can import and reference the `constant` package, but should not depend on or reference any other package within the project.
Index ¶
- type Attribute
- type CancelMatch
- type CreateGroup
- type EnterGroup
- type EnterGroupSourceType
- type GamePlayerState
- type GameResult
- type GameServerInfo
- type Glicko2Info
- type GroupInfo
- type GroupPlayerInfo
- type InviteMsg
- type MatchInfo
- type MatchPlayerInfo
- type MatchTeamInfo
- type PlayerInfo
- type PlayerMetaInfo
- type UploadPlayerAttr
- type UserVoiceState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
Attribute is the common information of a player for game display. You should define them according to your requirement.
type CancelMatch ¶
CancelMatch is the cancel match signal pushed to the client.
type CreateGroup ¶
type CreateGroup struct {
PlayerInfo
}
CreateGroup is the parameter of creating a group
type EnterGroup ¶
type EnterGroup struct {
PlayerInfo
Source EnterGroupSourceType
}
EnterGroup is the parameter of entering a group
type EnterGroupSourceType ¶
type EnterGroupSourceType int
EnterGroupSourceType is the source type of entering a group.
const ( EnterGroupSourceTypeInvite EnterGroupSourceType = 0 // invited by other EnterGroupSourceTypeNearby EnterGroupSourceType = 1 // from recent list EnterGroupSourceTypeRecent EnterGroupSourceType = 2 // from nearby list EnterGroupSourceTypeFriend EnterGroupSourceType = 3 // from friend list EnterGroupSourceTypeWorldChannel EnterGroupSourceType = 4 // from world channel EnterGroupSourceTypeClanChannel EnterGroupSourceType = 5 // from clan channel )
type GamePlayerState ¶
type GamePlayerState uint8
const ( Offline GamePlayerState = 0 Online GamePlayerState = 1 )
type GameResult ¶
type GameResult struct {
RoomID int64
StartTime int64
EndTime int64
ScoreSign string
GameMode constant.GameMode
MatchStrategy constant.MatchStrategy
ModeVersion int64
PlayerState map[string]GamePlayerState
AIPlayer map[string]bool
PlayerMetaInfo map[string]PlayerMetaInfo
// Result is the game result detail info.
// It is sent from client and different game mode would be different.
Result []byte
}
GameResult defines the common information of a game result.
type GameServerInfo ¶
type GameServerInfo struct {
Host string
Port uint16
Protocol constant.NetProtocol
}
GameServerInfo is the game server info pushed to the client.
type Glicko2Info ¶
type GroupInfo ¶
type GroupInfo struct {
GroupID int64
Captain string
GameMode constant.GameMode
ModeVersion int64
// Positions indicate whether positions in the room are occupied.
Positions []bool
// PlayerInfos holds the player infos, related to the player position.
// If Positions[i] == false, means PlayerInfos[i] would be nil.
PlayerInfos []*GroupPlayerInfo
}
GroupInfo is the group players info pushed to the clients to sync group info.
type GroupPlayerInfo ¶
type InviteMsg ¶
type InviteMsg struct {
InviterUID string
InviterName string
InviteeUID string
Source EnterGroupSourceType
GameMode constant.GameMode
ModeVersion int64
}
InviteMsg is the invitation message pushed to the client.
type MatchInfo ¶
type MatchInfo struct {
RoomID int64
GameMode constant.GameMode
ModeVersion int64
MatchStrategy constant.MatchStrategy
MatchedTimeUnix int64
Teams []MatchTeamInfo
GameServerInfo GameServerInfo
}
MatchInfo is the match result pushed to the client.
type MatchPlayerInfo ¶
type MatchTeamInfo ¶
type MatchTeamInfo struct {
TeamID int
Players []MatchPlayerInfo
}
type PlayerInfo ¶
type PlayerInfo struct {
UID string `json:"uid" binding:"required"`
GameMode constant.GameMode `json:"game_mode" binding:"required" example:"905"`
ModeVersion int64 `json:"mode_version" binding:"required" example:"1"`
Star int64 `json:"star"`
Rank int64 `json:"rank"`
Glicko2Info *Glicko2Info `json:"glicko2_info"`
}
PlayerInfo defines the common information of a player. It is often used to initial a player.
type PlayerMetaInfo ¶
type PlayerMetaInfo struct {
}
type UploadPlayerAttr ¶
type UploadPlayerAttr struct {
// Attribute is the common information of a player for game presentation.
Attribute
// Extra is the extra information of a player needed by different game mode.
// Here, if you want to do each game mode is independent,
// you need to use 1+n interfaces (uploadCommonAttr +n * uploadxxxGameAttr),
// the development efficiency is relatively low.
//
// After weighing, it was decided to use a common interface for processing,
// and then use Extra extension fields for different game modes,
// in the specific game mode implementation,
// need to parse and carry out the corresponding processing logic.
Extra []byte
}
UploadPlayerAttr is the parameter for uploading player attributes needed by game presentation.
type UserVoiceState ¶
UserVoiceState is user voice state pushed to the client.