package exclusive import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/event" "go_dreamfactory/modules" ) const moduleName = "专武" func NewModule() core.IModule { m := new(Exclusive) return m } type Exclusive struct { modules.ModuleBase service core.IService chat comm.IChat api *apiComp configure *configureComp modelExclusive *modelExclusive } // 模块名 func (this *Exclusive) GetType() core.M_Modules { return comm.ModuleExclusive } // 模块初始化接口 注册用户创建角色事件 func (this *Exclusive) 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 *Exclusive) Start() (err error) { if err = this.ModuleBase.Start(); err != nil { return } var module core.IModule if module, err = this.service.GetModule(comm.ModuleChat); err != nil { return } this.chat = module.(comm.IChat) event.RegisterGO(comm.EventUserOffline, this.EventUserOffline) return } // 装备组件 func (this *Exclusive) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api = this.RegisterComp(new(apiComp)).(*apiComp) this.modelExclusive = this.RegisterComp(new(modelExclusive)).(*modelExclusive) this.configure = this.RegisterComp(new(configureComp)).(*configureComp) } // Event------------------------------------------------------------------------------------------------------------ func (this *Exclusive) EventUserOffline(uid, sessionid string) { this.modelExclusive.BatchDelLists(uid) }