diff --git a/cmd/v2/ui/views/sys_funclist.go b/cmd/v2/ui/views/sys_funclist.go index 2638954bf..ed5cb39da 100644 --- a/cmd/v2/ui/views/sys_funclist.go +++ b/cmd/v2/ui/views/sys_funclist.go @@ -7,6 +7,7 @@ import ( "strings" "fyne.io/fyne/v2" + "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/widget" "github.com/sirupsen/logrus" ) @@ -36,5 +37,18 @@ func (this *SysFuncListView) CreateView(t *model.TestCase) fyne.CanvasObject { } logrus.WithFields(logrus.Fields{"mainType": t.MainType, "subType": t.SubType, "params": req}).Info("功能开启列表") } - return this.form + + newBtn := widget.NewButton("新的", func() { + if err := service.GetPttService().SendToClient( + t.MainType, + "funcgetlist", + &pb.SysFuncGetListReq{Keys: []string{"pavilion_kick"}}, + ); err != nil { + logrus.Error(err) + return + } + }) + + c := container.NewBorder(newBtn, nil, nil, nil, this.form) + return c } diff --git a/comm/imodule.go b/comm/imodule.go index 042bf0c4f..4205c006a 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -475,4 +475,10 @@ type ( // 声望升级 返回声望等级 Upgrade(session IUserSession, raceType int32, fv int32) (lv int32) } + + // 关卡编辑器 + ICombat interface { + // 获取关卡状态 + GetLevelStatus(uid string, levelId int32) bool + } ) diff --git a/modules/combat/module.go b/modules/combat/module.go index aea152e77..e945dec33 100644 --- a/modules/combat/module.go +++ b/modules/combat/module.go @@ -6,6 +6,7 @@ import ( "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/event" "go_dreamfactory/modules" + "go_dreamfactory/pb" ) /* @@ -27,12 +28,12 @@ type Combat struct { modelCombat *modelCombatComp } -//模块名 +// 模块名 func (this *Combat) GetType() core.M_Modules { return comm.ModuleCombat } -//模块初始化接口 注册用户创建角色事件 +// 模块初始化接口 注册用户创建角色事件 func (this *Combat) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) this.service = service.(base.IRPCXService) @@ -50,7 +51,7 @@ func (this *Combat) Start() (err error) { return } -//装备组件 +// 装备组件 func (this *Combat) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp) @@ -58,7 +59,21 @@ func (this *Combat) OnInstallComp() { this.configure = this.RegisterComp(new(configureComp)).(*configureComp) } -//Event------------------------------------------------------------------------------------------------------------ +// Event------------------------------------------------------------------------------------------------------------ func (this *Combat) EventUserOffline(uid, sessionid string) { this.modelCombat.delInfo(uid) } + +func (this *Combat) GetLevelStatus(uid string, levelId int32) bool { + combat := &pb.DBCombatUser{} + if err := this.modelCombat.Get(uid, combat); err != nil { + return false + } + + if combat != nil { + if v, ok := combat.Level[levelId]; ok { + return v.Pass + } + } + return false +} diff --git a/modules/oldtimes/api_getall.go b/modules/oldtimes/api_getall.go index 0fb1d121f..b715b815e 100644 --- a/modules/oldtimes/api_getall.go +++ b/modules/oldtimes/api_getall.go @@ -2,6 +2,7 @@ package oldtimes import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" ) @@ -15,6 +16,25 @@ func (this *apiComp) Getall(session comm.IUserSession, req *pb.OldtimesGetallReq rsp := &pb.OldtimesGetallResp{} d := this.module.modelOldtimes.getDBOldtimes(uid) + if imodule, err := this.service.GetModule(comm.ModuleCombat); err == nil { + if combat, ok := imodule.(comm.ICombat); ok { + for _, chapter := range d.Chapters { + for _, level := range chapter.Levels { + conf := this.module.configure.getMaintaskCfgBy(level.Lid) + if conf != nil { + if combat.GetLevelStatus(uid, conf.Stageid) { + level.Status = int32(finish) + if err := this.module.modelOldtimes.updateOldtimes(uid, d); err != nil { + this.module.Error("oldtime更新失败", + log.Field{Key: "uid", Value: uid}) + } + } + } + } + } + } + } + rsp.Data = d session.SendMsg(string(this.module.GetType()), "getall", rsp) return diff --git a/modules/oldtimes/configure.go b/modules/oldtimes/configure.go index 3c4bc744b..d3fb314c4 100644 --- a/modules/oldtimes/configure.go +++ b/modules/oldtimes/configure.go @@ -41,6 +41,19 @@ func (this *configureComp) getMaintaskCfg() (data *cfg.GameLinestoryMainTask, er return } +func (this *configureComp) getMaintaskCfgBy(id int32) (data *cfg.GameLinestoryMainTaskData) { + glmt, err := this.getMaintaskCfg() + if err != nil { + return nil + } + + if glmt != nil { + data = glmt.GetDataMap()[id] + return data + } + return data +} + func (this *configureComp) getTimelineCfg() (data *cfg.GameLinestoryTimeLine, err error) { var ( v interface{} diff --git a/pb/oldtimes_db.pb.go b/pb/oldtimes_db.pb.go index e12c9be39..863a8ce73 100644 --- a/pb/oldtimes_db.pb.go +++ b/pb/oldtimes_db.pb.go @@ -82,7 +82,7 @@ type Chapter struct { Cid int32 `protobuf:"varint,1,opt,name=cid,proto3" json:"cid" bson:"cid"` //章节ID Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status" bson:"status"` //状态 0锁定 1已解锁 2进行中 3已完成 - Received int32 `protobuf:"varint,3,opt,name=received,proto3" json:"received" bson:"received"` //奖励领取状态 + Received int32 `protobuf:"varint,3,opt,name=received,proto3" json:"received" bson:"received"` //奖励领取状态0未领取 1已领取 Levels []*Level `protobuf:"bytes,4,rep,name=levels,proto3" json:"levels" bson:"levels"` //关卡 }