63 lines
1.5 KiB
Go
63 lines
1.5 KiB
Go
package moonfantasy
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/base"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
)
|
|
|
|
/*
|
|
模块名:月子秘境
|
|
描述:随机世界副本
|
|
开发:李伟
|
|
*/
|
|
func NewModule() core.IModule {
|
|
m := new(Moonfantasy)
|
|
return m
|
|
}
|
|
|
|
type Moonfantasy struct {
|
|
modules.ModuleBase
|
|
service base.IRPCXService
|
|
chat comm.IChat
|
|
battle comm.IBattle
|
|
api_comp *apiComp
|
|
configure *configureComp
|
|
modelDream *modelDreamComp
|
|
}
|
|
|
|
//模块名
|
|
func (this *Moonfantasy) GetType() core.M_Modules {
|
|
return comm.ModuleMoonfantasy
|
|
}
|
|
|
|
//模块初始化接口 注册用户创建角色事件
|
|
func (this *Moonfantasy) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
|
err = this.ModuleBase.Init(service, module, options)
|
|
this.service = service.(base.IRPCXService)
|
|
return
|
|
}
|
|
|
|
func (this *Moonfantasy) Start() (err error) {
|
|
err = this.ModuleBase.Start()
|
|
var module core.IModule
|
|
if module, err = this.service.GetModule(comm.ModuleChat); err != nil {
|
|
return
|
|
}
|
|
this.chat = module.(comm.IChat)
|
|
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
|
|
return
|
|
}
|
|
this.battle = module.(comm.IBattle)
|
|
return
|
|
}
|
|
|
|
//装备组件
|
|
func (this *Moonfantasy) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
|
|
this.modelDream = this.RegisterComp(new(modelDreamComp)).(*modelDreamComp)
|
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
|
}
|