86 lines
1.9 KiB
Go
86 lines
1.9 KiB
Go
package mline
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
type Mline struct {
|
|
modules.ModuleBase
|
|
modelMline *ModelMline
|
|
service core.IService
|
|
api *apiComp
|
|
configure *configureComp
|
|
battle comm.IBattle
|
|
}
|
|
|
|
func NewModule() core.IModule {
|
|
return &Mline{}
|
|
}
|
|
|
|
func (this *Mline) GetType() core.M_Modules {
|
|
return comm.ModuleMline
|
|
}
|
|
|
|
func (this *Mline) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
|
err = this.ModuleBase.Init(service, module, options)
|
|
this.service = service
|
|
return
|
|
}
|
|
|
|
func (this *Mline) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
|
this.modelMline = this.RegisterComp(new(ModelMline)).(*ModelMline)
|
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
|
}
|
|
|
|
func (this *Mline) 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 *Mline) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) {
|
|
reddot = make(map[comm.ReddotType]bool)
|
|
for _, v := range rid {
|
|
if v == comm.Reddot5 {
|
|
reddot[comm.Reddot5] = this.CheckPoint(session.GetUserId())
|
|
break
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// 红点检测
|
|
func (this *Mline) CheckPoint(uid string) bool {
|
|
// list, err := this.modelMainline.getMainlineList(uid)
|
|
// if err != nil {
|
|
// return false
|
|
// }
|
|
// for _, v := range list {
|
|
// conf := this.configure.GetMainlineChapter(v.ChapterId)
|
|
// if conf == nil {
|
|
// continue
|
|
// }
|
|
// if len(conf.Episode) != len(v.BranchID) {
|
|
// return true
|
|
// }
|
|
// }
|
|
return false
|
|
}
|
|
|
|
// 参数 难度 + 关卡id
|
|
func (this *Mline) ModifyMainlineDataByNanduID(uid string, nandu, id int32) (code pb.ErrorCode) {
|
|
|
|
return
|
|
}
|