59 lines
1.4 KiB
Go
59 lines
1.4 KiB
Go
package arena
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/base"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
)
|
|
|
|
/*
|
|
模块名:战斗模块
|
|
描述:处理游侠战斗相关业务
|
|
开发:李伟
|
|
*/
|
|
func NewModule() core.IModule {
|
|
m := new(Arena)
|
|
return m
|
|
}
|
|
|
|
type Arena struct {
|
|
modules.ModuleBase
|
|
service base.IRPCXService
|
|
battle comm.IBattle
|
|
api *apiComp
|
|
configure *configureComp
|
|
modelArena *modelArena
|
|
modelRank *modelRank
|
|
}
|
|
|
|
//模块名
|
|
func (this *Arena) GetType() core.M_Modules {
|
|
return comm.ModuleArena
|
|
}
|
|
|
|
//模块初始化接口 注册用户创建角色事件
|
|
func (this *Arena) 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 *Arena) Start() (err error) {
|
|
err = this.ModuleBase.Start()
|
|
var module core.IModule
|
|
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
|
|
return
|
|
}
|
|
this.battle = module.(comm.IBattle)
|
|
return
|
|
}
|
|
|
|
//装备组件
|
|
func (this *Arena) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
|
this.modelArena = this.RegisterComp(new(modelArena)).(*modelArena)
|
|
this.modelRank = this.RegisterComp(new(modelRank)).(*modelRank)
|
|
}
|