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

104 lines
3.4 KiB
Lua

----- 新副本战斗回放弹窗 -----
local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
local fun
local data = {}
local prbGoGrid = {}
local backFun
local fightLevelData = {}
this.playerScrollHead = {}--背景前三头像
function this:InitComponent(gameObject)
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
end
function this:BindEvent()
Util.AddClick(this.backBtn, function()
parent:ClosePanel()
if backFun then
backFun()
backFun = nil
end
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent,...)
parent=_parent
sortingOrder = _parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
local args = {...}
data = args[1]
fightLevelData = args[2]
backFun = args[3]
this.titleText.text="战斗回放"
for i = 1, 2 do
prbGoGrid[i]:SetActive(false)
end
for i = 1, #data do
local root = prbGoGrid[i]
this.SetInfo(root,data[i],i)
end
end
function this:OnSortingOrderChange(_sortingOrder)
end
--设置头像
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)
end
this.playerScrollHead[root]:Reset()
this.playerScrollHead[root]:SetHead(data.head)
this.playerScrollHead[root]:SetFrame(data.headFrame)
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)
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
if data.type == 1 then
if fightLevelData.config.StageType == FIGHTLEVEL_STAGETYPE.MainLevel then
Util.GetGameObject(root,"tip"):GetComponent("Text").text = "首次三星通关"
elseif fightLevelData.config.StageType == 3 then
Util.GetGameObject(root,"tip"):GetComponent("Text").text = "首次通关"
end
elseif data.type == 2 then
if fightLevelData.config.StageType == FIGHTLEVEL_STAGETYPE.MainLevel then
Util.GetGameObject(root,"tip"):GetComponent("Text").text = "最低战力三星通关"
elseif fightLevelData.config.StageType == 3 then
Util.GetGameObject(root,"tip"):GetComponent("Text").text = "最低战力通关"
end
end
Util.AddOnceClick(Util.GetGameObject(root,"ClickBtn"), function()
local _fightData = BattleManager.GetBattleServerData(data,0)
UIManager.OpenPanel(UIName.BattlePanel, _fightData, BATTLE_TYPE.BACK, function()
end)
end)
end
function this:OnClose()
end
function this:OnDestroy()
for _, playerHead in ipairs(this.playerScrollHead) do
playerHead:Recycle()
end
this.playerScrollHead = {}
end
return this