主界面图标

This commit is contained in:
puxuan 2025-09-28 16:09:37 +08:00
parent c41b85349a
commit 0736e58c5f
35 changed files with 1032 additions and 955 deletions

View File

@ -188,6 +188,14 @@ function DataManager:initWithServerData(data)
self.initWithServer = true self.initWithServer = true
end end
function DataManager:setAuthInfo(authInfo)
self.authInfo = authInfo
end
function DataManager:getAuthInfo()
return self.authInfo
end
-- 是否首次登录 -- 是否首次登录
function DataManager:getIsFirstLogin() function DataManager:getIsFirstLogin()
local nowTime = Time:getServerTime() local nowTime = Time:getServerTime()

View File

@ -79,6 +79,7 @@ EventManager.CUSTOM_EVENT = {
FORCE_SUMMON_NEXT_FINISH = "FORCE_SUMMON_NEXT_FINISH", FORCE_SUMMON_NEXT_FINISH = "FORCE_SUMMON_NEXT_FINISH",
FORCE_SUMMON_CHECK_PATH = "FORCE_SUMMON_CHECK_PATH", FORCE_SUMMON_CHECK_PATH = "FORCE_SUMMON_CHECK_PATH",
FORCE_SUMMON_CHECK_PATH_GM = "FORCE_SUMMON_CHECK_PATH_GM", FORCE_SUMMON_CHECK_PATH_GM = "FORCE_SUMMON_CHECK_PATH_GM",
UPDATE_SIDE_BAR = "UPDATE_SIDE_BAR",
CROSS_DAY = "CROSS_DAY",-- 跨天 CROSS_DAY = "CROSS_DAY",-- 跨天
} }

View File

@ -292,7 +292,7 @@ function PayManager:checkAndPay(productId, id, purchaseType, rechargeId)
-- 检查是否可以支付 -- 检查是否可以支付
SDKManager:checkPay(productId, function(code) SDKManager:checkPay(productId, function(code)
if code == 0 then if code == 0 then
self:sendMessage(ProtoMsgType.FromMsgEnum.ActPayReq, {id = id, act_type = purchaseType}, {}, function(binder, msgData) self:sendMessage(ProtoMsgType.FromMsgEnum.ActPayReq, {id = id, act_type = purchaseType}, function(binder, msgData)
if msgData.status == 0 then if msgData.status == 0 then
if msgData.uuid and msgData.uuid ~= GConst.EMPTY_STRING then if msgData.uuid and msgData.uuid ~= GConst.EMPTY_STRING then
local giftType = PayManager:getGiftType(purchaseType, id) local giftType = PayManager:getGiftType(purchaseType, id)
@ -323,7 +323,7 @@ end
function PayManager:sendMsgToServer(purchaseToken, uuid, originOrderId, productId, callback) function PayManager:sendMsgToServer(purchaseToken, uuid, originOrderId, productId, callback)
local args = SDKManager:getPurchaseArgs(purchaseToken, uuid, originOrderId, productId) local args = SDKManager:getPurchaseArgs(purchaseToken, uuid, originOrderId, productId)
self:sendMessage(ProtoMsgType.FromMsgEnum.ActPaidResultReq, args, {}, callback) self:sendMessage(ProtoMsgType.FromMsgEnum.ActPaidResultReq, args, callback)
end end
return PayManager return PayManager

View File

@ -20,7 +20,7 @@ function AccountManager:getIsBinded()
end end
function AccountManager:deleteAccount() function AccountManager:deleteAccount()
self:sendMessage(ProtoMsgType.FromMsgEnum.DeleteReq, {}, {}, self.onDeleteAccount, BIReport.ITEM_GET_TYPE.NONE) self:sendMessage(ProtoMsgType.FromMsgEnum.DeleteReq, {}, self.onDeleteAccount, BIReport.ITEM_GET_TYPE.NONE)
end end
function AccountManager:onDeleteAccount(result) function AccountManager:onDeleteAccount(result)
@ -52,7 +52,7 @@ function AccountManager:bindAccount()
id = params.id, id = params.id,
token = params.token token = params.token
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.BindReq, args, {}, self.onBindAccount, BIReport.ITEM_GET_TYPE.NONE) self:sendMessage(ProtoMsgType.FromMsgEnum.BindReq, args, self.onBindAccount, BIReport.ITEM_GET_TYPE.NONE)
end, loginType) end, loginType)
end end
@ -128,7 +128,7 @@ function AccountManager:changeAccount()
id = params.id, id = params.id,
token = params.token token = params.token
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.ExistReq, args, {}, self.onChangeAccount, BIReport.ITEM_GET_TYPE.NONE) self:sendMessage(ProtoMsgType.FromMsgEnum.ExistReq, args, self.onChangeAccount, BIReport.ITEM_GET_TYPE.NONE)
end, loginType) end, loginType)
end end

View File

@ -188,4 +188,78 @@ function ActSprintManager:onBuyBountyPro(giftId)
PayManager:purchasePackage(giftId, PayManager.PURCHARSE_TYPE.ACT_GIFT, true) PayManager:purchasePackage(giftId, PayManager.PURCHARSE_TYPE.ACT_GIFT, true)
end end
--region 打点
BIReport.ACT_SPRINT_OPT_TYPE = {
SPRINT_REWARD = "SprintReward",
SPRINT_TASK = "SprintTask",
NORMAL_TASK = "NormalTask",
SIGN_BOUNTY = "SignBounty",
}
-- 冲刺活动
BIReport.ITEM_GET_TYPE.ACT_SPRINT_EXCHANGE = "act_sprint_exchange"
BIReport.ITEM_GET_TYPE.ACT_SPRINT_STANDARD = "act_sprint_standard"
BIReport.ITEM_GET_TYPE.ACT_SPRINT_TASK = "act_sprint_task"
BIReport.ITEM_GET_TYPE.ACT_SPRINT_GIFT = "act_sprint_gift"
BIReport.ITEM_GET_TYPE.ACT_SPRINT_SIGN_BOX = "act_sprint_sign_box"
local EVENT_NAME_ACT_SPRINT = "client_act_sprint"
function BIReport:postActSprintClaimSprintReward(actId, actType, curNum, totalNum, sprintTaskRound, sprintRewardRound)
local args = {
opt_type = BIReport.ACT_SPRINT_OPT_TYPE.SPRINT_REWARD,
act_id = actId,
act_type = actType,
finish_num = curNum,
total_num = totalNum,
sprint_task_round = sprintTaskRound,
sprint_reward_round = sprintRewardRound,
}
self:report(EVENT_NAME_ACT_SPRINT, args)
end
function BIReport:postActSprintClaimSprintTask(actId, actType, taskIds, curNum, totalNum, sprintTaskRound, sprintRewardRound)
local taskStr = GConst.EMPTY_STRING
for _, taskId in ipairs(taskIds) do
taskStr = taskStr .. tostring(taskId) .. "|"
end
local args = {
opt_type = BIReport.ACT_SPRINT_OPT_TYPE.SPRINT_TASK,
act_id = actId,
act_type = actType,
task_str = taskStr,
finish_num = curNum,
total_num = totalNum,
sprint_task_round = sprintTaskRound,
sprint_reward_round = sprintRewardRound,
}
self:report(EVENT_NAME_ACT_SPRINT, args)
end
function BIReport:postActSprintClaimNormalTask(actId, actType, taskId, curNum, totalNum, sprintTaskRound, sprintRewardRound)
local args = {
opt_type = BIReport.ACT_SPRINT_OPT_TYPE.NORMAL_TASK,
act_id = actId,
act_type = actType,
task_str = tostring(taskId),
finish_num = curNum,
total_num = totalNum,
sprint_task_round = sprintTaskRound,
sprint_reward_round = sprintRewardRound,
}
self:report(EVENT_NAME_ACT_SPRINT, args)
end
function BIReport:postActSprintSignBounty(actId, actType, signDay, isPro)
local args = {
opt_type = BIReport.ACT_SPRINT_OPT_TYPE.SIGN_BOUNTY,
act_id = actId,
act_type = actType,
sign_day = signDay,
is_pro = isPro
}
self:report(EVENT_NAME_ACT_SPRINT, args)
end
--endregion
return ActSprintManager return ActSprintManager

View File

@ -43,7 +43,7 @@ function ActivityManager:reqSummerData()
if not DataManager.ActivityData:isOpen() then if not DataManager.ActivityData:isOpen() then
return return
end end
self:sendMessage(ProtoMsgType.FromMsgEnum.SummerDataReq, {}, {}, self.rspSummerData, nil) self:sendMessage(ProtoMsgType.FromMsgEnum.SummerDataReq, {}, self.rspSummerData, nil)
end end
function ActivityManager:rspSummerData(result) function ActivityManager:rspSummerData(result)
@ -54,7 +54,7 @@ end
-- 请求夏日活动任务奖励 -- 请求夏日活动任务奖励
function ActivityManager:reqSummerTaskReward(id) function ActivityManager:reqSummerTaskReward(id)
self:sendMessage(ProtoMsgType.FromMsgEnum.SummerTaskClaimReq, {id = id, stage = DataManager.ActivityData:getTaskStage(id)}, {}, self.rspSummerTaskReward, nil) self:sendMessage(ProtoMsgType.FromMsgEnum.SummerTaskClaimReq, {id = id, stage = DataManager.ActivityData:getTaskStage(id)}, self.rspSummerTaskReward, nil)
end end
function ActivityManager:rspSummerTaskReward(result) function ActivityManager:rspSummerTaskReward(result)
@ -67,7 +67,7 @@ end
-- 请求夏日活动战令奖励id为0就是领取档位全部可领奖励 -- 请求夏日活动战令奖励id为0就是领取档位全部可领奖励
function ActivityManager:reqSummerBountyReward(id, grade) function ActivityManager:reqSummerBountyReward(id, grade)
self:sendMessage(ProtoMsgType.FromMsgEnum.SummerBountyClaimReq, {id = id, grade = grade}, {}, self.rspSummerBountyReward, BIReport.ITEM_GET_TYPE.ACTIVITY_BOUNTY_REWARD) self:sendMessage(ProtoMsgType.FromMsgEnum.SummerBountyClaimReq, {id = id, grade = grade}, self.rspSummerBountyReward, BIReport.ITEM_GET_TYPE.ACTIVITY_BOUNTY_REWARD)
end end
function ActivityManager:rspSummerBountyReward(result) function ActivityManager:rspSummerBountyReward(result)
@ -96,7 +96,7 @@ function ActivityManager:reqBuyBountyLevel()
okFunc = function() okFunc = function()
local id = DataManager.ActivityData:getBountyCfg()[DataManager.ActivityData:getBountyLevel() + 1].id local id = DataManager.ActivityData:getBountyCfg()[DataManager.ActivityData:getBountyLevel() + 1].id
-- Logger.logHighlight("购买战令等级:"..id) -- Logger.logHighlight("购买战令等级:"..id)
self:sendMessage(ProtoMsgType.FromMsgEnum.SummerBountyClaimByDiamondReq, {id = id}, {}, self.rspBuyBountyLevel, BIReport.ITEM_GET_TYPE.ACTIVITY_BOUNTY_LEVEL) self:sendMessage(ProtoMsgType.FromMsgEnum.SummerBountyClaimByDiamondReq, {id = id}, self.rspBuyBountyLevel, BIReport.ITEM_GET_TYPE.ACTIVITY_BOUNTY_LEVEL)
end, end,
} }
GFunc.showMessageBox(params) GFunc.showMessageBox(params)

View File

@ -14,7 +14,7 @@ function ArenaBountyManager:claimReward(index, isPro)
level = index, level = index,
is_pro = isPro, is_pro = isPro,
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.ArenaBountyRewardReq, args, {}, self.onClaimReward, BIReport.ITEM_GET_TYPE.ARENA_BOUNTY_REWARD) self:sendMessage(ProtoMsgType.FromMsgEnum.ArenaBountyRewardReq, args, self.onClaimReward, BIReport.ITEM_GET_TYPE.ARENA_BOUNTY_REWARD)
end end
function ArenaBountyManager:onClaimReward(result) function ArenaBountyManager:onClaimReward(result)
@ -87,7 +87,7 @@ function ArenaBountyManager:buyBountyLevel()
costId = costId, costId = costId,
costNum = costNum, costNum = costNum,
okFunc = function() okFunc = function()
self:sendMessage(ProtoMsgType.FromMsgEnum.ArenaBountyLevelUnlockReq, {}, {}, self.onBoughtBountyLevel, BIReport.ITEM_GET_TYPE.ARENA_BOUNTY_UNLOCK_LEVEL) self:sendMessage(ProtoMsgType.FromMsgEnum.ArenaBountyLevelUnlockReq, {}, self.onBoughtBountyLevel, BIReport.ITEM_GET_TYPE.ARENA_BOUNTY_UNLOCK_LEVEL)
end, end,
} }
GFunc.showMessageBox(params) GFunc.showMessageBox(params)

View File

@ -50,7 +50,7 @@ end
-- 匹配 -- 匹配
function ArenaManager:reqMatch() function ArenaManager:reqMatch()
self:sendMessage(ProtoMsgType.FromMsgEnum.MatchReq, {}, {}, self.rspMatch, nil) self:sendMessage(ProtoMsgType.FromMsgEnum.MatchReq, {}, self.rspMatch, nil)
end end
function ArenaManager:rspMatch(result) function ArenaManager:rspMatch(result)
@ -83,7 +83,7 @@ function ArenaManager:reqChallenge()
defInfo = DataManager.ArenaData:getMatchInfo() defInfo = DataManager.ArenaData:getMatchInfo()
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPChallengeStartReq, reqData, {}, self.rspChallenge, BIReport.ITEM_GET_TYPE.ARENA_CHALLENGE) self:sendMessage(ProtoMsgType.FromMsgEnum.PVPChallengeStartReq, reqData, self.rspChallenge, BIReport.ITEM_GET_TYPE.ARENA_CHALLENGE)
end end
function ArenaManager:rspChallenge(result) function ArenaManager:rspChallenge(result)
@ -128,7 +128,7 @@ function ArenaManager:reqSettlement(win, battleReport, taskProgress)
task_stat = taskProgress, task_stat = taskProgress,
battleReport = battleReport, battleReport = battleReport,
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPChallengeSettlementReq, parmas, {}, self.rspSettlement, BIReport.ITEM_GET_TYPE.ARENA_SETTLEMENT) self:sendMessage(ProtoMsgType.FromMsgEnum.PVPChallengeSettlementReq, parmas, self.rspSettlement, BIReport.ITEM_GET_TYPE.ARENA_SETTLEMENT)
end end
function ArenaManager:rspSettlement(result) function ArenaManager:rspSettlement(result)
@ -167,7 +167,7 @@ end
-- 战报 -- 战报
function ArenaManager:reqRecord() function ArenaManager:reqRecord()
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPRecordHistoryReq, {}, {}, self.rspRecord, nil) self:sendMessage(ProtoMsgType.FromMsgEnum.PVPRecordHistoryReq, {}, self.rspRecord, nil)
end end
function ArenaManager:rspRecord(result) function ArenaManager:rspRecord(result)
@ -179,7 +179,7 @@ end
-- 排行榜 -- 排行榜
function ArenaManager:reqRank() function ArenaManager:reqRank()
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPRankReq, {}, {}, self.rspRank, nil) self:sendMessage(ProtoMsgType.FromMsgEnum.PVPRankReq, {}, self.rspRank, nil)
end end
function ArenaManager:rspRank(result) function ArenaManager:rspRank(result)
@ -191,7 +191,7 @@ end
-- 排行榜玩家编队信息 -- 排行榜玩家编队信息
function ArenaManager:reqRankHeroes(id) function ArenaManager:reqRankHeroes(id)
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPRankHeroesReq, {rid = id}, {}, self.rspRankHeroes, nil) self:sendMessage(ProtoMsgType.FromMsgEnum.PVPRankHeroesReq, {rid = id}, self.rspRankHeroes, nil)
end end
function ArenaManager:rspRankHeroes(result) function ArenaManager:rspRankHeroes(result)
@ -202,7 +202,7 @@ end
-- 领取上赛季奖励 -- 领取上赛季奖励
function ArenaManager:reqLastSeasonReward() function ArenaManager:reqLastSeasonReward()
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPSeasonRewardReq, {}, {}, self.rspLastSeasonReward, BIReport.ITEM_GET_TYPE.ARENA_REWARD) self:sendMessage(ProtoMsgType.FromMsgEnum.PVPSeasonRewardReq, {}, self.rspLastSeasonReward, BIReport.ITEM_GET_TYPE.ARENA_REWARD)
end end
function ArenaManager:rspLastSeasonReward(result) function ArenaManager:rspLastSeasonReward(result)
@ -218,7 +218,7 @@ function ArenaManager:reqArenaInfo(showUI)
return return
end end
self.isResetting = true self.isResetting = true
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPInfoReq, {showUI = showUI}, {}, self.rspArenaInfo, nil) self:sendMessage(ProtoMsgType.FromMsgEnum.PVPInfoReq, {showUI = showUI}, self.rspArenaInfo, nil)
end end
function ArenaManager:rspArenaInfo(result) function ArenaManager:rspArenaInfo(result)
@ -233,7 +233,7 @@ end
-- 结束匹配cd -- 结束匹配cd
function ArenaManager:reqOverCD(isAd) function ArenaManager:reqOverCD(isAd)
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPOverCDReq, {ad = isAd}, {}, self.rspOverCD, BIReport.ITEM_GET_TYPE.ARENA_REMATCH_CD) self:sendMessage(ProtoMsgType.FromMsgEnum.PVPOverCDReq, {ad = isAd}, self.rspOverCD, BIReport.ITEM_GET_TYPE.ARENA_REMATCH_CD)
end end
function ArenaManager:rspOverCD(result) function ArenaManager:rspOverCD(result)
@ -245,7 +245,7 @@ end
-- 领取广告宝箱 -- 领取广告宝箱
function ArenaManager:reqAdBoxReward(isWin) function ArenaManager:reqAdBoxReward(isWin)
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPSettlementADRewardReq, {win = isWin}, {}, self.rspAdBoxReward, BIReport.ITEM_GET_TYPE.ARENA_AD_BOX_REWARD) self:sendMessage(ProtoMsgType.FromMsgEnum.PVPSettlementADRewardReq, {win = isWin}, self.rspAdBoxReward, BIReport.ITEM_GET_TYPE.ARENA_AD_BOX_REWARD)
end end
function ArenaManager:rspAdBoxReward(result) function ArenaManager:rspAdBoxReward(result)
@ -265,7 +265,7 @@ end
function ArenaManager:reqGradingReward(id) function ArenaManager:reqGradingReward(id)
local getIds = {} local getIds = {}
table.insert(getIds, id) table.insert(getIds, id)
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPStageRewardReq, {ids = getIds}, {}, self.rspGradingReward, BIReport.ITEM_GET_TYPE.ARENA_GRADING_REWARD) self:sendMessage(ProtoMsgType.FromMsgEnum.PVPStageRewardReq, {ids = getIds}, self.rspGradingReward, BIReport.ITEM_GET_TYPE.ARENA_GRADING_REWARD)
end end
function ArenaManager:rspGradingReward(result) function ArenaManager:rspGradingReward(result)

View File

@ -73,11 +73,11 @@ function BaseModule:removeAllEventListeners()
end end
-- 阻塞式等待服务器回复以后再回调callback -- 阻塞式等待服务器回复以后再回调callback
function BaseModule:sendMessage(msgName, params, responseData, callback, getType, lockGame) function BaseModule:sendMessage(msgName, params, callback, getType, lockGame)
if lockGame == nil then if lockGame == nil then
lockGame = true lockGame = true
end end
NetManager:send(self, msgName, params, responseData, callback, lockGame, nil, getType) NetManager:send(self, msgName, params, callback, lockGame, nil, getType)
end end
-- 阻塞式等待所有指令完成以后再发送此消息并且锁界面等待服务器回复以后再回调callback -- 阻塞式等待所有指令完成以后再发送此消息并且锁界面等待服务器回复以后再回调callback

View File

@ -104,7 +104,7 @@ function BattleManager:reqSkillRefresh(isAd)
end end
end end
self:sendMessage(ProtoMsgType.FromMsgEnum.BattleSkillRefreshReq, {ad = isAd}, {}, self.rspSkillRefresh, BIReport.ITEM_GET_TYPE.BATTLE_SKILL_REFRESH, true) self:sendMessage(ProtoMsgType.FromMsgEnum.BattleSkillRefreshReq, {ad = isAd}, self.rspSkillRefresh, BIReport.ITEM_GET_TYPE.BATTLE_SKILL_REFRESH, true)
end end
function BattleManager:rspSkillRefresh(result) function BattleManager:rspSkillRefresh(result)

View File

@ -7,7 +7,7 @@ function ChapterManager:openBox(chapterId, index)
local parmas = {} local parmas = {}
parmas.boxes = DataManager.ChapterData:getChapterBoxCanGetInfo() parmas.boxes = DataManager.ChapterData:getChapterBoxCanGetInfo()
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterBoxRewardReq, parmas, {}, self.openBoxFinish, BIReport.ITEM_GET_TYPE.CHAPTER_BOX) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterBoxRewardReq, parmas, self.openBoxFinish, BIReport.ITEM_GET_TYPE.CHAPTER_BOX)
end end
function ChapterManager:openBoxFinish(result) function ChapterManager:openBoxFinish(result)
@ -46,7 +46,7 @@ function ChapterManager:startFight(isTrail)
return return
end end
end end
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterStartReq, parmas, {}, self.startFightFinish, BIReport.ITEM_GET_TYPE.CHAPTER_FIGHT_START) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterStartReq, parmas, self.startFightFinish, BIReport.ITEM_GET_TYPE.CHAPTER_FIGHT_START)
end end
function ChapterManager:startFightFinish(result) function ChapterManager:startFightFinish(result)
@ -96,7 +96,7 @@ function ChapterManager:endFight(id, combatReport, gotMysteryBoxIndexs, taskProg
combatReport = combatReport, combatReport = combatReport,
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterSettlementReq, parmas, {}, self.endFightFinish, BIReport.ITEM_GET_TYPE.CHAPTER_FIGHT_END) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterSettlementReq, parmas, self.endFightFinish, BIReport.ITEM_GET_TYPE.CHAPTER_FIGHT_END)
end end
function ChapterManager:endFightFinish(result) function ChapterManager:endFightFinish(result)

View File

@ -2,7 +2,7 @@ local CollectionManager = class("CollectionManager", BaseModule)
-- 请求领取英雄图鉴点数 -- 请求领取英雄图鉴点数
function CollectionManager:reqHeroPoint(id) function CollectionManager:reqHeroPoint(id)
self:sendMessage(ProtoMsgType.FromMsgEnum.HeroCollectionPointReq, {hero_id = id}, {}, self.rspHeroPoint) self:sendMessage(ProtoMsgType.FromMsgEnum.HeroCollectionPointReq, {hero_id = id}, self.rspHeroPoint)
end end
function CollectionManager:rspHeroPoint(result) function CollectionManager:rspHeroPoint(result)
@ -14,7 +14,7 @@ end
-- 请求领取皮肤图鉴点数 -- 请求领取皮肤图鉴点数
function CollectionManager:reqSkinPoint(id) function CollectionManager:reqSkinPoint(id)
self:sendMessage(ProtoMsgType.FromMsgEnum.SkinCollectionPointReq, {skin_id = id}, {}, self.rspSkinPoint) self:sendMessage(ProtoMsgType.FromMsgEnum.SkinCollectionPointReq, {skin_id = id}, self.rspSkinPoint)
end end
function CollectionManager:rspSkinPoint(result) function CollectionManager:rspSkinPoint(result)
@ -26,7 +26,7 @@ end
-- 请求领取图鉴奖励 -- 请求领取图鉴奖励
function CollectionManager:reqPointReward() function CollectionManager:reqPointReward()
self:sendMessage(ProtoMsgType.FromMsgEnum.CollectionUpgradeReq, {}, {}, self.rspPointReward, BIReport.ITEM_GET_TYPE.COLLECTION_HERO_REWARD) self:sendMessage(ProtoMsgType.FromMsgEnum.CollectionUpgradeReq, {}, self.rspPointReward, BIReport.ITEM_GET_TYPE.COLLECTION_HERO_REWARD)
end end
function CollectionManager:rspPointReward(result) function CollectionManager:rspPointReward(result)

View File

@ -14,15 +14,9 @@ function CommerceManager:onBuyVit(isFree)
} }
} }
if isFree then if isFree then
local reward = ConfigManager:getConfig("const")["stamina_ad_buy"].reward self:sendMessage(ProtoMsgType.FromMsgEnum.EnergyByADReq, {}, self.onBuyBitFinish, BIReport.ITEM_GET_TYPE.ADS_BUY_VIT)
responseData.rewards = {reward}
self:sendMessage(ProtoMsgType.FromMsgEnum.EnergyByADReq, {}, responseData, self.onBuyBitFinish, BIReport.ITEM_GET_TYPE.ADS_BUY_VIT)
else else
local reward = ConfigManager:getConfig("const")["stamina_diamond_buy"].reward self:sendMessage(ProtoMsgType.FromMsgEnum.EnergyByDiamondReq, {}, self.onBuyBitFinish, BIReport.ITEM_GET_TYPE.GEM_BUY_VIT)
responseData.rewards = {reward}
local cost = ConfigManager:getConfig("const")["stamina_diamond_cost"].reward
responseData.costs = {cost}
self:sendMessage(ProtoMsgType.FromMsgEnum.EnergyByDiamondReq, {}, responseData, self.onBuyBitFinish, BIReport.ITEM_GET_TYPE.GEM_BUY_VIT)
end end
end end
@ -53,7 +47,7 @@ function CommerceManager:onBuyArenaTicket(isAd)
else else
report = BIReport.ITEM_GET_TYPE.GEM_BUY_ARENA_TICKET report = BIReport.ITEM_GET_TYPE.GEM_BUY_ARENA_TICKET
end end
self:sendMessage(ProtoMsgType.FromMsgEnum.BuyTicketReq, {ad = isAd}, {}, self.onBuyArenaTicketFinish, report) self:sendMessage(ProtoMsgType.FromMsgEnum.BuyTicketReq, {ad = isAd}, self.onBuyArenaTicketFinish, report)
end end
function CommerceManager:onBuyArenaTicketFinish(data) function CommerceManager:onBuyArenaTicketFinish(data)

View File

@ -65,7 +65,7 @@ function DailyChallengeManager:startChallenge()
end end
local parmas = {} local parmas = {}
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeStartReq, parmas, {}, self.rspStartChallenge, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeStartReq, parmas, self.rspStartChallenge, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE)
end end
function DailyChallengeManager:rspStartChallenge(result) function DailyChallengeManager:rspStartChallenge(result)
@ -87,7 +87,7 @@ function DailyChallengeManager:endChallenge(chapterId, combatReport, taskProgres
taskCurProgress = taskCurProgress taskCurProgress = taskCurProgress
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeSettlementReq, parmas, {}, self.endChallengeFinish, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE_END) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeSettlementReq, parmas, self.endChallengeFinish, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE_END)
end end
function DailyChallengeManager:endChallengeFinish(result) function DailyChallengeManager:endChallengeFinish(result)
@ -142,7 +142,7 @@ function DailyChallengeManager:onResetState()
return return
end end
DataManager.DailyChallengeData:setInReset(true) DataManager.DailyChallengeData:setInReset(true)
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeResetReq, {}, {}, self.rspResetState, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE_RESET) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeResetReq, {}, self.rspResetState, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE_RESET)
end end
function DailyChallengeManager:rspResetState(result) function DailyChallengeManager:rspResetState(result)
@ -156,7 +156,7 @@ function DailyChallengeManager:getTaskReward(idx)
local parmas = { local parmas = {
idx = idx, idx = idx,
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.DailyChallengeTaskAwardReq, parmas, {}, self.getTaskRewardFinish, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE_TASK_REWARD) self:sendMessage(ProtoMsgType.FromMsgEnum.DailyChallengeTaskAwardReq, parmas, self.getTaskRewardFinish, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE_TASK_REWARD)
end end
function DailyChallengeManager:getTaskRewardFinish(result) function DailyChallengeManager:getTaskRewardFinish(result)
@ -239,7 +239,7 @@ function DailyChallengeManager:onChapterDailyChallengeLevelReq(level)
local parmas = { local parmas = {
level = level, level = level,
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeLevelReq, parmas, {}, self.onChapterDailyChallengeLevelRsp) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeLevelReq, parmas, self.onChapterDailyChallengeLevelRsp)
end end
function DailyChallengeManager:onChapterDailyChallengeLevelRsp(result) function DailyChallengeManager:onChapterDailyChallengeLevelRsp(result)

View File

@ -64,7 +64,7 @@ function DungeonManager:reqChallengeGold(id)
end end
local parmas = {chapter_gold_id = id} local parmas = {chapter_gold_id = id}
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeStartReq, parmas, {}, self.respChallengeGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_CHALLENGE) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeStartReq, parmas, self.respChallengeGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_CHALLENGE)
end end
-- 响应挑战金币副本 -- 响应挑战金币副本
@ -87,7 +87,7 @@ function DungeonManager:reqEndChallengeGold(id, combatReport, taskProgress, tota
task_stat = taskProgress, task_stat = taskProgress,
combatReport = combatReport, combatReport = combatReport,
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeSettlementReq, parmas, {}, self.respEndChallengeGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_END) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeSettlementReq, parmas, self.respEndChallengeGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_END)
end end
-- 响应结算金币副本 -- 响应结算金币副本
@ -138,7 +138,7 @@ function DungeonManager:reqSweepGold(id)
local parmas = { local parmas = {
chapter_gold_id = id, chapter_gold_id = id,
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeFarmReq, parmas, {}, self.respSweepGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_SWEEP) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeFarmReq, parmas, self.respSweepGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_SWEEP)
end end
-- 响应扫荡金币副本 -- 响应扫荡金币副本
@ -171,7 +171,7 @@ function DungeonManager:reqChallengeShards(id)
end end
local parmas = {chapter_shards_id = id} local parmas = {chapter_shards_id = id}
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterShardsChallengeStartReq, parmas, {}, self.respChallengeShards, BIReport.ITEM_GET_TYPE.DUNGEON_SHARDS_CHALLENGE) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterShardsChallengeStartReq, parmas, self.respChallengeShards, BIReport.ITEM_GET_TYPE.DUNGEON_SHARDS_CHALLENGE)
end end
-- 响应挑战碎片副本 -- 响应挑战碎片副本
@ -193,7 +193,7 @@ function DungeonManager:reqEndChallengeShards(id, combatReport, taskProgress, to
task_stat = taskProgress, task_stat = taskProgress,
combatReport = combatReport, combatReport = combatReport,
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterShardsChallengeSettlementReq, parmas, {}, self.respEndChallengeShards, BIReport.ITEM_GET_TYPE.DUNGEON_SHARDS_END) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterShardsChallengeSettlementReq, parmas, self.respEndChallengeShards, BIReport.ITEM_GET_TYPE.DUNGEON_SHARDS_END)
end end
-- 响应结算碎片副本 -- 响应结算碎片副本
@ -245,7 +245,7 @@ function DungeonManager:reqSweepShards(id)
local parmas = { local parmas = {
chapter_shards_id = id, chapter_shards_id = id,
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterShardsChallengeFarmReq, parmas, {}, self.respSweepShards, BIReport.ITEM_GET_TYPE.DUNGEON_SHARDS_SWEEP) self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterShardsChallengeFarmReq, parmas, self.respSweepShards, BIReport.ITEM_GET_TYPE.DUNGEON_SHARDS_SWEEP)
end end
-- 响应扫荡碎片副本 -- 响应扫荡碎片副本

View File

@ -45,7 +45,7 @@ function EquipManager:onEquipWearReq(slotId, ids)
local params = {} local params = {}
params.slot = slotId params.slot = slotId
params.ids = ids params.ids = ids
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipWearReq, params, {}, self.onEquipWearRsp, BIReport.ITEM_GET_TYPE.EQUIP_WEAR) self:sendMessage(ProtoMsgType.FromMsgEnum.EquipWearReq, params, self.onEquipWearRsp, BIReport.ITEM_GET_TYPE.EQUIP_WEAR)
end end
function EquipManager:onEquipWearRsp(result) function EquipManager:onEquipWearRsp(result)
@ -72,7 +72,7 @@ function EquipManager:onEquipUpgradeReq(slotId, part)
local params = {} local params = {}
params.slot = slotId params.slot = slotId
params.part = part params.part = part
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipUpgradeReq, params, {}, self.onEquipUpgradeRsp, BIReport.ITEM_GET_TYPE.EQUIP_LV_UP) self:sendMessage(ProtoMsgType.FromMsgEnum.EquipUpgradeReq, params, self.onEquipUpgradeRsp, BIReport.ITEM_GET_TYPE.EQUIP_LV_UP)
end end
function EquipManager:onEquipUpgradeRsp(result) function EquipManager:onEquipUpgradeRsp(result)
@ -99,7 +99,7 @@ function EquipManager:onEquipRefineReq(slotId, part)
local params = {} local params = {}
params.slot = slotId params.slot = slotId
params.part = part params.part = part
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipRefineReq, params, {}, self.onEquipRefineRsp, BIReport.ITEM_GET_TYPE.EQUIP_REFINE) self:sendMessage(ProtoMsgType.FromMsgEnum.EquipRefineReq, params, self.onEquipRefineRsp, BIReport.ITEM_GET_TYPE.EQUIP_REFINE)
end end
function EquipManager:onEquipRefineRsp(result) function EquipManager:onEquipRefineRsp(result)
@ -118,7 +118,7 @@ end
-- 装备分解 -- 装备分解
function EquipManager:onEquipDecomposeReq(ids) function EquipManager:onEquipDecomposeReq(ids)
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipDecomposeReq, {ids = ids}, {}, self.onEquipDecomposeRsp, BIReport.ITEM_GET_TYPE.EQUIP_RESOLVE) self:sendMessage(ProtoMsgType.FromMsgEnum.EquipDecomposeReq, {ids = ids}, self.onEquipDecomposeRsp, BIReport.ITEM_GET_TYPE.EQUIP_RESOLVE)
end end
function EquipManager:onEquipDecomposeRsp(result) function EquipManager:onEquipDecomposeRsp(result)

View File

@ -6,7 +6,7 @@ function FormationManager:upHeroToStageFormation(heroIds)
type = 1, type = 1,
heroes = heroIds heroes = heroIds
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.FormationSetReq, args, {}, self.upHeroToStageFormationFinish) self:sendMessage(ProtoMsgType.FromMsgEnum.FormationSetReq, args, self.upHeroToStageFormationFinish)
end end
function FormationManager:upHeroToStageFormationFinish(result) function FormationManager:upHeroToStageFormationFinish(result)
@ -31,7 +31,7 @@ function FormationManager:reqArenaFormation()
attack_heroIds = DataManager.FormationData:getArenaAttackFormation(),-- 进攻编队 attack_heroIds = DataManager.FormationData:getArenaAttackFormation(),-- 进攻编队
defend_heroIds = DataManager.FormationData:getArenaDefendFormation(),-- 防守编队 defend_heroIds = DataManager.FormationData:getArenaDefendFormation(),-- 防守编队
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPHeroesArrayReq, parmas, {}, self.rspArenaFormation, nil) self:sendMessage(ProtoMsgType.FromMsgEnum.PVPHeroesArrayReq, parmas, self.rspArenaFormation, nil)
end end
function FormationManager:rspArenaFormation(result) function FormationManager:rspArenaFormation(result)

View File

@ -58,7 +58,7 @@ function FundManager:claimFundRewards()
local args = { local args = {
id_with_lv = claimRewards id_with_lv = claimRewards
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.FundAwardReq, args, {}, self.onClaimFundRewards, BIReport.ITEM_GET_TYPE.GROWTH_FUND) self:sendMessage(ProtoMsgType.FromMsgEnum.FundAwardReq, args, self.onClaimFundRewards, BIReport.ITEM_GET_TYPE.GROWTH_FUND)
end end
function FundManager:onClaimFundRewards(result) function FundManager:onClaimFundRewards(result)

View File

@ -24,7 +24,7 @@ function GameSettingManager:exchangeCdkey(key)
local args = { local args = {
key = key key = key
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.CDKeyUseReq, args, {}, self.onExchangeCdkey, BIReport.ITEM_GET_TYPE.CDKEY) self:sendMessage(ProtoMsgType.FromMsgEnum.CDKeyUseReq, args, self.onExchangeCdkey, BIReport.ITEM_GET_TYPE.CDKEY)
end end
function GameSettingManager:onExchangeCdkey(result) function GameSettingManager:onExchangeCdkey(result)
@ -83,7 +83,7 @@ function GameSettingManager:showSupport(objectId)
end end
function GameSettingManager:reqAiHelper() function GameSettingManager:reqAiHelper()
self:sendMessage(ProtoMsgType.FromMsgEnum.AIHelpUnreadReq, {}, {}, self.rspAiHelper) self:sendMessage(ProtoMsgType.FromMsgEnum.AIHelpUnreadReq, {}, self.rspAiHelper)
end end
function GameSettingManager:rspAiHelper(result) function GameSettingManager:rspAiHelper(result)

View File

@ -77,7 +77,7 @@ function DevToolManager:getCacheDemoFightInfo()
end end
function DevToolManager:dealGM(paramsList) function DevToolManager:dealGM(paramsList)
self:sendMessage(ProtoMsgType.FromMsgEnum.GMReq, paramsList, {}, self.onDealGMFinish) self:sendMessage(ProtoMsgType.FromMsgEnum.GMReq, paramsList, self.onDealGMFinish)
end end
function DevToolManager:onDealGMFinish(parmas, code, result) function DevToolManager:onDealGMFinish(parmas, code, result)

View File

@ -28,7 +28,7 @@ function HeroManager:upgradeHero(heroId, heroEntity, level)
return return
end end
self:sendMessage(ProtoMsgType.FromMsgEnum.HeroUpgradeReq, {id = heroId, level = level}, {}, self.upgradeHeroFinish, BIReport.ITEM_GET_TYPE.UPGRADE_HERO) self:sendMessage(ProtoMsgType.FromMsgEnum.HeroUpgradeReq, {id = heroId, level = level}, self.upgradeHeroFinish, BIReport.ITEM_GET_TYPE.UPGRADE_HERO)
end end
function HeroManager:upgradeHeroFinish(result) function HeroManager:upgradeHeroFinish(result)
@ -53,7 +53,7 @@ function HeroManager:upgradeHeroStar(heroId, heroEntity)
return return
end end
self:sendMessage(ProtoMsgType.FromMsgEnum.HeroStarReq, {id = heroId}, {}, self.heroStarReqFinish, BIReport.ITEM_GET_TYPE.UPGRADE_HERO) self:sendMessage(ProtoMsgType.FromMsgEnum.HeroStarReq, {id = heroId}, self.heroStarReqFinish, BIReport.ITEM_GET_TYPE.UPGRADE_HERO)
end end
function HeroManager:heroStarReqFinish(result) function HeroManager:heroStarReqFinish(result)

View File

@ -10,7 +10,7 @@ function IdleManager:showIdleQuickDropUI(params)
end end
function IdleManager:getIdleShowRewrad() function IdleManager:getIdleShowRewrad()
self:sendMessage(ProtoMsgType.FromMsgEnum.IdleInfoReq, {}, {}, self.onGetIdleShowRewrad, BIReport.ITEM_GET_TYPE.NONE) self:sendMessage(ProtoMsgType.FromMsgEnum.IdleInfoReq, {}, self.onGetIdleShowRewrad, BIReport.ITEM_GET_TYPE.NONE)
end end
function IdleManager:onGetIdleShowRewrad(result) function IdleManager:onGetIdleShowRewrad(result)
@ -20,7 +20,7 @@ function IdleManager:onGetIdleShowRewrad(result)
end end
function IdleManager:getIdleRewrad() function IdleManager:getIdleRewrad()
self:sendMessage(ProtoMsgType.FromMsgEnum.IdleRewardReq, {}, {}, self.onGetIdleRewrad, BIReport.ITEM_GET_TYPE.IDLE_DROP) self:sendMessage(ProtoMsgType.FromMsgEnum.IdleRewardReq, {}, self.onGetIdleRewrad, BIReport.ITEM_GET_TYPE.IDLE_DROP)
end end
function IdleManager:onGetIdleRewrad(result) function IdleManager:onGetIdleRewrad(result)
@ -38,7 +38,7 @@ function IdleManager:getIdleQuickRewrad(isAd)
local args = { local args = {
ad = true ad = true
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.IdleQuickReq, args, {}, self.onGetIdleQuickRewrad, BIReport.ITEM_GET_TYPE.IDLE_QUICK_DROP) self:sendMessage(ProtoMsgType.FromMsgEnum.IdleQuickReq, args, self.onGetIdleQuickRewrad, BIReport.ITEM_GET_TYPE.IDLE_QUICK_DROP)
end) end)
else else
local cost = DataManager.IdleData:getQuickIdleCost()[1] local cost = DataManager.IdleData:getQuickIdleCost()[1]
@ -53,7 +53,7 @@ function IdleManager:getIdleQuickRewrad(isAd)
local args = { local args = {
ad = false ad = false
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.IdleQuickReq, args, {}, self.onGetIdleQuickRewrad, BIReport.ITEM_GET_TYPE.IDLE_QUICK_DROP) self:sendMessage(ProtoMsgType.FromMsgEnum.IdleQuickReq, args, self.onGetIdleQuickRewrad, BIReport.ITEM_GET_TYPE.IDLE_QUICK_DROP)
end end
end end

View File

@ -140,7 +140,6 @@ function LoginManager:_login()
self:sendMessage( self:sendMessage(
ProtoMsgType.FromMsgEnum.LoginReq, ProtoMsgType.FromMsgEnum.LoginReq,
args, args,
{},
self.loginFinish, self.loginFinish,
nil, false nil, false
) )

View File

@ -15,7 +15,7 @@ function MailManager:getMailList(force)
self.needUpdateMailSid = nil self.needUpdateMailSid = nil
end end
self:sendMessage(ProtoMsgType.FromMsgEnum.MailListReq, {}, {}, self.getMailListFinish) self:sendMessage(ProtoMsgType.FromMsgEnum.MailListReq, {}, self.getMailListFinish)
end end
function MailManager:getMailListFinish(result) function MailManager:getMailListFinish(result)
@ -31,7 +31,7 @@ end
-- 触发服务器时间相关邮件 -- 触发服务器时间相关邮件
function MailManager:getTriggeredTimeMail() function MailManager:getTriggeredTimeMail()
self:sendMessage(ProtoMsgType.FromMsgEnum.MailCycleReq, {}, {}, self.getTriggeredTimeMailFinish) self:sendMessage(ProtoMsgType.FromMsgEnum.MailCycleReq, {}, self.getTriggeredTimeMailFinish)
end end
function MailManager:getTriggeredTimeMailFinish(result) function MailManager:getTriggeredTimeMailFinish(result)
@ -62,7 +62,7 @@ function MailManager:claimMail(ids)
end end
local reqData = {ids = ids} local reqData = {ids = ids}
self:sendMessage(ProtoMsgType.FromMsgEnum.MailExtractReq, reqData, {}, self.claimMailFinish, BIReport.ITEM_GET_TYPE.MAIL) self:sendMessage(ProtoMsgType.FromMsgEnum.MailExtractReq, reqData, self.claimMailFinish, BIReport.ITEM_GET_TYPE.MAIL)
end end
function MailManager:claimMailFinish(result) function MailManager:claimMailFinish(result)
@ -104,8 +104,7 @@ function MailManager:deleteMail(ids)
return return
end end
local reqData = {ids = ids} local reqData = {ids = ids}
local rspData = {ids = ids} self:sendMessage(ProtoMsgType.FromMsgEnum.MailDeleteReq, reqData, self.deleteMailFinish)
self:sendMessage(ProtoMsgType.FromMsgEnum.MailDeleteReq, reqData, rspData, self.deleteMailFinish)
end end
function MailManager:deleteMailFinish(result) function MailManager:deleteMailFinish(result)
@ -122,8 +121,7 @@ function MailManager:readMail(id)
end end
local reqData = {ids = {id}} local reqData = {ids = {id}}
local rspData = {ids = {id}} self:sendMessage(ProtoMsgType.FromMsgEnum.MailReadReq, reqData, self.readMailFinish)
self:sendMessage(ProtoMsgType.FromMsgEnum.MailReadReq, reqData, rspData, self.readMailFinish)
end end
function MailManager:readMailFinish(result) function MailManager:readMailFinish(result)

View File

@ -16,7 +16,7 @@ function PlayerManager:showPlayerUpUI(currLv, rewards)
end end
function PlayerManager:levelUp() function PlayerManager:levelUp()
self:sendMessage(ProtoMsgType.FromMsgEnum.LevelUpReq, {}, {}, self.onLevelUpFinish, BIReport.ITEM_GET_TYPE.PLAYER_LV_UP) self:sendMessage(ProtoMsgType.FromMsgEnum.LevelUpReq, {}, self.onLevelUpFinish, BIReport.ITEM_GET_TYPE.PLAYER_LV_UP)
end end
function PlayerManager:onLevelUpFinish(result) function PlayerManager:onLevelUpFinish(result)
@ -35,7 +35,7 @@ end
-- 修改昵称 -- 修改昵称
function PlayerManager:reqChangeNickname(changeName) function PlayerManager:reqChangeNickname(changeName)
self:sendMessage(ProtoMsgType.FromMsgEnum.ChangeNameReq, {name = changeName}, {}, self.respChangeNickname, BIReport.ITEM_GET_TYPE.CHANGE_NAME) self:sendMessage(ProtoMsgType.FromMsgEnum.ChangeNameReq, {name = changeName}, self.respChangeNickname, BIReport.ITEM_GET_TYPE.CHANGE_NAME)
end end
function PlayerManager:respChangeNickname(result) function PlayerManager:respChangeNickname(result)
@ -49,7 +49,7 @@ end
-- 修改头像 -- 修改头像
function PlayerManager:reqChangeAvatar(changeId) function PlayerManager:reqChangeAvatar(changeId)
self:sendMessage(ProtoMsgType.FromMsgEnum.ChangeAvatarReq, {id = changeId}, {}, self.respChangeAvatar, BIReport.ITEM_GET_TYPE.CHANGE_AVATAR) self:sendMessage(ProtoMsgType.FromMsgEnum.ChangeAvatarReq, {id = changeId}, self.respChangeAvatar, BIReport.ITEM_GET_TYPE.CHANGE_AVATAR)
end end
function PlayerManager:respChangeAvatar(result) function PlayerManager:respChangeAvatar(result)
@ -60,7 +60,7 @@ end
-- 修改头像框 -- 修改头像框
function PlayerManager:reqChangeFrame(changeId) function PlayerManager:reqChangeFrame(changeId)
self:sendMessage(ProtoMsgType.FromMsgEnum.ChangeAvatarFrameReq, {id = changeId}, {}, self.respChangeFrame, BIReport.ITEM_GET_TYPE.CHANGE_FRAME) self:sendMessage(ProtoMsgType.FromMsgEnum.ChangeAvatarFrameReq, {id = changeId}, self.respChangeFrame, BIReport.ITEM_GET_TYPE.CHANGE_FRAME)
end end
function PlayerManager:respChangeFrame(result) function PlayerManager:respChangeFrame(result)

View File

@ -21,7 +21,7 @@ end
-- 使用皮肤 -- 使用皮肤
function SkinManager:reqChangeSkin(heroId, skinId) function SkinManager:reqChangeSkin(heroId, skinId)
self:sendMessage(ProtoMsgType.FromMsgEnum.HeroChangeSkinReq, {id = heroId, skin_id = skinId}, {}, self.rspChangeSkin) self:sendMessage(ProtoMsgType.FromMsgEnum.HeroChangeSkinReq, {id = heroId, skin_id = skinId}, self.rspChangeSkin)
end end
function SkinManager:rspChangeSkin(result) function SkinManager:rspChangeSkin(result)

View File

@ -37,7 +37,7 @@ function SummonManager:onForceSummonReq(count, free, summonType)
args.times = count args.times = count
args.free = free args.free = free
args.id = summonType args.id = summonType
self:sendMessage(ProtoMsgType.FromMsgEnum.SummonReq, args, {}, self.onForceSummonRsp, BIReport.ITEM_GET_TYPE.FORCE_SUMMON) self:sendMessage(ProtoMsgType.FromMsgEnum.SummonReq, args, self.onForceSummonRsp, BIReport.ITEM_GET_TYPE.FORCE_SUMMON)
end end
function SummonManager:onForceSummonRsp(result) function SummonManager:onForceSummonRsp(result)
@ -77,7 +77,7 @@ end
--@endregion --@endregion
function SummonManager:onSummonWishSetReq(summonType, heroId) function SummonManager:onSummonWishSetReq(summonType, heroId)
self:sendMessage(ProtoMsgType.FromMsgEnum.SummonWishSetReq, {id = summonType, hero = heroId}, {}, self.onSummonWishSetRsp, self:sendMessage(ProtoMsgType.FromMsgEnum.SummonWishSetReq, {id = summonType, hero = heroId}, self.onSummonWishSetRsp,
BIReport.ITEM_GET_TYPE.FORCE_SUMMON_WISH_HREO_ID) BIReport.ITEM_GET_TYPE.FORCE_SUMMON_WISH_HREO_ID)
end end
@ -90,7 +90,7 @@ function SummonManager:onSummonWishSetRsp(result)
end end
function SummonManager:onSummonWishClaimReq(summonType) function SummonManager:onSummonWishClaimReq(summonType)
self:sendMessage(ProtoMsgType.FromMsgEnum.SummonWishClaimReq, {id = summonType}, {}, self.onSummonWishClaimRsp, self:sendMessage(ProtoMsgType.FromMsgEnum.SummonWishClaimReq, {id = summonType}, self.onSummonWishClaimRsp,
BIReport.ITEM_GET_TYPE.FORCE_SUMMON_WISH_HREO_ID) BIReport.ITEM_GET_TYPE.FORCE_SUMMON_WISH_HREO_ID)
end end

View File

@ -10,7 +10,7 @@ end
function TalentManager:talentUpgrade() function TalentManager:talentUpgrade()
local args = {} local args = {}
self:sendMessage(ProtoMsgType.FromMsgEnum.TalentUpgradeReq, args, {}, self.onTalentUpgradeRsp, BIReport.ITEM_GET_TYPE.BOUNTY_REWARD) self:sendMessage(ProtoMsgType.FromMsgEnum.TalentUpgradeReq, args, self.onTalentUpgradeRsp, BIReport.ITEM_GET_TYPE.BOUNTY_REWARD)
end end
function TalentManager:onTalentUpgradeRsp(result) function TalentManager:onTalentUpgradeRsp(result)

View File

@ -20,7 +20,7 @@ function TaskManager:onTaskDailyStageRewardReq(dailyTaskId)
local parmas = {} local parmas = {}
parmas.id = 0 parmas.id = 0
-- parmas.type = 1 -- parmas.type = 1
self:sendMessage(ProtoMsgType.FromMsgEnum.TaskDailyStageRewardReq, parmas, {}, self.onTaskDailyStageRewardRsp, BIReport.ITEM_GET_TYPE.TASK_DAILY_REFRESH) self:sendMessage(ProtoMsgType.FromMsgEnum.TaskDailyStageRewardReq, parmas, self.onTaskDailyStageRewardRsp, BIReport.ITEM_GET_TYPE.TASK_DAILY_REFRESH)
end end
function TaskManager:onTaskDailyStageRewardRsp(result) function TaskManager:onTaskDailyStageRewardRsp(result)
@ -40,7 +40,7 @@ function TaskManager:claimDailyTask(dailyTaskId)
-- id = dailyTaskId, -- id = dailyTaskId,
id = 0, id = 0,
} }
self:sendMessage(ProtoMsgType.FromMsgEnum.TaskDailyRewardReq, parmas, {}, self.onDailyTaskClaim, BIReport.ITEM_GET_TYPE.TASK_DAILY_REWARD) self:sendMessage(ProtoMsgType.FromMsgEnum.TaskDailyRewardReq, parmas, self.onDailyTaskClaim, BIReport.ITEM_GET_TYPE.TASK_DAILY_REWARD)
end end
function TaskManager:onDailyTaskClaim(result) function TaskManager:onDailyTaskClaim(result)
@ -60,7 +60,7 @@ function TaskManager:resetDailyTask()
return return
end end
DataManager.DailyTaskData:setInReset(true) DataManager.DailyTaskData:setInReset(true)
self:sendMessage(ProtoMsgType.FromMsgEnum.TaskDailyInfoReq, {}, {}, self.onResetDailyTask, BIReport.ITEM_GET_TYPE.NONE) self:sendMessage(ProtoMsgType.FromMsgEnum.TaskDailyInfoReq, {}, self.onResetDailyTask, BIReport.ITEM_GET_TYPE.NONE)
end end
function TaskManager:onResetDailyTask(result) function TaskManager:onResetDailyTask(result)
@ -72,7 +72,7 @@ end
function TaskManager:watchTaskSpecialAd() function TaskManager:watchTaskSpecialAd()
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.TASK_DAILY_TASK, function() SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.TASK_DAILY_TASK, function()
self:sendMessage(ProtoMsgType.FromMsgEnum.TaskDailyAdReq, {}, {}, self.onWatchTaskSpecialAd, BIReport.ITEM_GET_TYPE.NONE) self:sendMessage(ProtoMsgType.FromMsgEnum.TaskDailyAdReq, {}, self.onWatchTaskSpecialAd, BIReport.ITEM_GET_TYPE.NONE)
end) end)
end end
@ -156,7 +156,7 @@ function TaskManager:onTaskAchievementReq(taskId, stage)
-- 一键领取处理 -- 一键领取处理
taskId = nil taskId = nil
stage = nil stage = nil
self:sendMessage(ProtoMsgType.FromMsgEnum.TaskAchievementReq, {task_id = taskId, stage = stage}, {}, self.onTaskAchievementRsp, BIReport.ITEM_GET_TYPE.TASK_ACHIEVEMENT) self:sendMessage(ProtoMsgType.FromMsgEnum.TaskAchievementReq, {task_id = taskId, stage = stage}, self.onTaskAchievementRsp, BIReport.ITEM_GET_TYPE.TASK_ACHIEVEMENT)
end end
function TaskManager:onTaskAchievementRsp(result) function TaskManager:onTaskAchievementRsp(result)

View File

@ -23,7 +23,7 @@ function TutorialManager:sendTutorialId(id, callback)
self.sendTutorialIdCallback = callback self.sendTutorialIdCallback = callback
self:sendMessage(ProtoMsgType.FromMsgEnum.GuideFundMarkReq, args, {}, self.sendTutorialIdFinish) self:sendMessage(ProtoMsgType.FromMsgEnum.GuideFundMarkReq, args, self.sendTutorialIdFinish)
end end
function TutorialManager:sendTutorialIdFinish(result) function TutorialManager:sendTutorialIdFinish(result)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,363 @@
local SideBarComp = class("SideBarComp", LuaComponent)
local UIPrefabObject = require "app/bf/unity/uiprefab_object"
-- 侧边栏整体边距
local SIDE_BAR_NODE_INTERVAL_X = 10
-- 侧边栏每项间距
local SIDE_BAR_INTERVAL_X = 30
local SIDE_BAR_INTERVAL_Y = 45
function SideBarComp:onReshow()
self:checkSideBarOpenStatus()
end
function SideBarComp:updateTime()
self:updateSideBarStatus()
end
function SideBarComp:init()
local uiMap = self:getUIMap()
self.leftNode = uiMap["side_bar_comp.left_node"]
self.leftSideBar = uiMap["side_bar_comp.left_node.side_bar"]
self.leftArrow = uiMap["side_bar_comp.left_node.arrow"]
self.leftArrowRp = uiMap["side_bar_comp.left_node.arrow.rp"]
self.rightNode = uiMap["side_bar_comp.right_node"]
self.rightSideBar = uiMap["side_bar_comp.right_node.side_bar"]
self.rightArrow = uiMap["side_bar_comp.right_node.arrow"]
self.rightArrowRp = uiMap["side_bar_comp.right_node.arrow.rp"]
self.sideBarCacheRoot = uiMap["side_bar_comp.cache"]
self.sideBarCellObject = uiMap["side_bar_comp.cache.side_bar_base_cell"]
self.sideBarWidth, self.sideBarHeight = self.sideBarCellObject:fastGetSizeDelta()
self.sideBarHeight = self.sideBarHeight * 0.8
if GConst.UI_SCREEN_HEIGHT / GConst.UI_SCREEN_WIDTH >= 2 then
self.sideBarMaxCount = 5
else
self.sideBarMaxCount = 4
end
if self.showLeftSideBar == nil then
self.showLeftSideBar = true
end
if self.showRightSideBar == nil then
self.showRightSideBar = true
end
if self.leftBarList == nil then
self.leftBarList = {}
end
if self.rightBarList == nil then
self.rightBarList = {}
end
if self.sideBarCellCacheMap == nil then
self.sideBarCellCacheMap = {}
end
if self.sideBarCellAllMap == nil then
self.sideBarCellAllMap = {}
end
self.leftArrow:addClickListener(function()
self.showLeftSideBar = not self.showLeftSideBar
self:refreshLeftSideBars()
end)
self.rightArrow:addClickListener(function()
self.showRightSideBar = not self.showRightSideBar
self:refreshRightSideBars()
end)
-- self:bind(DataManager.PaymentData, "isDirty", function()
-- self:onReshow()
-- self:updateTime()
-- end)
-- self:bind(DataManager.SignWeekData, "isDirty", function()
-- self:updateTime()
-- end)
-- self:bind(DataManager.SignMonthData, "isDirty", function()
-- self:updateTime()
-- end)
end
function SideBarComp:refresh()
self:refreshLeftSideBars()
self:refreshRightSideBars()
self:updateSideBarStatus()
end
function SideBarComp:addSideBarCellComp(cellClassPath, parent)
local prefab = CS.UnityEngine.Object.Instantiate(self.sideBarCellObject:getGameObject())
local prefabObject = UIPrefabObject:create()
prefabObject:initWithPrefab(GConst.EMPTY_STRING, prefab)
prefabObject:initPrefabHelper()
prefabObject:genAllChildren()
prefabObject:setName(cellClassPath)
return prefabObject:addLuaComponent(cellClassPath)
end
function SideBarComp:clearSideBarList(sideBarList)
local count = #sideBarList
for i = 1, count do
local cell = table.remove(sideBarList)
cell:setActive(false)
cell:setVisible(false)
self.sideBarCellCacheMap[cell:getCellPath()] = cell
end
end
function SideBarComp:refreshLeftSideBars()
self:clearSideBarList(self.leftBarList)
self.leftArrow:setActive(false)
self.leftNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS)
local list = GConst.MainCityConst.LEFT_SIDE_BARS
if #list <= 0 then
return
end
local showCellCount = 0
local showArrowRedPoint = false
for index, path in ipairs(list) do
local cellClass = self.sideBarCellAllMap[path]
if cellClass == nil then
cellClass = require(path)
self.sideBarCellAllMap[path] = cellClass
end
if cellClass:checkIsOpen() then
showCellCount = showCellCount + 1
local cell = self.sideBarCellCacheMap[path]
if cell == nil then
cell = self:addSideBarCellComp(path)
cell:getBaseObject():setParent(self.leftSideBar, false)
cell:getBaseObject():setAnchorMin(0, 1)
cell:getBaseObject():setAnchorMax(0, 1)
end
cell:initWithParentUI(self, path, true)
table.insert(self.leftBarList, cell)
-- 侧边栏红点
if showCellCount > GConst.MainCityConst.SIDE_BAR_MIN_COUNT and cellClass:getIsShowRedPoint() then
showArrowRedPoint = true
end
end
end
local listCount = #self.leftBarList
if listCount <= 0 then
return
end
-- 刷新位置
self.leftNode:setAnchoredPositionX(SIDE_BAR_NODE_INTERVAL_X)
local initX = self.sideBarWidth/2
local addX = SIDE_BAR_INTERVAL_X + self.sideBarWidth
local initY = self.sideBarHeight/2
local addY = SIDE_BAR_INTERVAL_Y + self.sideBarHeight
local x = 100
for index, cell in ipairs(self.leftBarList) do
if self.showLeftSideBar or index <= GConst.MainCityConst.SIDE_BAR_MIN_COUNT then
local addMulX = math.floor((index - 1) / self.sideBarMaxCount)
local addMulY = (index - 1) % self.sideBarMaxCount
cell:setAnchoredPositionX(initX + addMulX * addX)
cell:setAnchoredPositionY(-(initY + addMulY * addY))
cell:refresh()
cell:setActive(true)
cell:setVisible(true)
if addMulX >= 1 and x <= 100 then
x = (addMulX + 1) * self.sideBarWidth + SIDE_BAR_INTERVAL_X + 14
end
else
cell:setActive(false)
cell:setVisible(false)
end
end
local y = 110
if listCount > GConst.MainCityConst.SIDE_BAR_MIN_COUNT then
self.leftArrow:setActive(true)
self.leftArrowRp:setVisible(false)
if self.showLeftSideBar then
local addMulY = ((listCount - 1) % self.sideBarMaxCount) + 1
if listCount > self.sideBarMaxCount then
addMulY = self.sideBarMaxCount
end
self.leftArrow:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_GRAPHIC_FLIP).horizontal = true
self.leftArrow:setAnchoredPositionY(-(initY + addMulY * addY) - 5)
y = initY + addMulY * addY - 10 + 27 + 14
else
self.leftArrow:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_GRAPHIC_FLIP).horizontal = false
self.leftArrow:setAnchoredPositionY(-(initY + GConst.MainCityConst.SIDE_BAR_MIN_COUNT * addY) + 10)
self.leftArrowRp:setVisible(showArrowRedPoint)
y = initY + GConst.MainCityConst.SIDE_BAR_MIN_COUNT * addY -10 + 27 + 14
end
end
self.leftNode:setSizeDelta(x, y)
end
function SideBarComp:refreshRightSideBars()
self:clearSideBarList(self.rightBarList)
self.rightArrow:setActive(false)
self.rightNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS)
local list = GConst.MainCityConst.RIGHT_SIDE_BARS
if #list <= 0 then
return
end
local showCellCount = 0
local showArrowRedPoint = false
for index, path in ipairs(list) do
local cellClass = self.sideBarCellAllMap[path]
if cellClass == nil then
cellClass = require(path)
self.sideBarCellAllMap[path] = cellClass
end
if cellClass:checkIsOpen() then
showCellCount = showCellCount + 1
local cell = self.sideBarCellCacheMap[path]
if cell == nil then
cell = self:addSideBarCellComp(path)
cell:getBaseObject():setParent(self.rightSideBar, false)
cell:getBaseObject():setAnchorMin(1, 1)
cell:getBaseObject():setAnchorMax(1, 1)
end
cell:initWithParentUI(self, path, false)
table.insert(self.rightBarList, cell)
-- 侧边栏红点
if showCellCount > GConst.MainCityConst.SIDE_BAR_MIN_COUNT and cellClass:getIsShowRedPoint() then
showArrowRedPoint = true
end
end
end
local listCount = #self.rightBarList
if listCount <= 0 then
return
end
-- 刷新位置
self.rightNode:setAnchoredPositionX(-SIDE_BAR_NODE_INTERVAL_X)
local initX = self.sideBarWidth/2
local addX = SIDE_BAR_INTERVAL_X + self.sideBarWidth
local initY = self.sideBarHeight/2
local addY = SIDE_BAR_INTERVAL_Y + self.sideBarHeight
local x = 100
for index, cell in ipairs(self.rightBarList) do
if self.showRightSideBar or index <= GConst.MainCityConst.SIDE_BAR_MIN_COUNT then
local addMulX = math.floor((index - 1) / self.sideBarMaxCount)
local addMulY = (index - 1) % self.sideBarMaxCount
cell:setAnchoredPositionX(-(initX + addMulX * addX))
cell:setAnchoredPositionY(-(initY + addMulY * addY))
cell:refresh()
cell:setActive(true)
cell:setVisible(true)
if addMulX >= 1 and x <= 100 then
x = (addMulX + 1) * self.sideBarWidth + SIDE_BAR_INTERVAL_X + 14
end
else
cell:setActive(false)
cell:setVisible(false)
end
end
local y = 110
if listCount > GConst.MainCityConst.SIDE_BAR_MIN_COUNT then
self.rightArrow:setActive(true)
self.rightArrowRp:setVisible(false)
if self.showRightSideBar then
local addMulY = ((listCount - 1) % self.sideBarMaxCount) + 1
if listCount > self.sideBarMaxCount then
addMulY = self.sideBarMaxCount
end
self.rightArrow:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_GRAPHIC_FLIP).horizontal = true
self.rightArrow:setAnchoredPositionY(-(initY + addMulY * addY) - 5)
y = initY + addMulY * addY - 10 + 27 + 14
else
self.rightArrow:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_GRAPHIC_FLIP).horizontal = false
self.rightArrow:setAnchoredPositionY(-(initY + GConst.MainCityConst.SIDE_BAR_MIN_COUNT * addY) + 10)
self.rightArrowRp:setVisible(showArrowRedPoint)
y = initY + GConst.MainCityConst.SIDE_BAR_MIN_COUNT * addY -10 + 27 + 14
end
end
self.rightNode:setSizeDelta(x, y)
end
function SideBarComp:updateSideBarStatus()
if self.leftBarList then
local refreshCount = self.showLeftSideBar and #self.leftBarList or GConst.MainCityConst.SIDE_BAR_MIN_COUNT
for i = 1, refreshCount do
local sideBarBtn = self.leftBarList[i]
if sideBarBtn then
if sideBarBtn:getIsShowRedPoint() then
sideBarBtn:showRedPoint()
else
sideBarBtn:hideRedPoint()
end
sideBarBtn:updateTime()
end
end
end
if self.rightBarList then
local refreshCount = self.showRightSideBar and #self.rightBarList or GConst.MainCityConst.SIDE_BAR_MIN_COUNT
for i = 1, refreshCount do
local sideBarBtn = self.rightBarList[i]
if sideBarBtn then
if sideBarBtn:getIsShowRedPoint() then
sideBarBtn:showRedPoint()
else
sideBarBtn:hideRedPoint()
end
sideBarBtn:updateTime()
end
end
end
end
-- 检查侧边栏功能开启
function SideBarComp:checkSideBarOpenStatus()
for k, CellClass in pairs(self.sideBarCellAllMap) do
local cell = self.sideBarCellCacheMap[k]
if cell and cell:getIsActive() then
if not CellClass:checkIsOpen() then
self:refreshLeftSideBars()
self:refreshRightSideBars()
end
else
if CellClass:checkIsOpen() then
self:refreshLeftSideBars()
self:refreshRightSideBars()
end
end
end
end
-- 获取侧边栏活动入口坐标
function SideBarComp:getSideBarActIconPos(moduleKey)
for name, cell in pairs(self.leftBarList) do
if moduleKey == cell:getModuleKey() then
return cell:getBaseObject():getPosition()
end
end
for name, cell in pairs(self.rightBarList) do
if moduleKey == cell:getModuleKey() then
return cell:getBaseObject():getPosition()
end
end
return nil
end
function SideBarComp:closeSideBarBtn(isLeft)
if isLeft then
self:refreshLeftSideBars()
else
self:refreshRightSideBars()
end
end
return SideBarComp

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 1507e2acdab2e42ec8474c24a7ffb49c
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -2,19 +2,18 @@ local UIPrefabObject = require "app/bf/unity/uiprefab_object"
local MainCityUI = class("MainCityUI", BaseUI) local MainCityUI = class("MainCityUI", BaseUI)
local SIDE_BAR_BORDER_OFFSET = 22
local SIDE_BAR_INTERVAL = 28
local SIDE_BAR_ARROW_INTERVAL = 20
local BF_UI_HELPER = GConst.TYPEOF_UNITY_CLASS.BF_UI_HELPER local BF_UI_HELPER = GConst.TYPEOF_UNITY_CLASS.BF_UI_HELPER
local HERO_COMP = "app/ui/hero/hero_comp" local HERO_COMP = "app/ui/hero/hero_comp"
local MAIN_COMP = "app/ui/main_city/component/main_comp" local MAIN_COMP = "app/ui/main_city/component/main_comp"
local SHOP_COMP = "app/ui/shop/shop_comp" local SHOP_COMP = "app/ui/shop/shop_comp"
local DUNGEON_COMP = "app/ui/dungeon/dungeon_comp" local DUNGEON_COMP = "app/ui/dungeon/dungeon_comp"
local COMPANY_COMP = "app/ui/company/company_comp" local COMPANY_COMP = "app/ui/company/company_comp"
local SIDE_BAR_COMP = "app/ui/main_city/component/side_bar_comp"
local BOTTOM_BTN_CELL = "app/ui/main_city/cell/bottom_btn_cell" local BOTTOM_BTN_CELL = "app/ui/main_city/cell/bottom_btn_cell"
local MAIN_COMP_INEDX = 3
MainCityUI.CLICK_BTN_TYPE = { MainCityUI.CLICK_BTN_TYPE = {
[1] = "HOME", [1] = "HOME",
[2] = "HERO", [2] = "HERO",
@ -81,6 +80,7 @@ end
function MainCityUI:ctor(params) function MainCityUI:ctor(params)
self.isFirstEnter = params and params.isFirstEnter self.isFirstEnter = params and params.isFirstEnter
self.targetIndex = params and params.targetIndex self.targetIndex = params and params.targetIndex
self.selectedIndex = params and params.targetIndex or GConst.MainCityConst.BOTTOM_PAGE.MAIN
end end
function MainCityUI:onLoadRootComplete() function MainCityUI:onLoadRootComplete()
@ -96,13 +96,11 @@ function MainCityUI:onLoadRootComplete()
self:updateTime() self:updateTime()
self:scheduleGlobal(function() self:scheduleGlobal(function()
self:updateSideBarStatus()
self:updateTime() self:updateTime()
end, 1) end, 1)
end end
function MainCityUI:onRefresh() function MainCityUI:onRefresh()
self:refreshAllSideBars()
self:refreshSettingBtn() self:refreshSettingBtn()
end end
@ -111,15 +109,12 @@ function MainCityUI:onClose()
self.subComps = nil self.subComps = nil
end end
function MainCityUI:refreshAllSideBars()
self:refreshLeftBtns()
self:refreshRightBtns()
self:updateSideBarStatus()
end
function MainCityUI:onReshow() function MainCityUI:onReshow()
self:checkMainPop() self:checkMainPop()
self:checkSideBarOpenStatus() -- 检查目前没开的侧边栏功能是否有可以开启的
if self.sideBarComp then
self.sideBarComp:onReshow()
end
end end
function MainCityUI:onSetUIOrder() function MainCityUI:onSetUIOrder()
@ -195,21 +190,21 @@ function MainCityUI:_addListeners()
end) end)
self:addEventListener(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, function(params) self:addEventListener(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, function(params)
params = params or {} params = params or {}
local page = params.page or self.selectedInedx local page = params.page or self.selectedIndex
if page == GConst.MainCityConst.BOTTOM_PAGE.SHOP then if page == GConst.MainCityConst.BOTTOM_PAGE.SHOP then
if self.selectedInedx == page then -- 直接跳转 if self.selectedIndex == page then -- 直接跳转
if self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP] then if self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP] then
self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:switchPage(params.storeIdx) self.subComps[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:switchPage(params.storeIdx)
end end
end end
-- elseif page == GConst.MainCityConst.BOTTOM_PAGE.DUNGEON then -- elseif page == GConst.MainCityConst.BOTTOM_PAGE.DUNGEON then
-- if self.selectedInedx == page then -- 直接跳转 -- if self.selectedIndex == page then -- 直接跳转
-- if self.dungeonComp then -- if self.dungeonComp then
-- self.dungeonComp:refresh(params.dungeonModule) -- self.dungeonComp:refresh(params.dungeonModule)
-- end -- end
-- end -- end
-- elseif page == GConst.MainCityConst.BOTTOM_PAGE.MAIN then -- elseif page == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
-- if self.selectedInedx == page then -- 直接跳转 -- if self.selectedIndex == page then -- 直接跳转
-- if self.mainComp then -- if self.mainComp then
-- -- 跳转到精英 需要改变下最大关卡 -- -- 跳转到精英 需要改变下最大关卡
-- if self.showChapterModule and self.showChapterModule == GConst.MainCityConst.MAIN_CHAPTER_MODULE.TEAM then -- if self.showChapterModule and self.showChapterModule == GConst.MainCityConst.MAIN_CHAPTER_MODULE.TEAM then
@ -289,6 +284,13 @@ function MainCityUI:_bind()
end end
end end
end) end)
self:bind(DataManager.ActTimeData, "isDirty", function()
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
self.subComps[self.selectedIndex]:refresh()
end
self:checkMainPop()
self:refreshSideBarComp()
end)
self:bind(DataManager.AIHelperData, "isDirty", function() self:bind(DataManager.AIHelperData, "isDirty", function()
self:refreshSettingBtn() self:refreshSettingBtn()
end) end)
@ -398,6 +400,26 @@ function MainCityUI:refreshBottom(selectedIndex, playAnim)
else else
self:refreshBottomCell(false) self:refreshBottomCell(false)
end end
self:refreshSideBarComp()
end
function MainCityUI:refreshBottomBtns()
for page, cell in pairs(self.bottomCells) do
cell:refresh(page, self.selectedIndex)
end
end
function MainCityUI:refreshSideBarComp()
if self.sideBarComp == nil then
local uiMap = self.root:genAllChildren()
self.sideBarCompNode = uiMap["main_ui.side_bar_comp"]
self.sideBarCompNode:initPrefabHelper()
self.sideBarCompNode:genAllChildren()
self.sideBarComp = self.sideBarCompNode:addLuaComponent(SIDE_BAR_COMP)
end
self.sideBarCompNode:setActive(self:getIsInMainPage())
self.sideBarComp:refresh()
end end
function MainCityUI:refreshBottomCell(showAni) function MainCityUI:refreshBottomCell(showAni)
@ -406,6 +428,10 @@ function MainCityUI:refreshBottomCell(showAni)
end end
end end
function MainCityUI:getIsInMainPage()
return self.selectedIndex == MAIN_COMP_INEDX
end
function MainCityUI:initLeftRightBtns() function MainCityUI:initLeftRightBtns()
self.leftNode = self.uiMap["main_ui.left_node"] self.leftNode = self.uiMap["main_ui.left_node"]
self.leftSideBar = self.uiMap["main_ui.left_node.side_bar"] self.leftSideBar = self.uiMap["main_ui.left_node.side_bar"]
@ -435,300 +461,6 @@ function MainCityUI:initLeftRightBtns()
self:openOrCloseRightSideBar() self:openOrCloseRightSideBar()
end) end)
self.rightArrowImg = self.uiMap["main_ui.right_node.arrow_node.arrow"] self.rightArrowImg = self.uiMap["main_ui.right_node.arrow_node.arrow"]
self.sideBarCellObject = self.uiMap["main_ui.cache_node.side_bar_base_cell"]
local w, h = self.sideBarCellObject:fastGetSizeDelta()
self.sideBarHeight = h
self.sideBarMaxCount = 4
if self.leftBarList == nil then
self.leftBarList = {}
end
if self.rightBarList == nil then
self.rightBarList = {}
end
if self.sideBarClassMap == nil then
self.sideBarClassMap = {}
end
if self.sideBarCellMap == nil then
self.sideBarCellMap = {}
end
self:recycleSideBarCells(self.leftSideBar)
self:recycleSideBarCells(self.rightSideBar)
end
function MainCityUI:recycleSideBarCells(list)
local childList = list:getChildList()
if childList and #childList > 0 then
local count = #childList
for i = count, 1, -1 do
local child = childList[i]
local name = child:getName()
if name and name ~= "" then
child:setVisible(false)
self.sideBarCellMap[name] = child:getLuaComponent(name)
else
child:destroy()
table.remove(childList, i)
end
end
end
end
function MainCityUI:addSideBarCellComp(cellClassPath)
local prefab = CS.UnityEngine.Object.Instantiate(self.sideBarCellObject:getGameObject())
local prefabObject = UIPrefabObject:create()
prefabObject:initWithPrefab(GConst.EMPTY_STRING, prefab)
prefabObject:initPrefabHelper()
prefabObject:genAllChildren()
prefabObject:setName(cellClassPath)
return prefabObject:addLuaComponent(cellClassPath)
end
function MainCityUI:openOrCloseLeftSideBar()
ModuleManager.MaincityManager:changeMainCityLeftSideBarOpenOrClose()
if self.isShowLeftSideBarArrowRedPoint ~= nil then
local isShowLeftSideBarArrowRedPoint = self.isShowLeftSideBarArrowRedPoint
self.isShowLeftSideBarArrowRedPoint = nil
self:setLeftSideBarArrowRedPoint(isShowLeftSideBarArrowRedPoint)
end
end
function MainCityUI:refreshLeftBtns()
self:clearSideBarList(self.leftBarList)
local list = GConst.MainCityConst.LEFT_SIDE_BARS
if #list <= 0 then
return
end
local isClose = ModuleManager.MaincityManager:getIsMainCityLeftSideBarClose()
for k, v in ipairs(list) do
local CellClass = self.sideBarClassMap[v]
if CellClass == nil then
CellClass = require(v)
self.sideBarClassMap[v] = CellClass
end
if CellClass:checkIsOpen() then
local cell = self.sideBarCellMap[v]
if cell == nil then
cell = self:addSideBarCellComp(v)
cell:getBaseObject():setParent(self.leftSideBar, false)
cell:getBaseObject():setAnchorMin(0, 1)
cell:getBaseObject():setAnchorMax(0, 1)
end
cell:initWithParentUI(self, v, true)
table.insert(self.leftBarList, cell)
end
end
local sideBarShowCount = #self.leftBarList
if sideBarShowCount <= 0 then
self.leftNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS)
return
end
self.leftNode:setAnchoredPositionX(0)
local y = -SIDE_BAR_BORDER_OFFSET - self.sideBarHeight/2
local x = 60
local maxCount = self.sideBarMaxCount
local minY = y
local bgSizeX = 112
local otherColumn = false
if isClose then -- 只显示3个
local minCount = GConst.MainCityConst.SIDE_BAR_MIN_COUNT
for i = 1, minCount do
local sideBarBtn = self.leftBarList[i]
if i <= sideBarShowCount then
sideBarBtn:setAnchoredPositionX(x)
sideBarBtn:setAnchoredPositionY(y)
sideBarBtn:refresh()
sideBarBtn:setActive(true)
sideBarBtn:setVisible(true)
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
if minY > y then
minY = y
end
end
end
for i = minCount + 1, sideBarShowCount do
self.leftBarList[i]:refresh()
self.leftBarList[i]:setActive(true)
self.leftBarList[i]:setVisible(false)
end
else
for k, v in ipairs(self.leftBarList) do
if maxCount == 0 then -- 换行
y = -SIDE_BAR_BORDER_OFFSET - self.sideBarHeight/2
x = x + 110
bgSizeX = 228
otherColumn = true
end
maxCount = maxCount - 1
v:setAnchoredPositionX(x)
v:setAnchoredPositionY(y)
v:refresh()
v:setActive(true)
v:setVisible(true)
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
if minY > y then
minY = y
end
end
end
if sideBarShowCount <= GConst.MainCityConst.SIDE_BAR_MIN_COUNT then -- 小于3个不显示箭头
y = y + self.sideBarHeight / 2
if minY > y then
minY = y
end
self.leftSideBar:setSizeDeltaX(bgSizeX)
self.leftSideBar:setSizeDeltaY(-minY)
self.leftArrowBtn:stopClickAnimation()
self.leftArrowBtn:setVisible(false)
else
local arrowHeight = self.leftArrowBtn:getRectHeight()
y = y + self.sideBarHeight/2 - SIDE_BAR_ARROW_INTERVAL - arrowHeight
if minY > y then
minY = y
end
self.leftSideBar:setSizeDeltaX(bgSizeX)
self.leftSideBar:setSizeDeltaY(-minY)
self.leftArrowImg:setLocalScale(1, isClose and -1 or 1, 1)
self.leftArrowBtn:setVisible(true)
self.leftArrowBtn:setAnchoredPositionY(self.leftSideBar:fastGetAnchoredPositionY() + minY + arrowHeight/2 + SIDE_BAR_BORDER_OFFSET)
if otherColumn then
self.leftArrowBtn:setAnchoredPositionX(133)
else
self.leftArrowBtn:setAnchoredPositionX(73)
end
end
end
function MainCityUI:openOrCloseRightSideBar()
ModuleManager.MaincityManager:changeMainCityRightSideBarOpenOrClose()
if self.isShowRightSideBarArrowRedPoint ~= nil then
local isShowRightSideBarArrowRedPoint = self.isShowRightSideBarArrowRedPoint
self.isShowRightSideBarArrowRedPoint = nil
self:setRightSideBarArrowRedPoint(isShowRightSideBarArrowRedPoint)
end
end
function MainCityUI:refreshRightBtns()
self:clearSideBarList(self.rightBarList)
local list = GConst.MainCityConst.RIGHT_SIDE_BARS
if #list <= 0 then
return
end
local isClose = ModuleManager.MaincityManager:getIsMainCityRightSideBarClose()
for k, v in ipairs(list) do
local CellClass = self.sideBarClassMap[v]
if CellClass == nil then
CellClass = require(v)
self.sideBarClassMap[v] = CellClass
end
if CellClass:checkIsOpen() then
local cell = self.sideBarCellMap[v]
if cell == nil then
cell = self:addSideBarCellComp(v)
cell:getBaseObject():setParent(self.rightSideBar, false)
cell:getBaseObject():setAnchorMin(1, 1)
cell:getBaseObject():setAnchorMax(1, 1)
end
cell:initWithParentUI(self, v, false)
table.insert(self.rightBarList, cell)
end
end
local sideBarShowCount = #self.rightBarList
if #self.rightBarList <= 0 then
self.rightNode:setAnchoredPositionX(GConst.NOT_VISIBLE_POS)
return
end
self.rightNode:setAnchoredPositionX(0)
local y = -SIDE_BAR_BORDER_OFFSET - self.sideBarHeight/2
local x = -60
local maxCount = self.sideBarMaxCount
local minY = y
local bgSizeX = 112
local otherColumn = false
if isClose then -- 只显示一个
local minCount = GConst.MainCityConst.SIDE_BAR_MIN_COUNT
for i = 1, minCount do
local sideBarBtn = self.rightBarList[i]
if i <= sideBarShowCount then
sideBarBtn:setAnchoredPositionX(x)
sideBarBtn:setAnchoredPositionY(y)
sideBarBtn:refresh()
sideBarBtn:setActive(true)
sideBarBtn:setVisible(true)
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
if minY > y then
minY = y
end
end
end
for i = minCount + 1, sideBarShowCount do
self.rightBarList[i]:refresh()
self.rightBarList[i]:setActive(true)
self.rightBarList[i]:setVisible(false)
end
else
for k, v in ipairs(self.rightBarList) do
if maxCount == 0 then -- 换行
y = -SIDE_BAR_BORDER_OFFSET - self.sideBarHeight/2
x = x - 110
bgSizeX = 228
otherColumn = true
end
maxCount = maxCount - 1
v:setAnchoredPositionX(x)
v:setAnchoredPositionY(y)
v:refresh()
v:setActive(true)
v:setVisible(true)
y = y - self.sideBarHeight - SIDE_BAR_INTERVAL
if minY > y then
minY = y
end
end
end
if sideBarShowCount <= GConst.MainCityConst.SIDE_BAR_MIN_COUNT then
y = y + self.sideBarHeight / 2
y = y + self.sideBarHeight / 2
if minY > y then
minY = y
end
self.rightSideBar:setSizeDeltaX(bgSizeX)
self.rightSideBar:setSizeDeltaY(-minY)
self.rightArrowBtn:stopClickAnimation()
self.rightArrowBtn:setVisible(false)
else
local arrowHeight = self.rightArrowBtn:getRectHeight()
y = y + self.sideBarHeight / 2 - SIDE_BAR_ARROW_INTERVAL - arrowHeight
if minY > y then
minY = y
end
self.rightSideBar:setSizeDeltaX(bgSizeX)
self.rightSideBar:setSizeDeltaY(-minY)
self.rightArrowImg:setLocalScale(1, isClose and -1 or 1, 1)
self.rightArrowBtn:setVisible(true)
self.rightArrowBtn:setAnchoredPositionY(self.rightSideBar:fastGetAnchoredPositionY() + minY + arrowHeight/2 + SIDE_BAR_BORDER_OFFSET)
if otherColumn then
self.rightArrowBtn:setAnchoredPositionX(-133)
else
self.rightArrowBtn:setAnchoredPositionX(-73)
end
end
end
function MainCityUI:clearSideBarList(sideBarList)
local count = #sideBarList
for i = 1, count do
local cell = table.remove(sideBarList)
cell:setActive(false)
cell:setVisible(false)
self.sideBarCellMap[cell:getCellPath()] = cell
end
end
function MainCityUI:setSideBarVisible(visible)
self.leftNode:setVisible(visible)
self.rightNode:setVisible(visible)
end end
function MainCityUI:refreshPlayerInfo() function MainCityUI:refreshPlayerInfo()
@ -866,7 +598,6 @@ function MainCityUI:switchComp(index)
self:switchMainCompModule() self:switchMainCompModule()
else else
self:setTopNodeVisible(false) self:setTopNodeVisible(false)
self:setSideBarVisible(false)
end end
end end
@ -878,7 +609,6 @@ function MainCityUI:switchMainCompModule(moduleKey)
self.mainComp:refresh() self.mainComp:refresh()
self:checkMainPop() self:checkMainPop()
self:setTopNodeVisible(true) self:setTopNodeVisible(true)
self:setSideBarVisible(true)
self:refreshBounty() self:refreshBounty()
self:refreshPlayerInfo() self:refreshPlayerInfo()
UIManager:updateBarsState(self) UIManager:updateBarsState(self)
@ -888,142 +618,15 @@ function MainCityUI:updateTime()
if self.subComps[self.selectedIndex] and self.subComps[self.selectedIndex].refreshTime then if self.subComps[self.selectedIndex] and self.subComps[self.selectedIndex].refreshTime then
self.subComps[self.selectedIndex]:refreshTime() self.subComps[self.selectedIndex]:refreshTime()
end end
self.inSideBarUpdate = true if self.sideBarComp then
if self.leftBarList then self.sideBarComp:updateTime()
for k, v in ipairs(self.leftBarList) do end
v:updateTime()
end
end
if self.waitRefreshSideBar then
self:refreshLeftBtns()
self.waitRefreshSideBar = false
end
if self.rightBarList then
for k, v in ipairs(self.rightBarList) do
v:updateTime()
end
end
self.inSideBarUpdate = false
if self.waitRefreshSideBar then
self:refreshRightBtns()
self.waitRefreshSideBar = false
end
if DataManager.AIHelperData:getNeedReqTime() then if DataManager.AIHelperData:getNeedReqTime() then
ModuleManager.GameSettingManager:reqAiHelper() ModuleManager.GameSettingManager:reqAiHelper()
end end
end end
function MainCityUI:updateSideBarStatus()
if self.leftBarList then
local minCount = GConst.MainCityConst.SIDE_BAR_MIN_COUNT
for i = 1, minCount do
local sideBarBtn = self.leftBarList[i]
if sideBarBtn then
if sideBarBtn:getIsShowRedPoint() then
sideBarBtn:showRedPoint()
else
sideBarBtn:hideRedPoint()
end
end
end
local sideBarCount = #self.leftBarList
if sideBarCount > minCount then
local count = 0
for i = minCount + 1, sideBarCount do
if self.leftBarList[i]:getIsShowRedPoint() then
self.leftBarList[i]:showRedPoint()
count = count + 1
else
self.leftBarList[i]:hideRedPoint()
end
end
if count > 0 then
self:setLeftSideBarArrowRedPoint(true)
else
self:setLeftSideBarArrowRedPoint(false)
end
else
self:setLeftSideBarArrowRedPoint(false)
end
end
if self.rightBarList then
local minCount = GConst.MainCityConst.SIDE_BAR_MIN_COUNT
for i = 1, minCount do
local sideBarBtn = self.rightBarList[i]
if sideBarBtn then
if sideBarBtn:getIsShowRedPoint() then
sideBarBtn:showRedPoint()
else
sideBarBtn:hideRedPoint()
end
end
end
local sideBarCount = #self.rightBarList
if sideBarCount > minCount then
local count = 0
for i = minCount + 1, sideBarCount do
if self.rightBarList[i]:getIsShowRedPoint() then
self.rightBarList[i]:showRedPoint()
count = count + 1
else
self.rightBarList[i]:hideRedPoint()
end
end
if count > 0 then
self:setRightSideBarArrowRedPoint(true)
else
self:setRightSideBarArrowRedPoint(false)
end
else
self:setRightSideBarArrowRedPoint(false)
end
end
end
function MainCityUI:setLeftSideBarArrowRedPoint(isShow)
if self.isShowLeftSideBarArrowRedPoint == isShow then
return
end
if isShow then
if ModuleManager.MaincityManager:getIsMainCityLeftSideBarClose() then
self.leftArrowBtn:addRedPoint(19, 10, 1)
else
self.leftArrowBtn:removeRedPoint()
end
else
self.leftArrowBtn:removeRedPoint()
end
end
function MainCityUI:setRightSideBarArrowRedPoint(isShow)
if self.isShowRightSideBarArrowRedPoint == isShow then
return
end
if isShow then
if ModuleManager.MaincityManager:getIsMainCityRightSideBarClose() then
self.rightArrowBtn:addRedPoint(19, 10, 1)
else
self.rightArrowBtn:removeRedPoint()
end
else
self.rightArrowBtn:removeRedPoint()
end
end
function MainCityUI:closeSideBarBtn(isLeft)
if self.inSideBarUpdate then
self.waitRefreshSideBar = true
else
self.waitRefreshSideBar = false
if isLeft then
self:refreshLeftBtns()
else
self:refreshRightBtns()
end
end
end
function MainCityUI:refreshBottomRp() function MainCityUI:refreshBottomRp()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
local heroRpObj = uiMap["main_ui.bottom_node.icons.ui_spine_obj_2.rp_node"] local heroRpObj = uiMap["main_ui.bottom_node.icons.ui_spine_obj_2.rp_node"]
@ -1048,22 +651,6 @@ function MainCityUI:refreshSettingBtn()
end end
end end
function MainCityUI:checkSideBarOpenStatus()
-- 检查目前没开的侧边栏功能是否有可以开启的
for k, CellClass in pairs(self.sideBarClassMap) do
local cell = self.sideBarCellMap[k]
if cell and cell:getIsActive() then
if not CellClass:checkIsOpen() then
return self:refreshAllSideBars()
end
else
if CellClass:checkIsOpen() then
return self:refreshAllSideBars()
end
end
end
end
-- 弹窗优先级: 升级>功能弹窗>英雄解锁弹窗>礼包弹窗>引导 -- 弹窗优先级: 升级>功能弹窗>英雄解锁弹窗>礼包弹窗>引导
function MainCityUI:checkMainPop() function MainCityUI:checkMainPop()
-- 续关 -- 续关
@ -1345,17 +932,9 @@ function MainCityUI:getSummonIconPos()
end end
function MainCityUI:getSideBarActIconPos(moduleKey) function MainCityUI:getSideBarActIconPos(moduleKey)
for name, cell in pairs(self.leftBarList) do if self.sideBarComp and self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
if moduleKey == cell:getModuleKey() then return self.sideBarComp:getSideBarActIconPos(moduleKey)
return cell:getBaseObject():getPosition() end
end
end
for name, cell in pairs(self.rightBarList) do
if moduleKey == cell:getModuleKey() then
return cell:getBaseObject():getPosition()
end
end
return nil
end end
function MainCityUI:isInSideBarLeft(moduleKey) function MainCityUI:isInSideBarLeft(moduleKey)

View File

@ -4,7 +4,7 @@ local RECHARGE_CFG = ConfigManager:getConfig("recharge")
local PlayerExpCfg = ConfigManager:getConfig("player_exp") local PlayerExpCfg = ConfigManager:getConfig("player_exp")
function PlayerData:ctor() function PlayerData:ctor()
self.data.dirty = false self.data.isDirty = false
end end
function PlayerData:clear() function PlayerData:clear()
@ -58,7 +58,7 @@ function PlayerData:init(data)
self.lastLoginTime = basicInfo.lastLoginTime or Time:getBeginningOfServerToday() self.lastLoginTime = basicInfo.lastLoginTime or Time:getBeginningOfServerToday()
DataManager:registerCrossDayFunc("PlayerData", function() DataManager:registerCrossDayFunc("PlayerData", function()
self:resetOnCrossDay() self:resetOnCrossDay()
self:markDirty() self:setDirty()
end) end)
self.createTime = basicInfo.create_at or 0 -- 创角时间 self.createTime = basicInfo.create_at or 0 -- 创角时间
@ -98,10 +98,19 @@ function PlayerData:resetOnCrossDay()
self.data.arenaTicketADCount = 0 self.data.arenaTicketADCount = 0
end end
function PlayerData:markDirty() function PlayerData:setDirty()
self.data.dirty = not self.data.dirty self.data.dirty = not self.data.dirty
end end
function PlayerData:getAuthInfo()
return self.auth
end
function PlayerData:setAuthInfo(authInfo)
self.auth = authInfo or {}
self:setDirty()
end
function PlayerData:setVit(vit) function PlayerData:setVit(vit)
self.vit = vit self.vit = vit
end end
@ -126,7 +135,7 @@ function PlayerData:addExp(exp)
if self.data.level >= self:getMaxLv() then if self.data.level >= self:getMaxLv() then
return return
end end
self:markDirty() self:setDirty()
end end
function PlayerData:setLv(level, exp) function PlayerData:setLv(level, exp)
@ -134,7 +143,7 @@ function PlayerData:setLv(level, exp)
self.data.level = level self.data.level = level
self.data.exp = exp self.data.exp = exp
self.lvUpNeedExp = self:getNextExp(self.data.level) self.lvUpNeedExp = self:getNextExp(self.data.level)
self:markDirty() self:setDirty()
local data = {} local data = {}
data.player_level = self.data.level data.player_level = self.data.level
@ -269,7 +278,7 @@ end
function PlayerData:setNickname(name) function PlayerData:setNickname(name)
self.data.playInfo.nickName = name self.data.playInfo.nickName = name
self.data.playInfo.nameChanged = true self.data.playInfo.nameChanged = true
self:markDirty() self:setDirty()
end end
-- 是否可以免费修改昵称 -- 是否可以免费修改昵称
@ -292,7 +301,7 @@ end
-- 设置玩家使用的头像 -- 设置玩家使用的头像
function PlayerData:setAvatarUsing(id) function PlayerData:setAvatarUsing(id)
self.data.playInfo.usingAvatarId = id self.data.playInfo.usingAvatarId = id
self:markDirty() self:setDirty()
end end
-- 获取头像icon id -- 获取头像icon id
@ -357,7 +366,7 @@ function PlayerData:setNewAvatarStatus(id, isNew)
table.removebyvalue(newIds.avatar, id, true) table.removebyvalue(newIds.avatar, id, true)
end end
LocalData:setNewAvatarAndFrame(newIds) LocalData:setNewAvatarAndFrame(newIds)
self:markDirty() self:setDirty()
end end
-- 是否显示头像(已解锁+未解锁可显示) -- 是否显示头像(已解锁+未解锁可显示)
@ -441,7 +450,7 @@ end
-- 设置玩家使用的头像框 -- 设置玩家使用的头像框
function PlayerData:setFrameUsing(id) function PlayerData:setFrameUsing(id)
self.data.playInfo.usingFrameId = id self.data.playInfo.usingFrameId = id
self:markDirty() self:setDirty()
end end
-- 获取框icon id -- 获取框icon id
@ -506,7 +515,7 @@ function PlayerData:setNewFrameStatus(id, isNew)
table.removebyvalue(newIds.frame, id, true) table.removebyvalue(newIds.frame, id, true)
end end
LocalData:setNewAvatarAndFrame(newIds) LocalData:setNewAvatarAndFrame(newIds)
self:markDirty() self:setDirty()
end end
-- 是否显示头像框(已解锁+未解锁可显示) -- 是否显示头像框(已解锁+未解锁可显示)