619 lines
28 KiB
Lua
619 lines
28 KiB
Lua
require("Base/BasePanel")
|
|
RoleEquipTreasureChangePopup = Inherit(BasePanel)
|
|
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
|
local spcialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
|
|
local jewelConfig = ConfigManager.GetConfig(ConfigName.JewelConfig)
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
local this=RoleEquipTreasureChangePopup
|
|
local type--1 穿装备 2 卸装备 3 替换装备
|
|
local curHeroData
|
|
local equipData
|
|
local openThisPanel
|
|
local equipIdList
|
|
local equipDataList
|
|
local position
|
|
local isGongMing = false
|
|
local isShowBtn
|
|
|
|
--初始化组件(用于子类重写)
|
|
function RoleEquipTreasureChangePopup:InitComponent()
|
|
equipData = {}
|
|
this.spLoader = SpriteLoader.New()
|
|
this.btnBack= Util.GetGameObject(self.transform, "btnBack")
|
|
this.GameObject=Util.GetGameObject(self.transform, "GameObject")
|
|
this.BasePropertyList = {}
|
|
this.RefinePropertyList = {}
|
|
this.TreePropertyList = {}
|
|
this.TreePropertyList2 = {}
|
|
this.strongPropertyList = {}
|
|
this.RefineMonsterPropertyList = {}
|
|
for i = 1, 2 do
|
|
this.BasePropertyList[i] = {}
|
|
this.RefinePropertyList[i] = {}
|
|
this.TreePropertyList[i] = {}
|
|
this.TreePropertyList2[i] = {}
|
|
this.strongPropertyList[i] = {}
|
|
this.RefineMonsterPropertyList[i] = {}
|
|
end
|
|
this.preList = {}
|
|
this.treasurePanel = {}
|
|
for i = 1, 2 do
|
|
if not this.treasurePanel[i] then
|
|
this.treasurePanel[i] = {}
|
|
--信息
|
|
this.treasurePanel[i].bg = Util.GetGameObject(self.transform, "GameObject/bg"..i)
|
|
this.treasurePanel[i].desc = Util.GetGameObject(this.treasurePanel[i].bg, "equipInfo/Text"):GetComponent("Text")
|
|
this.treasurePanel[i].EquipName = Util.GetGameObject(this.treasurePanel[i].bg, "equipInfo/name/text"):GetComponent("Text")
|
|
this.treasurePanel[i].EquipTypeText = Util.GetGameObject(this.treasurePanel[i].bg, "equipInfo/equipTypeText"):GetComponent("Text")
|
|
this.treasurePanel[i].powerUPorDown = Util.GetGameObject(this.treasurePanel[i].bg, "equipInfo/powerUPorDown")
|
|
this.treasurePanel[i].qualityText = Util.GetGameObject(this.treasurePanel[i].bg, "equipInfo/qualityText"):GetComponent("Text")
|
|
this.treasurePanel[i].powerNum = Util.GetGameObject(this.treasurePanel[i].bg, "equipInfo/powerNum"):GetComponent("Text")
|
|
this.treasurePanel[i].pos = Util.GetGameObject(this.treasurePanel[i].bg, "equipInfo/pos")
|
|
--按钮
|
|
this.treasurePanel[i].EquipBtns = Util.GetGameObject(self.transform, "GameObject/bg"..i.."/btns")
|
|
this.treasurePanel[i].EquipBtnStrong = Util.GetGameObject(this.treasurePanel[i].EquipBtns, "btnStrong")
|
|
this.treasurePanel[i].EquipBtnRefine = Util.GetGameObject(this.treasurePanel[i].EquipBtns, "btnRefine")
|
|
this.treasurePanel[i].EquipBtnRemove = Util.GetGameObject(this.treasurePanel[i].EquipBtns, "btnRemove")
|
|
this.treasurePanel[i].EquipBtnAdd = Util.GetGameObject(this.treasurePanel[i].EquipBtns, "btnAdd")
|
|
this.treasurePanel[i].EquipBtnChange = Util.GetGameObject(this.treasurePanel[i].EquipBtns, "btnChange")
|
|
--红点
|
|
this.treasurePanel[i].StrongRed = Util.GetGameObject(this.treasurePanel[i].EquipBtnStrong, "red")
|
|
this.treasurePanel[i].RefineRed = Util.GetGameObject(this.treasurePanel[i].EquipBtnRefine, "red")
|
|
--属性信息
|
|
this.treasurePanel[i].bgScroll = Util.GetGameObject(this.treasurePanel[i].bg, "Scroll")
|
|
this.treasurePanel[i].bgScrollContent = Util.GetGameObject(this.treasurePanel[i].bg, "Scroll/grid")
|
|
--基础
|
|
this.treasurePanel[i].BaseAttri = Util.GetGameObject(this.treasurePanel[i].bg, "Scroll/grid/baseAttri")
|
|
this.treasurePanel[i].BaseAttriNum = Util.GetGameObject(this.treasurePanel[i].BaseAttri, "name/attriNum"):GetComponent("Text")
|
|
this.treasurePanel[i].BaseAttriGrid = Util.GetGameObject(this.treasurePanel[i].BaseAttri, "grid")
|
|
--精炼
|
|
this.treasurePanel[i].RefineAttri = Util.GetGameObject(this.treasurePanel[i].bgScroll, "grid/refineAttri")
|
|
this.treasurePanel[i].RefineAttriNum = Util.GetGameObject(this.treasurePanel[i].RefineAttri, "name/attriNum"):GetComponent("Text")
|
|
this.treasurePanel[i].RefineAttriGrid = Util.GetGameObject(this.treasurePanel[i].RefineAttri, "grid")
|
|
--神应
|
|
this.treasurePanel[i].TreeAttri = Util.GetGameObject(this.treasurePanel[i].bgScroll, "grid/treeAttri")
|
|
this.treasurePanel[i].TreeAttriNum = Util.GetGameObject(this.treasurePanel[i].TreeAttri, "name/attriNum"):GetComponent("Text")
|
|
this.treasurePanel[i].TreeAttriGrid = Util.GetGameObject(this.treasurePanel[i].TreeAttri, "grid")
|
|
this.treasurePanel[i].TreeAttri:SetActive(false)
|
|
--强化共鸣
|
|
this.treasurePanel[i].strongAttri = Util.GetGameObject(this.treasurePanel[i].bgScroll, "grid/strongAttri")
|
|
this.treasurePanel[i].strongAttriNum = Util.GetGameObject(this.treasurePanel[i].strongAttri, "name/attriName"):GetComponent("Text")
|
|
this.treasurePanel[i].strongAttriGrid = Util.GetGameObject(this.treasurePanel[i].strongAttri, "grid")
|
|
this.treasurePanel[i].strongAttri:SetActive(false)
|
|
--精炼共鸣
|
|
this.treasurePanel[i].refineMasterAttri = Util.GetGameObject(this.treasurePanel[i].bgScroll, "grid/refineMasterAttri")
|
|
this.treasurePanel[i].refineMasterAttriNum = Util.GetGameObject(this.treasurePanel[i].refineMasterAttri, "name/attriName"):GetComponent("Text")
|
|
this.treasurePanel[i].refineMasterAttriGrid = Util.GetGameObject(this.treasurePanel[i].refineMasterAttri, "grid")
|
|
this.treasurePanel[i].refineMasterAttri:SetActive(false)
|
|
end
|
|
|
|
end
|
|
--其他
|
|
this.propertyPre=Util.GetGameObject(self.transform, "GameObject/bg1/PropertyTxt")
|
|
this.curEquipSign=Util.GetGameObject(self.transform, "GameObject/bg1/Text")
|
|
this.TextPre = Util.GetGameObject(self.transform, "GameObject/bg1/TextPre")
|
|
this.line = Util.GetGameObject(self.transform, "GameObject/bg1/line")
|
|
this.space = Util.GetGameObject(self.transform, "GameObject/bg1/space")
|
|
end
|
|
--绑定事件(用于子类重写)
|
|
function RoleEquipTreasureChangePopup:BindEvent()
|
|
Util.AddClick(this.btnBack, function()
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
self:ClosePanel()
|
|
end)
|
|
Util.AddClick(this.treasurePanel[1].EquipBtnRemove, function()
|
|
equipIdList={}
|
|
equipDataList={}
|
|
table.insert(equipIdList,equipData[1].idDyn)
|
|
table.insert(equipDataList,equipData[1])
|
|
NetManager.EquipUnLoadOptRequest(curHeroData.dynamicId,equipIdList ,2,function ()
|
|
self:ClosePanel()
|
|
openThisPanel.UpdateEquipPosHeroData(2,type,equipDataList)
|
|
end)
|
|
end)
|
|
Util.AddClick(this.treasurePanel[1].EquipBtnAdd, function()
|
|
local config=spcialConfig[40]
|
|
if config then
|
|
local limits = string.split(config.Value, "|")
|
|
if limits then
|
|
local heroConfig=ConfigManager.GetConfigData(ConfigName.HeroConfig,curHeroData.id)
|
|
local lvs=string.split(limits[1],"#")
|
|
local stars=string.split(limits[2],"#")
|
|
local lv=tonumber(lvs[2])
|
|
if PlayerManager.level<lv then
|
|
PopupTipPanel.ShowTip(string.format(Language[11801],lv))
|
|
return
|
|
else
|
|
local star=tonumber(stars[2])
|
|
if heroConfig~=nil and curHeroData.star< star then
|
|
PopupTipPanel.ShowTip(string.format(Language[11802],star))
|
|
return
|
|
end
|
|
end
|
|
end
|
|
end
|
|
equipIdList={}
|
|
equipDataList={}
|
|
table.insert(equipIdList,equipData[1].idDyn)
|
|
table.insert(equipDataList,equipData[1])
|
|
NetManager.EquipWearRequest(curHeroData.dynamicId,equipIdList,2,function ()
|
|
self:ClosePanel()
|
|
openThisPanel.UpdateEquipPosHeroData(2,type,equipDataList,0,position)
|
|
end)
|
|
end)
|
|
Util.AddClick(this.treasurePanel[2].EquipBtnChange, function()
|
|
equipIdList={}
|
|
equipDataList={}
|
|
table.insert(equipIdList,equipData[2].idDyn)
|
|
table.insert(equipDataList,equipData[2])
|
|
NetManager.EquipWearRequest(curHeroData.dynamicId,equipIdList,2,function ()
|
|
self:ClosePanel()
|
|
openThisPanel.UpdateEquipPosHeroData(2,type,equipDataList,equipData[1],position)
|
|
end)
|
|
end)
|
|
|
|
Util.AddClick(this.treasurePanel[2].EquipBtnStrong, function()
|
|
UIManager.OpenPanel(UIName.EquipTreasureStrongPopup,equipData[1],1)
|
|
self:ClosePanel()
|
|
end)
|
|
Util.AddClick(this.treasurePanel[1].EquipBtnStrong, function()
|
|
if isGongMing then
|
|
PopupTipPanel.ShowTip(Language[12184])
|
|
else
|
|
UIManager.OpenPanel(UIName.EquipTreasureStrongPopup,equipData[1],1)
|
|
self:ClosePanel()
|
|
end
|
|
end)
|
|
|
|
Util.AddClick(this.treasurePanel[2].EquipBtnRefine, function()
|
|
UIManager.OpenPanel(UIName.EquipTreasureStrongPopup,equipData[1],2)
|
|
self:ClosePanel()
|
|
end)
|
|
Util.AddClick(this.treasurePanel[1].EquipBtnRefine, function()
|
|
UIManager.OpenPanel(UIName.EquipTreasureStrongPopup,equipData[1],2)
|
|
self:ClosePanel()
|
|
end)
|
|
end
|
|
|
|
--添加事件监听(用于子类重写)
|
|
function RoleEquipTreasureChangePopup:AddListener()
|
|
Game.GlobalEvent:AddEvent(GameEvent.Treasure.TreasureLvUp, this.CurrEquipDataChange)
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function RoleEquipTreasureChangePopup:RemoveListener()
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Treasure.TreasureLvUp, this.CurrEquipDataChange)
|
|
end
|
|
|
|
function this.CurrEquipDataChange()
|
|
--替换
|
|
if type==3 then
|
|
equipData[1] = EquipTreasureManager.GetSingleEquipTreasreData(equipData[1].idDyn)
|
|
this.NextCurEquipData()
|
|
else
|
|
equipData[1] = EquipTreasureManager.GetSingleEquipTreasreData(equipData[1].idDyn)
|
|
this.ShowCurEquipData()
|
|
end
|
|
|
|
end
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
function RoleEquipTreasureChangePopup:OnOpen(_openThisPanel,_type,_curHeroData,_curEquipData,_nextEquipData,_position,_isShowBtn)
|
|
openThisPanel = _openThisPanel
|
|
type = _type--1 穿戴 2 卸下 3 替换 4显示信息
|
|
curHeroData = _curHeroData
|
|
equipData[1] = _curEquipData--lv
|
|
equipData[2] = _nextEquipData--refinelv
|
|
position = _position--treelv
|
|
isShowBtn = _isShowBtn
|
|
end
|
|
function RoleEquipTreasureChangePopup:OnShow()
|
|
Log("openType:"..tostring(type))
|
|
--初始化
|
|
for i = 1, 2 do
|
|
this.treasurePanel[i].bg:SetActive(false)
|
|
this.treasurePanel[i].EquipBtns:SetActive(false)
|
|
this.treasurePanel[i].EquipBtnStrong:SetActive(false)
|
|
this.treasurePanel[i].EquipBtnRefine:SetActive(false)
|
|
this.treasurePanel[i].EquipBtnRemove:SetActive(false)
|
|
this.treasurePanel[i].EquipBtnAdd:SetActive(false)
|
|
this.treasurePanel[i].EquipBtnChange:SetActive(false)
|
|
end
|
|
this.space:SetActive(false)
|
|
this.treasurePanel[1].BaseAttri:SetActive(true)
|
|
if not this.preList then
|
|
this.preList = {}
|
|
end
|
|
for k,v in pairs(this.preList) do
|
|
v.gameObject:SetActive(false)
|
|
end
|
|
if type==3 then
|
|
this.ShowEquipData(1)
|
|
this.ShowEquipData(2)
|
|
elseif type==5 then
|
|
this.resetData()
|
|
this.ShowEquipData(1)
|
|
else
|
|
this.ShowEquipData(1)
|
|
end
|
|
|
|
this.treasurePanel[1].bg:SetActive(type ~= 3)
|
|
this.treasurePanel[1].EquipBtns:SetActive((type == 1) or (type == 2))
|
|
this.treasurePanel[2].EquipBtns:SetActive(type == 3)
|
|
this.treasurePanel[1].EquipBtnAdd:SetActive(type == 1)
|
|
this.treasurePanel[1].EquipBtnStrong:SetActive((type == 2) or (type == 4))
|
|
this.treasurePanel[1].EquipBtnRefine:SetActive((type == 2) or (type == 4))
|
|
this.treasurePanel[1].EquipBtnRemove:SetActive((type == 2) or (type == 4))
|
|
this.curEquipSign.gameObject:SetActive(type == 3)
|
|
|
|
this.treasurePanel[2].bg:SetActive(type == 3)
|
|
this.treasurePanel[2].EquipBtnChange:SetActive(type == 3)
|
|
this.treasurePanel[2].EquipBtnStrong:SetActive(false)
|
|
this.treasurePanel[2].EquipBtnRefine:SetActive(false)
|
|
this.space:SetActive(type == 5)
|
|
|
|
if equipData[1] and equipData[1] ~= 0 then
|
|
isGongMing = HarmonyManager.IsInfo(equipData[1].upHeroDid)
|
|
Util.SetGray(this.treasurePanel[1].EquipBtnStrong, isGongMing)
|
|
end
|
|
|
|
if isShowBtn and isShowBtn == 0 then
|
|
for k,v in ipairs(this.treasurePanel) do
|
|
v.EquipBtns.gameObject:SetActive(false)
|
|
end
|
|
end
|
|
|
|
ForceRebuildLayout(this.GameObject.transform)
|
|
end
|
|
|
|
function this.resetData()
|
|
|
|
local single = {}
|
|
local staticId = curHeroData
|
|
local currJewel = jewelConfig[staticId]
|
|
single.id = staticId
|
|
single.lv = equipData[1]
|
|
single.refineLv = equipData[2]
|
|
single.maxLv = currJewel.Max[1]
|
|
single.maxRefineLv = currJewel.Max[2]
|
|
single.maxTreeLv = currJewel.GodHoodMaxlv
|
|
single.upHeroDid = "1"
|
|
single.treeLv = position
|
|
|
|
local quantity = currJewel.Level
|
|
single.quantity = quantity
|
|
single.race = currJewel.Race
|
|
single.frame = GetQuantityImageByquality(quantity)
|
|
single.name = itemConfig[staticId].Name
|
|
single.itemConfig = itemConfig[staticId]
|
|
single.levelPool = currJewel.LevelupPool
|
|
single.proIcon = GetProStrImageByProNum(currJewel.Race)
|
|
single.refinePool = currJewel.RankupPool
|
|
single.treePool = currJewel.GodHoodPool
|
|
single.equipType = currJewel.Location
|
|
if currJewel.Location == 1 then
|
|
single.type = Language[10505]
|
|
else
|
|
single.type = Language[10506]
|
|
end
|
|
single.icon = GetResourcePath(itemConfig[staticId].ResourceID)
|
|
equipData[1] = single
|
|
end
|
|
|
|
function this.ShowEquipData(i)
|
|
local equipConfigData = ConfigManager.GetConfigData(ConfigName.JewelConfig, equipData[i].id)
|
|
local itemConfigData = ConfigManager.GetConfigData(ConfigName.ItemConfig, equipData[i].id)
|
|
local Power = {}
|
|
Power[1] = 0
|
|
Power[2] = 0
|
|
|
|
--计算战力
|
|
if type == 5 then
|
|
if i == 1 then
|
|
if not equipData[i].idDyn then
|
|
Power[1] = EquipTreasureManager.CalculateWarForceBySid(equipData[1].id, equipData[1].lv, equipData[1].refineLv, equipData[1].treeLv)
|
|
else
|
|
Power[1] = EquipTreasureManager.CalculateWarForce(equipData[1].idDyn)
|
|
end
|
|
elseif i == 2 then
|
|
Power[2] = EquipTreasureManager.CalculateWarForce(equipData[2].idDyn)
|
|
end
|
|
elseif type == 3 then
|
|
if not equipData[i].idDyn then
|
|
Power[1] = EquipTreasureManager.CalculateWarForceBySid(equipData[1].id, equipData[1].lv, equipData[1].refineLv, equipData[1].treeLv)
|
|
else
|
|
Power[1] = EquipTreasureManager.CalculateWarForce(equipData[1].idDyn)
|
|
end
|
|
Power[2] = EquipTreasureManager.CalculateWarForce(equipData[2].idDyn)
|
|
else
|
|
if not equipData[i].idDyn then
|
|
Power[1] = EquipTreasureManager.CalculateWarForceBySid(equipData[1].id, equipData[1].lv, equipData[1].refineLv, equipData[1].treeLv)
|
|
else
|
|
Power[1] = EquipTreasureManager.CalculateWarForce(equipData[1].idDyn)
|
|
end
|
|
end
|
|
|
|
this.treasurePanel[i].powerNum.text = Power[i]
|
|
--装备描述
|
|
this.treasurePanel[i].desc.text = GetLanguageStrById(itemConfigData.ItemDescribe)
|
|
|
|
if type==3 and equipData[2] ~= nil and i == 1 then
|
|
if(Power[1] > Power[2]) then
|
|
this.treasurePanel[1].powerUPorDown:SetActive(true)
|
|
this.treasurePanel[1].powerUPorDown:GetComponent("Image").sprite = this.spLoader:LoadSprite(PowerChangeIconDef[1])
|
|
elseif(Power[1] < Power[2] )then
|
|
this.treasurePanel[1].powerUPorDown:SetActive(true)
|
|
this.treasurePanel[1].powerUPorDown:GetComponent("Image").sprite = this.spLoader:LoadSprite(PowerChangeIconDef[2])
|
|
else
|
|
this.treasurePanel[1].powerUPorDown:SetActive(false)
|
|
end
|
|
elseif type==3 and equipData[1] ~= nil and i == 2 then
|
|
if Power[2] > Power[1] then
|
|
this.treasurePanel[2].powerUPorDown:SetActive(true)
|
|
this.treasurePanel[2].powerUPorDown:GetComponent("Image").sprite = this.spLoader:LoadSprite(PowerChangeIconDef[1])
|
|
elseif Power[2] < Power[1] then
|
|
this.treasurePanel[2].powerUPorDown:SetActive(true)
|
|
this.treasurePanel[2].powerUPorDown:GetComponent("Image").sprite = this.spLoader:LoadSprite(PowerChangeIconDef[2])
|
|
else
|
|
this.treasurePanel[2].powerUPorDown:SetActive(false)
|
|
end
|
|
else
|
|
this.treasurePanel[1].powerUPorDown:SetActive(false)
|
|
end
|
|
|
|
this.treasurePanel[i].qualityText.text = GetStringByEquipQua(equipConfigData.Level,GetQuaStringByEquipQua(equipConfigData.Level))
|
|
this.treasurePanel[i].EquipName.text=GetStringByEquipQua(itemConfigData.Quantity,GetLanguageStrById(itemConfigData.Name))
|
|
this.treasurePanel[i].EquipTypeText.text = string.format(Language[11803],EquipTreasureTypeStr[equipConfigData.Location])
|
|
|
|
|
|
if not this.preList[i] then
|
|
this.preList[i] = SubUIManager.Open(SubUIConfig.ItemView,this.treasurePanel[i].pos.transform)
|
|
end
|
|
this.preList[i].gameObject:SetActive(true)
|
|
this.preList[i]:OnOpen(false,{equipConfigData.Id,0},1,false, false,false, 0,equipData[i].idDyn)
|
|
|
|
--(基础属性)
|
|
this.treasurePanel[i].bgScroll:GetComponent("RectTransform").sizeDelta = Vector2.New(800,100)
|
|
local baseInfo = EquipTreasureManager.GetCurLvPropertyValue(1,equipData[i].levelPool,equipData[i].lv)
|
|
this.treasurePanel[i].BaseAttriNum.text = string.format("[强化等级:%s/%s]",equipData[i].lv,equipData[i].maxLv)
|
|
this.SetPropertyShow1(baseInfo,this.BasePropertyList[i],this.treasurePanel[i].BaseAttriGrid)
|
|
--(精炼属性)
|
|
local refineInfo = EquipTreasureManager.GetCurLvPropertyValue(2,equipData[i].refinePool,equipData[i].refineLv,true)
|
|
this.treasurePanel[i].RefineAttriNum.text = string.format("[精炼等级:%s/%s]",equipData[i].refineLv,equipData[i].maxRefineLv)
|
|
if LengthOfTable(refineInfo) == 0 or refineInfo == nil then
|
|
this.treasurePanel[i].RefineAttri:SetActive(false)
|
|
else
|
|
this.treasurePanel[i].RefineAttri:SetActive(true)
|
|
this.treasurePanel[i].bgScroll:GetComponent("RectTransform").sizeDelta = Vector2.New(800,250)
|
|
this.SetPropertyShow1(refineInfo,this.RefinePropertyList[i],this.treasurePanel[i].RefineAttriGrid)
|
|
end
|
|
if equipData[i].upHeroDid == "" or equipData[i].upHeroDid == "0" then
|
|
this.treasurePanel[i].strongAttri.gameObject:SetActive(false)
|
|
this.treasurePanel[i].refineMasterAttri:SetActive(false)
|
|
else
|
|
--强化共鸣
|
|
local _QH = this.GongMingSetData(1,this.strongPropertyList[i],this.treasurePanel[i].strongAttriGrid,this.treasurePanel[i].strongAttriNum,this.treasurePanel[i].strongAttri)
|
|
--精炼共鸣
|
|
local _JL = this.GongMingSetData(2,this.RefineMonsterPropertyList[i],this.treasurePanel[i].refineMasterAttriGrid,this.treasurePanel[i].refineMasterAttriNum,this.treasurePanel[i].refineMasterAttri)
|
|
-- 判断显示界面高度
|
|
local height = 250
|
|
height = _QH and height + 110 or height
|
|
height = _JL and height + 110 or height
|
|
this.treasurePanel[i].bgScroll:GetComponent("RectTransform").sizeDelta = Vector2.New(800,height)
|
|
end
|
|
--(神应属性)
|
|
local treeInfo=SacredTreeManager.GetCurLvPropertyValue(3,equipData[i].treePool,equipData[i].treeLv or 0)
|
|
this.treasurePanel[i].TreeAttriNum.text = string.format("[神应等级:%s/%s]",equipData[i].treeLv,equipData[i].maxTreeLv)
|
|
--if equipData[i].upHeroDid == "" or equipData[i].upHeroDid == "0" or (equipData[i].treeLv < 1 and SacredTreeManager.CulAttri(equipData[1]) < 1) then
|
|
if (equipData[i].treeLv < 1 and SacredTreeManager.CulAttri(equipData[1]) < 1) then
|
|
this.treasurePanel[i].TreeAttri:SetActive(false)
|
|
else
|
|
this.treasurePanel[i].TreeAttri:SetActive(true)
|
|
this.treasurePanel[i].bgScroll:GetComponent("RectTransform").sizeDelta = Vector2.New(800,589)
|
|
this.SetPropertyShow2(treeInfo,this.TreePropertyList[i],this.treasurePanel[i].TreeAttriGrid,this.TreePropertyList2[i])
|
|
end
|
|
if i == 1 then
|
|
this.treasurePanel[i].StrongRed:SetActive(HeroManager.CheckIsUpTreasure(equipData[i].idDyn,1))
|
|
this.treasurePanel[i].RefineRed:SetActive(HeroManager.CheckIsUpTreasure(equipData[i].idDyn,2))
|
|
end
|
|
|
|
-- 内容置顶
|
|
this.treasurePanel[i].bgScrollContent.transform.localPosition = Vector2.New(0, 0)
|
|
end
|
|
|
|
function this.GongMingSetData(curTabIndex,proPreList,grid,title,go)
|
|
--获取穿戴宝物强化/精炼的最小等级
|
|
local minLv--最小等级
|
|
local maxlv --最大等级
|
|
if #curHeroData.jewels < 2 then
|
|
go.gameObject:SetActive(false)
|
|
return
|
|
end
|
|
go.gameObject:SetActive(true)
|
|
for i = 1, #curHeroData.jewels do
|
|
local curEquipTreasureData = EquipTreasureManager.GetTreasureData(curHeroData.jewels[i])
|
|
if curTabIndex == 1 then
|
|
if minLv then
|
|
if curEquipTreasureData.lv < minLv then
|
|
minLv = curEquipTreasureData.lv
|
|
end
|
|
else
|
|
minLv = curEquipTreasureData.lv
|
|
end
|
|
if maxlv then
|
|
if curEquipTreasureData.maxLv < maxlv then
|
|
maxlv = curEquipTreasureData.maxLv
|
|
end
|
|
else
|
|
maxlv = curEquipTreasureData.maxLv
|
|
end
|
|
elseif curTabIndex == 2 then
|
|
if minLv then
|
|
if curEquipTreasureData.refineLv < minLv then
|
|
minLv = curEquipTreasureData.refineLv
|
|
end
|
|
else
|
|
minLv = curEquipTreasureData.refineLv
|
|
end
|
|
if maxlv then
|
|
if curEquipTreasureData.maxRefineLv < maxlv then
|
|
maxlv = curEquipTreasureData.maxRefineLv
|
|
end
|
|
else
|
|
maxlv = curEquipTreasureData.maxRefineLv
|
|
end
|
|
end
|
|
end
|
|
local curJewelResonanceConfig = nil
|
|
local allCurTypeJewelResonanceConfig = ConfigManager.GetAllConfigsDataByKey(ConfigName.JewelResonanceConfig,"Type",curTabIndex)
|
|
table.sort(allCurTypeJewelResonanceConfig,function(a,b)
|
|
return a.SortId<b.SortId
|
|
end)
|
|
for i = 1, #allCurTypeJewelResonanceConfig do
|
|
--获取当前强化/精炼 大师等级数据
|
|
if allCurTypeJewelResonanceConfig[i].Level <= minLv then
|
|
if curJewelResonanceConfig then
|
|
if curJewelResonanceConfig.SortId < allCurTypeJewelResonanceConfig[i].SortId then
|
|
curJewelResonanceConfig = allCurTypeJewelResonanceConfig[i]
|
|
end
|
|
else
|
|
curJewelResonanceConfig = allCurTypeJewelResonanceConfig[i]
|
|
end
|
|
end
|
|
end
|
|
if curJewelResonanceConfig.SortId < 1 then
|
|
go.gameObject:SetActive(false)
|
|
return
|
|
end
|
|
go.gameObject:SetActive(true)
|
|
if curTabIndex == 1 then
|
|
title.text = string.format("<color=#FE2F33>强化大师%s级</color>",curJewelResonanceConfig.SortId)
|
|
else
|
|
title.text = string.format("<color=#FE2F33>精炼大师%s级</color>",curJewelResonanceConfig.SortId)
|
|
end
|
|
for i = 1, math.max(#curJewelResonanceConfig.Property,#proPreList) do
|
|
if not curJewelResonanceConfig.Property[i] then
|
|
proPreList[i].gameObject:SetActive(false)
|
|
else
|
|
if not proPreList[i] then
|
|
proPreList[i] = newObjToParent(this.TextPre,grid.transform)
|
|
end
|
|
proPreList[i].gameObject:SetActive(true)
|
|
local str = GetLanguageStrById(propertyConfig[curJewelResonanceConfig.Property[i][1]].Info).."+"..GetPropertyFormatStr(propertyConfig[curJewelResonanceConfig.Property[i][1]].Style,curJewelResonanceConfig.Property[i][2])
|
|
proPreList[i].transform:GetComponent("Text").text = string.format("<color=#66FF00>%s</color>",str)
|
|
end
|
|
end
|
|
return true
|
|
end
|
|
|
|
--神应专用
|
|
function this.SetPropertyShow2(_infos,_preList,_grid,_preList2)
|
|
local curTree = SacredTreeManager.CulAttri(equipData[1])
|
|
local attriConfig = ConfigManager.GetConfigDataByKey(ConfigName.GodHoodTreeSetting,"Id",0).PropertyUnlcokLevelForClient
|
|
local dataCount=LengthOfTable(_infos)
|
|
local preCount=#_preList ---行数
|
|
for i = 1, math.ceil(dataCount/2) - preCount do
|
|
local go = newObject(this.line)
|
|
go.transform:SetParent(_grid.transform)
|
|
go.transform.localScale = Vector3.one
|
|
go.transform.localPosition = Vector3.zero
|
|
go.gameObject:SetActive(false)
|
|
table.insert(_preList,go)
|
|
end
|
|
preCount = #_preList2
|
|
for i = 1, dataCount - preCount do
|
|
local go = newObject(this.TextPre)
|
|
table.insert(_preList2,go)
|
|
go.transform:SetParent(_preList[math.ceil(#_preList2/2)].transform)
|
|
go.transform.localScale = Vector3.one
|
|
go.transform.localPosition = Vector3.zero
|
|
go.gameObject:SetActive(false)
|
|
end
|
|
local index=1
|
|
for key, value in pairs(attriConfig) do
|
|
local obj = _preList2[index]
|
|
_preList[math.ceil(index/2)].gameObject:SetActive(true)
|
|
local proper=propertyConfig[value[1]]
|
|
local string = ""
|
|
if _infos[value[1]] then
|
|
if proper.Style==1 then
|
|
string = GetLanguageStrById(proper.Info).."+".._infos[value[1]].currValue--value.currValue
|
|
else
|
|
string = GetLanguageStrById(proper.Info).."+".._infos[value[1]].currValue/100 .."%"
|
|
end
|
|
end
|
|
if index <= curTree then
|
|
string = "<color=#66FF00>"..string.."</color>"
|
|
else
|
|
-- string = "<color=#828282>"..string.."\n".."<size=25>(四灵试炼"..attriConfig[index][2].."层解锁)</size></color>"
|
|
string = "<color=#828282>"..string.."\n".."<size=25>"..string.format("(四灵试炼%s层解锁)",attriConfig[index][2]).."</size></color>"
|
|
end
|
|
obj.transform:GetComponent("Text").text = string
|
|
obj.gameObject:SetActive(true)
|
|
index=index+1
|
|
end
|
|
for i = 1, #_preList2 do
|
|
if i >= index then
|
|
_preList2[i]:SetActive(false)
|
|
end
|
|
end
|
|
for i = 1, #_preList do
|
|
if i > math.ceil(index/2) then
|
|
_preList[i]:SetActive(false)
|
|
end
|
|
end
|
|
end
|
|
|
|
function this.SetPropertyShow1(_infos,_preList,_grid)
|
|
local dataCount=LengthOfTable(_infos)
|
|
local preCount=#_preList
|
|
for i = 1, dataCount-preCount do
|
|
local go = newObject(this.TextPre)
|
|
go.transform:SetParent(_grid.transform)
|
|
go.transform.localScale = Vector3.one
|
|
go.transform.localPosition = Vector3.zero
|
|
go.gameObject:SetActive(false)
|
|
table.insert(_preList,go)
|
|
end
|
|
local index=1
|
|
for key, value in pairs(_infos) do
|
|
local obj=_preList[index]
|
|
local proper=propertyConfig[key]
|
|
if proper.Style==1 then
|
|
obj.transform:GetComponent("Text").text = GetLanguageStrById(proper.Info).."+".. value.currValue
|
|
else
|
|
obj.transform:GetComponent("Text").text=GetLanguageStrById(proper.Info).."+"..value.currValue/100 .."%"
|
|
end
|
|
obj.gameObject:SetActive(true)
|
|
index=index+1
|
|
end
|
|
for i = 1, #_preList do
|
|
if i>=index then
|
|
_preList[i]:SetActive(false)
|
|
end
|
|
end
|
|
end
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function RoleEquipTreasureChangePopup:OnClose()
|
|
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function RoleEquipTreasureChangePopup:OnDestroy()
|
|
type=0--1 穿装备 2 卸装备 3 替换装备
|
|
curHeroData=nil
|
|
equipData=nil
|
|
openThisPanel=nil
|
|
equipIdList=nil
|
|
equipDataList=nil
|
|
position=0
|
|
this.spLoader:Destroy()
|
|
for k,v in pairs(this.preList) do
|
|
SubUIManager.Close(v)
|
|
end
|
|
this.preList = {}
|
|
end
|
|
|
|
return RoleEquipTreasureChangePopup |