c1_lua/lua/app/ui/battle/battle_box_open_ui.lua
2023-06-01 22:10:01 +08:00

54 lines
1.6 KiB
Lua

local BattleBoxOpenUI = class("BattleBoxOpenUI", BaseUI)
function BattleBoxOpenUI:isFullScreen()
return false
end
function BattleBoxOpenUI:getPrefabPath()
return "assets/prefabs/ui/battle/battle_box_open_ui.prefab"
end
function BattleBoxOpenUI:ctor(params)
self.rewards = params.rewards
self.callback = params.callback
end
function BattleBoxOpenUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
if not self.rewardCell then
self.rewardCell = CellManager:addCellComp(uiMap["battle_box_open_ui.reward_cell"], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
end
local reward = self.rewards[1]
if reward then
self.rewardCell:refreshByConfig(reward)
end
self.aniOver = false
uiMap["battle_box_open_ui.mask"]:addClickListener(function()
if not self.aniOver then
return
end
self:closeUI()
if self.callback then
self.callback()
end
end)
if self.seqAni then
self.seqAni:Kill()
self.seqAni = nil
end
local canvasGroup = uiMap["battle_box_open_ui.title_bg"]:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
canvasGroup.alpha = 0
uiMap["battle_box_open_ui.title_bg.title"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_11))
uiMap["battle_box_open_ui.ui_spine_obj"]:playAnim("born", false, true)
self.seqAni = self.root:createBindTweenSequence()
self.seqAni:Insert(0.75, canvasGroup:DOFade(1, 0.5))
self.seqAni:AppendCallback(function()
self.aniOver = true
end)
end
return BattleBoxOpenUI