package timer import ( "go_dreamfactory/comm" "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" "go_dreamfactory/lego/core/cbase" "go_dreamfactory/modules" ) /* 模块名:定时任务 描述:处理区服集群下需要做的一些定时任务 开发:李伟 */ func NewModule() core.IModule { m := new(Timer) return m } type Timer struct { cbase.ModuleBase modules.MCompModel service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口 rank *PagodaRank rank2 *VikingRank rank3 *HuntingRank } //模块名 func (this *Timer) GetType() core.M_Modules { return comm.ModuleTimer } // NewOptions 模块自定义参数 func (this *Timer) NewOptions() (options core.IModuleOptions) { return new(Options) } //模块初始化接口 注册用户创建角色事件 func (this *Timer) 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 *Timer) Start() (err error) { err = this.ModuleBase.Start() return } func (this *Timer) OnInstallComp() { this.ModuleBase.OnInstallComp() this.rank = this.RegisterComp(new(PagodaRank)).(*PagodaRank) this.rank2 = this.RegisterComp(new(VikingRank)).(*VikingRank) this.rank3 = this.RegisterComp(new(HuntingRank)).(*HuntingRank) }