miduo_client/Assets/ManagedResources/~Lua/Modules/FightLevel/View/FightLevelInfoPopup_MainLev...

103 lines
3.1 KiB
Lua
Raw Normal View History

2025-03-14 11:58:20 +08:00
----- 新副本战斗回放弹窗 -----
2021-05-07 14:44:50 +08:00
local this = {}
--传入父脚本模块
local parent
--传入特效层级
2024-09-06 10:38:56 +08:00
local sortingOrder = 0
2021-05-07 14:44:50 +08:00
local fun
2021-05-11 20:20:38 +08:00
local data = {}
2021-05-07 20:24:41 +08:00
local prbGoGrid = {}
2021-05-11 20:20:38 +08:00
local backFun
local fightLevelData = {}
2024-09-06 10:38:56 +08:00
this.playerScrollHead = {} --背景前三头像
2021-05-07 14:44:50 +08:00
function this:InitComponent(gameObject)
2024-09-06 10:38:56 +08:00
this.titleText = Util.GetGameObject(gameObject, "TitleText"):GetComponent("Text")
this.backBtn = Util.GetGameObject(gameObject, "BackBtn")
2021-05-11 20:20:38 +08:00
prbGoGrid = {}
for i = 1, 2 do
2024-09-06 10:38:56 +08:00
prbGoGrid[i] = Util.GetGameObject(gameObject, "rect/ItemPre (" .. i .. ")")
2021-05-11 20:20:38 +08:00
end
2021-05-07 14:44:50 +08:00
end
function this:BindEvent()
Util.AddClick(this.backBtn, function()
parent:ClosePanel()
2021-05-11 20:20:38 +08:00
if backFun then
backFun()
backFun = nil
end
2021-05-07 14:44:50 +08:00
end)
end
2024-09-06 10:38:56 +08:00
2021-05-07 14:44:50 +08:00
function this:AddListener()
end
function this:RemoveListener()
end
2024-09-06 10:38:56 +08:00
function this:OnShow(_parent, ...)
parent = _parent
2021-05-11 20:20:38 +08:00
sortingOrder = _parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
2024-09-06 10:38:56 +08:00
local args = { ... }
2021-05-11 20:20:38 +08:00
data = args[1]
fightLevelData = args[2]
backFun = args[3]
2024-09-06 10:38:56 +08:00
this.titleText.text = Language[10808]
2021-05-11 20:20:38 +08:00
for i = 1, 2 do
prbGoGrid[i]:SetActive(false)
end
for i = 1, #data do
local root = prbGoGrid[i]
2024-09-06 10:38:56 +08:00
this.SetInfo(root, data[i], i)
2021-05-11 20:20:38 +08:00
end
2021-05-07 14:44:50 +08:00
end
2024-09-06 10:38:56 +08:00
2021-05-27 20:17:53 +08:00
function this:OnSortingOrderChange(_sortingOrder)
end
2024-09-06 10:38:56 +08:00
2021-05-07 20:24:41 +08:00
--设置头像
2024-09-06 10:38:56 +08:00
function this.SetInfo(root, data, index)
2021-05-07 20:24:41 +08:00
root:SetActive(true)
--头像
2024-09-06 10:38:56 +08:00
local headObj = Util.GetGameObject(root, "HeadParent")
2021-05-07 20:24:41 +08:00
if not this.playerScrollHead[root] then
2024-09-06 10:38:56 +08:00
this.playerScrollHead[root] = CommonPool.CreateNode(POOL_ITEM_TYPE.PLAYER_HEAD, headObj)
2021-05-07 14:44:50 +08:00
end
2021-05-07 20:24:41 +08:00
this.playerScrollHead[root]:Reset()
this.playerScrollHead[root]:SetHead(data.head)
2021-05-11 20:20:38 +08:00
this.playerScrollHead[root]:SetFrame(data.headFrame)
2021-05-07 20:24:41 +08:00
this.playerScrollHead[root]:SetLevel(data.level)
2024-09-06 10:38:56 +08:00
this.playerScrollHead[root]:SetScale(Vector3.one * 0.7)
2021-05-07 20:24:41 +08:00
this.playerScrollHead[root]:SetLayer(this.sortingOrder)
this.playerScrollHead[root]:SetEffectScale(0.75)
2024-09-06 10:38:56 +08:00
Util.GetGameObject(root, "name"):GetComponent("Text").text = PracticeManager.SetNameColor(data.userName,
data.practiceLevel) --data.userName
Util.GetGameObject(root, "warPower/Text"):GetComponent("Text").text = data.power
2021-05-13 22:50:34 +08:00
if data.type == 1 then
2024-09-06 10:38:56 +08:00
Util.GetGameObject(root, "tip"):GetComponent("Text").text = Language[10809]
2021-05-13 22:50:34 +08:00
elseif data.type == 2 then
2024-09-06 10:38:56 +08:00
Util.GetGameObject(root, "tip"):GetComponent("Text").text = Language[10810]
2021-05-07 14:44:50 +08:00
end
2024-09-06 10:38:56 +08:00
Util.AddOnceClick(Util.GetGameObject(root, "ClickBtn"), function()
local _fightData = BattleManager.GetBattleServerData(data, 0)
2021-05-13 22:50:34 +08:00
UIManager.OpenPanel(UIName.BattlePanel, _fightData, BATTLE_TYPE.BACK, function()
2024-09-06 10:38:56 +08:00
2021-05-07 20:24:41 +08:00
end)
end)
2021-05-07 14:44:50 +08:00
end
2024-09-06 10:38:56 +08:00
2021-05-07 14:44:50 +08:00
function this:OnClose()
end
2024-09-06 10:38:56 +08:00
2021-05-07 14:44:50 +08:00
function this:OnDestroy()
2021-05-13 22:50:34 +08:00
for _, playerHead in ipairs(this.playerScrollHead) do
playerHead:Recycle()
end
this.playerScrollHead = {}
2021-05-07 14:44:50 +08:00
end
2024-09-06 10:38:56 +08:00
return this