space

package
v0.0.0-...-2be58df Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: BSD-4-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 场景的Navmash为nil
	ErrSp_Navmash_Nil = common.NewError(-1, "Space.Init PathFindermgr == nil (%s,%s) ")
)

Functions

This section is empty.

Types

type ISpace

type ISpace interface {
	entity.IEntity
	entity.IEntities

	//回收进Pool
	GCPool()
}

场景接口

type Space

type Space struct {
	/* 组合 */
	SimpleEntity
	DelayCallHost
	//对象管理器
	*Entities

	MapID uint64 //地图ID
	//地图名字
	MapName string
	// 地图唯一标识,空表示独立,有值的话,使用相同引用,这个逻辑由业务决定
	MapKey string

	//场景开始时间
	StartTime time.Time

	//时间轮
	Timer *timerwheel.Timer
	//寻路算法有关
	PathFindermgr pathfinder.IPathFinder
	// contains filtered or unexported fields
}

场景基础

func (*Space) Destroy

func (this *Space) Destroy()

销毁

func (*Space) GCPool

func (this *Space) GCPool()

回收进Pool;进去后state进入到暂停状态

func (*Space) GetEntityID

func (this *Space) GetEntityID() uint64

GetEntityID 获取实体ID

func (*Space) Init

func (this *Space) Init() (err error)

初始化

func (*Space) Loop

func (this *Space) Loop()

循环调用

func (*Space) Looped

func (this *Space) Looped()

循环调用后

func (*Space) Looping

func (this *Space) Looping()

循环调用中

func (*Space) OnCreated

func (this *Space) OnCreated(etype string, eid, dbid uint64, realPtr IEntity, spacePtr IEntities, fly bool, param ...interface{}) error

在创建对象的时候调用 eid:实例的唯一ID etype:实例对象类型 dbid:实例持久化的唯一ID,如果没有持久化可以使用eid一样,也可以为0 realPtr:最外面的实例对象引用 spacePtr:最外面的实例所在空间的引用 fly:是否需要在redis中注册路由信息

func (*Space) OnPanic

func (this *Space) OnPanic(err error)

发生Panic的时候,做的处理

func (*Space) ReLoop

func (this *Space) ReLoop()

恢复到Loop状态;一般是从Pool拿出来的时候,会跑的逻辑

func (*Space) String

func (this *Space) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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