This commit is contained in:
xiekaidong 2023-05-08 09:47:58 +08:00
parent 2c341db47c
commit 55ec0dd76c
16 changed files with 73 additions and 72 deletions

View File

@ -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)

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -992,7 +992,7 @@ function NetManager:getNotCheckResponse(msgName)
-- then
-- return true
-- end
return false
return true
end
function NetManager:getNotAddCostsRsp(msgName)

View File

@ -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",
},

View File

@ -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"

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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