条件校验参数修改
This commit is contained in:
parent
64d6876be9
commit
f3319fa989
@ -182,17 +182,18 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
|||||||
go_overrideBtn.Disable()
|
go_overrideBtn.Disable()
|
||||||
defer func() {
|
defer func() {
|
||||||
go_overrideBtn.Enable()
|
go_overrideBtn.Enable()
|
||||||
|
this.goList.itemList.Refresh()
|
||||||
}()
|
}()
|
||||||
for _, v := range this.goList.cachedList.Items {
|
for _, v := range this.goList.selItemIds {
|
||||||
// logrus.WithField("path1", filepath.Join(tmpDir.Text, "go", v)).Debug("copy go")
|
// logrus.WithField("path1", filepath.Join(tmpDir.Text, "go", v)).Debug("copy go")
|
||||||
// logrus.WithField("path2", filepath.Join(projectDir.Text, outputCodeDir.Text, v)).Debug("copy go")
|
// logrus.WithField("path2", filepath.Join(projectDir.Text, outputCodeDir.Text, v)).Debug("copy go")
|
||||||
_, err := common.Copy(filepath.Join(tmpDir.Text, "go", v.Text),
|
_, err := common.Copy(filepath.Join(tmpDir.Text, "go", v),
|
||||||
filepath.Join(projectDir.Text, outputCodeDir.Text, v.Text))
|
filepath.Join(projectDir.Text, outputCodeDir.Text, v))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.goList.deleteItem(v.Text)
|
this.goList.deleteItem(v)
|
||||||
}
|
}
|
||||||
this.goList.changeFileCount()
|
this.goList.changeFileCount()
|
||||||
}
|
}
|
||||||
@ -244,16 +245,16 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
|||||||
defer func() {
|
defer func() {
|
||||||
json_overrideBtn.Enable()
|
json_overrideBtn.Enable()
|
||||||
}()
|
}()
|
||||||
for _, v := range this.jsonList.cachedList.Items {
|
for _, v := range this.jsonList.selItemIds {
|
||||||
// logrus.WithField("path1", filepath.Join(tmpDir.Text, "json", v)).Debug("copy json")
|
// logrus.WithField("path1", filepath.Join(tmpDir.Text, "json", v)).Debug("copy json")
|
||||||
// logrus.WithField("path2", filepath.Join(projectDir.Text, outputJsonDir.Text, v)).Debug("copy json")
|
// logrus.WithField("path2", filepath.Join(projectDir.Text, outputJsonDir.Text, v)).Debug("copy json")
|
||||||
_, err := common.Copy(filepath.Join(tmpDir.Text, "json", v.Text),
|
_, err := common.Copy(filepath.Join(tmpDir.Text, "json", v),
|
||||||
filepath.Join(projectDir.Text, outputJsonDir.Text, v.Text))
|
filepath.Join(projectDir.Text, outputJsonDir.Text, v))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.jsonList.deleteItem(v.Text)
|
this.jsonList.deleteItem(v)
|
||||||
}
|
}
|
||||||
this.jsonList.changeFileCount()
|
this.jsonList.changeFileCount()
|
||||||
}
|
}
|
||||||
@ -453,6 +454,9 @@ func (f *fileList) deleteItem(name string) {
|
|||||||
if v.Text == name {
|
if v.Text == name {
|
||||||
f.selItemIds = utils.DeleteString(f.selItemIds, v.Text)
|
f.selItemIds = utils.DeleteString(f.selItemIds, v.Text)
|
||||||
f.cachedList.Items = append(f.cachedList.Items[:i], f.cachedList.Items[i+1:]...)
|
f.cachedList.Items = append(f.cachedList.Items[:i], f.cachedList.Items[i+1:]...)
|
||||||
|
if f.fileTotal > 0 {
|
||||||
|
f.fileTotal--
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -498,7 +502,7 @@ func (f *fileList) changeItem(tmpDir, projectDir string) {
|
|||||||
|
|
||||||
// 刷新文件数
|
// 刷新文件数
|
||||||
func (f *fileList) changeFileCount() {
|
func (f *fileList) changeFileCount() {
|
||||||
f.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(f.cachedList.Items), f.fileTotal))
|
f.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(f.selItemIds), f.fileTotal))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *appGen) GetAppName() string {
|
func (a *appGen) GetAppName() string {
|
||||||
|
@ -122,7 +122,7 @@ type (
|
|||||||
// 随机任务
|
// 随机任务
|
||||||
IRtask interface {
|
IRtask interface {
|
||||||
// 条件校验
|
// 条件校验
|
||||||
CheckCondi(session IUserSession, condiId int32) (code pb.ErrorCode)
|
CheckCondi(uid string, condiId int32) (code pb.ErrorCode)
|
||||||
//任务触发
|
//任务触发
|
||||||
SendToRtask(session IUserSession, rtaskType TaskType, params ...int32) (code pb.ErrorCode)
|
SendToRtask(session IUserSession, rtaskType TaskType, params ...int32) (code pb.ErrorCode)
|
||||||
// 初始化条件数据
|
// 初始化条件数据
|
||||||
|
@ -115,7 +115,7 @@ func (this *apiComp) Dotask(session comm.IUserSession, req *pb.LinestoryDotaskRe
|
|||||||
//校验子任务完成条件
|
//校验子任务完成条件
|
||||||
if m, ok := module.(comm.IRtask); ok {
|
if m, ok := module.(comm.IRtask); ok {
|
||||||
for _, condiId := range stageConf.Cond {
|
for _, condiId := range stageConf.Cond {
|
||||||
if code = m.CheckCondi(session, condiId); code != pb.ErrorCode_Success {
|
if code = m.CheckCondi(session.GetUserId(), condiId); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ func (this *apiComp) Dostart(session comm.IUserSession, req *pb.LinestoryStartRe
|
|||||||
if m, ok := module.(comm.IRtask); ok {
|
if m, ok := module.(comm.IRtask); ok {
|
||||||
// 校验限定条件
|
// 校验限定条件
|
||||||
for _, condiId := range conf.Cond {
|
for _, condiId := range conf.Cond {
|
||||||
if code = m.CheckCondi(session, condiId); code != pb.ErrorCode_Success {
|
if code = m.CheckCondi(session.GetUserId(), condiId); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,28 +72,6 @@ func (this *configureComp) GetConfigure(name string) (v interface{}, err error)
|
|||||||
return configure.GetConfigure(name)
|
return configure.GetConfigure(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取爬塔配置表数据
|
|
||||||
func (this *configureComp) GetPagodaconfig(id int32) (data *cfg.GamePagodaData) {
|
|
||||||
if v, err := this.GetConfigure(game_pagoda); err != nil {
|
|
||||||
log.Errorf("get global conf err:%v", err)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
var (
|
|
||||||
configure *cfg.GamePagoda
|
|
||||||
ok bool
|
|
||||||
)
|
|
||||||
if configure, ok = v.(*cfg.GamePagoda); !ok {
|
|
||||||
log.Errorf("%T no is *cfg.Game_pagodaData", v)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if data, ok = configure.GetDataMap()[id]; ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 爬塔奖励
|
// 爬塔奖励
|
||||||
func (this *configureComp) GetPagodaRewardconfig(id int32) (data *cfg.GamePagodaTaskRewardData) {
|
func (this *configureComp) GetPagodaRewardconfig(id int32) (data *cfg.GamePagodaTaskRewardData) {
|
||||||
if v, err := this.GetConfigure(game_pagodataskreward); err == nil {
|
if v, err := this.GetConfigure(game_pagodataskreward); err == nil {
|
||||||
|
@ -241,8 +241,8 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 任务条件校验
|
// 任务条件校验
|
||||||
func (this *ModuleRtask) CheckCondi(session comm.IUserSession, condiId int32) (code pb.ErrorCode) {
|
func (this *ModuleRtask) CheckCondi(uid string, condiId int32) (code pb.ErrorCode) {
|
||||||
if _, ok := this.modelRtask.checkCondi(session.GetUserId(), condiId); !ok {
|
if _, ok := this.modelRtask.checkCondi(uid, condiId); !ok {
|
||||||
code = pb.ErrorCode_RtaskCondiNoReach
|
code = pb.ErrorCode_RtaskCondiNoReach
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -9,34 +9,26 @@
|
|||||||
package cfg
|
package cfg
|
||||||
|
|
||||||
type GamePagoda struct {
|
type GamePagoda struct {
|
||||||
_dataMap map[int32]*GamePagodaData
|
|
||||||
_dataList []*GamePagodaData
|
_dataList []*GamePagodaData
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGamePagoda(_buf []map[string]interface{}) (*GamePagoda, error) {
|
func NewGamePagoda(_buf []map[string]interface{}) (*GamePagoda, error) {
|
||||||
_dataList := make([]*GamePagodaData, 0, len(_buf))
|
_dataList := make([]*GamePagodaData, 0, len(_buf))
|
||||||
dataMap := make(map[int32]*GamePagodaData)
|
|
||||||
for _, _ele_ := range _buf {
|
for _, _ele_ := range _buf {
|
||||||
if _v, err2 := DeserializeGamePagodaData(_ele_); err2 != nil {
|
if _v, err2 := DeserializeGamePagodaData(_ele_); err2 != nil {
|
||||||
return nil, err2
|
return nil, err2
|
||||||
} else {
|
} else {
|
||||||
_dataList = append(_dataList, _v)
|
_dataList = append(_dataList, _v)
|
||||||
dataMap[_v.Key] = _v
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &GamePagoda{_dataList:_dataList, _dataMap:dataMap}, nil
|
return &GamePagoda{_dataList:_dataList}, nil
|
||||||
}
|
|
||||||
|
|
||||||
func (table *GamePagoda) GetDataMap() map[int32]*GamePagodaData {
|
|
||||||
return table._dataMap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (table *GamePagoda) GetDataList() []*GamePagodaData {
|
func (table *GamePagoda) GetDataList() []*GamePagodaData {
|
||||||
return table._dataList
|
return table._dataList
|
||||||
}
|
}
|
||||||
|
|
||||||
func (table *GamePagoda) Get(key int32) *GamePagodaData {
|
func (table *GamePagoda) Get(index int) *GamePagodaData {
|
||||||
return table._dataMap[key]
|
return table._dataList[index]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user