From 55ec0dd76c47cb6d041169a6f83ace3c4f750d80 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Mon, 8 May 2023 09:47:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E7=BD=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/data_manager.lua | 10 +++---- lua/app/game.lua | 2 -- .../module/formation/formation_manager.lua | 10 +++---- lua/app/module/hero/hero_manager.lua | 4 +-- lua/app/module/tutorial/tutorial_manager.lua | 8 ++--- lua/app/net/net_manager.lua | 2 +- lua/app/proto/proto_msg_type.lua | 30 +++++++++++-------- lua/app/ui/common/cheat_message_box.lua | 11 +++---- lua/app/ui/game_setting/game_setting_ui.lua | 4 +-- lua/app/ui/main_city/main_city_ui.lua | 16 +++++++--- lua/app/userdata/bag/bag_data.lua | 2 +- lua/app/userdata/bag/item_data.lua | 12 ++++---- lua/app/userdata/chapter/chapter_data.lua | 8 ++--- lua/app/userdata/formation/formation_data.lua | 13 ++++---- lua/app/userdata/hero/hero_data.lua | 4 +-- lua/app/userdata/tutorial/tutorial_data.lua | 9 ++---- 16 files changed, 73 insertions(+), 72 deletions(-) diff --git a/lua/app/common/data_manager.lua b/lua/app/common/data_manager.lua index 97abb4f4..6d02f42d 100644 --- a/lua/app/common/data_manager.lua +++ b/lua/app/common/data_manager.lua @@ -96,12 +96,12 @@ function DataManager:initWithServerData(data) Logger.printTable(data) end self.todayFirstLogin = data.today_first_login - self.PlayerData:init(data.PlayerData) + -- self.PlayerData:init(data.PlayerData) self.ChapterData:init(data.chapter) - self.HeroData:init(data.HeroData) - self.BagData:init(data.BagData) - self.FormationData:init(data.FormationData) - self.TutorialData:init(data.TutorialData) + self.HeroData:init(data.bag.heros) + self.BagData:init(data.bag) + self.FormationData:init(data.fight_info) + self.TutorialData:init(data.guide) self.ActivityData:init() self.GodPigData:init() -- self.IdleData:clear(data.IdleData) diff --git a/lua/app/game.lua b/lua/app/game.lua index 4829b9b4..1a5838ad 100644 --- a/lua/app/game.lua +++ b/lua/app/game.lua @@ -83,7 +83,6 @@ function Game:initOther() BF.exports.SafeAreaManager = require "app/common/safe_area_manager" BF.exports.BaseModule = require "app/module/base_module" BF.exports.ModuleManager = require "app/common/module_manager" - BF.exports.ServerBaseData = require "app/server/data/server_base_data" BF.exports.DataManager = require "app/common/data_manager" BF.exports.DOTweenManager = require "app/common/dotween_manager" BF.exports.FSMManager = require "app/common/state_machine_manager" @@ -151,7 +150,6 @@ function Game:specialForIdea() SafeAreaManager = SafeAreaManager or require "app/common/safe_area_manager" BaseModule = BaseModule or require "app/module/base_module" ModuleManager = ModuleManager or require "app/common/module_manager" - ServerBaseData = ServerBaseData or require "app/server/data/server_base_data" DataManager = DataManager or require "app/common/data_manager" DOTweenManager = DOTweenManager or require "app/common/dotween_manager" FSMManager = FSMManager or require "app/common/state_machine_manager" diff --git a/lua/app/module/formation/formation_manager.lua b/lua/app/module/formation/formation_manager.lua index 83050b43..5a690988 100644 --- a/lua/app/module/formation/formation_manager.lua +++ b/lua/app/module/formation/formation_manager.lua @@ -6,16 +6,16 @@ function FormationManager:upHeroToStageFormation(heroId, matchType) return end local args = { - formationType = GConst.BattleConst.BATTLE_TYPE.STAGE, - matchType = matchType, - heroId = heroId + -- formationType = GConst.BattleConst.BATTLE_TYPE.STAGE, + -- matchType = matchType, + id = heroId } - -- self:sendMessage(ProtoMsgType.FromMsgEnum., args, {}, self.upHeroToStageFormationFinish) + self:sendMessage(ProtoMsgType.FromMsgEnum.HeroPutOnReq, args, {}, self.upHeroToStageFormationFinish) end function FormationManager:upHeroToStageFormationFinish(result) if result.err_code == GConst.ERROR_STR.SUCCESS then - DataManager.FormationData:upHeroToFormation(GConst.BattleConst.BATTLE_TYPE.STAGE, matchType, heroId) + DataManager.FormationData:init(result) DataManager.HeroData:setDirty() end end diff --git a/lua/app/module/hero/hero_manager.lua b/lua/app/module/hero/hero_manager.lua index ed77560a..768f6bb4 100644 --- a/lua/app/module/hero/hero_manager.lua +++ b/lua/app/module/hero/hero_manager.lua @@ -14,12 +14,12 @@ function HeroManager:upgradeHero(heroId, heroEntity) return end - -- self:sendMessage(ProtoMsgType.FromMsgEnum., args, {}, self.upgradeHeroFinish, BIReport.ITEM_GET_TYPE.UPGRADE_HERO) + self:sendMessage(ProtoMsgType.FromMsgEnum.HeroUpgradeReq, {id = heroId}, {}, self.upgradeHeroFinish, BIReport.ITEM_GET_TYPE.UPGRADE_HERO) end function HeroManager:upgradeHeroFinish(result) if result.err_code == GConst.ERROR_STR.SUCCESS then - DataManager.HeroData:setHeroLv(result.heroId, result.lv) + DataManager.HeroData:setHeroLv(result.hero.id, result.hero.level) DataManager.HeroData:setDirty() end end diff --git a/lua/app/module/tutorial/tutorial_manager.lua b/lua/app/module/tutorial/tutorial_manager.lua index 0e3d5d3e..e8f19e50 100644 --- a/lua/app/module/tutorial/tutorial_manager.lua +++ b/lua/app/module/tutorial/tutorial_manager.lua @@ -23,15 +23,13 @@ function TutorialManager:sendTutorialId(id, callback) self.sendTutorialIdCallback = callback - -- self:sendMessage(ProtoMsgType.FromMsgEnum., args, {}, self.sendTutorialIdFinish) + self:sendMessage(ProtoMsgType.FromMsgEnum.GuideFundMarkReq, args, {}, self.sendTutorialIdFinish) end function TutorialManager:sendTutorialIdFinish(result) - Logger.printTable(result) if result.err_code == GConst.ERROR_STR.SUCCESS then - if result.id then - -- BIReport:postTutorialStep(result.id) - -- DataManager.TutorialData:markFuncTutorialFinish(result.id) + if result.reqData.id then + BIReport:postTutorialStep(result.reqData.id) end if self.sendTutorialIdCallback then diff --git a/lua/app/net/net_manager.lua b/lua/app/net/net_manager.lua index 251585a6..8faa6733 100644 --- a/lua/app/net/net_manager.lua +++ b/lua/app/net/net_manager.lua @@ -992,7 +992,7 @@ function NetManager:getNotCheckResponse(msgName) -- then -- return true -- end - return false + return true end function NetManager:getNotAddCostsRsp(msgName) diff --git a/lua/app/proto/proto_msg_type.lua b/lua/app/proto/proto_msg_type.lua index 50bd8c57..ef898364 100644 --- a/lua/app/proto/proto_msg_type.lua +++ b/lua/app/proto/proto_msg_type.lua @@ -2,8 +2,8 @@ local ProtoMsgType = { FromMsgId = { [132242856] = "ChapterSettlementReq", [132244689] = "ChapterSettlementRsp", - [361733825] = "SkipGuideReq", - [361735658] = "SkipGuideRsp", + [516281556] = "GuideFundMarkReq", + [516283389] = "GuideFundMarkRsp", [565555292] = "MallPayNtf", [565621982] = "MallPayReq", [565623815] = "MallPayRsp", @@ -18,8 +18,6 @@ local ProtoMsgType = { [1115038364] = "BattlePassBoughtNtf", [1122994860] = "AdFreeDailyGiftReq", [1122996693] = "AdFreeDailyGiftRsp", - [1304663451] = "MarkGuideReq", - [1304665284] = "MarkGuideRsp", [1471116409] = "BindReq", [1471118242] = "BindRsp", [1473507638] = "TaskTutorRewardReq", @@ -52,6 +50,8 @@ local ProtoMsgType = { [3190730044] = "KickOutNtf", [3224230499] = "SevenDayTaskRewardReq", [3224232332] = "SevenDayTaskRewardRsp", + [3309820798] = "HeroPutOnReq", + [3309822631] = "HeroPutOnRsp", [3370485095] = "MonCardRewardReq", [3370486928] = "MonCardRewardRsp", [3421843875] = "TaskDailyRewardReq", @@ -66,14 +66,16 @@ local ProtoMsgType = { [3846223098] = "MallActTriggerGiftNtf", [3904148760] = "GMReq", [3904150593] = "GMRsp", + [3933875617] = "ChapterStartReq", + [3933877450] = "ChapterStartRsp", [4256333947] = "ExistReq", [4256335780] = "ExistRsp", }, FromMsgToId = { ChapterSettlementReq = 132242856, ChapterSettlementRsp = 132244689, - SkipGuideReq = 361733825, - SkipGuideRsp = 361735658, + GuideFundMarkReq = 516281556, + GuideFundMarkRsp = 516283389, MallPayNtf = 565555292, MallPayReq = 565621982, MallPayRsp = 565623815, @@ -88,8 +90,6 @@ local ProtoMsgType = { BattlePassBoughtNtf = 1115038364, AdFreeDailyGiftReq = 1122994860, AdFreeDailyGiftRsp = 1122996693, - MarkGuideReq = 1304663451, - MarkGuideRsp = 1304665284, BindReq = 1471116409, BindRsp = 1471118242, TaskTutorRewardReq = 1473507638, @@ -122,6 +122,8 @@ local ProtoMsgType = { KickOutNtf = 3190730044, SevenDayTaskRewardReq = 3224230499, SevenDayTaskRewardRsp = 3224232332, + HeroPutOnReq = 3309820798, + HeroPutOnRsp = 3309822631, MonCardRewardReq = 3370485095, MonCardRewardRsp = 3370486928, TaskDailyRewardReq = 3421843875, @@ -136,14 +138,16 @@ local ProtoMsgType = { MallActTriggerGiftNtf = 3846223098, GMReq = 3904148760, GMRsp = 3904150593, + ChapterStartReq = 3933875617, + ChapterStartRsp = 3933877450, ExistReq = 4256333947, ExistRsp = 4256335780, }, FromMsgEnum = { ChapterSettlementReq = "ChapterSettlementReq", ChapterSettlementRsp = "ChapterSettlementRsp", - SkipGuideReq = "SkipGuideReq", - SkipGuideRsp = "SkipGuideRsp", + GuideFundMarkReq = "GuideFundMarkReq", + GuideFundMarkRsp = "GuideFundMarkRsp", MallPayNtf = "MallPayNtf", MallPayReq = "MallPayReq", MallPayRsp = "MallPayRsp", @@ -158,8 +162,6 @@ local ProtoMsgType = { BattlePassBoughtNtf = "BattlePassBoughtNtf", AdFreeDailyGiftReq = "AdFreeDailyGiftReq", AdFreeDailyGiftRsp = "AdFreeDailyGiftRsp", - MarkGuideReq = "MarkGuideReq", - MarkGuideRsp = "MarkGuideRsp", BindReq = "BindReq", BindRsp = "BindRsp", TaskTutorRewardReq = "TaskTutorRewardReq", @@ -192,6 +194,8 @@ local ProtoMsgType = { KickOutNtf = "KickOutNtf", SevenDayTaskRewardReq = "SevenDayTaskRewardReq", SevenDayTaskRewardRsp = "SevenDayTaskRewardRsp", + HeroPutOnReq = "HeroPutOnReq", + HeroPutOnRsp = "HeroPutOnRsp", MonCardRewardReq = "MonCardRewardReq", MonCardRewardRsp = "MonCardRewardRsp", TaskDailyRewardReq = "TaskDailyRewardReq", @@ -206,6 +210,8 @@ local ProtoMsgType = { MallActTriggerGiftNtf = "MallActTriggerGiftNtf", GMReq = "GMReq", GMRsp = "GMRsp", + ChapterStartReq = "ChapterStartReq", + ChapterStartRsp = "ChapterStartRsp", ExistReq = "ExistReq", ExistRsp = "ExistRsp", }, diff --git a/lua/app/ui/common/cheat_message_box.lua b/lua/app/ui/common/cheat_message_box.lua index ec3f61a2..1844ca0a 100644 --- a/lua/app/ui/common/cheat_message_box.lua +++ b/lua/app/ui/common/cheat_message_box.lua @@ -13,15 +13,13 @@ function CheatMessageBox:showCheatMessageBox(params) uiMap["cheating_ui.title_bg_img.bg1.player_id_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.COPY_ID)) uiMap["cheating_ui.title_bg_img.bg2.player_id_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.COPY_MAIL)) - local ServerGameData = require "app/module/server/server_game_data" - local objectId = ServerGameData:getServerPlayerId() or "" + local objectId = "" uiMap["cheating_ui.title_bg_img.bg1.player_id"]:setText("PlayerID:" .. objectId) uiMap["cheating_ui.title_bg_img.bg2.player_id"]:setText("LonelySurvivorTech@cobbygame.com") uiMap["cheating_ui.title_bg_img.bg1.player_id_btn"]:addClickListener(function() - local ServerGameData = require "app/module/server/server_game_data" - local objectId = ServerGameData:getServerPlayerId() or "" - GFunc.copyStr(objectId) + -- local objectId = :getServerPlayerId() or "" + -- GFunc.copyStr(objectId) end) uiMap["cheating_ui.title_bg_img.bg2.player_id_btn"]:addClickListener(function() @@ -37,8 +35,7 @@ function CheatMessageBox:showCheatMessageBox(params) platform = "IOS" end - local ServerGameData = require "app/module/server/server_game_data" - local objectId = ServerGameData:getServerPlayerId() or "" + local objectId = "" local body = "\nPlease don't delete the information below\n===========\nGameName: Lonely Survivor\n" body = body .. "GameVersion: " .. Platform:getClientVersion() .. "\n" diff --git a/lua/app/ui/game_setting/game_setting_ui.lua b/lua/app/ui/game_setting/game_setting_ui.lua index 424d22ef..e401a5da 100644 --- a/lua/app/ui/game_setting/game_setting_ui.lua +++ b/lua/app/ui/game_setting/game_setting_ui.lua @@ -109,9 +109,7 @@ function GameSettingUI:_addListeners() end) uiMap["game_setting_ui.bg.player_id_btn"]:addClickListener(function() - local ServerGameData = require "app/module/server/server_game_data" - local objectId = ServerGameData:getServerPlayerId() or "" - GFunc.copyStr(objectId) + -- GFunc.copyStr(objectId) end) uiMap["game_setting_ui.bg.bg.facebook"]:addClickListener(function() diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index 231e8ec0..5d4ccfb5 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -107,7 +107,9 @@ end function MainCityUI:_bind() self:bind(DataManager.ChapterData, "isDirty", function() if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then - self.subComps[self.selectedIndex]:refreshChapter(true) + if self.subComps[self.selectedIndex] then + self.subComps[self.selectedIndex]:refreshChapter(true) + end end end, true) self:bind(DataManager.PlayerData, "dirty", function(binder, value) @@ -124,16 +126,22 @@ function MainCityUI:_bind() self:bind(DataManager.HeroData, "isDirty", function(binder, value) if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then - self.subComps[self.selectedIndex]:refresh() + if self.subComps[self.selectedIndex] then + self.subComps[self.selectedIndex]:refresh() + end self:refreshBottomRp() elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then - self.subComps[self.selectedIndex]:refreshStageFormaion() + if self.subComps[self.selectedIndex] then + self.subComps[self.selectedIndex]:refreshStageFormaion() + end end end) self:bind(DataManager.BagData.ItemData, "dirty", function(binder, value) if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN and self.subComps[self.selectedIndex] then - self.subComps[self.selectedIndex]:refreshStageFormaion() + if self.subComps[self.selectedIndex] then + self.subComps[self.selectedIndex]:refreshStageFormaion() + end end end) end diff --git a/lua/app/userdata/bag/bag_data.lua b/lua/app/userdata/bag/bag_data.lua index b8971c37..30cbb19c 100644 --- a/lua/app/userdata/bag/bag_data.lua +++ b/lua/app/userdata/bag/bag_data.lua @@ -13,7 +13,7 @@ end function BagData:init(data) if data then - self.ItemData:init(data.ItemData) + self.ItemData:init(data) else self.ItemData:init() end diff --git a/lua/app/userdata/bag/item_data.lua b/lua/app/userdata/bag/item_data.lua index 97ccb46d..2f62c0eb 100644 --- a/lua/app/userdata/bag/item_data.lua +++ b/lua/app/userdata/bag/item_data.lua @@ -1,5 +1,4 @@ local ItemEntity = require "app/userdata/bag/item_entity" -local ServerGameData = require "app/server/server_game_data" local ItemConst = require "app/module/item/item_const" local ItemData = class("ItemData", BaseData) @@ -30,10 +29,10 @@ function ItemData:init(data) parmas.gold = info.count CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(parmas) end - if info.cfg_id == GConst.ItemConst.ITEM_ID_VIT then + if info.id == GConst.ItemConst.ITEM_ID_VIT then DataManager.PlayerData:setVit(info.count) end - self:_add(info.cfg_id, info.count) + self:_add(info.id, info.count) end end self.recoveryList = {} @@ -41,16 +40,16 @@ function ItemData:init(data) if data.recoveries then local recoveryCfg = ConfigManager:getConfig("recovery") for k, v in ipairs(data.recoveries) do - local recoveryInfo = recoveryCfg[v.cfg_id] + local recoveryInfo = recoveryCfg[v.id] if recoveryInfo then local obj = { - cfg_id = v.cfg_id, + cfg_id = v.id, ts = v.ts, limit = recoveryInfo.limit, recoveryType = recoveryInfo.type, time = recoveryInfo.time } - self.recoveryMap[v.cfg_id] = obj + self.recoveryMap[v.id] = obj table.insert(self.recoveryList, obj) end end @@ -279,7 +278,6 @@ function ItemData:updateCd() self:recoveryItem(v) -- 根据间隔时间增加 end end - ServerGameData.BagData.ItemData:recoveryItems() end return ItemData \ No newline at end of file diff --git a/lua/app/userdata/chapter/chapter_data.lua b/lua/app/userdata/chapter/chapter_data.lua index 469ea14f..85a29e56 100644 --- a/lua/app/userdata/chapter/chapter_data.lua +++ b/lua/app/userdata/chapter/chapter_data.lua @@ -173,7 +173,7 @@ end function ChapterData:getChapterMaxWave(chapterId) chapterId = chapterId or self:getChapterId() - if chapterId <= self.maxChapterId then + if chapterId <= self.data.maxChapterId then return self:getChapterCfgMaxWave(chapterId) else return self.maxWave @@ -227,7 +227,7 @@ function ChapterData:getIsHaveRewardsMinId() if chapterBefore == nil then break end - if chapterBefore == self.maxChapterId then + if chapterBefore == self.data.maxChapterId then chapterBefore = self:getNextChapter(self.data.maxChapterId) break end @@ -273,7 +273,7 @@ end function ChapterData:getChapterPassed(chapterId) chapterId = chapterId or self:getChapterId() - if chapterId <= self.maxChapterId then + if chapterId <= self.data.maxChapterId then return true else return self.maxWave >= self:getChapterCfgMaxWave(chapterId) @@ -304,7 +304,7 @@ function ChapterData:fightChapter(chapterId, maxChapterId, maxWave) end self.data.chapterInfo[chapterId].total_count = (self.data.chapterInfo[chapterId].total_count or 0) + 1 - if maxChapterId <= self.maxChapterId then + if maxChapterId <= self.data.maxChapterId then return end diff --git a/lua/app/userdata/formation/formation_data.lua b/lua/app/userdata/formation/formation_data.lua index c5a3cc99..7bda5064 100644 --- a/lua/app/userdata/formation/formation_data.lua +++ b/lua/app/userdata/formation/formation_data.lua @@ -3,14 +3,15 @@ local FormationData = class("FormationData", BaseData) function FormationData:init(data) self.data.dirty = false self.formations = {} - if data and data.formations then - for formationType, formation in pairs(data.formations) do + if data and data.heroes then + -- for formationType, formation in pairs(data.heroes) do local clientFormation = {} - self.formations[formationType] = clientFormation - for matchTypeStr, heroId in pairs(formation) do - clientFormation[tonumber(matchTypeStr)] = heroId + -- self.formations[formationType] = clientFormation + self.formations[GConst.BattleConst.BATTLE_TYPE.STAGE] = clientFormation -- 暂时写死 + for matchType, heroId in pairs(data.heroes) do + clientFormation[matchType] = heroId end - end + -- end end end diff --git a/lua/app/userdata/hero/hero_data.lua b/lua/app/userdata/hero/hero_data.lua index f4fdd1f3..a5fe3dee 100644 --- a/lua/app/userdata/hero/hero_data.lua +++ b/lua/app/userdata/hero/hero_data.lua @@ -17,8 +17,8 @@ end function HeroData:init(data) self.heroes = {} if data then - for _, heroInfo in pairs(data.heroes) do - self:addHero(heroInfo.cfg_id, heroInfo.lv) + for id, heroInfo in pairs(data) do + self:addHero(heroInfo.id, heroInfo.level) end end diff --git a/lua/app/userdata/tutorial/tutorial_data.lua b/lua/app/userdata/tutorial/tutorial_data.lua index 86f6f049..34439707 100644 --- a/lua/app/userdata/tutorial/tutorial_data.lua +++ b/lua/app/userdata/tutorial/tutorial_data.lua @@ -22,12 +22,9 @@ function TutorialData:init(data) self.inTutorial = false -- 功能开启引导列表 self.funcTutorialMap = {} - if data.markedGuide then - for k,v in pairs(data.markedGuide) do - local id = tonumber(k) - if id then - self.funcTutorialMap[id] = v - end + if data.func then + for id,v in pairs(data.func) do + self.funcTutorialMap[id] = v end end end