require("Base/BasePanel")
GongMingResultTips = Inherit(BasePanel)
local this = GongMingResultTips
local curSelectHeroList={}
local heroDataList={}
local curNeedRoleNum
local openThisPanel
local curHeroData = {}
local TempData = nil;
local SelectHero = nil
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
local jewelConfig = ConfigManager.GetConfig(ConfigName.JewelConfig)
--初始化组件(用于子类重写)
function GongMingResultTips:InitComponent()
this.BtnBack = Util.GetGameObject(self.transform, "btnBack")
this.TextOneAll = Util.GetGameObject(self.transform,"grid/TextOne")
this.TextTwoAll = Util.GetGameObject(self.transform,"grid/TextTwo")
this.HeroSkin = Util.GetGameObject(self.transform,"grid/ver/HeroSkin")
end
--绑定事件(用于子类重写)
function GongMingResultTips:BindEvent()
Util.AddClick(this.BtnBack, function()
self:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function GongMingResultTips:AddListener()
end
--移除事件监听(用于子类重写)
function GongMingResultTips:RemoveListener()
end
local LingDegree = -1
local HunDegree = -1
function GongMingResultTips:OnOpen(flag)
--共鸣前
local SelectId = HarmonyManager:GetUnLoadData()
local herodata = HeroManager.GetSingleHeroData(SelectId)
local _Star = EquipManager.GetMinEquipStar(herodata.equipIdList)
local heroTData=nil
if herodata.skinId and herodata.skinId>0 then
heroTData=ConfigManager.GetConfigDataByKey(ConfigName.HeroSkin,"Type",herodata.skinId)
else
heroTData= ConfigManager.GetConfigData(ConfigName.HeroConfig,herodata.id)
end
this.liveName = GetResourcePath(heroTData.Live)
this.liveNode = poolManager:LoadLive(this.liveName, this.HeroSkin.transform, Vector3.one * heroTData.Scale, Vector3.New(heroTData.Position[1], heroTData.Position[2]))
-- this.liveNode.transform.sizeDelta = Vector2.New(1000, 1000)
this.HeroSkin:GetComponent("RectTransform").localScale = Vector2.New(0.7,0.7)
local SkeletonGraphic = this.liveNode:GetComponent("SkeletonGraphic")
local idle = function()
SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
end
SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idle
poolManager:SetLiveClearCall(this.liveName, this.liveNode, function()
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idle
end)
--共鸣后
if flag then
-- body
Util.GetGameObject(this.TextOneAll,"textDegree"):GetComponent("Text").text = string.format("%d",herodata.oriLv)
Util.GetGameObject(this.TextOneAll,"textEqiue"):GetComponent("Text").text = "无"
Util.GetGameObject(this.TextOneAll,"textHun"):GetComponent("Text").text = "无"
Util.GetGameObject(this.TextOneAll,"textLing"):GetComponent("Text").text = "无"
Util.GetGameObject(this.TextOneAll,"textFa"):GetComponent("Text").text = "无"
-- if EquipTreasureManager.GetSingleTreasureByIdDyn(herodata.jewels[2]) then
-- -- body
-- if EquipTreasureManager.GetSingleTreasureByIdDyn(herodata.jewels[2]).lv then
-- Util.GetGameObject(this.TextOneAll,"textHun"):GetComponent("Text").text = string.format("%d",EquipTreasureManager.GetSingleTreasureByIdDyn(herodata.jewels[2]).lv)
-- LingDegree = EquipTreasureManager.GetSingleTreasureByIdDyn(herodata.jewels[2]).lv
-- end
-- else
-- end
-- if EquipTreasureManager.GetSingleTreasureByIdDyn(herodata.jewels[1]) then
-- -- body
-- if EquipTreasureManager.GetSingleTreasureByIdDyn(herodata.jewels[1]).lv then
-- -- body
-- Util.GetGameObject(this.TextOneAll,"textLing"):GetComponent("Text").text = string.format("%d",EquipTreasureManager.GetSingleTreasureByIdDyn(herodata.jewels[1]).lv)
-- HunDegree = EquipTreasureManager.GetSingleTreasureByIdDyn(herodata.jewels[1]).lv
-- end
-- end
-- Util.GetGameObject(this.TextOneAll,"textFa"):GetComponent("Text").text = string.format("%d",herodata.talismanList)
if HeroManager.IsTenTalent(herodata.id) then
-- body
local data = HarmonyManager:GetAdditions()
Util.GetGameObject(this.TextTwoAll,"textDegree"):GetComponent("Text").text = data[1].value
else
Util.GetGameObject(this.TextTwoAll,"textDegree"):GetComponent("Text").text = herodata.lv
end
Util.GetGameObject(this.TextTwoAll,"textEqiue"):GetComponent("Text").text = "无"
Util.GetGameObject(this.TextTwoAll,"textHun"):GetComponent("Text").text = "无"
Util.GetGameObject(this.TextTwoAll,"textLing"):GetComponent("Text").text = "无"
Util.GetGameObject(this.TextTwoAll,"textFa"):GetComponent("Text").text = "无"
-- local data = HarmonyManager:GetAdditions()
-- for i = 1, #data do
-- if data[i].additionType == 1 then
-- Util.GetGameObject(this.TextTwoAll,"textDegree"):GetComponent("Text").text = string.format("%d",data[i].value)
-- elseif data[i].additionType == 2 then
-- if data[i].value == -1 then
-- Util.GetGameObject(this.TextTwoAll,"textEqiue"):GetComponent("Text").text = string.format("无")
-- else
-- Util.GetGameObject(this.TextTwoAll,"textEqiue"):GetComponent("Text").text = string.format("%d",data[i].value)
-- end
-- -- body
-- elseif data[i].additionType == 3 then
-- if HunDegree >data[i].value then
-- -- body
-- Util.GetGameObject(this.TextTwoAll,"textHun"):GetComponent("Text").text = string.format("%d",HunDegree)
-- else
-- Util.GetGameObject(this.TextTwoAll,"textHun"):GetComponent("Text").text = string.format("%d",data[i].value)
-- end
-- -- body
-- elseif data[i].additionType == 4 then
-- if LingDegree>data[i].value then
-- Util.GetGameObject(this.TextTwoAll,"textLing"):GetComponent("Text").text =string.format("%d",LingDegree)
-- else
-- Util.GetGameObject(this.TextTwoAll,"textLing"):GetComponent("Text").text =string.format("%d",data[i].value)
-- end
-- -- body
-- else
-- Util.GetGameObject(this.TextTwoAll,"textFa"):GetComponent("Text").text =string.format("%d",data[i].value)
-- end
-- end
else
local data = HarmonyManager:GetAdditions()
Util.GetGameObject(this.TextOneAll,"textDegree"):GetComponent("Text").text = string.format("%d",herodata.oriLv)
if data[2].value > 0 then
-- body
-- if _Star >= data[2].value then
-- -- body
-- -- local equip = ConfigManager.GetConfigData(ConfigName.EquipStarsConfig,_Star)
-- -- Util.GetGameObject(this.TextOneAll,"textEqiue"):GetComponent("Text").text = string.format("%s%d星",GetQuantityStrByquality(equip.Quality),equip.Stars)
-- else
-- end
Util.GetGameObject(this.TextOneAll,"textEqiue"):GetComponent("Text").text = "无"
else
if _Star == 0 then
-- body
Util.GetGameObject(this.TextOneAll,"textEqiue"):GetComponent("Text").text = "无"
else
local equip = ConfigManager.GetConfigData(ConfigName.EquipStarsConfig,_Star)
Util.GetGameObject(this.TextOneAll,"textEqiue"):GetComponent("Text").text = string.format("%s%d星",GetQuantityStrByquality(equip.Quality),equip.Stars)
end
end
local dataRockOne = EquipTreasureManager.GetSingleTreasureByIdDyn(herodata.jewels[2])
if dataRockOne then
-- body
if dataRockOne.lv > 0 then
if dataRockOne.type == "魂宝" then
-- body
Util.GetGameObject(this.TextOneAll,"textHun"):GetComponent("Text").text = string.format("%d",dataRockOne.lv)
HunDegree = dataRockOne.lv
else
Util.GetGameObject(this.TextOneAll,"textLing"):GetComponent("Text").text = string.format("%d",dataRockOne.lv)
LingDegree = dataRockOne.lv
end
else
Util.GetGameObject(this.TextOneAll,"textHun"):GetComponent("Text").text = "无"
end
else
Util.GetGameObject(this.TextOneAll,"textHun"):GetComponent("Text").text = "无"
end
local dataRockTwo = EquipTreasureManager.GetSingleTreasureByIdDyn(herodata.jewels[1])
if dataRockTwo then
-- body
if dataRockTwo.lv > 0 then
-- bodyLingDegree
if dataRockTwo.type == "灵宝" then
-- body
Util.GetGameObject(this.TextOneAll,"textLing"):GetComponent("Text").text = string.format("%d",dataRockTwo.lv)
LingDegree = dataRockTwo.lv
else
Util.GetGameObject(this.TextOneAll,"textHun"):GetComponent("Text").text = string.format("%d",dataRockTwo.lv)
HunDegree = dataRockTwo.lv
end
else
Util.GetGameObject(this.TextOneAll,"textLing"):GetComponent("Text").text = "无"
end
else
Util.GetGameObject(this.TextOneAll,"textLing"):GetComponent("Text").text = "无"
end
if herodata.star >= 6 then
-- body
if herodata.talismanList > 0 then
-- body
Util.GetGameObject(this.TextOneAll,"textFa"):GetComponent("Text").text = string.format("%d",herodata.talismanList)
else
Util.GetGameObject(this.TextOneAll,"textFa"):GetComponent("Text").text = string.format("无")
end
else
Util.GetGameObject(this.TextOneAll,"textFa"):GetComponent("Text").text = string.format("无")
end
for i = 1, #data do
if data[i].additionType == 1 then
if HarmonyManager.hongmengTablet >= HarmonyManager.TowerStartLimit then
-- body
Util.GetGameObject(this.TextTwoAll,"textDegree"):GetComponent("Text").text = string.format("%d",herodata.lv)
else
Util.GetGameObject(this.TextTwoAll,"textDegree"):GetComponent("Text").text = string.format("%d",herodata.lv)
end
elseif data[i].additionType == 2 then
if data[i].value == -1 then
if _Star == 0 then
-- body
Util.GetGameObject(this.TextTwoAll,"textEqiue"):GetComponent("Text").text = string.format("无")
else
local equip = ConfigManager.GetConfigData(ConfigName.EquipStarsConfig,_Star)
Util.GetGameObject(this.TextTwoAll,"textEqiue"):GetComponent("Text").text = string.format("%s%d星",GetQuantityStrByquality(equip.Quality),equip.Stars)
end
else
local equip = ConfigManager.GetConfigData(ConfigName.EquipStarsConfig,data[i].value)
Util.GetGameObject(this.TextTwoAll,"textEqiue"):GetComponent("Text").text = string.format("%s%d星",GetQuantityStrByquality(equip.Quality),equip.Stars)
end
-- body
elseif data[i].additionType == 3 then
if HunDegree ~= -1 and data[i].value > 0 then
-- body
if HunDegree >data[i].value then
-- body
Util.GetGameObject(this.TextTwoAll,"textHun"):GetComponent("Text").text = string.format("%d",HunDegree)
else
Util.GetGameObject(this.TextTwoAll,"textHun"):GetComponent("Text").text = string.format("%d",data[i].value)
end
else
if HunDegree > 0 then
-- body
Util.GetGameObject(this.TextTwoAll,"textHun"):GetComponent("Text").text = string.format("%d",HunDegree)
else
Util.GetGameObject(this.TextTwoAll,"textHun"):GetComponent("Text").text = "无"
end
end
-- body
elseif data[i].additionType == 4 then
if LingDegree ~= -1 and data[i].value > 0 then
-- body
if LingDegree>data[i].value then
Util.GetGameObject(this.TextTwoAll,"textLing"):GetComponent("Text").text =string.format("%d",LingDegree)
else
Util.GetGameObject(this.TextTwoAll,"textLing"):GetComponent("Text").text =string.format("%d",data[i].value)
end
else
if LingDegree > 0 then
-- body
Util.GetGameObject(this.TextTwoAll,"textLing"):GetComponent("Text").text =string.format("%d",LingDegree)
else
Util.GetGameObject(this.TextTwoAll,"textLing"):GetComponent("Text").text = "无"
end
end
-- body
else
if herodata.star >= 6 then
-- body
if data[i].value > 0 and data[i].value > herodata.talismanList then
-- body data[i].value > herodata.talismanList or data[i].value and herodata.talismanList
Util.GetGameObject(this.TextTwoAll,"textFa"):GetComponent("Text").text =string.format("%d",data[i].value)
elseif data[i].value <= herodata.talismanList then
-- body
Util.GetGameObject(this.TextTwoAll,"textFa"):GetComponent("Text").text =string.format("%d",herodata.talismanList)
else
Util.GetGameObject(this.TextTwoAll,"textFa"):GetComponent("Text").text =string.format("无")
end
else
Util.GetGameObject(this.TextTwoAll,"textFa"):GetComponent("Text").text =string.format("无")
end
end
end
end
end
--界面关闭时调用(用于子类重写)
function GongMingResultTips:OnClose()
if this.liveNode then
poolManager:UnLoadLive(this.liveName, this.liveNode)
this.liveNode = nil
end
end
--界面销毁时调用(用于子类重写)
function GongMingResultTips:OnDestroy()
if this.liveNode then
poolManager:UnLoadLive(this.liveName, this.liveNode)
this.liveNode = nil
end
end
return GongMingResultTips