go_dreamfactory/modules/expedition/module.go
2024-01-23 10:19:44 +08:00

80 lines
1.7 KiB
Go

package expedition
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
/*
公会远征
*/
func NewModule() core.IModule {
m := new(Expedition)
return m
}
type Expedition struct {
modules.ModuleBase
service comm.IService
sociaty comm.ISociaty
mail comm.Imail
api *apiComp
model *ModelExpedition
configure *MCompConfigure
}
// 模块名
func (this *Expedition) GetType() core.M_Modules {
return comm.ModuleExpedition
}
// 模块初始化接口 注册用户创建角色事件
func (this *Expedition) 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.(comm.IService)
return
}
func (this *Expedition) Start() (err error) {
if err = this.ModuleBase.Start(); err != nil {
return
}
var module core.IModule
if module, err = this.service.GetModule(comm.ModuleSociaty); err != nil {
return
}
this.sociaty = module.(comm.ISociaty)
if module, err = this.service.GetModule(comm.ModuleMail); err != nil {
return
}
this.mail = module.(comm.Imail)
return
}
// 装备组件
func (this *Expedition) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.configure = this.RegisterComp(new(MCompConfigure)).(*MCompConfigure)
this.model = this.RegisterComp(new(ModelExpedition)).(*ModelExpedition)
}
// 红点
func (this *Expedition) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) {
var ()
reddot = make(map[comm.ReddotType]*pb.ReddotItem)
for _, v := range rid {
switch v {
case comm.Reddot15301:
break
}
}
return
}