主界面图标
This commit is contained in:
parent
c41b85349a
commit
0736e58c5f
@ -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()
|
||||||
|
|||||||
@ -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",-- 跨天
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
||||||
@ -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
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
-- 响应扫荡碎片副本
|
-- 响应扫荡碎片副本
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
)
|
)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
@ -10,13 +10,14 @@ local NetManager =
|
|||||||
mainReconnectWaitTime = 0,
|
mainReconnectWaitTime = 0,
|
||||||
sendQueue = {},
|
sendQueue = {},
|
||||||
tillBeforeOverCount = 0,
|
tillBeforeOverCount = 0,
|
||||||
msgId = 0
|
msgId = 0,
|
||||||
|
lastReceiveTime = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
local CSApplication = CS.UnityEngine.Application
|
local CSApplication = CS.UnityEngine.Application
|
||||||
local CSNotReachable = CS.UnityEngine.NetworkReachability.NotReachable
|
local CSNotReachable = CS.UnityEngine.NetworkReachability.NotReachable
|
||||||
|
|
||||||
local MAX_CHAT_WAIT_TIME = 16
|
local MAX_CHAT_WAIT_TIME = 64
|
||||||
local MAX_MAIN_WAIT_TIME = 10
|
local MAX_MAIN_WAIT_TIME = 10
|
||||||
local JOIN_CHAT_INTERVAL = 15
|
local JOIN_CHAT_INTERVAL = 15
|
||||||
local TILL_BEFORE_INTERVAL = 0.5
|
local TILL_BEFORE_INTERVAL = 0.5
|
||||||
@ -39,11 +40,13 @@ NetManager.LOGIN_TYPE = {
|
|||||||
GOOGLE = "google",
|
GOOGLE = "google",
|
||||||
APPLE = "apple",
|
APPLE = "apple",
|
||||||
FACEBOOK = "facebook",
|
FACEBOOK = "facebook",
|
||||||
|
FACEBOOK_LIMITED = "facebook_limited",
|
||||||
|
VKID = "vk",
|
||||||
}
|
}
|
||||||
|
|
||||||
function NetManager:getGate()
|
function NetManager:getGate()
|
||||||
if EDITOR_MODE then
|
if EDITOR_MODE then
|
||||||
return "https://entrance.wdd817.link"
|
return "http://game.juzugame.com:3000"
|
||||||
else
|
else
|
||||||
return "https://d3ksek7t8d0wbt.cloudfront.net/"
|
return "https://d3ksek7t8d0wbt.cloudfront.net/"
|
||||||
end
|
end
|
||||||
@ -52,7 +55,7 @@ end
|
|||||||
function NetManager:init(callback)
|
function NetManager:init(callback)
|
||||||
self.chatReconnectWaitTime = 1
|
self.chatReconnectWaitTime = 1
|
||||||
|
|
||||||
CS.BF.BFMain.Instance.NetMgr:InitNetClientCount(1) -- 只有主链接,没有聊天,但是聊天逻辑先不删
|
CS.BF.BFMain.Instance.NetMgr:InitNetClientCount(2)
|
||||||
if self.initSucc then
|
if self.initSucc then
|
||||||
if callback then
|
if callback then
|
||||||
return callback()
|
return callback()
|
||||||
@ -112,6 +115,7 @@ function NetManager:connect(domain, port, callback, socketName)
|
|||||||
|
|
||||||
if socketName == NetManager.MAIN_SOCKET_NAME then
|
if socketName == NetManager.MAIN_SOCKET_NAME then
|
||||||
UIManager:showWaitNet(true)
|
UIManager:showWaitNet(true)
|
||||||
|
self.alreadyClose = false
|
||||||
end
|
end
|
||||||
|
|
||||||
self.connectIPMap[socketName] = ""
|
self.connectIPMap[socketName] = ""
|
||||||
@ -137,7 +141,6 @@ function NetManager:connect(domain, port, callback, socketName)
|
|||||||
if DataManager.ChatData then
|
if DataManager.ChatData then
|
||||||
DataManager.ChatData:onConnect()
|
DataManager.ChatData:onConnect()
|
||||||
end
|
end
|
||||||
self:joinChatChannel()
|
|
||||||
end
|
end
|
||||||
if callback then
|
if callback then
|
||||||
callback()
|
callback()
|
||||||
@ -145,18 +148,19 @@ function NetManager:connect(domain, port, callback, socketName)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
CS.BF.BFMain.Instance.NetMgr:AddLuaOnDisconnected(function(name)
|
CS.BF.BFMain.Instance.NetMgr:AddLuaOnDisconnected(function(name)
|
||||||
-- self:onDisconnect(name)
|
Logger.log("[NetManager]disconnected:%s", name)
|
||||||
self:disconnectAndReconnect()
|
self:onDisconnect(name)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
CS.BF.BFMain.Instance.NetMgr:AddLuaOnReceiveMessage(function(name, group, recvId, bytes)
|
CS.BF.BFMain.Instance.NetMgr:AddLuaOnReceiveMessage(function(name, group, recvId, bytes)
|
||||||
if name == NetManager.MAIN_SOCKET_NAME then
|
if name == NetManager.MAIN_SOCKET_NAME then
|
||||||
|
self.lastReceiveTime = Time:getServerTime()
|
||||||
self.recvId = recvId
|
self.recvId = recvId
|
||||||
if self.reconnectMainFlag then -- 如果是在重连状态下收到消息就设置下重连所需要的数据
|
if self.reconnectMainFlag then -- 如果是在重连状态下收到消息就设置下重连所需要的数据
|
||||||
self:setReconnectData()
|
self:setReconnectData()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:onReceive(group, bytes)
|
self:onReceive(group, bytes, name)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
CS.BF.BFMain.Instance.NetMgr:AddLuaOnError(function(name, errorCode, errorMsg)
|
CS.BF.BFMain.Instance.NetMgr:AddLuaOnError(function(name, errorCode, errorMsg)
|
||||||
@ -165,14 +169,21 @@ function NetManager:connect(domain, port, callback, socketName)
|
|||||||
|
|
||||||
CS.BF.BFMain.Instance.NetMgr:AddLuaOnReconnectSuccess(function(name)
|
CS.BF.BFMain.Instance.NetMgr:AddLuaOnReconnectSuccess(function(name)
|
||||||
Logger.log("[NetManager]reconnect succes:%s", name)
|
Logger.log("[NetManager]reconnect succes:%s", name)
|
||||||
if self.receiveCallbacks["ChapterSettlementRsp"] then -- 处理一下重发问题
|
|
||||||
if #self.receiveCallbacks["ChapterSettlementRsp"] > 0 then
|
|
||||||
self.receiveCallbacks["ChapterSettlementRsp"] = nil
|
if name == NetManager.MAIN_SOCKET_NAME then
|
||||||
self.isSending = false
|
local count = 0
|
||||||
|
for msg, list in pairs(self.receiveCallbacks) do
|
||||||
|
for k, v in ipairs(list) do
|
||||||
|
if v.socketName == NetManager.MAIN_SOCKET_NAME then
|
||||||
|
count = 1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if count <= 0 then -- 没有正在等待回复的消息,检测如果有断线时的缓存消息,则直接发送
|
||||||
self:trySend()
|
self:trySend()
|
||||||
end
|
end
|
||||||
end
|
|
||||||
if name == NetManager.MAIN_SOCKET_NAME then
|
|
||||||
if self.reconnectMainId then
|
if self.reconnectMainId then
|
||||||
SchedulerManager:unscheduleGlobal(self.reconnectMainId)
|
SchedulerManager:unscheduleGlobal(self.reconnectMainId)
|
||||||
self.reconnectMainId = nil
|
self.reconnectMainId = nil
|
||||||
@ -193,7 +204,7 @@ function NetManager:connect(domain, port, callback, socketName)
|
|||||||
durationTime = Time:getServerTime() - self.disconnectTime
|
durationTime = Time:getServerTime() - self.disconnectTime
|
||||||
self.disconnectTime = nil
|
self.disconnectTime = nil
|
||||||
end
|
end
|
||||||
BIReport:postNetWorkOpt(BIReport.NETWORK_OPT_TYPE.RECONNECT, UIManager:getTopUIIndex(), nil, durationTime)
|
BIReport:postNetWorkOpt(BIReport.NETWORK_OPT_TYPE.RECONNECT, UIManager:getTopUIIndex(), nil, nil,durationTime)
|
||||||
else
|
else
|
||||||
self.chatReconnectWaitTime = 1
|
self.chatReconnectWaitTime = 1
|
||||||
if self.reconnectChatId then
|
if self.reconnectChatId then
|
||||||
@ -207,7 +218,6 @@ function NetManager:connect(domain, port, callback, socketName)
|
|||||||
if DataManager.ChatData then
|
if DataManager.ChatData then
|
||||||
DataManager.ChatData:onConnect()
|
DataManager.ChatData:onConnect()
|
||||||
end
|
end
|
||||||
self:joinChatChannel()
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -224,9 +234,18 @@ function NetManager:connect(domain, port, callback, socketName)
|
|||||||
return pb.decode(fullMsgName, data)
|
return pb.decode(fullMsgName, data)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
if name == NetManager.MAIN_SOCKET_NAME then
|
||||||
if ok and pbData then
|
if ok and pbData then
|
||||||
pbData.status = not pbData.err_code and 0 or ProtoMsgDispatch:getErrCodeEnum(pbData.err_code)
|
pbData.status = not pbData.err_code and 0 or ProtoMsgDispatch:getErrCodeEnum(pbData.err_code)
|
||||||
if pbData.status ~= 0 then
|
if pbData.status ~= 0 then
|
||||||
|
if pbData.err_code == GConst.ERROR_STR.COUNTRY_NOT_ALLOWED then -- ip限制
|
||||||
|
local taData = {
|
||||||
|
ip_limit = true
|
||||||
|
}
|
||||||
|
BIReport:TAUserSet(taData)
|
||||||
|
BIReport:postIpLimit()
|
||||||
|
end
|
||||||
|
|
||||||
local lastLoginInfo = LocalData:getLastLoginInfo()
|
local lastLoginInfo = LocalData:getLastLoginInfo()
|
||||||
BIReport:postPbAuthfailed(ProtoMsgType.FromMsgEnum.AuthReq, lastLoginInfo, self.authFailToLogin)
|
BIReport:postPbAuthfailed(ProtoMsgType.FromMsgEnum.AuthReq, lastLoginInfo, self.authFailToLogin)
|
||||||
if self.autoReAuthSid then
|
if self.autoReAuthSid then
|
||||||
@ -253,6 +272,12 @@ function NetManager:connect(domain, port, callback, socketName)
|
|||||||
elseif accountInfo.apple_id and accountInfo.apple_id ~= "" then
|
elseif accountInfo.apple_id and accountInfo.apple_id ~= "" then
|
||||||
loginType = SDKManager.BF_LOGIN_TYPE.APPLE
|
loginType = SDKManager.BF_LOGIN_TYPE.APPLE
|
||||||
lastLoginType = NetManager.LOGIN_TYPE.APPLE
|
lastLoginType = NetManager.LOGIN_TYPE.APPLE
|
||||||
|
elseif accountInfo.facebook_id and accountInfo.facebook_id ~= "" then
|
||||||
|
loginType = SDKManager.BF_LOGIN_TYPE.FACEBOOK
|
||||||
|
lastLoginType = SDKManager:getLoginTypeFacebook()
|
||||||
|
elseif accountInfo.vk_id and accountInfo.vk_id ~= "" then
|
||||||
|
loginType = SDKManager.BF_LOGIN_TYPE.VKID
|
||||||
|
lastLoginType = NetManager.LOGIN_TYPE.VKID
|
||||||
end
|
end
|
||||||
if loginType then
|
if loginType then
|
||||||
SDKManager:login(function(params)
|
SDKManager:login(function(params)
|
||||||
@ -273,7 +298,7 @@ function NetManager:connect(domain, port, callback, socketName)
|
|||||||
LocalData:setLastLoginInfo()
|
LocalData:setLastLoginInfo()
|
||||||
ModuleManager.LoginManager:saveAuthArgs(false)
|
ModuleManager.LoginManager:saveAuthArgs(false)
|
||||||
local params = {
|
local params = {
|
||||||
content = I18N:getGlobalText(I18N.GlobalConst.DISCONNECT_RELOGIN),
|
content = I18N:getGlobalText(I18N.GlobalConst.DISCONNECT_DESC_1),
|
||||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||||
noShowClose = true,
|
noShowClose = true,
|
||||||
okFunc = function()
|
okFunc = function()
|
||||||
@ -300,7 +325,8 @@ function NetManager:connect(domain, port, callback, socketName)
|
|||||||
if pbData.id then -- 重连也会走到这儿,但是没有token等信息
|
if pbData.id then -- 重连也会走到这儿,但是没有token等信息
|
||||||
LocalData:setLastLoginInfo(NetManager.LOGIN_TYPE.TOKEN, pbData.id, pbData.token)
|
LocalData:setLastLoginInfo(NetManager.LOGIN_TYPE.TOKEN, pbData.id, pbData.token)
|
||||||
LocalData:setAccountInfo(pbData)
|
LocalData:setAccountInfo(pbData)
|
||||||
BIReport:updateAccountId(pbData.id)
|
DataManager.PlayerData:setAuthInfo(pbData)
|
||||||
|
DataManager:setAuthInfo(pbData)
|
||||||
end
|
end
|
||||||
|
|
||||||
pbData.send_id = pbData.send_id or 0
|
pbData.send_id = pbData.send_id or 0
|
||||||
@ -310,12 +336,27 @@ function NetManager:connect(domain, port, callback, socketName)
|
|||||||
CS.BF.BFMain.Instance.NetMgr.decodeFinish = true
|
CS.BF.BFMain.Instance.NetMgr.decodeFinish = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
if ok and pbData then
|
||||||
|
pbData.status = not pbData.err_code and 0 or ProtoMsgDispatch:getErrCodeEnum(pbData.err_code)
|
||||||
|
if pbData.status == 0 then
|
||||||
|
CS.BF.BFMain.Instance.NetMgr.decodeChatPbStr = json.encode(pbData)
|
||||||
|
CS.BF.BFMain.Instance.NetMgr.rspChatGroup = group
|
||||||
|
CS.BF.BFMain.Instance.NetMgr.decodeChatFinish = true
|
||||||
|
self:joinChatChannel()
|
||||||
|
else
|
||||||
|
self:disconnect(name)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:disconnect(name)
|
||||||
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
CS.BF.BFMain.Instance.NetMgr:SetLuaAuthCallback(function(isSuccess)
|
CS.BF.BFMain.Instance.NetMgr:SetLuaAuthCallback(function(isSuccess)
|
||||||
if not isSuccess then
|
if not isSuccess then
|
||||||
local params = {
|
local params = {
|
||||||
content = I18N:getGlobalText(I18N.GlobalConst.DISCONNECT_RELOGIN),
|
content = I18N:getGlobalText(I18N.GlobalConst.DISCONNECT_DESC_1),
|
||||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||||
noShowClose = true,
|
noShowClose = true,
|
||||||
okFunc = function()
|
okFunc = function()
|
||||||
@ -376,8 +417,12 @@ function NetManager:getConnectIP(socketName)
|
|||||||
return CS.BF.BFMain.Instance.NetMgr:GetConnectIP(socketName)
|
return CS.BF.BFMain.Instance.NetMgr:GetConnectIP(socketName)
|
||||||
end
|
end
|
||||||
|
|
||||||
function NetManager:_sendBytes(clientName, bytes, group, cmd)
|
function NetManager:_sendBytes(clientName, bytes, group, cmd, noRsp)
|
||||||
|
if clientName ~= NetManager.CHAT_SOCKET_NAME then
|
||||||
|
if not noRsp then
|
||||||
self.isSending = true
|
self.isSending = true
|
||||||
|
end
|
||||||
|
end
|
||||||
CS.BF.BFMain.Instance.NetMgr:Send(clientName, group, cmd, bytes)
|
CS.BF.BFMain.Instance.NetMgr:Send(clientName, group, cmd, bytes)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -400,36 +445,81 @@ end
|
|||||||
function NetManager:saveChatAuthArgs(token)
|
function NetManager:saveChatAuthArgs(token)
|
||||||
local msgFullName = ProtoMsgDispatch:getMsgFullNameByMsgName(ProtoMsgType.FromMsgEnum.ChatAuthReq)
|
local msgFullName = ProtoMsgDispatch:getMsgFullNameByMsgName(ProtoMsgType.FromMsgEnum.ChatAuthReq)
|
||||||
local args = {
|
local args = {
|
||||||
id = DataManager.PlayerData:getUid(),
|
id = DataManager.PlayerData:getPlayerId(),
|
||||||
token = token
|
token = token
|
||||||
}
|
}
|
||||||
CS.BF.BFMain.Instance.NetMgr.ChatAuthReqData = pb.encode(msgFullName, args)
|
CS.BF.BFMain.Instance.NetMgr.ChatAuthReqData = pb.encode(msgFullName, args)
|
||||||
end
|
end
|
||||||
|
|
||||||
function NetManager:send(binder, msgName, params, responseData, callback, lockGame, noRsp, getType)
|
function NetManager:sendChat(binder, msgName, params, callback)
|
||||||
if responseData.rewards then
|
if self.alreadyClose then
|
||||||
responseData.rewards = GFunc.formatRewardsToServerStruct(responseData.rewards)
|
return
|
||||||
end
|
end
|
||||||
if responseData.costs then
|
local socketName = NetManager.CHAT_SOCKET_NAME
|
||||||
responseData.costs = GFunc.formatRewardsToServerStruct(responseData.costs)
|
if self:isDisconnected(socketName) then
|
||||||
|
self:disconnect(socketName)
|
||||||
|
return
|
||||||
end
|
end
|
||||||
responseData.err_code = GConst.ERROR_STR.SUCCESS
|
Logger.log("===onSendChat===:%s", msgName)
|
||||||
self:_send(binder, msgName, params, responseData, callback, lockGame, noRsp, getType)
|
local msgFullName = ProtoMsgDispatch:getMsgFullNameByMsgName(msgName)
|
||||||
|
local bytes = pb.encode(msgFullName, params)
|
||||||
|
if bytes == nil then
|
||||||
|
Logger.logError("SocketManager send data error %s", msgName)
|
||||||
|
return callback and callback()
|
||||||
end
|
end
|
||||||
|
|
||||||
function NetManager:sendTillBeforeOver(binder, msgName, params, responseData, callback, lockGame, noRsp, getType)
|
local msgId = ProtoMsgDispatch:getMsgIdByMsgName(msgName)
|
||||||
if responseData.rewards then
|
self:_sendBytes(socketName, bytes, msgId, 0)
|
||||||
responseData.rewards = GFunc.formatRewardsToServerStruct(responseData.rewards)
|
|
||||||
|
local msg = ProtoMsgDispatch:getRspMsgByMsgName(msgName)
|
||||||
|
if not self.receiveCallbacks[msg] then
|
||||||
|
self.receiveCallbacks[msg] = {}
|
||||||
end
|
end
|
||||||
if responseData.costs then
|
local receiveCallback = self:getReceiveCallback()
|
||||||
responseData.costs = GFunc.formatRewardsToServerStruct(responseData.costs)
|
receiveCallback.binder = binder
|
||||||
end
|
receiveCallback.lockGame = false
|
||||||
responseData.err_code = GConst.ERROR_STR.SUCCESS
|
receiveCallback.callback = callback
|
||||||
self:_send(binder, msgName, params, responseData, callback, lockGame, noRsp, getType, true)
|
receiveCallback.getType = BIReport.ITEM_GET_TYPE.NONE
|
||||||
|
receiveCallback.beforeOver = false
|
||||||
|
receiveCallback.socketName = NetManager.CHAT_SOCKET_NAME
|
||||||
|
receiveCallback.reqData = params
|
||||||
|
table.insert(self.receiveCallbacks[msg], receiveCallback)
|
||||||
end
|
end
|
||||||
|
|
||||||
function NetManager:_send(binder, msgName, params, responseData, callback, lockGame, noRsp, getType, beforeOver)
|
function NetManager:send(binder, msgName, params, callback, lockGame, noRsp, getType)
|
||||||
|
if self.alreadyClose then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:_send(binder, msgName, params, callback, lockGame, noRsp, getType)
|
||||||
|
end
|
||||||
|
|
||||||
|
function NetManager:sendTillBeforeOver(binder, msgName, params, callback, lockGame, noRsp, getType)
|
||||||
|
if self.alreadyClose then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:_send(binder, msgName, params, callback, lockGame, noRsp, getType, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
function NetManager:_send(binder, msgName, params, callback, lockGame, noRsp, getType, beforeOver)
|
||||||
local socketName = NetManager.MAIN_SOCKET_NAME
|
local socketName = NetManager.MAIN_SOCKET_NAME
|
||||||
|
local pipedMsgName, pipedParams = self:pipedMessage(msgName, params)
|
||||||
|
table.insert(self.sendQueue, {
|
||||||
|
binder = binder,
|
||||||
|
originMsgName = msgName,
|
||||||
|
msgName = pipedMsgName,
|
||||||
|
params = pipedParams,
|
||||||
|
socketName = socketName,
|
||||||
|
callback = callback,
|
||||||
|
lockGame = lockGame,
|
||||||
|
noRsp = noRsp,
|
||||||
|
getType = getType,
|
||||||
|
beforeOver = beforeOver,
|
||||||
|
})
|
||||||
|
|
||||||
|
if not self:isNotSave(msgName) then
|
||||||
|
self:saveSendQueue()
|
||||||
|
end
|
||||||
|
|
||||||
if self:isDisconnected(socketName) then
|
if self:isDisconnected(socketName) then
|
||||||
if socketName == NetManager.MAIN_SOCKET_NAME then
|
if socketName == NetManager.MAIN_SOCKET_NAME then
|
||||||
if UIManager:getWaitNetCount() > 0 then
|
if UIManager:getWaitNetCount() > 0 then
|
||||||
@ -449,23 +539,6 @@ function NetManager:_send(binder, msgName, params, responseData, callback, lockG
|
|||||||
UIManager:showWaitNet()
|
UIManager:showWaitNet()
|
||||||
self.tillBeforeOverCount = self.tillBeforeOverCount + 1
|
self.tillBeforeOverCount = self.tillBeforeOverCount + 1
|
||||||
end
|
end
|
||||||
local pipedMsgName, pipedParams = self:pipedMessage(msgName, params)
|
|
||||||
table.insert(self.sendQueue, {
|
|
||||||
binder = binder,
|
|
||||||
originMsgName = msgName,
|
|
||||||
msgName = pipedMsgName,
|
|
||||||
params = pipedParams,
|
|
||||||
responseData = responseData,
|
|
||||||
socketName = socketName,
|
|
||||||
callback = callback,
|
|
||||||
lockGame = lockGame,
|
|
||||||
noRsp = noRsp,
|
|
||||||
getType = getType,
|
|
||||||
beforeOver = beforeOver,
|
|
||||||
})
|
|
||||||
if not self:isNotSave(msgName) then
|
|
||||||
self:saveSendQueue()
|
|
||||||
end
|
|
||||||
|
|
||||||
self:trySend()
|
self:trySend()
|
||||||
end
|
end
|
||||||
@ -476,7 +549,6 @@ function NetManager:trySend()
|
|||||||
local originMsgName
|
local originMsgName
|
||||||
local curMsgName
|
local curMsgName
|
||||||
local curParams
|
local curParams
|
||||||
local responseData
|
|
||||||
local getType
|
local getType
|
||||||
local curSocketName
|
local curSocketName
|
||||||
local curCallback
|
local curCallback
|
||||||
@ -489,7 +561,6 @@ function NetManager:trySend()
|
|||||||
originMsgName = cache.originMsgName
|
originMsgName = cache.originMsgName
|
||||||
curMsgName = cache.msgName
|
curMsgName = cache.msgName
|
||||||
curParams = GFunc.getTable(cache.params)
|
curParams = GFunc.getTable(cache.params)
|
||||||
responseData = cache.responseData
|
|
||||||
getType = cache.getType
|
getType = cache.getType
|
||||||
curSocketName = cache.socketName
|
curSocketName = cache.socketName
|
||||||
curCallback = cache.callback
|
curCallback = cache.callback
|
||||||
@ -504,7 +575,8 @@ function NetManager:trySend()
|
|||||||
local reqData
|
local reqData
|
||||||
if curMsgName == ProtoMsgType.FromMsgEnum.PipedReq then
|
if curMsgName == ProtoMsgType.FromMsgEnum.PipedReq then
|
||||||
reqData = curParams.data
|
reqData = curParams.data
|
||||||
Logger.logHighlight("[NetManager]===onSend===name:%s params:%s", ProtoMsgDispatch:getReqMsgNameByMsgId(curParams.msg_id), json.encode(reqData))
|
Logger.logHighlight("[NetManager]===onSend===name:%s params:%s",
|
||||||
|
ProtoMsgDispatch:getReqMsgNameByMsgId(curParams.msg_id), json.encode(reqData))
|
||||||
else
|
else
|
||||||
reqData = curParams
|
reqData = curParams
|
||||||
Logger.logHighlight("[NetManager]===onSend===name:%s params:%s", subName, json.encode(reqData))
|
Logger.logHighlight("[NetManager]===onSend===name:%s params:%s", subName, json.encode(reqData))
|
||||||
@ -527,7 +599,7 @@ function NetManager:trySend()
|
|||||||
end
|
end
|
||||||
local msgId = ProtoMsgDispatch:getMsgIdByMsgName(curMsgName)
|
local msgId = ProtoMsgDispatch:getMsgIdByMsgName(curMsgName)
|
||||||
|
|
||||||
self:_sendBytes(curSocketName, bytes, msgId, 0)
|
self:_sendBytes(curSocketName, bytes, msgId, 0, noRsp)
|
||||||
|
|
||||||
if noRsp then
|
if noRsp then
|
||||||
return
|
return
|
||||||
@ -540,9 +612,9 @@ function NetManager:trySend()
|
|||||||
receiveCallback.binder = binder
|
receiveCallback.binder = binder
|
||||||
receiveCallback.lockGame = curLockGame
|
receiveCallback.lockGame = curLockGame
|
||||||
receiveCallback.callback = curCallback
|
receiveCallback.callback = curCallback
|
||||||
receiveCallback.responseData = responseData
|
|
||||||
receiveCallback.getType = getType
|
receiveCallback.getType = getType
|
||||||
receiveCallback.beforeOver = beforeOver
|
receiveCallback.beforeOver = beforeOver
|
||||||
|
receiveCallback.socketName = curSocketName
|
||||||
table.insert(self.receiveCallbacks[msg], receiveCallback)
|
table.insert(self.receiveCallbacks[msg], receiveCallback)
|
||||||
else
|
else
|
||||||
Logger.logError("[NetManager]send data error %s", curMsgName)
|
Logger.logError("[NetManager]send data error %s", curMsgName)
|
||||||
@ -580,6 +652,7 @@ end
|
|||||||
function NetManager:recycleReceiveCallback(receiveCallback)
|
function NetManager:recycleReceiveCallback(receiveCallback)
|
||||||
receiveCallback.callback = nil
|
receiveCallback.callback = nil
|
||||||
receiveCallback.lockGame = true
|
receiveCallback.lockGame = true
|
||||||
|
receiveCallback.reqData = nil
|
||||||
table.insert(self.receiveCallbackPool, receiveCallback)
|
table.insert(self.receiveCallbackPool, receiveCallback)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -591,30 +664,6 @@ function NetManager:disconnectAll()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function NetManager:disconnectAndReconnect()
|
|
||||||
if self.alreadyConnected[NetManager.MAIN_SOCKET_NAME] then
|
|
||||||
if not DataManager:getLoginSuccess() then -- 没登陆成功的,直接重新走auth->login
|
|
||||||
ModuleManager.LoginManager:reloginOnReconnectRefuse()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.reconnectMainId then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if self.mainReconnectWaitTime > MAX_MAIN_WAIT_TIME then
|
|
||||||
self.mainReconnectWaitTime = MAX_MAIN_WAIT_TIME
|
|
||||||
end
|
|
||||||
|
|
||||||
self.reconnectMainId = self:performWithDelayGlobal(function ()
|
|
||||||
self.reconnectMainId = nil
|
|
||||||
self:silentReconnectMain()
|
|
||||||
end, self.mainReconnectWaitTime)
|
|
||||||
self.mainReconnectWaitTime = self.mainReconnectWaitTime + 1
|
|
||||||
else
|
|
||||||
self:closeAll()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function NetManager:showReconnectMain()
|
function NetManager:showReconnectMain()
|
||||||
if self.reconnectMainId then
|
if self.reconnectMainId then
|
||||||
SchedulerManager:unscheduleGlobal(self.reconnectMainId)
|
SchedulerManager:unscheduleGlobal(self.reconnectMainId)
|
||||||
@ -624,9 +673,9 @@ function NetManager:showReconnectMain()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local params = {
|
local params = {
|
||||||
content = I18N:getGlobalText(I18N.GlobalConst.RECONNECT),
|
content = I18N:getGlobalText(I18N.GlobalConst.DISCONNECT_DESC_2),
|
||||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||||
cancelText = I18N:getGlobalText(I18N.GlobalConst.RELOGIN),
|
cancelText = I18N:getGlobalText(I18N.GlobalConst.DISCONNECT_DESC_3),
|
||||||
noShowClose = true,
|
noShowClose = true,
|
||||||
okFunc = function()
|
okFunc = function()
|
||||||
self:reconnectMain()
|
self:reconnectMain()
|
||||||
@ -645,7 +694,7 @@ function NetManager:disconnect(socketName)
|
|||||||
if self.isClosedMap[socketName] then
|
if self.isClosedMap[socketName] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if socketName == NetManager.CHAT_SOCKET_NAME then --暂时没有维护
|
if socketName == NetManager.CHAT_SOCKET_NAME then
|
||||||
self.isClosedMap[socketName] = true
|
self.isClosedMap[socketName] = true
|
||||||
CS.BF.BFMain.Instance.NetMgr:Close(socketName)
|
CS.BF.BFMain.Instance.NetMgr:Close(socketName)
|
||||||
|
|
||||||
@ -660,7 +709,7 @@ function NetManager:disconnect(socketName)
|
|||||||
self.reconnectChatId = self:performWithDelayGlobal(function()
|
self.reconnectChatId = self:performWithDelayGlobal(function()
|
||||||
self.reconnectChatId = nil
|
self.reconnectChatId = nil
|
||||||
if not self:isConnected(NetManager.CHAT_SOCKET_NAME) then
|
if not self:isConnected(NetManager.CHAT_SOCKET_NAME) then
|
||||||
ModuleManager.LoginManager:connectByChannel(nil, NetManager.CHAT_SOCKET_NAME)
|
ModuleManager.LoginManager:connectChat()
|
||||||
end
|
end
|
||||||
end, self.chatReconnectWaitTime)
|
end, self.chatReconnectWaitTime)
|
||||||
|
|
||||||
@ -681,8 +730,8 @@ function NetManager:disconnect(socketName)
|
|||||||
end
|
end
|
||||||
else -- 否则就悄咪咪的重连
|
else -- 否则就悄咪咪的重连
|
||||||
if self.mainReconnectWaitTime > MAX_MAIN_WAIT_TIME then
|
if self.mainReconnectWaitTime > MAX_MAIN_WAIT_TIME then
|
||||||
self.mainReconnectWaitTime = MAX_MAIN_WAIT_TIME
|
self:showReconnectMain()
|
||||||
end
|
else
|
||||||
if self.reconnectMainId then
|
if self.reconnectMainId then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -692,6 +741,7 @@ function NetManager:disconnect(socketName)
|
|||||||
end, self.mainReconnectWaitTime)
|
end, self.mainReconnectWaitTime)
|
||||||
self.mainReconnectWaitTime = self.mainReconnectWaitTime + 1
|
self.mainReconnectWaitTime = self.mainReconnectWaitTime + 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else -- 从来没有连上过
|
else -- 从来没有连上过
|
||||||
self:closeAll()
|
self:closeAll()
|
||||||
end
|
end
|
||||||
@ -720,15 +770,14 @@ function NetManager:closeAll(errorType)
|
|||||||
UIManager:showDisconnect(errorType)
|
UIManager:showDisconnect(errorType)
|
||||||
end
|
end
|
||||||
|
|
||||||
function NetManager:onReceive(msgId, data)
|
function NetManager:onReceive(msgId, data, clientName)
|
||||||
self.isSending = false
|
|
||||||
--Logger.logHighlight("MSGID:"..msgId)
|
--Logger.logHighlight("MSGID:"..msgId)
|
||||||
local msgName = ProtoMsgDispatch:getReqMsgNameByMsgId(msgId)
|
local msgName = ProtoMsgDispatch:getReqMsgNameByMsgId(msgId)
|
||||||
if msgName == nil then
|
if msgName == nil then
|
||||||
|
self.isSending = false
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- 这里保证即使协议有问题解不出来也不要卡住
|
-- 这里保证即使协议有问题解不出来也不要卡住
|
||||||
|
|
||||||
local ok, pbData = pcall(function()
|
local ok, pbData = pcall(function()
|
||||||
local fullMsgName = ProtoMsgDispatch:getMsgFullNameByMsgName(msgName)
|
local fullMsgName = ProtoMsgDispatch:getMsgFullNameByMsgName(msgName)
|
||||||
return pb.decode(fullMsgName, data)
|
return pb.decode(fullMsgName, data)
|
||||||
@ -742,19 +791,19 @@ function NetManager:onReceive(msgId, data)
|
|||||||
pbData.status = ProtoMsgDispatch:getErrCodeEnum(pbData.err_code)
|
pbData.status = ProtoMsgDispatch:getErrCodeEnum(pbData.err_code)
|
||||||
end
|
end
|
||||||
if EDITOR_MODE then
|
if EDITOR_MODE then
|
||||||
-- Logger.logHighlight("[NetManager]===onReceive===name:%s, msgId:%s, data:%s", msgName, msgId, json.encode(pbData))
|
|
||||||
self:printReceive(msgName, msgId, pbData)
|
self:printReceive(msgName, msgId, pbData)
|
||||||
end
|
end
|
||||||
self:dispatch(msgName, pbData)
|
self:dispatch(msgName, pbData)
|
||||||
else
|
else
|
||||||
if EDITOR_MODE then
|
if EDITOR_MODE then
|
||||||
Logger.logHighlight("[NetManager]===onReceive failed===name:%s, msgId:%s", msgName, msgId)
|
Logger.logHighlight("[NetManager]===onReceive failed===name:%s, msgId:%s, err:%s", msgName, msgId,
|
||||||
|
tostring(pbData))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local sendInfo
|
local sendInfo
|
||||||
local sendMsgName
|
local sendMsgName
|
||||||
if self.sendQueue[1]then
|
if clientName ~= NetManager.CHAT_SOCKET_NAME and self.sendQueue[1] then
|
||||||
sendMsgName = self.sendQueue[1].msgName
|
sendMsgName = self.sendQueue[1].msgName
|
||||||
if sendMsgName == ProtoMsgType.FromMsgEnum.PipedReq then
|
if sendMsgName == ProtoMsgType.FromMsgEnum.PipedReq then
|
||||||
sendMsgName = ProtoMsgDispatch:getReqMsgNameByMsgId(self.sendQueue[1].params.msg_id)
|
sendMsgName = ProtoMsgDispatch:getReqMsgNameByMsgId(self.sendQueue[1].params.msg_id)
|
||||||
@ -785,48 +834,51 @@ function NetManager:onReceive(msgId, data)
|
|||||||
reqDataStr = json.encode(sendInfo.params)
|
reqDataStr = json.encode(sendInfo.params)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
BIReport:postNetError(sendMsgName, pbData.err_code, reqDataStr, pbData)
|
BIReport:postNetError(sendMsgName, pbData.status, reqDataStr, pbData)
|
||||||
end
|
end
|
||||||
|
|
||||||
local callbacks = self.receiveCallbacks[msg]
|
local callbacks = self.receiveCallbacks[msg]
|
||||||
if callbacks and #callbacks > 0 then
|
if callbacks and #callbacks > 0 then
|
||||||
|
if clientName ~= NetManager.CHAT_SOCKET_NAME then -- 忽略推送和聊天
|
||||||
|
self.isSending = false
|
||||||
|
end
|
||||||
local receiveCallback = table.remove(callbacks, 1)
|
local receiveCallback = table.remove(callbacks, 1)
|
||||||
local lockGame = true
|
local lockGame = true
|
||||||
local receiveFunc = nil
|
local receiveFunc = nil
|
||||||
local responseData = nil
|
|
||||||
if receiveCallback then
|
if receiveCallback then
|
||||||
lockGame = receiveCallback.lockGame
|
lockGame = receiveCallback.lockGame
|
||||||
receiveFunc = receiveCallback.callback
|
receiveFunc = receiveCallback.callback
|
||||||
responseData = receiveCallback.responseData
|
if pbData.err_code == GConst.ERROR_STR.SUCCESS and pbData.rewards and not self:getNotAddRewardsRsp(sendMsgName) then
|
||||||
if pbData.err_code == GConst.ERROR_STR.SUCCESS and pbData.rewards then
|
|
||||||
local getType = receiveCallback.getType
|
local getType = receiveCallback.getType
|
||||||
if sendMsgName == "ActPayReq" then
|
if sendMsgName == "GiftPayReq" then
|
||||||
getType = PayManager:getItemGetType(pbData.act_type, pbData.id)
|
getType = PayManager:getItemGetType(pbData.gift_type, pbData.id)
|
||||||
elseif sendMsgName == "ActPaidResultReq" then -- 支付上报统一处理
|
elseif sendMsgName == "GiftPaidResultReq" then -- 支付上报统一处理
|
||||||
if pbData.gift then
|
if pbData.gift then
|
||||||
for _, gift in ipairs(pbData.gift) do
|
for _, gift in ipairs(pbData.gift) do
|
||||||
getType = PayManager:getItemGetType(gift.act_type, gift.id)
|
getType = PayManager:getItemGetType(gift.gift_type, gift.id)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif sendMsgName == "AppStorePaidReq" then -- ios支付上报统一处理
|
elseif sendMsgName == "AppStorePaidReq" then -- ios支付上报统一处理
|
||||||
if pbData.gift then
|
if pbData.gift then
|
||||||
for _, gift in ipairs(pbData.gift) do
|
for _, gift in ipairs(pbData.gift) do
|
||||||
getType = PayManager:getItemGetType(gift.act_type, gift.id)
|
getType = PayManager:getItemGetType(gift.gift_type, gift.id)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if EDITOR_MODE and not getType then
|
if EDITOR_MODE and not getType then
|
||||||
Logger.logFatal("sendMessage server have rewards but not getType, check it! manager = ", receiveCallback.binder.__cname)
|
Logger.logFatal("sendMessage server have rewards but not getType, check it! manager = ",
|
||||||
|
receiveCallback.binder.__cname)
|
||||||
end
|
end
|
||||||
|
|
||||||
GFunc.addRewards(pbData.rewards, getType)
|
GFunc.addRewards(pbData.rewards, getType)
|
||||||
end
|
end
|
||||||
if pbData.err_code == GConst.ERROR_STR.SUCCESS and pbData.costs and not self:getNotAddCostsRsp(msgName) then
|
if pbData.err_code == GConst.ERROR_STR.SUCCESS and pbData.costs and not self:getNotAddCostsRsp(sendMsgName) then
|
||||||
local getType = receiveCallback.getType
|
local getType = receiveCallback.getType
|
||||||
if sendMsgName == "ActPayReq" then
|
if sendMsgName == "GiftPayReq" then
|
||||||
|
getType = PayManager:getItemGetType(pbData.gift_type, pbData.id)
|
||||||
|
elseif sendMsgName == "ActPayReq" then
|
||||||
getType = PayManager:getItemGetType(pbData.mall_type, pbData.id)
|
getType = PayManager:getItemGetType(pbData.mall_type, pbData.id)
|
||||||
elseif sendMsgName == "ActPaidResultReq" then -- 支付上报统一处理
|
elseif sendMsgName == "ActPaidResultReq" then -- 支付上报统一处理
|
||||||
if pbData.gift then
|
if pbData.gift then
|
||||||
@ -837,21 +889,11 @@ function NetManager:onReceive(msgId, data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if EDITOR_MODE and not getType then
|
if EDITOR_MODE and not getType then
|
||||||
Logger.logFatal("sendMessage server have costs but not getType, check it! manager = ", receiveCallback.binder.__cname)
|
Logger.logFatal("sendMessage server have costs but not getType, check it! manager = ",
|
||||||
|
receiveCallback.binder.__cname)
|
||||||
end
|
end
|
||||||
GFunc.addCosts(pbData.costs, getType)
|
GFunc.addCosts(pbData.costs, getType)
|
||||||
end
|
end
|
||||||
if EDITOR_MODE and not self:getNotCheckResponse(ProtoMsgDispatch:getReqMsgByMsgName(msgName)) then -- 检查responseData
|
|
||||||
local fullMsgName = ProtoMsgDispatch:getMsgFullNameByMsgName(msgName)
|
|
||||||
local serverResult = pb.decode(fullMsgName, data)
|
|
||||||
self:checkCoin(responseData, serverResult)
|
|
||||||
if not GFunc.checkTableValueSame(responseData, serverResult, true) then
|
|
||||||
Logger.logWarningBox(msgName .. " : responseData not equate, please check it!")
|
|
||||||
Logger.logHighlight("------responseData not equate-------------")
|
|
||||||
Logger.printTable(responseData)
|
|
||||||
Logger.printTable(serverResult)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if receiveCallback.beforeOver then
|
if receiveCallback.beforeOver then
|
||||||
UIManager:hideWaitNet()
|
UIManager:hideWaitNet()
|
||||||
self.tillBeforeOverCount = self.tillBeforeOverCount - 1
|
self.tillBeforeOverCount = self.tillBeforeOverCount - 1
|
||||||
@ -859,6 +901,8 @@ function NetManager:onReceive(msgId, data)
|
|||||||
self.tillBeforeOverCount = 0
|
self.tillBeforeOverCount = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local chatReqData = receiveCallback.reqData
|
||||||
|
local receiveCallbackBinder = receiveCallback.binder
|
||||||
self:recycleReceiveCallback(receiveCallback)
|
self:recycleReceiveCallback(receiveCallback)
|
||||||
if lockGame then
|
if lockGame then
|
||||||
UIManager:hideWaitNet()
|
UIManager:hideWaitNet()
|
||||||
@ -870,8 +914,10 @@ function NetManager:onReceive(msgId, data)
|
|||||||
else
|
else
|
||||||
pbData.reqData = sendInfo.params
|
pbData.reqData = sendInfo.params
|
||||||
end
|
end
|
||||||
|
elseif clientName == NetManager.CHAT_SOCKET_NAME then
|
||||||
|
pbData.reqData = chatReqData
|
||||||
end
|
end
|
||||||
receiveFunc(receiveCallback.binder, pbData)
|
receiveFunc(receiveCallbackBinder, pbData)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -900,11 +946,11 @@ function NetManager:onError(socketName, errorType, errorMsg)
|
|||||||
elseif errorType == NetErrorCode.DNSParseDomainNameError then
|
elseif errorType == NetErrorCode.DNSParseDomainNameError then
|
||||||
self:closeAll()
|
self:closeAll()
|
||||||
else -- 未定义的error
|
else -- 未定义的error
|
||||||
self:disconnectAndReconnect()
|
self:disconnect(socketName)
|
||||||
end
|
end
|
||||||
if not self.disconnectTime then
|
if not self.disconnectTime then
|
||||||
self.disconnectTime = Time:getServerTime()
|
self.disconnectTime = Time:getServerTime()
|
||||||
BIReport:postNetWorkOpt(BIReport.NETWORK_OPT_TYPE.DISCONNECT, UIManager:getTopUIIndex(), errorType)
|
BIReport:postNetWorkOpt(BIReport.NETWORK_OPT_TYPE.DISCONNECT, UIManager:getTopUIIndex(), errorType, errorMsg)
|
||||||
end
|
end
|
||||||
elseif socketName == NetManager.CHAT_SOCKET_NAME then
|
elseif socketName == NetManager.CHAT_SOCKET_NAME then
|
||||||
Logger.logHighlight("chat net error:errorType = %d, errorMsg = %s", errorType, errorMsg)
|
Logger.logHighlight("chat net error:errorType = %d, errorMsg = %s", errorType, errorMsg)
|
||||||
@ -930,28 +976,39 @@ function NetManager:getKickOutReasonEnum(enum)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function NetManager:joinChatChannel()
|
function NetManager:joinChatChannel()
|
||||||
-- if self.joinChatId then
|
if self.joinChatId then
|
||||||
-- SchedulerManager:unscheduleGlobal(self.joinChatId)
|
SchedulerManager:unscheduleGlobal(self.joinChatId)
|
||||||
-- self.joinChatId = nil
|
self.joinChatId = nil
|
||||||
-- end
|
end
|
||||||
-- if DataManager.ChatData:getIsJoinWorldRoom() then
|
if DataManager.ChatData:getIsJoinWorldRoom() then
|
||||||
-- return
|
return
|
||||||
-- end
|
end
|
||||||
-- local wordChannelId = DataManager.ChatData:getChatWorld():getLocalChatWorldChannleId()
|
BIReport:postChatJoinChannel(BIReport.CHAT_CHANNEL.WORLD)
|
||||||
-- local args = {
|
|
||||||
-- id = wordChannelId,
|
local args = {
|
||||||
-- adjust = true -- 登录时第一次进入房间必须能接受调整,手动切房间的时候为false
|
world_id = tostring(DataManager.PlayerData:getServerId()),
|
||||||
-- }
|
}
|
||||||
-- self:send(ProtoMsgType.FromMsgEnum.JoinWorldRoomReq, args, function(data)
|
self:sendChat(self, ProtoMsgType.FromMsgEnum.JoinWorldRoomReq, args, self.onJoinChatChannelFinish)
|
||||||
-- if data.status == 0 then
|
end
|
||||||
-- DataManager.ChatData:initChat(data)
|
|
||||||
-- else
|
function NetManager:onJoinChatChannelFinish(result)
|
||||||
-- self.joinChatId = self:performWithDelayGlobal(function ()
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
-- self.joinChatId = nil
|
self.joinChatId = self:performWithDelayGlobal(function()
|
||||||
-- self:joinChatChannel()
|
self.joinChatId = nil
|
||||||
-- end, JOIN_CHAT_INTERVAL)
|
self:joinChatChannel()
|
||||||
-- end
|
end, JOIN_CHAT_INTERVAL)
|
||||||
-- end, NetManager.CHAT_SOCKET_NAME, true)
|
BIReport:postChatJoinChannelFailed(BIReport.CHAT_CHANNEL.WORLD)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if DataManager.ChatData:getIsJoinWorldRoom() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if result.world_id then
|
||||||
|
LocalData:setChatWorldChannelId(result.world_id)
|
||||||
|
end
|
||||||
|
DataManager.ChatData:initChat(result.messages, result.world_id)
|
||||||
|
BIReport:postChatJoinChannelSuccess(BIReport.CHAT_CHANNEL.WORLD)
|
||||||
|
ModuleManager.ChatManager:requestHistoryPersonalMessage()
|
||||||
end
|
end
|
||||||
|
|
||||||
function NetManager:registerMsgCallback(msgName, module, callback)
|
function NetManager:registerMsgCallback(msgName, module, callback)
|
||||||
@ -986,6 +1043,7 @@ function NetManager:closeAndClear()
|
|||||||
if not self.initSucc then
|
if not self.initSucc then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
self.alreadyClose = true
|
||||||
if self.tillBeforeOverSid then
|
if self.tillBeforeOverSid then
|
||||||
SchedulerManager:unscheduleGlobal(self.tillBeforeOverSid)
|
SchedulerManager:unscheduleGlobal(self.tillBeforeOverSid)
|
||||||
self.tillBeforeOverSid = nil
|
self.tillBeforeOverSid = nil
|
||||||
@ -1008,6 +1066,9 @@ function NetManager:closeAndClear()
|
|||||||
self.autoReAuthSid = nil
|
self.autoReAuthSid = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--@TODO 2024-08-09 10:32:25
|
||||||
|
-- ModuleManager.ChatManager:clear()
|
||||||
|
|
||||||
self.isSending = false
|
self.isSending = false
|
||||||
self.sendQueue = {}
|
self.sendQueue = {}
|
||||||
self.tillBeforeOverCount = 0
|
self.tillBeforeOverCount = 0
|
||||||
@ -1024,13 +1085,14 @@ function NetManager:closeAndClear()
|
|||||||
self.alreadyConnected[chatSocketName] = false
|
self.alreadyConnected[chatSocketName] = false
|
||||||
|
|
||||||
CS.BF.BFMain.Instance.NetMgr:Close(mainSocketName)
|
CS.BF.BFMain.Instance.NetMgr:Close(mainSocketName)
|
||||||
-- CS.BF.BFMain.Instance.NetMgr:Close(chatSocketName)
|
CS.BF.BFMain.Instance.NetMgr:Close(chatSocketName)
|
||||||
|
|
||||||
self:clearMsgCallbacks()
|
self:clearMsgCallbacks()
|
||||||
UIManager:hideWaitNet(true)
|
UIManager:hideWaitNet(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
function NetManager:saveSendQueue()
|
function NetManager:saveSendQueue()
|
||||||
|
if EDITOR_MODE then
|
||||||
local list = {}
|
local list = {}
|
||||||
for _, info in ipairs(self.sendQueue) do
|
for _, info in ipairs(self.sendQueue) do
|
||||||
if not self:isNotSave(info.msgName) then
|
if not self:isNotSave(info.msgName) then
|
||||||
@ -1041,7 +1103,7 @@ function NetManager:saveSendQueue()
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if EDITOR_MODE and #list > 0 then
|
|
||||||
local printList = {}
|
local printList = {}
|
||||||
for k, v in ipairs(list) do
|
for k, v in ipairs(list) do
|
||||||
local msgName = v.msgName
|
local msgName = v.msgName
|
||||||
@ -1058,7 +1120,6 @@ function NetManager:saveSendQueue()
|
|||||||
end
|
end
|
||||||
Logger.logHighlight("[NetManager]剩余消息队列缓存:%s", json.encode(printList))
|
Logger.logHighlight("[NetManager]剩余消息队列缓存:%s", json.encode(printList))
|
||||||
end
|
end
|
||||||
LocalData:saveSendQueue(list)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function NetManager:isNotSave(msgName)
|
function NetManager:isNotSave(msgName)
|
||||||
@ -1078,7 +1139,14 @@ function NetManager:getNotCheckResponse(msgName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function NetManager:getNotAddCostsRsp(msgName)
|
function NetManager:getNotAddCostsRsp(msgName)
|
||||||
if msgName == ProtoMsgType.FromMsgEnum.ChapterTrainRsp then
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function NetManager:getNotAddRewardsRsp(msgName)
|
||||||
|
if msgName == ProtoMsgType.FromMsgEnum.ChapterSyncReq or
|
||||||
|
msgName == ProtoMsgType.FromMsgEnum.ChapterPassReq or
|
||||||
|
msgName == ProtoMsgType.FromMsgEnum.DevelopEquipReq or
|
||||||
|
msgName == ProtoMsgType.FromMsgEnum.SellEquipReq then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
@ -1086,23 +1154,18 @@ end
|
|||||||
|
|
||||||
function NetManager:pipedMessage(msgName, params)
|
function NetManager:pipedMessage(msgName, params)
|
||||||
return msgName, params -- 屏蔽PipedReq
|
return msgName, params -- 屏蔽PipedReq
|
||||||
-- if msgName == ProtoMsgType.FromMsgEnum.LoginReq or
|
end
|
||||||
-- msgName == ProtoMsgType.FromMsgEnum.SyncReq or
|
|
||||||
-- msgName == ProtoMsgType.FromMsgEnum.IdleRewardReq or
|
function NetManager:getIsChatReconnectTimeReachMax()
|
||||||
-- msgName == ProtoMsgType.FromMsgEnum.IdleExtraRewardReq or
|
return self.chatReconnectWaitTime == MAX_CHAT_WAIT_TIME
|
||||||
-- msgName == ProtoMsgType.FromMsgEnum.MailCycleReq or
|
end
|
||||||
-- msgName == ProtoMsgType.FromMsgEnum.GMReq then
|
|
||||||
-- return msgName, params
|
function NetManager:resetChatReconnectWaitTime()
|
||||||
-- end
|
self.chatReconnectWaitTime = 1
|
||||||
-- local msgId = ProtoMsgDispatch:getMsgIdByMsgName(msgName)
|
end
|
||||||
-- self.msgId = self.msgId + 1
|
|
||||||
-- local pipedStruct = {
|
function NetManager:getLastReceiveTime()
|
||||||
-- id = self.msgId,
|
return self.lastReceiveTime
|
||||||
-- ts = Time:getServerTime() * 1000,
|
|
||||||
-- msg_id = msgId,
|
|
||||||
-- data = params,
|
|
||||||
-- }
|
|
||||||
-- return ProtoMsgType.FromMsgEnum.PipedReq, pipedStruct
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if EDITOR_MODE then
|
if EDITOR_MODE then
|
||||||
@ -1116,37 +1179,19 @@ if EDITOR_MODE then
|
|||||||
end
|
end
|
||||||
|
|
||||||
NetManager._releaseSend = NetManager.send
|
NetManager._releaseSend = NetManager.send
|
||||||
function NetManager:send(obj, msgName, params, responseData, callback, lockGame, noRsp, getType)
|
function NetManager:send(obj, msgName, params, callback, lockGame, noRsp, getType)
|
||||||
-- 参数检查
|
-- 参数检查
|
||||||
if (responseData.rewards or responseData.costs) and not getType and msgName ~= ProtoMsgType.FromMsgEnum.GMReq then
|
|
||||||
Logger.logFatal("sendMessage have rewards or have costs but not getType, check it! manager = ", self.__cname)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if not params then
|
if not params then
|
||||||
Logger.logFatal("NetManager send params is nil %s", msgName)
|
Logger.logFatal("NetManager send params is nil %s", msgName)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not responseData then
|
|
||||||
Logger.logFatal("NetManager send responseData is nil %s", msgName)
|
|
||||||
end
|
|
||||||
|
|
||||||
local msgFullName = ProtoMsgDispatch:getMsgFullNameByMsgName(msgName)
|
local msgFullName = ProtoMsgDispatch:getMsgFullNameByMsgName(msgName)
|
||||||
local bytes = pb.encode(msgFullName, params)
|
local bytes = pb.encode(msgFullName, params)
|
||||||
if not bytes then
|
if not bytes then
|
||||||
Logger.logFatal("NetManager send params error %s", msgName)
|
Logger.logFatal("NetManager send params error %s", msgName)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not self:getNotCheckResponse(msgName) then
|
|
||||||
local fullMsgName = ProtoMsgDispatch:getMsgFullNameByMsgName(ProtoMsgDispatch:getRspMsgByMsgName(msgName))
|
|
||||||
for name, number, type in pb.fields(fullMsgName) do
|
|
||||||
if name ~= "err_code" and responseData[name] == nil then
|
|
||||||
Logger.logFatal("NetManager send responseData error %s not have %s", msgName, name)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- end 参数检查
|
-- end 参数检查
|
||||||
|
|
||||||
self:_checkDebugFuncMap()
|
self:_checkDebugFuncMap()
|
||||||
@ -1164,27 +1209,26 @@ if EDITOR_MODE then
|
|||||||
else
|
else
|
||||||
findCallback = true
|
findCallback = true
|
||||||
end
|
end
|
||||||
|
if noRsp then
|
||||||
|
findCallback = true
|
||||||
|
end
|
||||||
|
|
||||||
if not findCallback then
|
if not findCallback then
|
||||||
Logger.logFatal("[NetManager]callback of NetManager:send is not %s function", obj.__cname)
|
Logger.logFatal("[NetManager]callback of NetManager:send is not %s function", obj.__cname)
|
||||||
end
|
end
|
||||||
self:_releaseSend(obj, msgName, params, responseData, callback, lockGame, noRsp, getType)
|
self:_releaseSend(obj, msgName, params, callback, lockGame, noRsp, getType)
|
||||||
end
|
end
|
||||||
|
|
||||||
NetManager._releaseSendTillBeforeOver = NetManager.sendTillBeforeOver
|
NetManager._releaseSendTillBeforeOver = NetManager.sendTillBeforeOver
|
||||||
function NetManager:sendTillBeforeOver(obj, msgName, params, responseData, callback, ...)
|
function NetManager:sendTillBeforeOver(obj, msgName, params, callback, ...)
|
||||||
self:_checkDebugFuncMap()
|
self:_checkDebugFuncMap()
|
||||||
local currFunc = debug.getinfo(2, "f").func
|
local currFunc = debug.getinfo(2, "f").func
|
||||||
if obj ~= NetManager and self._debugFuncMap[currFunc] == nil then
|
if obj ~= NetManager and self._debugFuncMap[currFunc] == nil then
|
||||||
Logger.logFatal("[NetManager]you can not call NetManager:send directly")
|
Logger.logFatal("[NetManager]you can not call NetManager:send directly")
|
||||||
end
|
end
|
||||||
self:_releaseSendTillBeforeOver(obj, msgName, params, responseData, callback, ...)
|
self:_releaseSendTillBeforeOver(obj, msgName, params, callback, ...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function NetManager:checkCoin(responseData, serverResponseData)
|
|
||||||
end
|
|
||||||
|
|
||||||
function NetManager:tagAuthFailToLogin()
|
function NetManager:tagAuthFailToLogin()
|
||||||
self.authFailToLogin = true
|
self.authFailToLogin = true
|
||||||
end
|
end
|
||||||
@ -1193,7 +1237,6 @@ function NetManager:clearTagAuthFailToLogin()
|
|||||||
self.authFailToLogin = false
|
self.authFailToLogin = false
|
||||||
end
|
end
|
||||||
|
|
||||||
--region 解析activities
|
|
||||||
-- 解析activities中的bytes
|
-- 解析activities中的bytes
|
||||||
function NetManager:decodeActivityData(msgName, data)
|
function NetManager:decodeActivityData(msgName, data)
|
||||||
local ok, pbData = pcall(function()
|
local ok, pbData = pcall(function()
|
||||||
@ -1221,6 +1264,5 @@ function NetManager:printReceive(msgName, msgId, pbData)
|
|||||||
end
|
end
|
||||||
Logger.logHighlight("[NetManager]===onReceive===name:%s, msgId:%s, data:%s", msgName, msgId, json.encode(tmp))
|
Logger.logHighlight("[NetManager]===onReceive===name:%s, msgId:%s, data:%s", msgName, msgId, json.encode(tmp))
|
||||||
end
|
end
|
||||||
--endregion
|
|
||||||
|
|
||||||
return NetManager
|
return NetManager
|
||||||
363
lua/app/ui/main_city/component/side_bar_comp.lua
Normal file
363
lua/app/ui/main_city/component/side_bar_comp.lua
Normal 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
|
||||||
10
lua/app/ui/main_city/component/side_bar_comp.lua.meta
Normal file
10
lua/app/ui/main_city/component/side_bar_comp.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1507e2acdab2e42ec8474c24a7ffb49c
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -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
|
||||||
@ -288,6 +283,13 @@ function MainCityUI:_bind()
|
|||||||
self.subComps[self.selectedIndex]:refresh()
|
self.subComps[self.selectedIndex]:refresh()
|
||||||
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)
|
end)
|
||||||
self:bind(DataManager.AIHelperData, "isDirty", function()
|
self:bind(DataManager.AIHelperData, "isDirty", function()
|
||||||
self:refreshSettingBtn()
|
self:refreshSettingBtn()
|
||||||
@ -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,25 +618,8 @@ 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
|
|
||||||
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
|
end
|
||||||
|
|
||||||
if DataManager.AIHelperData:getNeedReqTime() then
|
if DataManager.AIHelperData:getNeedReqTime() then
|
||||||
@ -914,116 +627,6 @@ function MainCityUI:updateTime()
|
|||||||
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,18 +932,10 @@ 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
|
end
|
||||||
for name, cell in pairs(self.rightBarList) do
|
|
||||||
if moduleKey == cell:getModuleKey() then
|
|
||||||
return cell:getBaseObject():getPosition()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
function MainCityUI:isInSideBarLeft(moduleKey)
|
function MainCityUI:isInSideBarLeft(moduleKey)
|
||||||
for name, cell in pairs(self.leftBarList) do
|
for name, cell in pairs(self.leftBarList) do
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
-- 是否显示头像框(已解锁+未解锁可显示)
|
-- 是否显示头像框(已解锁+未解锁可显示)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user