更新旧时光

This commit is contained in:
wh_zcy 2023-04-25 18:25:28 +08:00
parent bf8a33eba4
commit 48ac8dc350
15 changed files with 1631 additions and 219 deletions

View File

@ -1,10 +1,11 @@
[
{
"id": 30001,
"Id": 1,
"subTask": 0,
"group": 10001,
"nodeIndex": 0,
"order": "1",
"group": 10001,
"stageid": 10001,
"name": {
"key": "SubplotMainTask_30001",
"text": "让阿宝变强1"
@ -13,16 +14,15 @@
"key": "SubplotMainTask_10001",
"text": "让阿宝变强1"
},
"img": "zx_pt_01",
"ending": 0,
"resetto": []
"img": "zx_pt_01"
},
{
"id": 30003,
"subTask": 30001,
"Id": 2,
"subTask": 1,
"group": 10001,
"nodeIndex": 1,
"order": "2",
"group": 10001,
"stageid": 10002,
"name": {
"key": "SubplotMainTask_30003",
"text": "让阿宝变强2"
@ -31,16 +31,15 @@
"key": "SubplotMainTask_10001",
"text": "让阿宝变强2"
},
"img": "zx_pt_02",
"ending": 0,
"resetto": []
"img": "zx_pt_02"
},
{
"id": 30007,
"subTask": 30001,
"Id": 3,
"subTask": 1,
"group": 10001,
"nodeIndex": 1,
"order": "3",
"group": 10001,
"stageid": 10003,
"name": {
"key": "SubplotMainTask_30007",
"text": "让阿宝变强3"
@ -49,16 +48,15 @@
"key": "SubplotMainTask_10001",
"text": "让阿宝变强3"
},
"img": "zx_pt_03",
"ending": 0,
"resetto": []
"img": "zx_pt_03"
},
{
"id": 30004,
"subTask": 30003,
"Id": 4,
"subTask": 2,
"group": 10001,
"nodeIndex": 2,
"order": "4",
"group": 10001,
"stageid": 10004,
"name": {
"key": "SubplotMainTask_30004",
"text": "让阿宝变强4"
@ -67,16 +65,15 @@
"key": "SubplotMainTask_10001",
"text": "让阿宝变强4"
},
"img": "zx_pt_04",
"ending": 0,
"resetto": []
"img": "zx_pt_04"
},
{
"id": 30008,
"subTask": 30007,
"Id": 5,
"subTask": 3,
"group": 10001,
"nodeIndex": 2,
"order": "5",
"group": 10001,
"stageid": 10005,
"name": {
"key": "SubplotMainTask_30008",
"text": "让阿宝变强6"
@ -85,16 +82,15 @@
"key": "SubplotMainTask_10001",
"text": "让阿宝变强6"
},
"img": "zx_pt_06",
"ending": 0,
"resetto": []
"img": "zx_pt_06"
},
{
"id": 30005,
"subTask": 30004,
"Id": 6,
"subTask": 4,
"group": 10001,
"nodeIndex": 3,
"order": "6",
"group": 10001,
"stageid": 10006,
"name": {
"key": "SubplotMainTask_30005",
"text": "让阿宝变强5"
@ -103,16 +99,15 @@
"key": "SubplotMainTask_10001",
"text": "让阿宝变强5"
},
"img": "zx_pt_05",
"ending": 0,
"resetto": []
"img": "zx_pt_05"
},
{
"id": 30009,
"subTask": 30008,
"Id": 7,
"subTask": 5,
"group": 10001,
"nodeIndex": 3,
"order": "7",
"group": 10001,
"stageid": 10007,
"name": {
"key": "SubplotMainTask_30009",
"text": "让阿宝变强7"
@ -121,16 +116,15 @@
"key": "SubplotMainTask_10001",
"text": "让阿宝变强7"
},
"img": "zx_pt_07",
"ending": 0,
"resetto": []
"img": "zx_pt_07"
},
{
"id": 30010,
"subTask": 30009,
"Id": 8,
"subTask": 6,
"group": 10001,
"nodeIndex": 4,
"order": "8",
"group": 10001,
"stageid": 10008,
"name": {
"key": "SubplotMainTask_30010",
"text": "让阿宝变强8"
@ -139,16 +133,15 @@
"key": "SubplotMainTask_10001",
"text": "让阿宝变强8"
},
"img": "zx_pt_08",
"ending": 0,
"resetto": []
"img": "zx_pt_08"
},
{
"id": 30011,
"subTask": 30010,
"Id": 9,
"subTask": 7,
"group": 10001,
"nodeIndex": 5,
"order": "9",
"group": 10001,
"stageid": 10009,
"name": {
"key": "SubplotMainTask_30011",
"text": "让阿宝变强9"
@ -157,8 +150,6 @@
"key": "SubplotMainTask_10001",
"text": "让阿宝变强9"
},
"img": "zx_pt_01",
"ending": 0,
"resetto": []
"img": "zx_pt_01"
}
]

View File

@ -126,6 +126,8 @@ var (
ff(comm.ModuleDispatch, "dispatch"): &formview.DispatchView{},
//声望
ff(comm.ModuleReputation, "reputation"): &formview.ReputationView{},
//旧时光
ff(comm.ModuleOldtimes, "oldtimes"): &formview.OldtimesView{},
}
)
@ -156,6 +158,7 @@ var (
string(comm.ModuleSmithy),
string(comm.ModuleDispatch),
string(comm.ModuleReputation),
string(comm.ModuleOldtimes),
},
"gm": {ff(comm.ModuleGM, "cmd")},
"sys": {
@ -263,6 +266,9 @@ var (
"reputation": {
ff(comm.ModuleReputation, "reputation"),
},
"oldtimes": {
ff(comm.ModuleOldtimes, "oldtimes"),
},
}
)
@ -934,6 +940,19 @@ var (
SubType: "reputation",
Enabled: true,
},
// oldtimes
string(comm.ModuleOldtimes): {
NavLabel: "旧时光",
MainType: string(comm.ModuleOldtimes),
Enabled: true,
},
ff(comm.ModuleOldtimes, "oldtimes"): {
NavLabel: "关卡",
Desc: "关卡编辑器",
MainType: string(comm.ModuleOldtimes),
SubType: "oldtimes",
Enabled: true,
},
}
)

194
cmd/v2/ui/views/oldtimes.go Normal file
View File

@ -0,0 +1,194 @@
package formview
import (
"fmt"
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
"github.com/spf13/cast"
)
type OldtimesView struct {
BaseformView
chapterItemList *common.ItemList //章节列表
levelItemList *common.ItemList //关卡列表
flag bool
right *fyne.Container
}
func (this *OldtimesView) CreateView(t *model.TestCase) fyne.CanvasObject {
this.chapterItemList = common.NewItemList()
this.chapterItemList.ItemList = this.chapterItemList.CreateList()
this.levelItemList = common.NewItemList()
this.levelItemList.ItemList = this.levelItemList.CreateList()
this.right = container.NewGridWithColumns(2,
this.chapterItemList.ItemList,
this.levelItemList.ItemList)
this.chapterItemList.ItemList.OnSelected = func(id widget.ListItemID) {
item := this.chapterItemList.CachedList.Items[id]
this.chapterItemList.SelItemId = item.Id
this.levelItemList.Reset()
if chapter, ok := item.Data.(*pb.Chapter); ok {
for _, ll := range chapter.Levels {
item := common.Item{
Id: cast.ToString(ll.Lid),
Text: fmt.Sprintf("%v", ll.Lid),
}
this.levelItemList.AddItem(item)
}
}
}
// this.levelItemList.ItemList.OnSelected = func(id widget.ListItemID) {
// item := this.levelItemList.CachedList.Items[id]
// this.levelItemList.SelItemId = item.Id
// }
loadChapters := func() {
this.chapterItemList.Reset()
if err := service.GetPttService().SendToClient(
t.MainType,
"getall",
&pb.OldtimesGetallReq{},
); err != nil {
logrus.Error(err)
return
}
}
loadChapters()
levelIdEntry := widget.NewEntry()
form := widget.NewForm(
widget.NewFormItem("关卡", levelIdEntry),
)
enterBtn := widget.NewButton("进入", func() {
defer levelIdEntry.SetText("")
chapterId := cast.ToInt32(this.chapterItemList.SelItemId)
form.OnSubmit = func() {
levelId := cast.ToInt32(levelIdEntry.Text)
if chapterId == 0 || levelId == 0 {
common.ShowTip("没有正确选择章节或关卡")
return
}
if err := service.GetPttService().SendToClient(
t.MainType,
"enter",
&pb.OldtimesEnterReq{
ChapterId: chapterId,
LevelId: levelId,
},
); err != nil {
logrus.Error(err)
return
}
}
win := dialog.NewCustom("升级", "关闭", form, this.w)
win.Resize(fyne.NewSize(600, 300))
win.Show()
})
finishBtn := widget.NewButton("闯关", func() {
defer levelIdEntry.SetText("")
chapterId := cast.ToInt32(this.chapterItemList.SelItemId)
form.OnSubmit = func() {
levelId := cast.ToInt32(levelIdEntry.Text)
if chapterId == 0 || levelId == 0 {
common.ShowTip("没有正确选择章节或关卡")
return
}
if err := service.GetPttService().SendToClient(
t.MainType,
"finish",
&pb.OldtimesFinishReq{
ChapterId: chapterId,
LevelId: levelId,
},
); err != nil {
logrus.Error(err)
return
}
}
win := dialog.NewCustom("升级", "关闭", form, this.w)
win.Resize(fyne.NewSize(600, 300))
win.Show()
})
//领取章节奖励
receiveBtn := widget.NewButton("章节奖励", func() {
chapterId := cast.ToInt32(this.chapterItemList.SelItemId)
if err := service.GetPttService().SendToClient(
t.MainType,
"receive",
&pb.OldtimesReceiveReq{
ChapterId: chapterId,
},
); err != nil {
logrus.Error(err)
return
}
})
topBtns := container.NewHBox(enterBtn, finishBtn, receiveBtn)
c := container.NewBorder(topBtns, nil, nil, nil,
this.right,
)
this.chapterList()
return c
}
func (this *OldtimesView) chapterList() {
if this.flag {
return
}
this.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{
OnNotify: func(d interface{}, args ...interface{}) {
data := d.(*pb.UserMessage)
if data.MainType == string(comm.ModuleOldtimes) &&
data.SubType == "getall" {
rsp := &pb.OldtimesGetallResp{}
if !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err")
return
}
if rsp.Data == nil {
return
}
for _, v := range rsp.Data.Chapters {
item := common.Item{
Id: cast.ToString(v.Cid),
Text: fmt.Sprintf("%v", v.Cid),
Data: v,
}
this.chapterItemList.AddItem(item)
}
}
},
})
this.flag = true
}

View File

@ -6,7 +6,6 @@ import (
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/utils"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
@ -56,17 +55,17 @@ func (this *ModelLinestory) getChapters(uid string) map[int32]*pb.TaskChapter {
// 校验前置任务是否完成
// true完成 false未完成
func (this *ModelLinestory) isPreFinished(finishTasks []int32, taskId int32) bool {
maintaskConf, ok := this.moduleLinestory.confMaintask.GetDataMap()[taskId]
if !ok {
return false
}
if maintaskConf.SubTask == 0 {
return true
}
// maintaskConf, ok := this.moduleLinestory.confMaintask.GetDataMap()[taskId]
// if !ok {
// return false
// }
// if maintaskConf.SubTask == 0 {
// return true
// }
if _, ok := utils.Findx(finishTasks, maintaskConf.SubTask); ok {
return true
}
// if _, ok := utils.Findx(finishTasks, maintaskConf.SubTask); ok {
// return true
// }
return false
}

View File

@ -59,12 +59,12 @@ func (this *ModuleLinestory) Start() (err error) {
func (this *ModuleLinestory) isOverRealline(finishTasks []int32) bool {
//真实结局节点ID
var realEndingTaskId int32
for _, v := range this.confMaintask.GetDataList() {
if v.Ending == 1 {
realEndingTaskId = v.Id
break
}
}
// for _, v := range this.confMaintask.GetDataList() {
// if v.Ending == 1 {
// realEndingTaskId = v.Id
// break
// }
// }
log.Debugln(realEndingTaskId)
// 存在真实结局节点
if _, ok := utils.Findx(finishTasks, realEndingTaskId); ok {
@ -104,13 +104,13 @@ func (this *ModuleLinestory) TaskFinishNotify(uid string, taskId, groupId int32)
// 重置任务ID
if conf, ok := this.confMaintask.GetDataMap()[taskId]; ok {
if conf.Group == groupId {
if len(conf.Resetto) > 0 {
newTaskList := []int32{}
for _, v := range conf.Resetto {
newTaskList = utils.Deletex(chapter.TaskIds, v)
}
chapter.TaskIds = newTaskList
}
// if len(conf.Resetto) > 0 {
// newTaskList := []int32{}
// for _, v := range conf.Resetto {
// newTaskList = utils.Deletex(chapter.TaskIds, v)
// }
// chapter.TaskIds = newTaskList
// }
}
}
isUpdate = true

View File

@ -0,0 +1,60 @@
package oldtimes
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
func (this *apiComp) EnterCheck(session comm.IUserSession, req *pb.OldtimesEnterReq) (code pb.ErrorCode) {
if req.ChapterId <= 0 || req.LevelId <= 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Enter(session comm.IUserSession, req *pb.OldtimesEnterReq) (code pb.ErrorCode, data *pb.ErrorData) {
if code = this.EnterCheck(session, req); code != pb.ErrorCode_Success {
return
}
rsp := &pb.OldtimesEnterResp{}
uid := session.GetUserId()
ot := this.module.modelOldtimes.getDBOldtimes(uid)
if ot == nil {
code = pb.ErrorCode_DataNotFound
return
}
chapter := this.module.modelOldtimes.getChatper(req.ChapterId, ot)
if chapter != nil {
if chapter.Status == 3 {
code = pb.ErrorCode_OldtimesFinished
return
}
var exist bool
for _, l := range chapter.Levels {
if l.Lid == req.LevelId {
if l.Status == 3 {
code = pb.ErrorCode_OldtimesLevelOver
return
} else {
l.Status = 2
}
exist = true
break
}
}
if !exist {
chapter.Levels = append(chapter.Levels, &pb.Level{
Lid: req.LevelId,
Status: 1,
})
}
}
this.module.modelOldtimes.updateOldtimes(uid, ot)
session.SendMsg(string(this.module.GetType()), "enter", rsp)
return
}

View File

@ -0,0 +1,44 @@
package oldtimes
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
func (this *apiComp) FinishCheck(session comm.IUserSession, req *pb.OldtimesFinishReq) (code pb.ErrorCode) {
if req.ChapterId <= 0 || req.LevelId <= 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Finish(session comm.IUserSession, req *pb.OldtimesFinishReq) (code pb.ErrorCode, data *pb.ErrorData) {
if code = this.FinishCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
rsp := &pb.OldtimesFinishResp{}
ot := this.module.modelOldtimes.getDBOldtimes(uid)
if ot == nil {
code = pb.ErrorCode_DataNotFound
return
}
chapter := this.module.modelOldtimes.getChatper(req.ChapterId, ot)
level := this.module.modelOldtimes.getLevel(req.LevelId, chapter)
if level != nil && level.Status == 3 {
code = pb.ErrorCode_OldtimesLevelOver
return
}
if !this.module.modelOldtimes.isPreFinished(req.ChapterId, req.LevelId, ot) {
code = pb.ErrorCode_OldtimesPreLevelNoFinished
return
}
this.module.modelOldtimes.levelFinish(uid, req.ChapterId, req.LevelId, ot)
session.SendMsg(string(this.module.GetType()), "finish", rsp)
return
}

View File

@ -0,0 +1,21 @@
package oldtimes
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
func (this *apiComp) GetallCheck(session comm.IUserSession, req *pb.OldtimesGetallReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Getall(session comm.IUserSession, req *pb.OldtimesGetallReq) (code pb.ErrorCode, data *pb.ErrorData) {
uid := session.GetUserId()
rsp := &pb.OldtimesGetallResp{}
d := this.module.modelOldtimes.getDBOldtimes(uid)
rsp.Data = d
session.SendMsg(string(this.module.GetType()), "getall", rsp)
return
}

View File

@ -0,0 +1,45 @@
package oldtimes
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.OldtimesReceiveReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Receive(session comm.IUserSession, req *pb.OldtimesReceiveReq) (code pb.ErrorCode, data *pb.ErrorData) {
uid := session.GetUserId()
rsp := &pb.OldtimesReceiveResp{}
ot := this.module.modelOldtimes.getDBOldtimes(uid)
if ot != nil {
for _, v := range ot.Chapters {
if v.Cid == req.ChapterId {
if v.Received == 1 {
code = pb.ErrorCode_OldtimesReceived
return
} else if v.Status != 3 {
code = pb.ErrorCode_OldtimesNoAllFinished
return
} else {
v.Received = 1
this.module.modelOldtimes.updateOldtimes(uid, ot)
//发奖
gltl, err := this.module.configure.getTimelineCfg()
if err != nil {
return
}
if conf, ok := gltl.GetDataMap()[req.ChapterId]; ok {
this.module.DispenseRes(session, conf.Reward, true)
}
break
}
}
}
}
session.SendMsg(string(this.module.GetType()), "receive", rsp)
return
}

View File

@ -1,13 +1,15 @@
package oldtimes
import (
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
gameLinestoryMainTask = "game_linestroymaintask.json"
gameLinestoryMainTask = "game_linestorymaintask.json"
gameLinestoryTimeline = "game_linestorytimeline.json"
)
type configureComp struct {
@ -18,6 +20,39 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
err = this.MCompConfigure.Init(service, module, comp, options)
err = this.LoadMultiConfigure(map[string]interface{}{
gameLinestoryMainTask: cfg.NewGameLinestoryMainTask,
gameLinestoryTimeline: cfg.NewGameLinestoryTimeLine,
})
return
}
func (this *configureComp) getMaintaskCfg() (data *cfg.GameLinestoryMainTask, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameLinestoryMainTask); err != nil {
return
} else {
if data, ok = v.(*cfg.GameLinestoryMainTask); !ok {
err = fmt.Errorf("%T is *cfg.GameTalent", v)
return
}
}
return
}
func (this *configureComp) getTimelineCfg() (data *cfg.GameLinestoryTimeLine, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameLinestoryTimeline); err != nil {
return
} else {
if data, ok = v.(*cfg.GameLinestoryTimeLine); !ok {
err = fmt.Errorf("%T is *cfg.GameLinestoryTimeline", v)
return
}
}
return
}

View File

@ -3,7 +3,12 @@ package oldtimes
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"sort"
"go.mongodb.org/mongo-driver/mongo"
)
type ModelOldtimes struct {
@ -12,6 +17,15 @@ type ModelOldtimes struct {
service core.IService
}
type status int32
const (
lock status = 0 //未解锁
unlock status = 1 //已解锁
ongoing status = 2 //进行中
finish status = 3 //完成
)
func (this *ModelOldtimes) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompModel.Init(service, module, comp, options)
this.TableName = comm.TableOldtimes
@ -19,3 +33,198 @@ func (this *ModelOldtimes) Init(service core.IService, module core.IModule, comp
this.service = service
return
}
func (this *ModelOldtimes) firstChapter() int32 {
gltl, err := this.moduleOldtimes.configure.getTimelineCfg()
if err != nil {
return 0
}
list := gltl.GetDataList()
if len(list) == 0 {
return 0
}
sort.SliceStable(list, func(i int, j int) bool {
return list[i].Order < list[j].Order
})
return list[0].Group
}
func (this *ModelOldtimes) firstLevel(groupId int32) int32 {
glmt, err := this.moduleOldtimes.configure.getMaintaskCfg()
if err != nil {
return 0
}
for _, l := range glmt.GetDataList() {
if l.Group == groupId && l.SubTask == 0 {
return l.Id
}
}
return 0
}
func (this *ModelOldtimes) getDBOldtimes(uid string) *pb.DBOldtimes {
ot := &pb.DBOldtimes{}
if err := this.Get(uid, ot); err != nil {
if err == mongo.ErrNoDocuments {
ot.Uid = uid
//默认启动第一章第一关卡
groupId := this.firstChapter()
levelId := this.firstLevel(groupId)
if groupId == 0 || levelId == 0 {
this.moduleOldtimes.Error("init oldtimes id err",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "err", Value: err})
return nil
}
chapter := &pb.Chapter{
Cid: groupId,
Status: int32(unlock), //解锁
}
chapter.Levels = append(chapter.Levels, &pb.Level{
Lid: levelId,
Status: int32(unlock),
})
ot.Chapters = append(ot.Chapters, chapter)
if err := this.Add(uid, ot); err != nil {
this.moduleOldtimes.Error("add oldtimes err",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "err", Value: err})
return nil
}
}
}
return ot
}
func (this *ModelOldtimes) getChatper(chapterId int32, data *pb.DBOldtimes) *pb.Chapter {
for _, d := range data.Chapters {
if d.Cid == chapterId {
return d
}
}
return nil
}
func (this *ModelOldtimes) getLevel(levelId int32, chapter *pb.Chapter) *pb.Level {
if chapter == nil {
return nil
}
for _, d := range chapter.Levels {
if d.Lid == levelId {
return d
}
}
return nil
}
func (this *ModelOldtimes) levelFinish(uid string, chapterId, levelId int32, data *pb.DBOldtimes) error {
glmt, err := this.moduleOldtimes.configure.getMaintaskCfg()
if err != nil {
return nil
}
chapter := this.getChatper(chapterId, data)
if chapter == nil {
return nil
}
var exist bool
for _, l := range chapter.Levels {
if l.Lid == levelId {
l.Status = int32(finish)
exist = true
break
}
}
if !exist {
chapter.Levels = append(chapter.Levels, &pb.Level{
Lid: levelId,
Status: int32(finish),
})
}
// 检查章节下的关卡状态
var flag bool
for _, v := range glmt.GetDataList() {
if v.Group == chapterId {
for _, l := range chapter.Levels {
if l.Status == int32(finish) && l.Lid == v.Id {
flag = true
} else {
flag = false
}
}
}
}
if flag {
chapter.Status = int32(finish) //章节完成
}
this.unlockTask(levelId, data)
this.updateOldtimes(uid, data)
return nil
}
// 解锁任务
func (this *ModelOldtimes) unlockTask(levelId int32, ot *pb.DBOldtimes) error {
glmt, err := this.moduleOldtimes.configure.getMaintaskCfg()
if err != nil {
return err
}
for _, v := range glmt.GetDataList() {
if v.SubTask == levelId {
chapter := this.getChatper(v.Group, ot)
level := this.getLevel(v.Id, chapter)
if level != nil {
level.Status = int32(ongoing)
} else {
if chapter != nil {
chapter.Levels = append(chapter.Levels, &pb.Level{
Lid: v.Id,
Status: int32(unlock),
})
}
}
}
}
return nil
}
// 前置关卡是否完成
func (this *ModelOldtimes) isPreFinished(chapterId, levelId int32, ot *pb.DBOldtimes) bool {
glmt, err := this.moduleOldtimes.configure.getMaintaskCfg()
if err != nil {
return false
}
if conf, ok := glmt.GetDataMap()[levelId]; ok {
if conf.SubTask == 0 {
return true
}
//判断前置关卡状态
preLevel := this.getLevel(conf.SubTask, this.getChatper(chapterId, ot))
if preLevel != nil && preLevel.Status == int32(finish) {
return true
}
}
return false
}
// 更新旧时光
func (this *ModelOldtimes) updateOldtimes(uid string, ot *pb.DBOldtimes) error {
update := map[string]interface{}{
"chapters": ot.Chapters,
}
return this.Change(uid, update)
}

View File

@ -28,7 +28,6 @@ func (this *ModelReputation) Init(service core.IService, module core.IModule, co
func (this *ModelReputation) initCamp(reputation *pb.DBReputation) {
if reputation != nil && reputation.Camps == nil {
reputation.Camps = make(map[int32]*pb.Camp)
}
}

316
pb/oldtimes_db.pb.go Normal file
View File

@ -0,0 +1,316 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: oldtimes/oldtimes_db.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type DBOldtimes struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //玩家ID
Chapters []*Chapter `protobuf:"bytes,2,rep,name=chapters,proto3" json:"chapters" bson:"chapters"` // 章节
}
func (x *DBOldtimes) Reset() {
*x = DBOldtimes{}
if protoimpl.UnsafeEnabled {
mi := &file_oldtimes_oldtimes_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DBOldtimes) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DBOldtimes) ProtoMessage() {}
func (x *DBOldtimes) ProtoReflect() protoreflect.Message {
mi := &file_oldtimes_oldtimes_db_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DBOldtimes.ProtoReflect.Descriptor instead.
func (*DBOldtimes) Descriptor() ([]byte, []int) {
return file_oldtimes_oldtimes_db_proto_rawDescGZIP(), []int{0}
}
func (x *DBOldtimes) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *DBOldtimes) GetChapters() []*Chapter {
if x != nil {
return x.Chapters
}
return nil
}
type Chapter struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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"` //奖励领取状态
Levels []*Level `protobuf:"bytes,4,rep,name=levels,proto3" json:"levels" bson:"levels"` //关卡
}
func (x *Chapter) Reset() {
*x = Chapter{}
if protoimpl.UnsafeEnabled {
mi := &file_oldtimes_oldtimes_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Chapter) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Chapter) ProtoMessage() {}
func (x *Chapter) ProtoReflect() protoreflect.Message {
mi := &file_oldtimes_oldtimes_db_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Chapter.ProtoReflect.Descriptor instead.
func (*Chapter) Descriptor() ([]byte, []int) {
return file_oldtimes_oldtimes_db_proto_rawDescGZIP(), []int{1}
}
func (x *Chapter) GetCid() int32 {
if x != nil {
return x.Cid
}
return 0
}
func (x *Chapter) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *Chapter) GetReceived() int32 {
if x != nil {
return x.Received
}
return 0
}
func (x *Chapter) GetLevels() []*Level {
if x != nil {
return x.Levels
}
return nil
}
type Level struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Lid int32 `protobuf:"varint,1,opt,name=lid,proto3" json:"lid" bson:"lid"` //关卡ID
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status" bson:"status"` //状态 0锁定 1已解锁 2进行中 3已完成
}
func (x *Level) Reset() {
*x = Level{}
if protoimpl.UnsafeEnabled {
mi := &file_oldtimes_oldtimes_db_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Level) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Level) ProtoMessage() {}
func (x *Level) ProtoReflect() protoreflect.Message {
mi := &file_oldtimes_oldtimes_db_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Level.ProtoReflect.Descriptor instead.
func (*Level) Descriptor() ([]byte, []int) {
return file_oldtimes_oldtimes_db_proto_rawDescGZIP(), []int{2}
}
func (x *Level) GetLid() int32 {
if x != nil {
return x.Lid
}
return 0
}
func (x *Level) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
var File_oldtimes_oldtimes_db_proto protoreflect.FileDescriptor
var file_oldtimes_oldtimes_db_proto_rawDesc = []byte{
0x0a, 0x1a, 0x6f, 0x6c, 0x64, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x2f, 0x6f, 0x6c, 0x64, 0x74, 0x69,
0x6d, 0x65, 0x73, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x44, 0x0a, 0x0a,
0x44, 0x42, 0x4f, 0x6c, 0x64, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x24, 0x0a, 0x08,
0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08,
0x2e, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x08, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65,
0x72, 0x73, 0x22, 0x6f, 0x0a, 0x07, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a,
0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12,
0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69,
0x76, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69,
0x76, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x06, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x73, 0x18, 0x04, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x06, 0x6c, 0x65, 0x76,
0x65, 0x6c, 0x73, 0x22, 0x31, 0x0a, 0x05, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x10, 0x0a, 0x03,
0x6c, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6c, 0x69, 0x64, 0x12, 0x16,
0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_oldtimes_oldtimes_db_proto_rawDescOnce sync.Once
file_oldtimes_oldtimes_db_proto_rawDescData = file_oldtimes_oldtimes_db_proto_rawDesc
)
func file_oldtimes_oldtimes_db_proto_rawDescGZIP() []byte {
file_oldtimes_oldtimes_db_proto_rawDescOnce.Do(func() {
file_oldtimes_oldtimes_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_oldtimes_oldtimes_db_proto_rawDescData)
})
return file_oldtimes_oldtimes_db_proto_rawDescData
}
var file_oldtimes_oldtimes_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_oldtimes_oldtimes_db_proto_goTypes = []interface{}{
(*DBOldtimes)(nil), // 0: DBOldtimes
(*Chapter)(nil), // 1: Chapter
(*Level)(nil), // 2: Level
}
var file_oldtimes_oldtimes_db_proto_depIdxs = []int32{
1, // 0: DBOldtimes.chapters:type_name -> Chapter
2, // 1: Chapter.levels:type_name -> Level
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_oldtimes_oldtimes_db_proto_init() }
func file_oldtimes_oldtimes_db_proto_init() {
if File_oldtimes_oldtimes_db_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_oldtimes_oldtimes_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBOldtimes); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_oldtimes_oldtimes_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Chapter); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_oldtimes_oldtimes_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Level); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_oldtimes_oldtimes_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_oldtimes_oldtimes_db_proto_goTypes,
DependencyIndexes: file_oldtimes_oldtimes_db_proto_depIdxs,
MessageInfos: file_oldtimes_oldtimes_db_proto_msgTypes,
}.Build()
File_oldtimes_oldtimes_db_proto = out.File
file_oldtimes_oldtimes_db_proto_rawDesc = nil
file_oldtimes_oldtimes_db_proto_goTypes = nil
file_oldtimes_oldtimes_db_proto_depIdxs = nil
}

600
pb/oldtimes_msg.pb.go Normal file
View File

@ -0,0 +1,600 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: oldtimes/oldtimes_msg.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// 旧时光章节和关卡数据
type OldtimesGetallReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *OldtimesGetallReq) Reset() {
*x = OldtimesGetallReq{}
if protoimpl.UnsafeEnabled {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OldtimesGetallReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OldtimesGetallReq) ProtoMessage() {}
func (x *OldtimesGetallReq) ProtoReflect() protoreflect.Message {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OldtimesGetallReq.ProtoReflect.Descriptor instead.
func (*OldtimesGetallReq) Descriptor() ([]byte, []int) {
return file_oldtimes_oldtimes_msg_proto_rawDescGZIP(), []int{0}
}
type OldtimesGetallResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data *DBOldtimes `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
}
func (x *OldtimesGetallResp) Reset() {
*x = OldtimesGetallResp{}
if protoimpl.UnsafeEnabled {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OldtimesGetallResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OldtimesGetallResp) ProtoMessage() {}
func (x *OldtimesGetallResp) ProtoReflect() protoreflect.Message {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OldtimesGetallResp.ProtoReflect.Descriptor instead.
func (*OldtimesGetallResp) Descriptor() ([]byte, []int) {
return file_oldtimes_oldtimes_msg_proto_rawDescGZIP(), []int{1}
}
func (x *OldtimesGetallResp) GetData() *DBOldtimes {
if x != nil {
return x.Data
}
return nil
}
//进入关卡
type OldtimesEnterReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ChapterId int32 `protobuf:"varint,1,opt,name=chapterId,proto3" json:"chapterId"`
LevelId int32 `protobuf:"varint,2,opt,name=levelId,proto3" json:"levelId"`
}
func (x *OldtimesEnterReq) Reset() {
*x = OldtimesEnterReq{}
if protoimpl.UnsafeEnabled {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OldtimesEnterReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OldtimesEnterReq) ProtoMessage() {}
func (x *OldtimesEnterReq) ProtoReflect() protoreflect.Message {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OldtimesEnterReq.ProtoReflect.Descriptor instead.
func (*OldtimesEnterReq) Descriptor() ([]byte, []int) {
return file_oldtimes_oldtimes_msg_proto_rawDescGZIP(), []int{2}
}
func (x *OldtimesEnterReq) GetChapterId() int32 {
if x != nil {
return x.ChapterId
}
return 0
}
func (x *OldtimesEnterReq) GetLevelId() int32 {
if x != nil {
return x.LevelId
}
return 0
}
type OldtimesEnterResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code"`
}
func (x *OldtimesEnterResp) Reset() {
*x = OldtimesEnterResp{}
if protoimpl.UnsafeEnabled {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OldtimesEnterResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OldtimesEnterResp) ProtoMessage() {}
func (x *OldtimesEnterResp) ProtoReflect() protoreflect.Message {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OldtimesEnterResp.ProtoReflect.Descriptor instead.
func (*OldtimesEnterResp) Descriptor() ([]byte, []int) {
return file_oldtimes_oldtimes_msg_proto_rawDescGZIP(), []int{3}
}
func (x *OldtimesEnterResp) GetCode() int32 {
if x != nil {
return x.Code
}
return 0
}
//关卡通过
type OldtimesFinishReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ChapterId int32 `protobuf:"varint,1,opt,name=chapterId,proto3" json:"chapterId"` //章节ID
LevelId int32 `protobuf:"varint,2,opt,name=levelId,proto3" json:"levelId"` //关卡ID
}
func (x *OldtimesFinishReq) Reset() {
*x = OldtimesFinishReq{}
if protoimpl.UnsafeEnabled {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OldtimesFinishReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OldtimesFinishReq) ProtoMessage() {}
func (x *OldtimesFinishReq) ProtoReflect() protoreflect.Message {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OldtimesFinishReq.ProtoReflect.Descriptor instead.
func (*OldtimesFinishReq) Descriptor() ([]byte, []int) {
return file_oldtimes_oldtimes_msg_proto_rawDescGZIP(), []int{4}
}
func (x *OldtimesFinishReq) GetChapterId() int32 {
if x != nil {
return x.ChapterId
}
return 0
}
func (x *OldtimesFinishReq) GetLevelId() int32 {
if x != nil {
return x.LevelId
}
return 0
}
type OldtimesFinishResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code"`
}
func (x *OldtimesFinishResp) Reset() {
*x = OldtimesFinishResp{}
if protoimpl.UnsafeEnabled {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OldtimesFinishResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OldtimesFinishResp) ProtoMessage() {}
func (x *OldtimesFinishResp) ProtoReflect() protoreflect.Message {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OldtimesFinishResp.ProtoReflect.Descriptor instead.
func (*OldtimesFinishResp) Descriptor() ([]byte, []int) {
return file_oldtimes_oldtimes_msg_proto_rawDescGZIP(), []int{5}
}
func (x *OldtimesFinishResp) GetCode() int32 {
if x != nil {
return x.Code
}
return 0
}
//领取章节奖励
type OldtimesReceiveReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ChapterId int32 `protobuf:"varint,1,opt,name=chapterId,proto3" json:"chapterId"` //章节ID
}
func (x *OldtimesReceiveReq) Reset() {
*x = OldtimesReceiveReq{}
if protoimpl.UnsafeEnabled {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OldtimesReceiveReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OldtimesReceiveReq) ProtoMessage() {}
func (x *OldtimesReceiveReq) ProtoReflect() protoreflect.Message {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OldtimesReceiveReq.ProtoReflect.Descriptor instead.
func (*OldtimesReceiveReq) Descriptor() ([]byte, []int) {
return file_oldtimes_oldtimes_msg_proto_rawDescGZIP(), []int{6}
}
func (x *OldtimesReceiveReq) GetChapterId() int32 {
if x != nil {
return x.ChapterId
}
return 0
}
type OldtimesReceiveResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code"`
}
func (x *OldtimesReceiveResp) Reset() {
*x = OldtimesReceiveResp{}
if protoimpl.UnsafeEnabled {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OldtimesReceiveResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OldtimesReceiveResp) ProtoMessage() {}
func (x *OldtimesReceiveResp) ProtoReflect() protoreflect.Message {
mi := &file_oldtimes_oldtimes_msg_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OldtimesReceiveResp.ProtoReflect.Descriptor instead.
func (*OldtimesReceiveResp) Descriptor() ([]byte, []int) {
return file_oldtimes_oldtimes_msg_proto_rawDescGZIP(), []int{7}
}
func (x *OldtimesReceiveResp) GetCode() int32 {
if x != nil {
return x.Code
}
return 0
}
var File_oldtimes_oldtimes_msg_proto protoreflect.FileDescriptor
var file_oldtimes_oldtimes_msg_proto_rawDesc = []byte{
0x0a, 0x1b, 0x6f, 0x6c, 0x64, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x2f, 0x6f, 0x6c, 0x64, 0x74, 0x69,
0x6d, 0x65, 0x73, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x6f,
0x6c, 0x64, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x2f, 0x6f, 0x6c, 0x64, 0x74, 0x69, 0x6d, 0x65, 0x73,
0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x4f, 0x6c, 0x64,
0x74, 0x69, 0x6d, 0x65, 0x73, 0x47, 0x65, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x22, 0x35,
0x0a, 0x12, 0x4f, 0x6c, 0x64, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x47, 0x65, 0x74, 0x61, 0x6c, 0x6c,
0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x4f, 0x6c, 0x64, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x52,
0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x4a, 0x0a, 0x10, 0x4f, 0x6c, 0x64, 0x74, 0x69, 0x6d, 0x65,
0x73, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61,
0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68,
0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x65, 0x76, 0x65, 0x6c,
0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x49,
0x64, 0x22, 0x27, 0x0a, 0x11, 0x4f, 0x6c, 0x64, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x45, 0x6e, 0x74,
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x4b, 0x0a, 0x11, 0x4f, 0x6c,
0x64, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x71, 0x12,
0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a,
0x07, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
0x6c, 0x65, 0x76, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x28, 0x0a, 0x12, 0x4f, 0x6c, 0x64, 0x74, 0x69,
0x6d, 0x65, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a,
0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64,
0x65, 0x22, 0x32, 0x0a, 0x12, 0x4f, 0x6c, 0x64, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x63,
0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74,
0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x70,
0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x29, 0x0a, 0x13, 0x4f, 0x6c, 0x64, 0x74, 0x69, 0x6d, 0x65,
0x73, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04,
0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65,
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_oldtimes_oldtimes_msg_proto_rawDescOnce sync.Once
file_oldtimes_oldtimes_msg_proto_rawDescData = file_oldtimes_oldtimes_msg_proto_rawDesc
)
func file_oldtimes_oldtimes_msg_proto_rawDescGZIP() []byte {
file_oldtimes_oldtimes_msg_proto_rawDescOnce.Do(func() {
file_oldtimes_oldtimes_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_oldtimes_oldtimes_msg_proto_rawDescData)
})
return file_oldtimes_oldtimes_msg_proto_rawDescData
}
var file_oldtimes_oldtimes_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_oldtimes_oldtimes_msg_proto_goTypes = []interface{}{
(*OldtimesGetallReq)(nil), // 0: OldtimesGetallReq
(*OldtimesGetallResp)(nil), // 1: OldtimesGetallResp
(*OldtimesEnterReq)(nil), // 2: OldtimesEnterReq
(*OldtimesEnterResp)(nil), // 3: OldtimesEnterResp
(*OldtimesFinishReq)(nil), // 4: OldtimesFinishReq
(*OldtimesFinishResp)(nil), // 5: OldtimesFinishResp
(*OldtimesReceiveReq)(nil), // 6: OldtimesReceiveReq
(*OldtimesReceiveResp)(nil), // 7: OldtimesReceiveResp
(*DBOldtimes)(nil), // 8: DBOldtimes
}
var file_oldtimes_oldtimes_msg_proto_depIdxs = []int32{
8, // 0: OldtimesGetallResp.data:type_name -> DBOldtimes
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_oldtimes_oldtimes_msg_proto_init() }
func file_oldtimes_oldtimes_msg_proto_init() {
if File_oldtimes_oldtimes_msg_proto != nil {
return
}
file_oldtimes_oldtimes_db_proto_init()
if !protoimpl.UnsafeEnabled {
file_oldtimes_oldtimes_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OldtimesGetallReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_oldtimes_oldtimes_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OldtimesGetallResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_oldtimes_oldtimes_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OldtimesEnterReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_oldtimes_oldtimes_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OldtimesEnterResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_oldtimes_oldtimes_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OldtimesFinishReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_oldtimes_oldtimes_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OldtimesFinishResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_oldtimes_oldtimes_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OldtimesReceiveReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_oldtimes_oldtimes_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OldtimesReceiveResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_oldtimes_oldtimes_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_oldtimes_oldtimes_msg_proto_goTypes,
DependencyIndexes: file_oldtimes_oldtimes_msg_proto_depIdxs,
MessageInfos: file_oldtimes_oldtimes_msg_proto_msgTypes,
}.Build()
File_oldtimes_oldtimes_msg_proto = out.File
file_oldtimes_oldtimes_msg_proto_rawDesc = nil
file_oldtimes_oldtimes_msg_proto_goTypes = nil
file_oldtimes_oldtimes_msg_proto_depIdxs = nil
}

View File

@ -11,16 +11,15 @@ package cfg
import "errors"
type GameLinestoryMainTaskData struct {
Id int32
SubTask int32
NodeIndex int32
Order string
Group int32
Name string
Describe string
Img string
Ending int32
Resetto []int32
Id int32
SubTask int32
Group int32
NodeIndex int32
Order string
Stageid int32
Name string
Describe string
Img string
}
const TypeId_GameLinestoryMainTaskData = 1251904205
@ -29,136 +28,17 @@ func (*GameLinestoryMainTaskData) GetTypeId() int32 {
return 1251904205
}
func (_v *GameLinestoryMainTaskData) Deserialize(_buf map[string]interface{}) (err error) {
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ {
err = errors.New("id error")
return
}
_v.Id = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["subTask"].(float64); !_ok_ {
err = errors.New("subTask error")
return
}
_v.SubTask = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["nodeIndex"].(float64); !_ok_ {
err = errors.New("nodeIndex error")
return
}
_v.NodeIndex = int32(_tempNum_)
}
{
var _ok_ bool
if _v.Order, _ok_ = _buf["order"].(string); !_ok_ {
err = errors.New("order error")
return
}
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["group"].(float64); !_ok_ {
err = errors.New("group error")
return
}
_v.Group = int32(_tempNum_)
}
{
var _ok_ bool
var __json_text__ map[string]interface{}
if __json_text__, _ok_ = _buf["name"].(map[string]interface{}); !_ok_ {
err = errors.New("_v.Name error")
return
}
{
var _ok_ bool
if _, _ok_ = __json_text__["key"].(string); !_ok_ {
err = errors.New("key error")
return
}
}
{
var _ok_ bool
if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ {
err = errors.New("text error")
return
}
}
}
{
var _ok_ bool
var __json_text__ map[string]interface{}
if __json_text__, _ok_ = _buf["describe"].(map[string]interface{}); !_ok_ {
err = errors.New("_v.Describe error")
return
}
{
var _ok_ bool
if _, _ok_ = __json_text__["key"].(string); !_ok_ {
err = errors.New("key error")
return
}
}
{
var _ok_ bool
if _v.Describe, _ok_ = __json_text__["text"].(string); !_ok_ {
err = errors.New("text error")
return
}
}
}
{
var _ok_ bool
if _v.Img, _ok_ = _buf["img"].(string); !_ok_ {
err = errors.New("img error")
return
}
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["ending"].(float64); !_ok_ {
err = errors.New("ending error")
return
}
_v.Ending = int32(_tempNum_)
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["resetto"].([]interface{}); !_ok_ {
err = errors.New("resetto error")
return
}
_v.Resetto = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{
var _ok_ bool
var _x_ float64
if _x_, _ok_ = _e_.(float64); !_ok_ {
err = errors.New("_list_v_ error")
return
}
_list_v_ = int32(_x_)
}
_v.Resetto = append(_v.Resetto, _list_v_)
}
}
return
func (_v *GameLinestoryMainTaskData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Id"].(float64); !_ok_ { err = errors.New("Id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["subTask"].(float64); !_ok_ { err = errors.New("subTask error"); return }; _v.SubTask = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["group"].(float64); !_ok_ { err = errors.New("group error"); return }; _v.Group = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["nodeIndex"].(float64); !_ok_ { err = errors.New("nodeIndex error"); return }; _v.NodeIndex = int32(_tempNum_) }
{ var _ok_ bool; if _v.Order, _ok_ = _buf["order"].(string); !_ok_ { err = errors.New("order error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["stageid"].(float64); !_ok_ { err = errors.New("stageid error"); return }; _v.Stageid = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["describe"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Describe error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Describe, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; if _v.Img, _ok_ = _buf["img"].(string); !_ok_ { err = errors.New("img error"); return } }
return
}
func DeserializeGameLinestoryMainTaskData(_buf map[string]interface{}) (*GameLinestoryMainTaskData, error) {