1 Star 0 Fork 0

wuzpdev/goworld

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
cmd/goworld
cn
components
docker
engine
async
binutil
common
config
consts
crontab
dispatchercluster
entity
Entity.go
EntityManager.go
GameClient.go
ISpace.go
ListAttr.go
MapAttr.go
Space.go
SpaceManager.go
Vector3.go
attr.go
attr_test.go
entity_map.go
migarte_test.go
rpc_desc.go
space_ops.go
gwioutil
gwlog
gwutils
kvdb
lib/gwsnappy
netutil
opmon
post
proto
service
srvdis
storage
uuid
examples
ext
.gitignore
.travis.yml
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
README.md
TODO.md
_config.yml
covertest.sh
goworld.go
goworld.ini
goworld.ini.sample
rsa.crt
rsa.key
克隆/下载
SpaceManager.go 914 Bytes
一键复制 编辑 原始数据 按行查看 历史
package entity
import (
"reflect"
"github.com/xiaonanln/goworld/engine/common"
)
var (
spaceManager = newSpaceManager()
spaceType reflect.Type
)
type _SpaceManager struct {
spaces map[common.EntityID]*Space
}
func newSpaceManager() *_SpaceManager {
return &_SpaceManager{
spaces: map[common.EntityID]*Space{},
}
}
func (spmgr *_SpaceManager) putSpace(space *Space) {
spmgr.spaces[space.ID] = space
}
func (spmgr *_SpaceManager) delSpace(id common.EntityID) {
delete(spmgr.spaces, id)
}
func (spmgr *_SpaceManager) getSpace(id common.EntityID) *Space {
return spmgr.spaces[id]
}
// RegisterSpace registers the user custom space type
func RegisterSpace(spacePtr ISpace) {
spaceVal := reflect.Indirect(reflect.ValueOf(spacePtr))
spaceType = spaceVal.Type()
RegisterEntity(_SPACE_ENTITY_TYPE, spacePtr, false)
}
func GetSpace(id common.EntityID) *Space {
return spaceManager.spaces[id]
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wuzpdev/goworld.git
git@gitee.com:wuzpdev/goworld.git
wuzpdev
goworld
goworld
v0.1.6

搜索帮助