ui动画、结算界面逻辑
This commit is contained in:
parent
84f1f27c3c
commit
9dc155e593
@ -40,6 +40,9 @@ EventManager.CUSTOM_EVENT = {
|
||||
PLAYER_INFO_CLICK_AVATAR = "PLAYER_INFO_CLICK_AVATAR",-- 个人信息选择头像
|
||||
PLAYER_INFO_CLICK_FRAME = "PLAYER_INFO_CLICK_FRAME",-- 个人信息选择头像框
|
||||
RENAME_SUCCESS = "RENAME_SUCCESS",-- 重命名成功
|
||||
-- 竞技场
|
||||
ARENA_SEASON_SETTLEMENT = "ARENA_SEASON_SETTLEMENT",-- 赛季结算
|
||||
ARENA_SEASON_END = "ARENA_SEASON_END",-- 赛季结束
|
||||
-- BORAD_TOUCH_BEGIN = "BORAD_TOUCH_BEGIN",
|
||||
-- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER"
|
||||
}
|
||||
|
||||
@ -68,11 +68,11 @@ local func_open = {
|
||||
["pop_ups"]=1
|
||||
},
|
||||
["arena_open"]={
|
||||
["stage"]=10,
|
||||
["stage"]=5,
|
||||
["pop_ups"]=1
|
||||
},
|
||||
["act_arena_gift"]={
|
||||
["stage"]=10,
|
||||
["stage"]=5,
|
||||
["pop_ups"]=1
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,9 +135,7 @@ local LocalizationGlobalConst =
|
||||
LEVEL_FUND_DESC_1 = "LEVEL_FUND_DESC_1",
|
||||
BUFF_DESC = "BUFF_DESC",
|
||||
DAILY_CHALLENGE_DESC_1 = "DAILY_CHALLENGE_DESC_1",
|
||||
DISCONNECT_RELOGIN = "DISCONNECT_RELOGIN",
|
||||
RECONNECT = "RECONNECT",
|
||||
RELOGIN = "RELOGIN",
|
||||
SEVEN_DAY_TITLE = "SEVEN_DAY_TITLE",
|
||||
SEVEN_DAY_DESC_1 = "SEVEN_DAY_DESC_1",
|
||||
DAY_X = "DAY_X",
|
||||
@ -301,6 +299,13 @@ local LocalizationGlobalConst =
|
||||
ARENA_BATTLE_DESC_3 = "ARENA_BATTLE_DESC_3",
|
||||
ARENA_BATTLE_DESC_4 = "ARENA_BATTLE_DESC_4",
|
||||
ARENA_BATTLE_DESC_5 = "ARENA_BATTLE_DESC_5",
|
||||
ARENA_DESC_25 = "ARENA_DESC_25",
|
||||
ARENA_DESC_26 = "ARENA_DESC_26",
|
||||
ARENA_DESC_27 = "ARENA_DESC_27",
|
||||
ARENA_DESC_29 = "ARENA_DESC_29",
|
||||
ARENA_DESC_30 = "ARENA_DESC_30",
|
||||
ARENA_DESC_31 = "ARENA_DESC_31",
|
||||
ARENA_DESC_HELP = "ARENA_DESC_HELP",
|
||||
}
|
||||
|
||||
return LocalizationGlobalConst
|
||||
@ -135,9 +135,7 @@ local localization_global =
|
||||
["LEVEL_FUND_DESC_1"] = "购买成长基金{0}后,可通过提升等级获得钻石。\n多档基金可同时购买",
|
||||
["BUFF_DESC"] = "BUFF",
|
||||
["DAILY_CHALLENGE_DESC_1"] = "今日剩余挑战次数不足",
|
||||
["DISCONNECT_RELOGIN"] = "网络连接已断开, 请重新登录",
|
||||
["RECONNECT"] = "网络连接已断开,是否重连",
|
||||
["RELOGIN"] = "重新登录",
|
||||
["SEVEN_DAY_TITLE"] = "新手七天乐",
|
||||
["SEVEN_DAY_DESC_1"] = "每天将开启新的任务",
|
||||
["DAY_X"] = "第{0}天",
|
||||
@ -301,6 +299,13 @@ local localization_global =
|
||||
["ARENA_BATTLE_DESC_3"] = "眩晕中",
|
||||
["ARENA_BATTLE_DESC_4"] = "冻结中",
|
||||
["ARENA_BATTLE_DESC_5"] = "昏睡中",
|
||||
["ARENA_DESC_25"] = "是否消耗{0}钻石重新匹配?",
|
||||
["ARENA_DESC_26"] = "对手已经离开,请重新匹配",
|
||||
["ARENA_DESC_27"] = "竞技场积分{0}",
|
||||
["ARENA_DESC_29"] = "竞技场结算中,请稍后再匹配……",
|
||||
["ARENA_DESC_30"] = "竞技场新赛季开启,请更新游戏再进入!",
|
||||
["ARENA_DESC_31"] = "竞技场结算开始,暂停挑战!",
|
||||
["ARENA_DESC_HELP"] = "1.竞技场为赛季周期制,每个赛季结束后将重置竞技场并发放上一赛季段位奖励。\n2.竞技场结算将在结束当日的23点30分(UTC-0)开始结算,结算时长为30分钟,结算期间为防止竞技场记录员受到干扰,竞技场将无法进行挑战,请各位骑士见谅。\n3.结算后,所有骑士团将重置为当前段位的最低段位阶段。如果前一赛季挑战不足10次,则重置为上一段位的最低阶段。",
|
||||
}
|
||||
|
||||
return localization_global
|
||||
@ -135,9 +135,7 @@ local localization_global =
|
||||
["LEVEL_FUND_DESC_1"] = "After purchasing Growth Fund {0}, you can obtain Diamonds by upgrading. \nMultiple funds can be purchased simultaneously.",
|
||||
["BUFF_DESC"] = "BUFF",
|
||||
["DAILY_CHALLENGE_DESC_1"] = "Insufficient challenge attempts for today.",
|
||||
["DISCONNECT_RELOGIN"] = "Network disconnected. Please log in again.",
|
||||
["RECONNECT"] = "Network disconnected. Reconnect?",
|
||||
["RELOGIN"] = "Re-login",
|
||||
["SEVEN_DAY_TITLE"] = "Novice 7-Day Login Event",
|
||||
["SEVEN_DAY_DESC_1"] = "New quests are unlocked daily",
|
||||
["DAY_X"] = "Day {0}",
|
||||
|
||||
@ -135,9 +135,7 @@ local localization_global =
|
||||
["LEVEL_FUND_DESC_1"] = "Bisa mendapat berlian dengan naik level setelah membeli {0} Dana Growth.\nDana multi-level dapat dibeli secara bersamaan.",
|
||||
["BUFF_DESC"] = "BUFF",
|
||||
["DAILY_CHALLENGE_DESC_1"] = "Tantangan yang tersisa saat ini tidak cukup",
|
||||
["DISCONNECT_RELOGIN"] = "Koneksi jaringan terputus, silakan login ulang",
|
||||
["RECONNECT"] = "Koneksi jaringan terputus. Login ulang?",
|
||||
["RELOGIN"] = "Login ulang",
|
||||
["SEVEN_DAY_TITLE"] = "Kegembiraan 7 Hari bagi Pemula",
|
||||
["SEVEN_DAY_DESC_1"] = "Misi baru akan dibuka setiap hari.",
|
||||
["DAY_X"] = "Hari ke-{0}",
|
||||
|
||||
@ -135,9 +135,7 @@ local localization_global =
|
||||
["LEVEL_FUND_DESC_1"] = "成長ファンド{0}を購入した後、レベルアップすることでダイヤを獲得できます。\n複数のファンドを同時に購入できます",
|
||||
["BUFF_DESC"] = "バフ",
|
||||
["DAILY_CHALLENGE_DESC_1"] = "本日の残り挑戦回数が足りません",
|
||||
["DISCONNECT_RELOGIN"] = "ネットワーク接続が切断されました。もう一度ログインしてください",
|
||||
["RECONNECT"] = "ネットワーク接続が切断されました。再接続しますか",
|
||||
["RELOGIN"] = "再ログイン",
|
||||
["SEVEN_DAY_TITLE"] = "初心者7日間ログイン報酬",
|
||||
["SEVEN_DAY_DESC_1"] = "ミッションは日ごとに解放される",
|
||||
["DAY_X"] = "{0}日目",
|
||||
|
||||
@ -135,9 +135,7 @@ local localization_global =
|
||||
["LEVEL_FUND_DESC_1"] = "레벨업 펀드{0}를 구매한 후, 레벨업을 통해 다이아를 획득할 수 있습니다. \n여러 등급의 패스는 동시에 구매할 수 있습니다.",
|
||||
["BUFF_DESC"] = "버프",
|
||||
["DAILY_CHALLENGE_DESC_1"] = "오늘 남은 도전 횟수가 부족합니다.",
|
||||
["DISCONNECT_RELOGIN"] = "네트워크 연결이 끊어졌습니다. 다시 로그인하세요.",
|
||||
["RECONNECT"] = "네크워크 연결이 끊어졌습니다. 다시 연결해 보세요.",
|
||||
["RELOGIN"] = "다시 로그인하기",
|
||||
["SEVEN_DAY_TITLE"] = "초보자 7일 축제",
|
||||
["SEVEN_DAY_DESC_1"] = "매일 새로운 미션이 시작됩니다.",
|
||||
["DAY_X"] = "제{0}일",
|
||||
|
||||
@ -135,9 +135,7 @@ local localization_global =
|
||||
["LEVEL_FUND_DESC_1"] = "Após comprar o Fundo de Crescimento {0}, você pode obter diamantes ao aumentar de nível.\nVários fundos podem ser comprados ao mesmo tempo.",
|
||||
["BUFF_DESC"] = "BÔNUS",
|
||||
["DAILY_CHALLENGE_DESC_1"] = "Hoje restam poucas chances de desafio",
|
||||
["DISCONNECT_RELOGIN"] = "A conexão com a internet foi interrompida, por favor, faça login novamente",
|
||||
["RECONNECT"] = "A conexão com a internet foi interrompida, deseja reconectar?",
|
||||
["RELOGIN"] = "Fazer login novamente",
|
||||
["SEVEN_DAY_TITLE"] = "Alegria de 7 Dias do Principiante",
|
||||
["SEVEN_DAY_DESC_1"] = "Novas missões serão disponíveis diariamente",
|
||||
["DAY_X"] = "Dia {0}",
|
||||
|
||||
@ -135,9 +135,7 @@ local localization_global =
|
||||
["LEVEL_FUND_DESC_1"] = "หลังจากซื้อกองทุนเติบโต{0}แล้ว จะสามารถรับเพชรได้โดยการอัปเลเวล\nสามารถซื้อได้หลายกองทุนในเวลาเดียวกัน",
|
||||
["BUFF_DESC"] = "BUFF",
|
||||
["DAILY_CHALLENGE_DESC_1"] = "จำนวนท้าทายที่เหลือของวันนี้ไม่พอ",
|
||||
["DISCONNECT_RELOGIN"] = "การเชื่อมต่อเครือข่ายถูกตัด โปรดล็อกอินอีกครั้ง",
|
||||
["RECONNECT"] = "การเชื่อมต่อเครือข่ายถูกตัด เชื่อมต่อใหม่หรือไม่",
|
||||
["RELOGIN"] = "ล็อกอินใหม่",
|
||||
["SEVEN_DAY_TITLE"] = "กิจกรรมล็อกอิน 7 วันสำหรับมือใหม่",
|
||||
["SEVEN_DAY_DESC_1"] = "ภารกิจใหม่จะเปิดทุกวัน",
|
||||
["DAY_X"] = "วันที่ {0}",
|
||||
|
||||
@ -135,9 +135,7 @@ local localization_global =
|
||||
["LEVEL_FUND_DESC_1"] = "Sau khi mua Quỹ Trưởng Thành {0}, có thể tăng cấp nhận Kim Cương.\nCó thể cùng lúc mua nhiều mốc quỹ",
|
||||
["BUFF_DESC"] = "BUFF",
|
||||
["DAILY_CHALLENGE_DESC_1"] = "Hôm nay thiếu lượt khiêu chiến",
|
||||
["DISCONNECT_RELOGIN"] = "Mất kết nối, vui lòng đăng nhập lại",
|
||||
["RECONNECT"] = "Mất kết nối, kết nối lại chứ",
|
||||
["RELOGIN"] = "Đăng Nhập Lại",
|
||||
["SEVEN_DAY_TITLE"] = "7 ngày tân thủ vui vẻ",
|
||||
["SEVEN_DAY_DESC_1"] = "Mỗi ngày sẽ mở nhiệm vụ mới",
|
||||
["DAY_X"] = "Ngày {0}",
|
||||
|
||||
@ -135,9 +135,7 @@ local localization_global =
|
||||
["LEVEL_FUND_DESC_1"] = "購買成長基金{0}後,可透過提高等級獲得鑽石。 \n多檔基金可同時購買",
|
||||
["BUFF_DESC"] = "BUFF",
|
||||
["DAILY_CHALLENGE_DESC_1"] = "今日剩餘挑戰次數不足",
|
||||
["DISCONNECT_RELOGIN"] = "網路連接已中斷,請重新登入",
|
||||
["RECONNECT"] = "網路連接已中斷,是否重連",
|
||||
["RELOGIN"] = "重新登入",
|
||||
["SEVEN_DAY_TITLE"] = "新人七天樂",
|
||||
["SEVEN_DAY_DESC_1"] = "每天將開啟新的任務",
|
||||
["DAY_X"] = "第{0}天",
|
||||
|
||||
@ -1,7 +1,13 @@
|
||||
local ArenaManager = class("ArenaManager", BaseModule)
|
||||
|
||||
-- 赛季结算
|
||||
function ArenaManager:onSeasonSettlement()
|
||||
EventManager.dispatchEvent(EventManager.CUSTOM_EVENT.ARENA_SEASON_SETTLEMENT)
|
||||
end
|
||||
|
||||
-- 赛季改变
|
||||
function ArenaManager:onSeasonChanged()
|
||||
EventManager.dispatchEvent(EventManager.CUSTOM_EVENT.ARENA_SEASON_END)
|
||||
if not self.isResetting then
|
||||
return
|
||||
end
|
||||
@ -28,6 +34,13 @@ function ArenaManager:reqChallenge()
|
||||
return
|
||||
end
|
||||
|
||||
-- 判断体力
|
||||
if not DataManager.ArenaData:isEnoughTicket() then
|
||||
GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_ARENA_TICKET)
|
||||
ModuleManager.CommerceManager:showBuyArenaTicketUI()
|
||||
return
|
||||
end
|
||||
|
||||
local reqData = {
|
||||
defInfo = DataManager.ArenaData:getMatchInfo()
|
||||
}
|
||||
@ -82,12 +95,14 @@ end
|
||||
function ArenaManager:rspSettlement(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
DataManager.ArenaData:onBattleResultReceived(result.settlement)
|
||||
|
||||
-- 总共赢的次数result.total_win_count
|
||||
-- 总共输的次数result.total_lose_count
|
||||
|
||||
local checkCount = 0
|
||||
if result.settlement.win then
|
||||
checkCount = result.total_win_count
|
||||
else
|
||||
checkCount = result.total_lose_count
|
||||
end
|
||||
-- 展示结算界面
|
||||
ModuleManager.BattleManager:showBattleResultUI(GConst.BattleConst.BATTLE_TYPE.ARENA, result.rewards, result.reqData.combatReport)
|
||||
ModuleManager.BattleManager:showArenaBattleResultUI(result.settlement, result.rewards, checkCount)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -19,7 +19,25 @@ function BattleManager:showPauseUI(battleType)
|
||||
end
|
||||
|
||||
function BattleManager:showBattleResultUI(battleType, rewards, combatReport, mysteryBoxIdx)
|
||||
UIManager:showUI("app/ui/battle/battle_result_ui", {battleType = battleType, rewards = rewards, combatReport = combatReport, mysteryBoxIdx = mysteryBoxIdx})
|
||||
UIManager:showUI("app/ui/battle/battle_result_ui", {
|
||||
battleType = battleType,
|
||||
isWin = combatReport.victory,
|
||||
rewards = rewards,
|
||||
atkReport = combatReport.atkReport,
|
||||
wave = combatReport.wave,
|
||||
mysteryBoxIdx = mysteryBoxIdx or 0,
|
||||
remainRound = combatReport.remainRound or 0,
|
||||
})
|
||||
end
|
||||
|
||||
function BattleManager:showArenaBattleResultUI(settlement, rewards, checkCount)
|
||||
UIManager:showUI("app/ui/battle/battle_result_ui", {
|
||||
battleType = GConst.BattleConst.BATTLE_TYPE.ARENA,
|
||||
isWin = settlement.win,
|
||||
rewards = rewards,
|
||||
incrScore = settlement.incr_score,
|
||||
arenaTotalCount = checkCount,
|
||||
})
|
||||
end
|
||||
|
||||
function BattleManager:showBoxOpenUI(rewards, callback)
|
||||
|
||||
@ -73,6 +73,8 @@ function ArenaMatchUI:onLoadRootComplete()
|
||||
-- 匹配结果页
|
||||
self.matchResult = uiMap["arena_match_ui.match_result"]
|
||||
self.btnClose = uiMap["arena_match_ui.match_result.btn_close"]
|
||||
self.spineVS = uiMap["arena_match_ui.match_result.spine_vs"]
|
||||
self.matchAnimator = self.matchResult:getComponent(GConst.TYPEOF_UNITY_CLASS.ANIMATOR)
|
||||
-- 对手信息
|
||||
self.matchAvatar = CellManager:addCellComp(uiMap["arena_match_ui.match_result.match.info.player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL)
|
||||
self.matchTxName = uiMap["arena_match_ui.match_result.match.info.tx_name"]
|
||||
@ -105,7 +107,6 @@ function ArenaMatchUI:onLoadRootComplete()
|
||||
end)
|
||||
self.btnStart:addClickListener(function()
|
||||
ModuleManager.ArenaManager:reqChallenge()
|
||||
self:closeUI()
|
||||
end)
|
||||
self.btnRematch:addClickListener(function()
|
||||
self:onClickRematch()
|
||||
@ -114,6 +115,10 @@ function ArenaMatchUI:onLoadRootComplete()
|
||||
UIManager:showUI("app/ui/arena/arena_formation_ui", GConst.BattleConst.FORMATION_TYPE.ARENA_ATTACK)
|
||||
self:closeUI()
|
||||
end)
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.ARENA_SEASON_SETTLEMENT, function()
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_31))
|
||||
self:closeUI()
|
||||
end)
|
||||
end
|
||||
|
||||
function ArenaMatchUI:onRefresh()
|
||||
@ -160,7 +165,9 @@ function ArenaMatchUI:showMatchResult()
|
||||
self.matchResult:setActive(true)
|
||||
self.showResult = true
|
||||
|
||||
self.freeRematchCD = DataManager.ArenaData:getFreeRematchCd()
|
||||
self.spineVS:playAnimComplete("born", false, true, function()
|
||||
self.spineVS:playAnim("idle", true, true)
|
||||
end)
|
||||
|
||||
self.txStart:setText(I18N:getGlobalText(I18N.GlobalConst.TASK_CHALLENGE))
|
||||
self.txConst:setText(DataManager.ArenaData:getFightCostNum())
|
||||
@ -202,12 +209,13 @@ function ArenaMatchUI:showMatchResult()
|
||||
self.matchExistCd = self.matchExistCd - 1
|
||||
if self.matchExistCd <= 0 then
|
||||
self:unscheduleGlobal(self.existSid)
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_8))
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_26))
|
||||
self:closeUI()
|
||||
end
|
||||
end, 1)
|
||||
|
||||
-- 免费匹配cd倒计时
|
||||
self.freeRematchCD = DataManager.ArenaData:getFreeRematchCd()
|
||||
if self.countdownSid then
|
||||
self:unscheduleGlobal(self.countdownSid)
|
||||
end
|
||||
@ -245,7 +253,7 @@ function ArenaMatchUI:onClickRematch()
|
||||
else
|
||||
-- 钻石
|
||||
local params ={
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.BOUNTY_BUY_LEVEL_COUNTENT),
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_25, DataManager.ArenaData:getRematchConstGem()),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
||||
costId = GConst.ItemConst.ITEM_ID_GEM,
|
||||
costNum = DataManager.ArenaData:getRematchConstGem(),
|
||||
|
||||
@ -8,14 +8,28 @@ function BattleResultUI:getPrefabPath()
|
||||
end
|
||||
|
||||
function BattleResultUI:ctor(params)
|
||||
self.rewards = params.rewards
|
||||
self.combatReport = params.combatReport
|
||||
self.mysteryBoxIdx = params.mysteryBoxIdx or 0
|
||||
if EDITOR_MODE then
|
||||
Logger.printTable(params)
|
||||
end
|
||||
-- 通用
|
||||
self.battleType = params.battleType
|
||||
self.isWin = params.isWin
|
||||
self.rewards = params.rewards
|
||||
-- pve特有
|
||||
self.atkReport = params.atkReport
|
||||
self.wave = params.wave
|
||||
-- 主线特有
|
||||
self.mysteryBoxIdx = params.mysteryBoxIdx or 0
|
||||
-- 金币副本特有
|
||||
self.remainRound = params.remainRound
|
||||
-- 竞技场特有
|
||||
self.incrScore = params.incrScore
|
||||
self.arenaTotalCount = params.arenaTotalCount
|
||||
|
||||
self.isTryShowGoldPig = false
|
||||
self.totalDmg = 0
|
||||
if self.combatReport.atkReport then
|
||||
for _, info in ipairs(self.combatReport.atkReport) do
|
||||
if self.atkReport then
|
||||
for _, info in ipairs(self.atkReport) do
|
||||
self.totalDmg = self.totalDmg + info.dmg
|
||||
end
|
||||
end
|
||||
@ -35,8 +49,8 @@ function BattleResultUI:onClose()
|
||||
if self.sliderSequence then
|
||||
self.sliderSequence:Kill()
|
||||
end
|
||||
if self.animUnit then
|
||||
self.animUnit:Kill()
|
||||
if self.animNode then
|
||||
self.animNode:Kill()
|
||||
end
|
||||
if self.animPig then
|
||||
self.animPig:Kill()
|
||||
@ -48,217 +62,281 @@ function BattleResultUI:onClose()
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.arenaSequence then
|
||||
self.arenaSequence:Kill()
|
||||
self.arenaSequence = nil
|
||||
end
|
||||
end
|
||||
|
||||
function BattleResultUI:onLoadRootComplete()
|
||||
self:_display()
|
||||
self:_addListeners()
|
||||
end
|
||||
|
||||
function BattleResultUI:_display()
|
||||
if self.combatReport.victory then
|
||||
self:refreshVictoryNode()
|
||||
AudioManager:playEffect(AudioManager.EFFECT_ID.BATTLE_VICTORY)
|
||||
else
|
||||
self:refreshDefeatNode()
|
||||
AudioManager:playEffect(AudioManager.EFFECT_ID.BATTLE_DEFEAT)
|
||||
end
|
||||
self:refreshFixedInfo()
|
||||
self:refreshRewards()
|
||||
self:refreshUnitInfo()
|
||||
self:initGoldPig()
|
||||
end
|
||||
|
||||
function BattleResultUI:_addListeners()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
uiMap["battle_result_ui.mask_v"]:addClickListener(function()
|
||||
if self.isTryShowGoldPig then
|
||||
ModuleManager.BattleManager:endBattleAndExit()
|
||||
else
|
||||
if not self:tryShowGoldPig() then
|
||||
ModuleManager.BattleManager:endBattleAndExit()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
uiMap["battle_result_ui.mask_d"]:addClickListener(function()
|
||||
if self.isTryShowGoldPig then
|
||||
ModuleManager.BattleManager:endBattleAndExit()
|
||||
else
|
||||
if not self:tryShowGoldPig() then
|
||||
ModuleManager.BattleManager:endBattleAndExit()
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshFixedInfo()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
local icon = uiMap["battle_result_ui.unit_node.icon"]
|
||||
local desc1 = uiMap["battle_result_ui.unit_node.desc_1"]
|
||||
local desc2 = uiMap["battle_result_ui.unit_node.desc_2"]
|
||||
local desc3 = uiMap["battle_result_ui.unit_node.desc_3"]
|
||||
local rewardTitle = uiMap["battle_result_ui.reward_node.reward_title"]
|
||||
local continue = uiMap["battle_result_ui.continue"]
|
||||
desc2:setText(self.combatReport.wave)
|
||||
desc3:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_7, GFunc.num2Str(self.totalDmg)))
|
||||
rewardTitle:setText(I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC))
|
||||
continue:setText(I18N:getGlobalText(I18N.GlobalConst.CONTINUE_DESC))
|
||||
|
||||
local iconName = "common_dec_3"
|
||||
if self.battleType == GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD then
|
||||
iconName = "common_dec_15"
|
||||
local round = self.combatReport.remainRound or 0
|
||||
desc2:setText(round)
|
||||
desc1:setText(I18N:getGlobalText(I18N.GlobalConst.ROUND_LEFT))
|
||||
else
|
||||
desc1:setText(GConst.EMPTY_STRING)
|
||||
end
|
||||
icon:setSprite(GConst.ATLAS_PATH.COMMON, iconName)
|
||||
|
||||
GFunc.centerImgAndTx(icon, desc2, 7)
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshVictoryNode()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
uiMap["battle_result_ui.mask_v"]:setVisible(true)
|
||||
uiMap["battle_result_ui.mask_d"]:setVisible(false)
|
||||
uiMap["battle_result_ui.defeat_node"]:setVisible(false)
|
||||
uiMap["battle_result_ui.victory_node"]:setVisible(true)
|
||||
uiMap["battle_result_ui.victory_node.unit_node.report_img_v"]:setVisible(true)
|
||||
uiMap["battle_result_ui.defeat_node.unit_node.report_img_d"]:setVisible(false)
|
||||
uiMap["battle_result_ui.victory_node.title_bg.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5))
|
||||
uiMap["battle_result_ui.victory_node.ui_spine_obj"]:playAnimComplete("born", false, true, function()
|
||||
uiMap["battle_result_ui.victory_node.ui_spine_obj"]:playAnim("idle", true, true)
|
||||
end)
|
||||
self:refreshUnitNodeAnim(uiMap["battle_result_ui.victory_node.unit_node"])
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshDefeatNode()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
uiMap["battle_result_ui.mask_v"]:setVisible(false)
|
||||
uiMap["battle_result_ui.mask_d"]:setVisible(true)
|
||||
uiMap["battle_result_ui.defeat_node"]:setVisible(true)
|
||||
uiMap["battle_result_ui.victory_node"]:setVisible(false)
|
||||
uiMap["battle_result_ui.victory_node.unit_node.report_img_v"]:setVisible(false)
|
||||
uiMap["battle_result_ui.defeat_node.unit_node.report_img_d"]:setVisible(true)
|
||||
uiMap["battle_result_ui.defeat_node.title_bg.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_6))
|
||||
uiMap["battle_result_ui.defeat_node.ui_spine_obj"]:playAnimComplete("born", false, true, function()
|
||||
uiMap["battle_result_ui.defeat_node.ui_spine_obj"]:playAnim("idle", true, true)
|
||||
end)
|
||||
self:refreshUnitNodeAnim(uiMap["battle_result_ui.defeat_node.unit_node"])
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshUnitNodeAnim(parent)
|
||||
local uiMap = self.root:genAllChildren()
|
||||
if not parent then
|
||||
uiMap["battle_result_ui.unit_node"]:setActive(false)
|
||||
return
|
||||
else
|
||||
uiMap["battle_result_ui.unit_node"]:setActive(true)
|
||||
end
|
||||
uiMap["battle_result_ui.unit_node"]:setParent(parent, false)
|
||||
uiMap["battle_result_ui.unit_node"]:setAnchoredPosition(0, 0)
|
||||
local canvasNodeUnit = parent:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
||||
|
||||
self.animUnit = self.root:createBindTweenSequence()
|
||||
self.animUnit:Insert(0, canvasNodeUnit:DOFade(0, 0))
|
||||
self.animUnit:Insert(0.1, canvasNodeUnit:DOFade(1, 0))
|
||||
self.animUnit:Insert(0, parent:getTransform():DOScale(0, 0))
|
||||
self.animUnit:Insert(0.1, parent:getTransform():DOScale(0.35, 0))
|
||||
self.animUnit:Insert(0.13, parent:getTransform():DOScale(1.1, 0.16))
|
||||
self.animUnit:Insert(0.26, parent:getTransform():DOScale(1, 0.14))
|
||||
self.animUnit:OnComplete(function()
|
||||
self.animUnit = nil
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshArenaNode(isShow)
|
||||
local uiMap = self.root:genAllChildren()
|
||||
if not isShow then
|
||||
uiMap["battle_result_ui.arena_node"]:setActive(false)
|
||||
return
|
||||
else
|
||||
uiMap["battle_result_ui.arena_node"]:setActive(true)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshRewards()
|
||||
if self.scrollRectComp then
|
||||
self.scrollRectComp:updateAllCell()
|
||||
return
|
||||
end
|
||||
|
||||
self.animRewards = {}
|
||||
local uiMap = self.root:genAllChildren()
|
||||
self.rewardNode = uiMap["battle_result_ui.reward_node"]
|
||||
self.rewardNode:setVisible(true)
|
||||
local scrollRect = uiMap["battle_result_ui.reward_node.scroll_rect"]
|
||||
self.scrollRectComp = scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
self.scrollRectComp:addInitCallback(function()
|
||||
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
|
||||
end)
|
||||
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
||||
cell:refresh(self.rewards[index])
|
||||
if index <= MAX_SCROLL_SHOW_COUNT and self.animRewards[index] == nil then
|
||||
self.animRewards[index] = self:showRewardAppearAnim(index, cell)
|
||||
end
|
||||
cell:showRightUpIcon(index <= self.mysteryBoxIdx, GConst.ATLAS_PATH.COMMON, "common_chest_1")
|
||||
end)
|
||||
self.scrollRectComp:setFadeArgs(0.05, 0.3)
|
||||
self.scrollRectComp:clearCells()
|
||||
local rewardCount = #self.rewards
|
||||
if rewardCount > MAX_SCROLL_SHOW_COUNT then
|
||||
local comp = scrollRect:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_SCROLL_RECT)
|
||||
comp.movementType = CS.UnityEngine.UI.ScrollRect.MovementType.Elastic
|
||||
self.scrollRectComp:setPerLineNum(5)
|
||||
scrollRect:setSizeDeltaX(560)
|
||||
else
|
||||
local comp = scrollRect:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_SCROLL_RECT)
|
||||
comp.movementType = CS.UnityEngine.UI.ScrollRect.MovementType.Clamped
|
||||
if rewardCount >= 5 then
|
||||
self.scrollRectComp:setPerLineNum(5)
|
||||
scrollRect:setSizeDeltaX(560)
|
||||
elseif rewardCount <= 0 then
|
||||
self.scrollRectComp:setPerLineNum(1)
|
||||
scrollRect:setSizeDeltaX(560)
|
||||
else
|
||||
self.scrollRectComp:setPerLineNum(rewardCount)
|
||||
scrollRect:setSizeDeltaX(112*rewardCount)
|
||||
end
|
||||
end
|
||||
self.scrollRectComp:refillCells(rewardCount)
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshUnitInfo()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
self.continue = uiMap["battle_result_ui.continue"]
|
||||
-- 胜利节点
|
||||
self.victoryNode = uiMap["battle_result_ui.victory_node"]
|
||||
self.victoryMask = uiMap["battle_result_ui.mask_v"]
|
||||
self.victoryTxTitle = uiMap["battle_result_ui.victory_node.title_bg.desc"]
|
||||
self.victorySpine = uiMap["battle_result_ui.victory_node.ui_spine_obj"]
|
||||
self.victoryUnitNode = uiMap["battle_result_ui.victory_node.unit_node"]
|
||||
-- 失败节点
|
||||
self.defeatNode = uiMap["battle_result_ui.defeat_node"]
|
||||
self.defeatMask = uiMap["battle_result_ui.mask_d"]
|
||||
self.defeatTxTitle = uiMap["battle_result_ui.defeat_node.title_bg.desc"]
|
||||
self.defeatSpine = uiMap["battle_result_ui.defeat_node.ui_spine_obj"]
|
||||
self.defeatUnitNode = uiMap["battle_result_ui.defeat_node.unit_node"]
|
||||
-- 战斗信息
|
||||
self.unitNode = uiMap["battle_result_ui.unit_node"]
|
||||
self.unitImgBattleIcon = uiMap["battle_result_ui.unit_node.icon"]
|
||||
self.unitTxDesc1 = uiMap["battle_result_ui.unit_node.desc_1"]
|
||||
self.unitTxDesc2 = uiMap["battle_result_ui.unit_node.desc_2"]
|
||||
self.unitTxDesc3 = uiMap["battle_result_ui.unit_node.desc_3"]
|
||||
self.unitImgReportV = uiMap["battle_result_ui.unit_node.report_img_v"]
|
||||
self.unitImgReportD = uiMap["battle_result_ui.unit_node.report_img_d"]
|
||||
if not self.unitResultReportCells then
|
||||
self.unitResultReportCells = {}
|
||||
for index = 1, 5 do
|
||||
self.unitResultReportCells[index] = CellManager:addCellComp(uiMap["battle_result_ui.unit_node.unit_result_report_cell_" .. index], UNIT_RESULT_RERPORT_CELL)
|
||||
end
|
||||
end
|
||||
-- 奖励节点
|
||||
self.rewardNode = uiMap["battle_result_ui.reward_node"]
|
||||
self.rewardTxTitle = uiMap["battle_result_ui.reward_node.reward_title"]
|
||||
self.rewardScrollRect = uiMap["battle_result_ui.reward_node.scroll_rect"]
|
||||
self.rewardScrollRectComp = self.rewardScrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
-- 金猪存钱罐
|
||||
self.goldPigNode = uiMap["battle_result_ui.gold_pig"]
|
||||
self.goldPigTxGem = uiMap["battle_result_ui.gold_pig.gem_bg.gem_tx"]
|
||||
self.goldPigSlider = uiMap["battle_result_ui.gold_pig.slider_bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||
self.goldPigTxSlider = uiMap["battle_result_ui.gold_pig.slider_bg.text"]
|
||||
self.goldPigImgGem = uiMap["battle_result_ui.gold_pig.gem_bg.gem_img"]
|
||||
self.goldPigSpine = uiMap["battle_result_ui.gold_pig.spine_pig"]
|
||||
self.goldPigGem = uiMap["battle_result_ui.gold_pig.gem_bg"]
|
||||
self.canvasGroupPigGem = self.goldPigGem:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
||||
-- 竞技场
|
||||
self.arenaNode = uiMap["battle_result_ui.arena_node"]
|
||||
self.arenaSpineGrading = uiMap["battle_result_ui.arena_node.spine_grading"]
|
||||
self.arenaTxGrading = uiMap["battle_result_ui.arena_node.tx_grading"]
|
||||
self.arenaTxScore = uiMap["battle_result_ui.arena_node.tx_score"]
|
||||
self.arenaImgProp = uiMap["battle_result_ui.arena_node.prog.img_prog"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||
self.arenaTxProg = uiMap["battle_result_ui.arena_node.prog.tx_prog"]
|
||||
-- 竞技场广告宝箱
|
||||
self.arenaBoxNode = uiMap["battle_result_ui.arena_box_node"]
|
||||
|
||||
self.victoryMask:addClickListener(function()
|
||||
self:onClickMask()
|
||||
end)
|
||||
self.defeatMask:addClickListener(function()
|
||||
self:onClickMask()
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleResultUI:onClickMask()
|
||||
if self.isTryShowGoldPig then
|
||||
ModuleManager.BattleManager:endBattleAndExit()
|
||||
else
|
||||
if not self:tryShowGoldPig() then
|
||||
ModuleManager.BattleManager:endBattleAndExit()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleResultUI:onRefresh()
|
||||
if self.isWin then
|
||||
self:refreshVictoryNode()
|
||||
AudioManager:playEffect(AudioManager.EFFECT_ID.BATTLE_VICTORY)
|
||||
else
|
||||
self:refreshDefeatNode()
|
||||
AudioManager:playEffect(AudioManager.EFFECT_ID.BATTLE_DEFEAT)
|
||||
end
|
||||
self:refreshRewards()
|
||||
self:refreshUnitInfo()
|
||||
self:refreshArenaNode()
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshVictoryNode()
|
||||
self.victoryNode:setVisible(true)
|
||||
self.unitImgReportV:setVisible(true)
|
||||
self.defeatNode:setVisible(false)
|
||||
self.unitImgReportD:setVisible(false)
|
||||
|
||||
self.victoryTxTitle:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5))
|
||||
self.victorySpine:playAnimComplete("born", false, true, function()
|
||||
self.victorySpine:playAnim("idle", true, true)
|
||||
end)
|
||||
|
||||
if self.battleType == GConst.BattleConst.BATTLE_TYPE.ARENA then
|
||||
self:showNodeAnim(self.victoryUnitNode, self.arenaNode)
|
||||
else
|
||||
self:showNodeAnim(self.victoryUnitNode, self.unitNode)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshDefeatNode()
|
||||
self.victoryNode:setVisible(false)
|
||||
self.unitImgReportV:setVisible(false)
|
||||
self.defeatNode:setVisible(true)
|
||||
self.unitImgReportD:setVisible(true)
|
||||
|
||||
self.defeatTxTitle:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_6))
|
||||
self.defeatSpine:playAnimComplete("born", false, true, function()
|
||||
self.defeatSpine:playAnim("idle", true, true)
|
||||
end)
|
||||
|
||||
if self.battleType == GConst.BattleConst.BATTLE_TYPE.ARENA then
|
||||
self:showNodeAnim(self.defeatUnitNode, self.arenaNode)
|
||||
else
|
||||
self:showNodeAnim(self.defeatUnitNode, self.unitNode)
|
||||
end
|
||||
end
|
||||
|
||||
-- 播放节点动画
|
||||
function BattleResultUI:showNodeAnim(parent, node)
|
||||
if not parent then
|
||||
node:setVisible(false)
|
||||
return
|
||||
else
|
||||
node:setVisible(true)
|
||||
end
|
||||
node:setParent(parent, false)
|
||||
node:setAnchoredPosition(0, 0)
|
||||
local canvasNode = parent:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
||||
|
||||
self.animNode = self.root:createBindTweenSequence()
|
||||
self.animNode:Insert(0, canvasNode:DOFade(0, 0))
|
||||
self.animNode:Insert(0.1, canvasNode:DOFade(1, 0))
|
||||
self.animNode:Insert(0, parent:getTransform():DOScale(0, 0))
|
||||
self.animNode:Insert(0.1, parent:getTransform():DOScale(0.35, 0))
|
||||
self.animNode:Insert(0.13, parent:getTransform():DOScale(1.1, 0.16))
|
||||
self.animNode:Insert(0.26, parent:getTransform():DOScale(1, 0.14))
|
||||
self.animNode:OnComplete(function()
|
||||
self.animNode = nil
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshArenaNode()
|
||||
if self.battleType ~= GConst.BattleConst.BATTLE_TYPE.ARENA then
|
||||
self.arenaNode:setVisible(false)
|
||||
return
|
||||
end
|
||||
|
||||
self.arenaNode:setVisible(true)
|
||||
local totalScore = DataManager.ArenaData:getScore()
|
||||
local lastScore = totalScore - self.incrScore
|
||||
local curId = DataManager.ArenaData:getGradingId()
|
||||
local lastId = DataManager.ArenaData:getGradingIdFromScore(lastScore)
|
||||
|
||||
self.arenaTxGrading:setText(DataManager.ArenaData:getGradingName(lastId))
|
||||
if self.arenaSequence then
|
||||
self.arenaSequence:Kill()
|
||||
end
|
||||
self.arenaSequence = DOTweenManager:createSeqWithIntId()
|
||||
local tween = DOTweenManager:createDOTweenTo(
|
||||
function()
|
||||
return lastScore
|
||||
end,
|
||||
function(value)
|
||||
local maxScore = DataManager.ArenaData:getGradingScoreTotal(value)
|
||||
local curScore = DataManager.ArenaData:getGradingScore(value)
|
||||
self.arenaImgProp.value = curScore/maxScore
|
||||
self.arenaTxProg:setText(math.floor(curScore).."/"..maxScore)
|
||||
end,
|
||||
totalScore, 1.5)
|
||||
self.arenaSequence:Append(tween)
|
||||
self.arenaSequence:AppendCallback(function()
|
||||
self.arenaTxGrading:setText(DataManager.ArenaData:getGradingName(curId))
|
||||
self.arenaSequence = nil
|
||||
end)
|
||||
|
||||
if self.incrScore > 0 then
|
||||
self.arenaTxScore:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_27, "+"..self.incrScore))
|
||||
else
|
||||
self.arenaTxScore:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_27, self.incrScore))
|
||||
end
|
||||
|
||||
-- 检查ad宝箱显示
|
||||
self.arenaBoxNode:setVisible(false)
|
||||
if self.isWin then
|
||||
if (self.arenaTotalCount % GFunc.getConstIntValue("arena_win_adbox")) == 0 then
|
||||
self.arenaBoxNode:setVisible(true)
|
||||
|
||||
end
|
||||
else
|
||||
if (self.arenaTotalCount % GFunc.getConstIntValue("arena_lose_adbox")) == 0 then
|
||||
self.arenaBoxNode:setVisible(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshRewards()
|
||||
self.animRewards = {}
|
||||
self.rewardNode:setVisible(true)
|
||||
self.rewardTxTitle:setText(I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC))
|
||||
self.continue:setText(I18N:getGlobalText(I18N.GlobalConst.CONTINUE_DESC))
|
||||
self.rewardScrollRectComp:addInitCallback(function()
|
||||
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
|
||||
end)
|
||||
self.rewardScrollRectComp:addRefreshCallback(function(index, cell)
|
||||
cell:refresh(self.rewards[index])
|
||||
if index <= MAX_SCROLL_SHOW_COUNT and self.animRewards[index] == nil then
|
||||
self.animRewards[index] = self:showRewardAppearAnim(index, cell)
|
||||
end
|
||||
cell:showRightUpIcon(index <= self.mysteryBoxIdx, GConst.ATLAS_PATH.COMMON, "common_chest_1")
|
||||
end)
|
||||
self.rewardScrollRectComp:setFadeArgs(0.05, 0.3)
|
||||
self.rewardScrollRectComp:clearCells()
|
||||
local rewardCount = #self.rewards
|
||||
if rewardCount > MAX_SCROLL_SHOW_COUNT then
|
||||
local comp = self.rewardScrollRect:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_SCROLL_RECT)
|
||||
comp.movementType = CS.UnityEngine.UI.ScrollRect.MovementType.Elastic
|
||||
self.rewardScrollRectComp:setPerLineNum(5)
|
||||
self.rewardScrollRect:setSizeDeltaX(560)
|
||||
else
|
||||
local comp = self.rewardScrollRect:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_SCROLL_RECT)
|
||||
comp.movementType = CS.UnityEngine.UI.ScrollRect.MovementType.Clamped
|
||||
if rewardCount >= 5 then
|
||||
self.rewardScrollRectComp:setPerLineNum(5)
|
||||
self.rewardScrollRect:setSizeDeltaX(560)
|
||||
elseif rewardCount <= 0 then
|
||||
self.rewardScrollRectComp:setPerLineNum(1)
|
||||
self.rewardScrollRect:setSizeDeltaX(560)
|
||||
else
|
||||
self.rewardScrollRectComp:setPerLineNum(rewardCount)
|
||||
self.rewardScrollRect:setSizeDeltaX(112*rewardCount)
|
||||
end
|
||||
end
|
||||
self.rewardScrollRectComp:refillCells(rewardCount)
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshUnitInfo()
|
||||
if not self.atkReport then
|
||||
self.unitNode:setVisible(false)
|
||||
return
|
||||
end
|
||||
|
||||
self.unitNode:setVisible(true)
|
||||
for index, cell in ipairs(self.unitResultReportCells) do
|
||||
local info = self.combatReport.atkReport[index]
|
||||
local info = self.atkReport[index]
|
||||
cell:getBaseObject():setVisible(info ~= nil)
|
||||
if info then
|
||||
cell:refresh(info, self.totalDmg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleResultUI:initGoldPig()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
self.goldPigRoot = uiMap["battle_result_ui.gold_pig"]
|
||||
self.goldPigRoot:setVisible(false)
|
||||
self.goldPigGem = uiMap["battle_result_ui.gold_pig.gem_bg"]
|
||||
self.goldPigGemTx = uiMap["battle_result_ui.gold_pig.gem_bg.gem_tx"]
|
||||
self.goldPigGemImg = uiMap["battle_result_ui.gold_pig.gem_bg.gem_img"]
|
||||
self.goldPigGemSliderComp = uiMap["battle_result_ui.gold_pig.slider_bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
|
||||
self.goldPigGemSliderTx = uiMap["battle_result_ui.gold_pig.slider_bg.text"]
|
||||
self.goldPigSpine = uiMap["battle_result_ui.gold_pig.spine_pig"]
|
||||
self.canvasGroupPigGem = self.goldPigGem:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
||||
self.unitTxDesc2:setText(self.wave)
|
||||
self.unitTxDesc3:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_7, GFunc.num2Str(self.totalDmg)))
|
||||
|
||||
local iconName = "common_dec_3"
|
||||
if self.battleType == GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD then
|
||||
iconName = "common_dec_15"
|
||||
local round = self.remainRound or 0
|
||||
self.unitTxDesc2:setText(round)
|
||||
self.unitTxDesc1:setText(I18N:getGlobalText(I18N.GlobalConst.ROUND_LEFT))
|
||||
else
|
||||
self.unitTxDesc1:setText(GConst.EMPTY_STRING)
|
||||
end
|
||||
self.unitImgBattleIcon:setSprite(GConst.ATLAS_PATH.COMMON, iconName)
|
||||
|
||||
GFunc.centerImgAndTx(self.unitImgBattleIcon, self.unitTxDesc2, 7)
|
||||
end
|
||||
|
||||
function BattleResultUI:tryShowGoldPig()
|
||||
@ -270,7 +348,7 @@ function BattleResultUI:tryShowGoldPig()
|
||||
return false
|
||||
end
|
||||
self.rewardNode:setVisible(false)
|
||||
self.goldPigRoot:setVisible(true)
|
||||
self.goldPigNode:setVisible(true)
|
||||
local lastGemCount = DataManager.GoldPigData:getLastCount()
|
||||
local currGemCount = DataManager.GoldPigData:getCount()
|
||||
local maxGemCount = DataManager.GoldPigData:getMaxCount()
|
||||
@ -290,24 +368,24 @@ function BattleResultUI:tryShowGoldPig()
|
||||
self.goldPigSpine:playAnim("idle2", true, false)
|
||||
end)
|
||||
|
||||
self.goldPigGemTx:setText("+" .. currGemCount - lastGemCount)
|
||||
GFunc.centerImgAndTx(self.goldPigGemImg, self.goldPigGemTx, 0, -4)
|
||||
self.goldPigTxGem:setText("+" .. currGemCount - lastGemCount)
|
||||
GFunc.centerImgAndTx(self.goldPigImgGem, self.goldPigTxGem, 0, -4)
|
||||
if currGemCount > lastGemCount then
|
||||
self.sliderSequence = DOTweenManager:createSeqWithIntId()
|
||||
local curProgress = 0
|
||||
local remain = currGemCount - lastGemCount
|
||||
local startPercent = lastGemCount / maxGemCount
|
||||
local remainPercent = currGemCount / maxGemCount - startPercent
|
||||
self.goldPigGemSliderComp.value = startPercent
|
||||
self.goldPigGemSliderTx:setText(lastGemCount .. "/" .. currGemCount)
|
||||
self.goldPigSlider.value = startPercent
|
||||
self.goldPigTxSlider:setText(lastGemCount .. "/" .. currGemCount)
|
||||
local tween = DOTweenManager:createDOTweenTo(
|
||||
function()
|
||||
return curProgress
|
||||
end,
|
||||
function(value)
|
||||
curProgress = value
|
||||
self.goldPigGemSliderComp.value = startPercent + remainPercent*curProgress
|
||||
self.goldPigGemSliderTx:setText(lastGemCount + math.floor(remain*curProgress) .. "/" .. maxGemCount)
|
||||
self.goldPigSlider.value = startPercent + remainPercent*curProgress
|
||||
self.goldPigTxSlider:setText(lastGemCount + math.floor(remain*curProgress) .. "/" .. maxGemCount)
|
||||
end,
|
||||
1, 1)
|
||||
self.sliderSequence:Append(tween)
|
||||
@ -315,8 +393,8 @@ function BattleResultUI:tryShowGoldPig()
|
||||
self.sliderSequence = nil
|
||||
end)
|
||||
else -- 相等就不跑动画了
|
||||
self.goldPigGemSliderComp.value = currGemCount / maxGemCount
|
||||
self.goldPigGemSliderTx:setText(currGemCount .. "/" .. maxGemCount)
|
||||
self.goldPigSlider.value = currGemCount / maxGemCount
|
||||
self.goldPigTxSlider:setText(currGemCount .. "/" .. maxGemCount)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
@ -61,7 +61,7 @@ function ResourceCell:show(itemId, hideAddImg)
|
||||
end
|
||||
|
||||
function ResourceCell:updateTime()
|
||||
if self.itemId then
|
||||
if self.itemId and DataManager.BagData.ItemData:isTimingRecovery(self.itemId) then
|
||||
local curTime = DataManager.BagData.ItemData:getTimelyItemRecoveryTime(self.itemId)
|
||||
if curTime <= 0 then
|
||||
self.timeTx:setText(GConst.EMPTY_STRING)
|
||||
@ -93,6 +93,8 @@ function ResourceCell:refreshTextRightNow()
|
||||
self.numTx:setText("0")
|
||||
elseif obj:getId() == GConst.ItemConst.ITEM_ID_VIT then
|
||||
self.numTx:setText(GFunc.num2Str(count) .. "/" .. DataManager.PlayerData:getMaxVit())
|
||||
elseif obj:getId() == GConst.ItemConst.ITEM_ID_ARENA_TICKET then
|
||||
self.numTx:setText(GFunc.num2Str(count) .. "/" .. DataManager.PlayerData:getMaxArenaTicket())
|
||||
else
|
||||
self.numTx:setText(GFunc.num2Str(count))
|
||||
end
|
||||
|
||||
@ -102,10 +102,10 @@ end
|
||||
|
||||
function DungeonBoardCell:refreshCountdown(txCountdown)
|
||||
if self.countdownSid then
|
||||
ModuleManager.DungeonManager:unscheduleGlobal(self.countdownSid)
|
||||
self:getBaseObject():unscheduleGlobal(self.countdownSid)
|
||||
self.countdownSid = nil
|
||||
end
|
||||
self.countdownSid = ModuleManager.DungeonManager:scheduleGlobal(function()
|
||||
self.countdownSid = self:getBaseObject():scheduleGlobal(function()
|
||||
self:updateTime(txCountdown)
|
||||
end, 1)
|
||||
self:updateTime(txCountdown)
|
||||
|
||||
@ -51,9 +51,14 @@ function ArenaComp:init()
|
||||
self.txRank:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_5))
|
||||
|
||||
self.btnHelp:addClickListener(function()
|
||||
ModuleManager.TipsManager:showDescTips(DataManager.DungeonData:getRule(self.moduleKey), self.btnHelp)
|
||||
ModuleManager.TipsManager:showHelpTips({desc = I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_HELP)})
|
||||
end)
|
||||
self.btnRecord:addClickListener(function()
|
||||
-- 赛季结算
|
||||
if DataManager.ArenaData:isInSeasonSettlement() then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_29))
|
||||
return
|
||||
end
|
||||
UIManager:showUI("app/ui/arena/arena_recent_battle_ui")
|
||||
end)
|
||||
self.btnFormation:addClickListener(function()
|
||||
@ -119,32 +124,51 @@ function ArenaComp:refreshShow()
|
||||
return
|
||||
end
|
||||
|
||||
local maxScore = DataManager.ArenaData:getGradingScoreTotal()
|
||||
local curScore = DataManager.ArenaData:getGradingScore()
|
||||
local totalScore = DataManager.ArenaData:getScore()
|
||||
local maxScore = DataManager.ArenaData:getGradingScoreTotal(totalScore)
|
||||
local curScore = DataManager.ArenaData:getGradingScore(totalScore)
|
||||
self.txSeason:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_3, DataManager.ArenaData:getSeason()))
|
||||
self.txGarding:setText(DataManager.ArenaData:getGradingName(DataManager.ArenaData:getGradingId()))
|
||||
self.txProg:setText(curScore.."/"..maxScore)
|
||||
self.imgProg:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = curScore/maxScore
|
||||
|
||||
self.seasonChangeCD = DataManager.ArenaData:getRemainSeasonTime()
|
||||
if self.seasonChangeSid then
|
||||
ModuleManager.ArenaManager:unscheduleGlobal(self.seasonChangeSid)
|
||||
end
|
||||
self.seasonChangeSid = ModuleManager.ArenaManager:scheduleGlobal(function()
|
||||
self:refreshCountdown()
|
||||
end, 1)
|
||||
|
||||
self:refreshBounty() -- 刷新战令
|
||||
self:updateTimer()
|
||||
end
|
||||
|
||||
function ArenaComp:refreshCountdown()
|
||||
self.seasonChangeCD = self.seasonChangeCD - 1
|
||||
if self.seasonChangeCD < 0 then
|
||||
ModuleManager.ArenaManager:onSeasonChanged()
|
||||
function ArenaComp:updateTimer()
|
||||
if not DataManager.ArenaData:isOpen() then
|
||||
return
|
||||
end
|
||||
|
||||
self.txCountdown:setText(Time:formatNumTimeStr(self.seasonChangeCD))
|
||||
if self.seasonSettlementSid then
|
||||
self:getBaseObject():unscheduleGlobal(self.seasonSettlementSid)
|
||||
self.seasonSettlementSid = nil
|
||||
end
|
||||
if self.seasonEndSid then
|
||||
self:getBaseObject():unscheduleGlobal(self.seasonEndSid)
|
||||
self.seasonEndSid = nil
|
||||
end
|
||||
|
||||
if DataManager.ArenaData:isInSeasonSettlement() then
|
||||
-- 结算计时器
|
||||
self.seasonSettlementSid = self:getBaseObject():performWithDelayGlobal(function()
|
||||
ModuleManager.ArenaManager:onSeasonSettlement()
|
||||
end, DataManager.ArenaData:getRemainSeasonTime())
|
||||
else
|
||||
-- 结束计时器
|
||||
self.seasonEndSid = self:getBaseObject():performWithDelayGlobal(function()
|
||||
ModuleManager.ArenaManager:onSeasonChanged()
|
||||
end, DataManager.ArenaData:getRemainSeasonSettlementTime())
|
||||
end
|
||||
|
||||
-- 显示倒计时
|
||||
if self.seasonChangeSid then
|
||||
self:getBaseObject():unscheduleGlobal(self.seasonChangeSid)
|
||||
end
|
||||
self.seasonChangeSid = self:getBaseObject():scheduleGlobal(function()
|
||||
self.txCountdown:setText(Time:formatNumTimeStr(DataManager.ArenaData:getRemainSeasonTime()))
|
||||
end, 1)
|
||||
end
|
||||
|
||||
return ArenaComp
|
||||
@ -136,7 +136,7 @@ end
|
||||
function DailyChallengeComp:refreshCountdown()
|
||||
self.countdownTx = self.uiMap["daily_challenge_comp.countdown.time_tx"]
|
||||
if not self.countdownSid then
|
||||
self.countdownSid = ModuleManager.DailyChallengeManager:scheduleGlobal(function()
|
||||
self.countdownSid = self:getBaseObject():scheduleGlobal(function()
|
||||
self:updateTime()
|
||||
end, 1)
|
||||
end
|
||||
|
||||
@ -41,7 +41,7 @@ function DungeonComp:refreshShow()
|
||||
|
||||
-- 跨天定时器
|
||||
if self.countdownSid then
|
||||
SchedulerManager:unscheduleGlobal(self.countdownSid)
|
||||
self:getBaseObject():unscheduleGlobal(self.countdownSid)
|
||||
self.countdownSid = nil
|
||||
end
|
||||
self.countdownSid = self:getBaseObject():scheduleGlobal(function()
|
||||
|
||||
@ -40,8 +40,6 @@ function MainComp:refreshModule(selectModule)
|
||||
|
||||
-- 左侧活动入口
|
||||
if not self.leftEntrance then
|
||||
self.uiMap["main_comp.left"]:setAnchoredPositionY(self.btnPosY)
|
||||
|
||||
self.leftEntrance = {}
|
||||
self.leftEntrance[GConst.MainCityConst.MAIN_MODULE.CHAPTER] = self.uiMap["main_comp.left.chapter"]
|
||||
self.leftEntrance[GConst.MainCityConst.MAIN_MODULE.ARENA] = self.uiMap["main_comp.left.arena"]
|
||||
@ -50,8 +48,6 @@ function MainComp:refreshModule(selectModule)
|
||||
|
||||
-- 右侧活动入口
|
||||
if not self.rightEntrance then
|
||||
self.uiMap["main_comp.right"]:setAnchoredPositionY(self.btnPosY)
|
||||
|
||||
self.rightEntrance = {}
|
||||
self.rightEntrance[GConst.MainCityConst.MAIN_MODULE.CHAPTER] = self.uiMap["main_comp.right.chapter"]
|
||||
self.rightEntrance[GConst.MainCityConst.MAIN_MODULE.DUNGEON] = self.uiMap["main_comp.right.dungeon"]
|
||||
@ -163,10 +159,12 @@ function MainComp:refreshLeftBtn()
|
||||
end
|
||||
|
||||
if showCount >= 2 then
|
||||
self.uiMap["main_comp.left"]:setAnchoredPositionY(self.btnPosY - 20)
|
||||
table.foreach(self.leftEntrance, function(idx, entrance)
|
||||
entrance:setLocalScale(0.8,0.8)
|
||||
end)
|
||||
else
|
||||
self.uiMap["main_comp.left"]:setAnchoredPositionY(self.btnPosY)
|
||||
table.foreach(self.leftEntrance, function(idx, entrance)
|
||||
entrance:setLocalScale(1,1)
|
||||
end)
|
||||
@ -190,10 +188,12 @@ function MainComp:refreshRightBtn()
|
||||
end
|
||||
|
||||
if showCount >= 2 then
|
||||
self.uiMap["main_comp.right"]:setAnchoredPositionY(self.btnPosY - 20)
|
||||
table.foreach(self.rightEntrance, function(idx, entrance)
|
||||
entrance:setLocalScale(0.8,0.8)
|
||||
end)
|
||||
else
|
||||
self.uiMap["main_comp.right"]:setAnchoredPositionY(self.btnPosY)
|
||||
table.foreach(self.rightEntrance, function(idx, entrance)
|
||||
entrance:setLocalScale(1,1)
|
||||
end)
|
||||
@ -323,6 +323,11 @@ function MainComp:refreshDungeon()
|
||||
self.dungeonComp:refreshShow()
|
||||
end
|
||||
|
||||
function MainComp:refreshArena()
|
||||
self:refreshBtns()
|
||||
self.arenaComp:refreshShow()
|
||||
end
|
||||
|
||||
function MainComp:refreshStageFormaion()
|
||||
self.heroCells:refresh()
|
||||
self:refreshHeroFormationVisible()
|
||||
|
||||
@ -63,9 +63,18 @@ function ArenaData:isOpen()
|
||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ARENA, true) then
|
||||
return false
|
||||
end
|
||||
if self.cfgRank == nil or self.cfgTime == nil then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_30))
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- 是否在赛季结算中
|
||||
function ArenaData:isInSeasonSettlement()
|
||||
return self:getRemainSeasonTime() > 0 and self:getRemainSeasonSettlementTime() < 0
|
||||
end
|
||||
|
||||
-- 获取当前为第几赛季
|
||||
function ArenaData:getSeason()
|
||||
return self.season
|
||||
@ -122,6 +131,36 @@ function ArenaData:getGradingIdFromScore(score, isLastSeason)
|
||||
return seasonId
|
||||
end
|
||||
|
||||
-- 获取所在段位的积分 cur - min
|
||||
function ArenaData:getGradingScore(score)
|
||||
return score - self:getGradingMinScore(self.score)
|
||||
end
|
||||
|
||||
-- 获取所在段位的最低积分
|
||||
function ArenaData:getGradingMinScore(score)
|
||||
local id = self:getGradingIdFromScore(score)
|
||||
return self.cfgRank[id].score
|
||||
end
|
||||
|
||||
-- 获取所在段位的最高积分 full
|
||||
function ArenaData:getGradingMaxScore(score)
|
||||
local gradingId = self:getGradingIdFromScore(score)
|
||||
local isNext = false
|
||||
for id, data in pairs(self.cfgRank) do
|
||||
if isNext then
|
||||
return data.score
|
||||
end
|
||||
if id == gradingId then
|
||||
isNext = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 获取所在段位的总积分
|
||||
function ArenaData:getGradingScoreTotal(score)
|
||||
return self:getGradingMaxScore(score) - self:getGradingMinScore(score)
|
||||
end
|
||||
|
||||
-- 获取段位图标名
|
||||
function ArenaData:getGradingIconName(id)
|
||||
local cfg = ConfigManager:getConfig("arena_rank")
|
||||
@ -177,6 +216,11 @@ function ArenaData:getFightCostNum()
|
||||
return GFunc.getRewardNum(GFunc.getConstReward("arena_fight_cost"))
|
||||
end
|
||||
|
||||
-- 入场券是否足够
|
||||
function ArenaData:isEnoughTicket()
|
||||
return self:getFightCostNum() <= DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_ARENA_TICKET)
|
||||
end
|
||||
|
||||
-- 排行榜 ----------------------------------------------------------------------
|
||||
|
||||
-- 排行榜玩家总数
|
||||
@ -248,34 +292,6 @@ function ArenaData:getGradingId()
|
||||
return self.curGradingId
|
||||
end
|
||||
|
||||
-- 获取所在段位的积分 cur - min
|
||||
function ArenaData:getGradingScore()
|
||||
return self.score - self:getGradingMinScore(self.score)
|
||||
end
|
||||
|
||||
-- 获取所在段位的最低积分
|
||||
function ArenaData:getGradingMinScore()
|
||||
return self.cfgRank[self.curGradingId].score
|
||||
end
|
||||
|
||||
-- 获取所在段位的最高积分 full
|
||||
function ArenaData:getGradingMaxScore()
|
||||
local isNext = false
|
||||
for id, data in pairs(self.cfgRank) do
|
||||
if isNext then
|
||||
return data.score
|
||||
end
|
||||
if id == self.curGradingId then
|
||||
isNext = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 获取所在段位的总积分
|
||||
function ArenaData:getGradingScoreTotal()
|
||||
return self:getGradingMaxScore() - self:getGradingMinScore()
|
||||
end
|
||||
|
||||
-- 获取自己的排名
|
||||
function ArenaData:getRank()
|
||||
return self.rank
|
||||
@ -371,10 +387,13 @@ end
|
||||
-- 结算战斗数据
|
||||
function ArenaData:onBattleResultReceived(settlement)
|
||||
-- 战斗记录改变
|
||||
if self.recentBattle == nil then
|
||||
self.recentBattle = {}
|
||||
end
|
||||
table.remove(self.recentBattle, #self.recentBattle)
|
||||
table.insert(self.recentBattle, 1, settlement)
|
||||
-- 积分改变
|
||||
self.score = self.score + settlement.score
|
||||
self.score = self.score + settlement.incr_score
|
||||
self.curGradingId = self:getGradingIdFromScore(self.score)
|
||||
|
||||
self:setDirty()
|
||||
|
||||
@ -3,8 +3,8 @@ local ItemEntity = require "app/userdata/bag/item_entity"
|
||||
local ItemConst = require "app/module/item/item_const"
|
||||
local ItemData = class("ItemData", BaseData)
|
||||
|
||||
local RECOVERY_TYPE_TIME = 1
|
||||
local RECOVERY_TYPE_DAILY = 2
|
||||
local SECONDS_PRE_DAY = 86400
|
||||
|
||||
local CACHE_ITEM = {
|
||||
id = 0,
|
||||
@ -57,6 +57,7 @@ function ItemData:init(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
self.initDay = Time:getBeginningOfServerToday()
|
||||
self.data.dirty = false
|
||||
end
|
||||
|
||||
@ -222,6 +223,15 @@ function ItemData:setDirty()
|
||||
self.data.dirty = not self.data.dirty
|
||||
end
|
||||
|
||||
-- 是否按时间恢复
|
||||
function ItemData:isTimingRecovery(itemId)
|
||||
local data = self.recoveryMap[itemId]
|
||||
if not data then
|
||||
return -1
|
||||
end
|
||||
return data.type == RECOVERY_TYPE_TIME
|
||||
end
|
||||
|
||||
function ItemData:getTimelyItemRecoveryTime(itemId)
|
||||
local data = self.recoveryMap[itemId]
|
||||
if not data then
|
||||
@ -234,8 +244,13 @@ function ItemData:getTimelyItemRecoveryTime(itemId)
|
||||
return -1
|
||||
end
|
||||
-- 计算时间
|
||||
local remainTime = data.ts + data.time - Time:getServerTime()
|
||||
return remainTime
|
||||
if self:isTimingRecovery(itemId) then
|
||||
local remainTime = data.ts + data.time - Time:getServerTime()
|
||||
return remainTime
|
||||
else
|
||||
-- 无自动恢复时间
|
||||
return -1
|
||||
end
|
||||
end
|
||||
|
||||
-- 按时间回复的在此回复
|
||||
@ -270,17 +285,15 @@ end
|
||||
|
||||
-- 每日回复的在此回复
|
||||
function ItemData:recoveryDailyItem(data)
|
||||
local nowTime = Time:getServerTime()
|
||||
if nowTime < data.ts then
|
||||
if not self:isDayChange() then
|
||||
return
|
||||
end
|
||||
|
||||
local itemId = data.id
|
||||
local currNum = self:getItemNumById(itemId)
|
||||
if currNum < data.limit then
|
||||
self:addItemNumById(itemId, data.limit - currNum, BIReport.ITEM_GET_TYPE.CROSS_DAY)
|
||||
end
|
||||
-- 计算下次回复的时间
|
||||
data.ts = data.ts + SECONDS_PRE_DAY
|
||||
end
|
||||
|
||||
function ItemData:resetItemRecoveryTime(itemId)
|
||||
@ -311,6 +324,11 @@ function ItemData:updateCd()
|
||||
self:recoveryItem(v) -- 根据间隔时间增加
|
||||
end
|
||||
end
|
||||
self.initDay = Time:getBeginningOfServerToday()
|
||||
end
|
||||
|
||||
function ItemData:isDayChange()
|
||||
return self.initDay ~= Time:getBeginningOfServerToday()
|
||||
end
|
||||
|
||||
return ItemData
|
||||
@ -42,6 +42,7 @@ end
|
||||
|
||||
-- 设置数量
|
||||
function ItemEntity:setNum(num)
|
||||
Logger.logHighlight("设置:"..num)
|
||||
self.data.num = num
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
@ -59,7 +59,7 @@ function HeroData:isExistHeroById(id)
|
||||
return false
|
||||
end
|
||||
|
||||
return self.heroes[id] ~= nil
|
||||
return ConfigManager:getConfig("hero")[id] ~= nil
|
||||
end
|
||||
|
||||
function HeroData:addHero(heroStruct)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user