Documentation
¶
Overview ¶
好用的kcp 爱 来自 hk4e-go
Index ¶
- Constants
- Variables
- func GetPlayerTokenReq(g *Game, payloadMsg pb.Message)
- func GetServerTime() int64
- func Run() error
- func SendHandle(g *Game, cmdid uint16, playerMsg pb.Message)
- type Game
- func (g *Game) AddAvatar(avatarId uint32)
- func (g *Game) AddWeapon(guid uint64, weaponId uint32)
- func (g *Game) AllSeenMonsterNotify()
- func (g *Game) AvatarDataNotify()
- func (g *Game) AvatarFightPropUpdateNotify(avatarId uint32)
- func (g *Game) EnterSceneDoneReq(payloadMsg pb.Message)
- func (g *Game) EnterScenePeerNotify()
- func (g *Game) EnterSceneReadyReq(payloadMsg pb.Message)
- func (g *Game) FinishedParentQuestNotify()
- func (g *Game) GetNextGameObjectGuid() uint64
- func (g *Game) GetPlayerBlacklistReq(payloadMsg pb.Message)
- func (g *Game) GetPlayerSocialDetailReq(payloadMsg pb.Message)
- func (g *Game) GetSceneAreaReq(payloadMsg pb.Message)
- func (g *Game) GetScenePointReq(payloadMsg pb.Message)
- func (g *Game) HostPlayerNotify()
- func (g *Game) ItemCdGroupTimeNotify()
- func (g *Game) LoginNotify()
- func (g *Game) OpenStateChangeNotify(stateMap map[uint32]uint32)
- func (g *Game) OpenStateUpdateNotify()
- func (g *Game) PacketAvatarInfo(avatarId uint32) *proto.AvatarInfo
- func (g *Game) PacketPropValue(key uint32, value any) *proto.PropValue
- func (g *Game) PathfindingEnterSceneReq(payloadMsg pb.Message)
- func (g *Game) PingReq(playerMsg pb.Message)
- func (g *Game) PlayerBornData(nickName string, avatarId uint32)
- func (g *Game) PlayerDataNotify()
- func (g *Game) PlayerEnterSceneInfoNotify()
- func (g *Game) PlayerEnterSceneNotify()
- func (g *Game) PlayerGameTimeNotify()
- func (g *Game) PlayerLevelRewardUpdateNotify()
- func (g *Game) PlayerLoginReq(payloadMsg pb.Message)
- func (g *Game) PlayerStoreNotify()
- func (g *Game) PostEnterSceneReq(payloadMsg pb.Message)
- func (g *Game) QuestListNotify()
- func (g *Game) RegisterMessage(cmdId uint16, payloadMsg pb.Message)
- func (g *Game) SceneDataNotify()
- func (g *Game) SceneEntityAppearNotify()
- func (g *Game) SceneForceUnlockNotify()
- func (g *Game) SceneInitFinishReq(payloadMsg pb.Message)
- func (g *Game) ScenePlayerInfoNotify()
- func (g *Game) SceneTeamUpdateNotify()
- func (g *Game) SceneTimeNotify()
- func (g *Game) ServerTimeNotify()
- func (g *Game) SetOpenStateReq(payloadMsg pb.Message)
- func (g *Game) SetPlayerBornDataReq(payloadMsg pb.Message)
- func (g *Game) StoreWeightLimitNotify()
- func (g *Game) UpdateAvatarWeapon(avatarId uint32, guid uint64)
- func (g *Game) WeaponStoreItemChangeNotify(guidList []uint64)
- func (g *Game) WorldDataNotify()
- func (g *Game) WorldPlayerInfoNotify()
- type HandlerFunc
- type KcpConnManager
- type KcpEvent
- type RouteManager
Constants ¶
View Source
const ( PacketMaxLen = 343 * 1024 // 最大应用层包长度 KcpConnAddrChangeNotify = "KcpConnAddrChangeNotify" )
Variables ¶
View Source
var CLIENT_CONN_NUM int32 = 0 // 当前客户端连接数
Functions ¶
func GetPlayerTokenReq ¶
func GetServerTime ¶
func GetServerTime() int64
Types ¶
type Game ¶
type Game struct { IsToken bool // 是否通过token验证 Uid uint32 Seed uint64 KcpConn *kcp.UDPSession RouteManager *RouteManager // 玩家数据 Player *model.Player // 临时数据 SceneEntity *sceneEntity.SceneEntity // 场景实体数据 XorKey []byte // 密钥 LastActiveTime int64 // 最近一次的活跃时间 GameObjectGuidCounter uint64 // 玩家在线唯一id SceneToken uint32 // 场景token }
func NewGame ¶
func NewGame(kcpConn *kcp.UDPSession) *Game
func (*Game) AllSeenMonsterNotify ¶
func (g *Game) AllSeenMonsterNotify()
func (*Game) AvatarDataNotify ¶
func (g *Game) AvatarDataNotify()
func (*Game) AvatarFightPropUpdateNotify ¶
func (*Game) EnterSceneDoneReq ¶
func (*Game) EnterSceneReadyReq ¶
func (*Game) FinishedParentQuestNotify ¶
func (g *Game) FinishedParentQuestNotify()
func (*Game) GetNextGameObjectGuid ¶
func (*Game) GetPlayerBlacklistReq ¶
func (*Game) GetPlayerSocialDetailReq ¶
func (*Game) GetSceneAreaReq ¶
func (*Game) GetScenePointReq ¶
func (*Game) HostPlayerNotify ¶
func (g *Game) HostPlayerNotify()
func (*Game) ItemCdGroupTimeNotify ¶
func (g *Game) ItemCdGroupTimeNotify()
func (*Game) OpenStateChangeNotify ¶
func (*Game) OpenStateUpdateNotify ¶
func (g *Game) OpenStateUpdateNotify()
func (*Game) PacketAvatarInfo ¶
func (g *Game) PacketAvatarInfo(avatarId uint32) *proto.AvatarInfo
func (*Game) PacketPropValue ¶
func (*Game) PathfindingEnterSceneReq ¶
func (*Game) PlayerBornData ¶
func (*Game) PlayerDataNotify ¶
func (g *Game) PlayerDataNotify()
func (*Game) PlayerEnterSceneInfoNotify ¶
func (g *Game) PlayerEnterSceneInfoNotify()
func (*Game) PlayerEnterSceneNotify ¶
func (g *Game) PlayerEnterSceneNotify()
func (*Game) PlayerGameTimeNotify ¶
func (g *Game) PlayerGameTimeNotify()
func (*Game) PlayerLevelRewardUpdateNotify ¶
func (g *Game) PlayerLevelRewardUpdateNotify()
func (*Game) PlayerLoginReq ¶
func (*Game) PlayerStoreNotify ¶
func (g *Game) PlayerStoreNotify()
func (*Game) PostEnterSceneReq ¶
func (*Game) QuestListNotify ¶
func (g *Game) QuestListNotify()
func (*Game) SceneDataNotify ¶
func (g *Game) SceneDataNotify()
func (*Game) SceneEntityAppearNotify ¶
func (g *Game) SceneEntityAppearNotify()
func (*Game) SceneForceUnlockNotify ¶
func (g *Game) SceneForceUnlockNotify()
func (*Game) SceneInitFinishReq ¶
func (*Game) ScenePlayerInfoNotify ¶
func (g *Game) ScenePlayerInfoNotify()
func (*Game) SceneTeamUpdateNotify ¶
func (g *Game) SceneTeamUpdateNotify()
func (*Game) SceneTimeNotify ¶
func (g *Game) SceneTimeNotify()
func (*Game) ServerTimeNotify ¶
func (g *Game) ServerTimeNotify()
func (*Game) SetOpenStateReq ¶
func (*Game) SetPlayerBornDataReq ¶
func (*Game) StoreWeightLimitNotify ¶
func (g *Game) StoreWeightLimitNotify()
func (*Game) UpdateAvatarWeapon ¶
角色装备武器
func (*Game) WeaponStoreItemChangeNotify ¶
武器通知
func (*Game) WorldDataNotify ¶
func (g *Game) WorldDataNotify()
func (*Game) WorldPlayerInfoNotify ¶
func (g *Game) WorldPlayerInfoNotify()
type HandlerFunc ¶
type KcpConnManager ¶
type KcpConnManager struct {
// contains filtered or unexported fields
}
var KCPCONNMANAGER *KcpConnManager
type RouteManager ¶
type RouteManager struct {
// contains filtered or unexported fields
}
func NewRouteManager ¶
func NewRouteManager(g *Game) (r *RouteManager)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.