Documentation ¶
Index ¶
- Constants
- func Contains[K comparable](array []K, ele K) bool
- func CopyMap[K comparable, V any](src map[K]V, SkipKeys ...K) map[K]V
- func GenSimpleUUIDStr() string
- func GenUUIDStr() string
- func LastSuffixAfterDot(s string) string
- func StartService(ctx context.Context, services ...IService)
- type Hashable
- type IAnno
- type IMgr
- type IPlayer
- type IPlayerMgr
- type IRoom
- type IScene
- type ISceneMgr
- type IService
- type ITeam
- type ITeamMgr
- type IUnion
- type IUnionMgr
- type IWorld
Constants ¶
View Source
const ( PLAIN_CONTENT = "plain" ALGO_AES = "aes" ALGO_XXX_TEA = "xxtea" // 加密的 header key X_CRYPTO_ALGO = "_x_crypto_algo" )
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[K comparable](array []K, ele K) bool
func CopyMap ¶
func CopyMap[K comparable, V any](src map[K]V, SkipKeys ...K) map[K]V
func GenUUIDStr ¶
func GenUUIDStr() string
func LastSuffixAfterDot ¶
func StartService ¶
Types ¶
type IAnno ¶
type IAnno interface { Reg(cmdCode int32, pb proto.Message) Instance(cmdCode int32, bytes []byte) (proto.Message, error) }
func NewAnnoProto ¶
func NewAnnoProto() IAnno
func NewAnnoProtoType ¶
func NewAnnoProtoType() IAnno
type IPlayer ¶
type IPlayer[PK Hashable] interface { Id() PK Load() Unload() ReplaceBy(IPlayer[PK]) Read(netty.Message) Write(netty.Message) }
玩家对象的接口
type IPlayerMgr ¶
type IPlayerMgr[PK Hashable, T IPlayer[PK]] interface { IService Id() string // 加入 Join(T) // 退出 Quit(T) Read(netty.HandlerContext, netty.Message) // 推送数据 async=false 为同步发送,async=true 为异步发送 写数据 Write(msg netty.Message, async bool) // 向特定的玩家的id集合推送数据 WriteToIds(ids []PK, msg netty.Message, async bool) WritePredicateById(predicate func(PK) bool, msg netty.Message, async bool) WritePredicateByPlayer(predicate func(T) bool, msg netty.Message, async bool) }
玩家服 管理玩家资源
type IScene ¶
type IScene[PK Hashable, T IPlayer[PK]] interface { IPlayerMgr[PK, T] }
场景 针对场景服 管理场景资源
Click to show internal directories.
Click to hide internal directories.