go_dreamfactory/modules/entertainment/module.go

58 lines
1.3 KiB
Go

package entertainment
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
func NewModule() core.IModule {
m := new(Entertainment)
return m
}
type Entertainment struct {
modules.ModuleBase
service core.IService
api *apiComp
configure *configureComp
model *modelComp
gameMgr *gameMgrComp
xxl *MapData
}
// 模块名
func (this *Entertainment) GetType() core.M_Modules {
return comm.ModuleEntertainment
}
// 模块初始化接口 注册用户创建角色事件
func (this *Entertainment) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
if err = this.ModuleBase.Init(service, module, options); err != nil {
return
}
this.service = service
return
}
// 装备组件
func (this *Entertainment) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.model = this.RegisterComp(new(modelComp)).(*modelComp)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
this.gameMgr = this.RegisterComp(new(gameMgrComp)).(*gameMgrComp)
//this.xxl = this.RegisterComp(new(MapData)).(*MapData)
}
func (this *Entertainment) Start() (err error) {
if err = this.ModuleBase.Start(); err != nil {
return
}
this.xxl = new(MapData)
this.xxl.InitMap()
this.xxl.SwapGirde(1, 0)
return
}