diff --git a/comm/imodule.go b/comm/imodule.go index e6b767afd..8517e2cda 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -82,8 +82,6 @@ type ( InitTaskAll(uid string) //清空任务 ResetTask(uid string, taskTag TaskTag) - //监听任务 - ListenTask() //任务通知 SendToTask(session IUserSession, taskType TaskType, param *pb.TaskParam) (code pb.ErrorCode) // 清理玩家任务数据 diff --git a/modules/task/model_task.go b/modules/task/model_task.go index 7c1c5de0c..ffb8a0a5e 100644 --- a/modules/task/model_task.go +++ b/modules/task/model_task.go @@ -18,7 +18,6 @@ const ( //Redis type ModelTask struct { modules.MCompModel moduleTask *ModuleTask - } func (this *ModelTask) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { @@ -59,14 +58,10 @@ func (this *ModelTask) getTaskTypeList(uid string, taskType comm.TaskType) (newl return } -//任务处理器注册 - //初始化任务 func (this *ModelTask) initTask(uid string) error { if data, err := this.moduleTask.configure.getTaskList(); err == nil { for _, cnf := range data { - //注册任务处理器 - //初始玩家任务数据 objId := primitive.NewObjectID().Hex() task := &pb.DBTask{ @@ -245,3 +240,15 @@ func (this *ModelTask) inStrategy(uid string, heroCfgId int32) (taskIds []int32, return } + +func (this *ModelTask) UpEquip() { + +} + +func (this *ModelTask) UpHeroStar() { + +} + +func (this *ModelTask) UpHeroLevel() { + +} diff --git a/modules/task/module.go b/modules/task/module.go index fad79cfdf..fdc42486b 100644 --- a/modules/task/module.go +++ b/modules/task/module.go @@ -27,6 +27,7 @@ func (this *ModuleTask) GetType() core.M_Modules { func (this *ModuleTask) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) + // this.initTaskHandle() return } @@ -89,6 +90,7 @@ func (this *ModuleTask) CreateTaskForStrategy(uid string, heroCfgId int32) { } +// 清理任务数据 func (this *ModuleTask) CleanData(uid string) { this.modelTask.clearTask(uid, comm.TASK_DAILY) this.modelTask.clearTask(uid, comm.TASK_WEEKLY) @@ -97,4 +99,29 @@ func (this *ModuleTask) CleanData(uid string) { this.modelTaskActive.clearTask(uid, comm.TASK_DAILY) this.modelTaskActive.clearTask(uid, comm.TASK_WEEKLY) -} \ No newline at end of file +} + +//任务处理器注册 +type taskHandle func() + +func (this *ModuleTask) register(taskType comm.TaskType, fn taskHandle) { + +} + +func (this *ModuleTask) initTaskHandle() { + if data, err := this.configure.getTaskList(); err == nil { + for _, v := range data { + switch v.TypeId { + case int32(comm.TaskTypeUpEquip): + this.register(comm.TaskTypeUpEquip, this.modelTask.UpEquip) + case int32(comm.TaskTypeUpHeroStar): + this.register(comm.TaskTypeUpEquip, this.modelTask.UpHeroStar) + case int32(comm.TaskTypeUpHeroLevel): + this.register(comm.TaskTypeUpEquip, this.modelTask.UpHeroLevel) + default: + log.Error("no ") + } + + } + } +}