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

96 lines
2.9 KiB
Lua
Raw Normal View History

2021-05-07 14:44:50 +08:00
----- 新副本战斗回放弹窗 -----
local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
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 = {}
2021-05-13 22:50:34 +08:00
this.playerScrollHead = {}--背景前三头像
2021-05-07 14:44:50 +08:00
function this:InitComponent(gameObject)
2021-05-11 20:20:38 +08:00
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.backBtn=Util.GetGameObject(gameObject,"BackBtn")
prbGoGrid = {}
for i = 1, 2 do
prbGoGrid[i] = Util.GetGameObject(gameObject,"rect/ItemPre (" .. i .. ")")
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
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent,...)
2021-05-11 20:20:38 +08:00
parent=_parent
sortingOrder = _parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
local args = {...}
data = args[1]
fightLevelData = args[2]
backFun = args[3]
2021-05-11 20:20:38 +08:00
this.titleText.text="战斗回放"
for i = 1, 2 do
prbGoGrid[i]:SetActive(false)
end
for i = 1, #data do
local root = prbGoGrid[i]
2021-05-13 22:50:34 +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
2021-05-27 20:17:53 +08:00
function this:OnSortingOrderChange(_sortingOrder)
end
2021-05-07 20:24:41 +08:00
--设置头像
function this.SetInfo(root,data,index)
root:SetActive(true)
--头像
local headObj=Util.GetGameObject(root,"HeadParent")
if not this.playerScrollHead[root] then
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)
this.playerScrollHead[root]:SetScale(Vector3.one*0.7)
this.playerScrollHead[root]:SetLayer(this.sortingOrder)
this.playerScrollHead[root]:SetEffectScale(0.75)
2021-05-26 17:03:42 +08:00
Util.GetGameObject(root,"name"):GetComponent("Text").text = PracticeManager.SetNameColor(data.userName,data.practiceLevel) --data.userName
2021-05-15 16:16:46 +08:00
Util.GetGameObject(root,"warPower/Text"):GetComponent("Text").text = data.power
2021-05-13 22:50:34 +08:00
if data.type == 1 then
2021-05-28 13:48:43 +08:00
Util.GetGameObject(root,"tip"):GetComponent("Text").text = "首次通关"
2021-05-13 22:50:34 +08:00
elseif data.type == 2 then
2021-05-28 13:48:43 +08:00
Util.GetGameObject(root,"tip"):GetComponent("Text").text = "最低战力通关"
2021-05-07 14:44:50 +08:00
end
2021-05-07 20:24:41 +08:00
Util.AddOnceClick(Util.GetGameObject(root,"ClickBtn"), function()
2021-05-13 22:50:34 +08:00
local _fightData = BattleManager.GetBattleServerData(data,0)
UIManager.OpenPanel(UIName.BattlePanel, _fightData, BATTLE_TYPE.BACK, function()
2021-05-07 20:24:41 +08:00
end)
end)
2021-05-07 14:44:50 +08:00
end
function this:OnClose()
end
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
return this