Game

package
v0.0.0-...-656f6e7 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

好用的kcp 爱 来自 hk4e-go

Index

Constants

View Source
const (
	PacketMaxLen            = 343 * 1024 // 最大应用层包长度
	KcpConnAddrChangeNotify = "KcpConnAddrChangeNotify"
)

Variables

View Source
var CLIENT_CONN_NUM int32 = 0 // 当前客户端连接数

Functions

func GetPlayerTokenReq

func GetPlayerTokenReq(g *Game, payloadMsg pb.Message)

func GetServerTime

func GetServerTime() int64

func Run

func Run() error

func SendHandle

func SendHandle(g *Game, cmdid uint16, playerMsg pb.Message)

发送事件处理

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

func (g *Game) AddAvatar(avatarId uint32)

func (*Game) AddWeapon

func (g *Game) AddWeapon(guid uint64, weaponId uint32)

func (*Game) AllSeenMonsterNotify

func (g *Game) AllSeenMonsterNotify()

func (*Game) AvatarDataNotify

func (g *Game) AvatarDataNotify()

func (*Game) AvatarFightPropUpdateNotify

func (g *Game) AvatarFightPropUpdateNotify(avatarId uint32)

func (*Game) EnterSceneDoneReq

func (g *Game) EnterSceneDoneReq(payloadMsg pb.Message)

func (*Game) EnterScenePeerNotify

func (g *Game) EnterScenePeerNotify()

场景情况通知

func (*Game) EnterSceneReadyReq

func (g *Game) EnterSceneReadyReq(payloadMsg pb.Message)

func (*Game) FinishedParentQuestNotify

func (g *Game) FinishedParentQuestNotify()

func (*Game) GetNextGameObjectGuid

func (g *Game) GetNextGameObjectGuid() uint64

func (*Game) GetPlayerBlacklistReq

func (g *Game) GetPlayerBlacklistReq(payloadMsg pb.Message)

func (*Game) GetPlayerSocialDetailReq

func (g *Game) GetPlayerSocialDetailReq(payloadMsg pb.Message)

func (*Game) GetSceneAreaReq

func (g *Game) GetSceneAreaReq(payloadMsg pb.Message)

func (*Game) GetScenePointReq

func (g *Game) GetScenePointReq(payloadMsg pb.Message)

func (*Game) HostPlayerNotify

func (g *Game) HostPlayerNotify()

func (*Game) ItemCdGroupTimeNotify

func (g *Game) ItemCdGroupTimeNotify()

func (*Game) LoginNotify

func (g *Game) LoginNotify()

登录通知包

func (*Game) OpenStateChangeNotify

func (g *Game) OpenStateChangeNotify(stateMap map[uint32]uint32)

func (*Game) OpenStateUpdateNotify

func (g *Game) OpenStateUpdateNotify()

func (*Game) PacketAvatarInfo

func (g *Game) PacketAvatarInfo(avatarId uint32) *proto.AvatarInfo

func (*Game) PacketPropValue

func (g *Game) PacketPropValue(key uint32, value any) *proto.PropValue

func (*Game) PathfindingEnterSceneReq

func (g *Game) PathfindingEnterSceneReq(payloadMsg pb.Message)

func (*Game) PingReq

func (g *Game) PingReq(playerMsg pb.Message)

func (*Game) PlayerBornData

func (g *Game) PlayerBornData(nickName string, avatarId uint32)

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 (g *Game) PlayerLoginReq(payloadMsg pb.Message)

func (*Game) PlayerStoreNotify

func (g *Game) PlayerStoreNotify()

func (*Game) PostEnterSceneReq

func (g *Game) PostEnterSceneReq(payloadMsg pb.Message)

func (*Game) QuestListNotify

func (g *Game) QuestListNotify()

func (*Game) RegisterMessage

func (g *Game) RegisterMessage(cmdId uint16, payloadMsg pb.Message)

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 (g *Game) SceneInitFinishReq(payloadMsg pb.Message)

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 (g *Game) SetOpenStateReq(payloadMsg pb.Message)

func (*Game) SetPlayerBornDataReq

func (g *Game) SetPlayerBornDataReq(payloadMsg pb.Message)

func (*Game) StoreWeightLimitNotify

func (g *Game) StoreWeightLimitNotify()

func (*Game) UpdateAvatarWeapon

func (g *Game) UpdateAvatarWeapon(avatarId uint32, guid uint64)

角色装备武器

func (*Game) WeaponStoreItemChangeNotify

func (g *Game) WeaponStoreItemChangeNotify(guidList []uint64)

武器通知

func (*Game) WorldDataNotify

func (g *Game) WorldDataNotify()

func (*Game) WorldPlayerInfoNotify

func (g *Game) WorldPlayerInfoNotify()

type HandlerFunc

type HandlerFunc func(payloadMsg pb.Message)

type KcpConnManager

type KcpConnManager struct {
	// contains filtered or unexported fields
}
var KCPCONNMANAGER *KcpConnManager

type KcpEvent

type KcpEvent struct {
	SessionId    uint32
	EventId      string
	EventMessage any
}

type RouteManager

type RouteManager struct {
	// contains filtered or unexported fields
}

func NewRouteManager

func NewRouteManager(g *Game) (r *RouteManager)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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