条件状态判断
This commit is contained in:
parent
4f2660fabb
commit
1ba179f675
@ -20,7 +20,7 @@ const (
|
|||||||
type configureComp struct {
|
type configureComp struct {
|
||||||
modules.MCompConfigure
|
modules.MCompConfigure
|
||||||
lock sync.RWMutex
|
lock sync.RWMutex
|
||||||
worldtaskConf map[int32]*cfg.GameWorldTaskData
|
worldtaskConf map[int32]*cfg.GameWorldTaskData //key 条件ID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
@ -31,6 +31,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
gameWorldAll: cfg.NewGameWorldAll,
|
gameWorldAll: cfg.NewGameWorldAll,
|
||||||
gameburiedCond: cfg.NewGameBuriedCondi,
|
gameburiedCond: cfg.NewGameBuriedCondi,
|
||||||
})
|
})
|
||||||
|
this.worldtaskConf = make(map[int32]*cfg.GameWorldTaskData)
|
||||||
configure.RegisterConfigure(gameWorldTask, cfg.NewGameBuriedCondi, this.updateconfigure)
|
configure.RegisterConfigure(gameWorldTask, cfg.NewGameBuriedCondi, this.updateconfigure)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,6 @@ func (this *Worldtask) OnInstallComp() {
|
|||||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||||
this.modelWorldtask = this.RegisterComp(new(ModelWorldtask)).(*ModelWorldtask)
|
this.modelWorldtask = this.RegisterComp(new(ModelWorldtask)).(*ModelWorldtask)
|
||||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||||
// conf,err = this.configure.getWorldtaskBattleCfg()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +52,11 @@ func (this *Worldtask) Start() (err error) {
|
|||||||
if err = this.checkWorldtaskConf(); err != nil {
|
if err = this.checkWorldtaskConf(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
conf, err := this.configure.getWorldtaskCfg()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
this.configure.worldtaskConf = conf.GetDataMap()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,8 +125,6 @@ func (this *Worldtask) TCondFinishNotify(uid string, conds []*pb.ConIProgress) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检索condId是否是世界任务的完成条件
|
|
||||||
|
|
||||||
taskConds := make(map[int32][]*pb.CurrentTask)
|
taskConds := make(map[int32][]*pb.CurrentTask)
|
||||||
finishedCondIds := []*pb.ConIProgress{}
|
finishedCondIds := []*pb.ConIProgress{}
|
||||||
|
|
||||||
@ -186,11 +188,23 @@ func (this *Worldtask) TCondFinishNotify(uid string, conds []*pb.ConIProgress) {
|
|||||||
if err != nil || curTaskConf == nil {
|
if err != nil || curTaskConf == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
var flag bool
|
||||||
if curTaskConf.DeliverNpc == 0 {
|
if curTaskConf.DeliverNpc == 0 {
|
||||||
defer func() {
|
//判断当前任务下的条件是否全部是完成状态
|
||||||
this.modelWorldtask.taskFinish(session, t.TaskId, userTask, curTaskConf)
|
for _, s := range t.Conds {
|
||||||
this.modelWorldtask.taskFinishPush(session, userTask, curTaskConf)
|
if s.State == pb.BuriedItemFinishState_buried_finish {
|
||||||
}()
|
flag = true
|
||||||
|
} else {
|
||||||
|
flag = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if flag {
|
||||||
|
defer func() {
|
||||||
|
this.modelWorldtask.taskFinish(session, t.TaskId, userTask, curTaskConf)
|
||||||
|
this.modelWorldtask.taskFinishPush(session, userTask, curTaskConf)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
currentTasks = append(currentTasks, t)
|
currentTasks = append(currentTasks, t)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user