miduo_client/Assets/ManagedResources/~Lua/Modules/RoleInfo/EquipTreasureStrongPopup.lua

584 lines
24 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
EquipTreasureStrongPopup = Inherit(BasePanel)
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
2020-06-13 11:47:13 +08:00
local jewelConfig=ConfigManager.GetConfig(ConfigName.JewelConfig)
2020-05-09 13:31:21 +08:00
local this=EquipTreasureStrongPopup
local curEquipData
local haveTreasures={}
local type
local isMatEnough=true
local matId=0
local isMax=false
2020-07-16 10:49:01 +08:00
local isEnough = false
local curIndex
2021-07-26 17:16:29 +08:00
local datas
2021-07-28 15:40:50 +08:00
local isGongMing = false
2020-05-09 13:31:21 +08:00
--初始化组件(用于子类重写)
function EquipTreasureStrongPopup:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2021-07-28 10:51:39 +08:00
this.Image2 = Util.GetGameObject(self.transform, "bg/Image")
2021-07-23 19:12:42 +08:00
this.content = Util.GetGameObject(self.transform, "bg/content")
this.btnBack= Util.GetGameObject(this.content,"btnBack")
this.titleTxt=Util.GetGameObject(this.content,"name"):GetComponent("Text")
this.itemPre = Util.GetGameObject(this.content,"itemView")
this.firstScroll=Util.GetGameObject(this.content,"firstScroll")
2021-07-28 10:51:39 +08:00
this.secondScroll=Util.GetGameObject(this.content,"secondScroll")
2022-09-06 10:16:57 +08:00
this.properItemPre = Util.GetGameObject( this.content,"propertyPre")
2021-07-28 10:51:39 +08:00
this.propertyGrid=Util.GetGameObject(this.secondScroll,"grid")
2021-07-30 15:11:56 +08:00
this.costItemPre=Util.GetGameObject(this.content,"costItemPre")
this.costPreList = {}
2021-07-23 19:12:42 +08:00
this.costItemGrid=Util.GetGameObject(this.content,"costGrid")
this.hintTxt=Util.GetGameObject(this.content,"hintTxt"):GetComponent("Text")
2021-07-28 10:51:39 +08:00
this.btnGrid=Util.GetGameObject(this.content,"btnGrid")
this.btnRefine=Util.GetGameObject(this.btnGrid,"btnRefine")
2021-07-23 19:12:42 +08:00
this.btnRefineText = Util.GetGameObject(this.btnRefine,"Text"):GetComponent("Text")
2021-07-28 10:51:39 +08:00
this.btnStrong=Util.GetGameObject(this.btnGrid,"btnStrong")
2021-07-23 19:12:42 +08:00
this.btnStrongText = Util.GetGameObject(this.btnStrong,"Text"):GetComponent("Text")
2022-09-06 10:16:57 +08:00
this.btnShenying=Util.GetGameObject(this.btnGrid,"btnShenying")
this.btnShenyingText = Util.GetGameObject(this.btnShenying,"Text"):GetComponent("Text")
2021-07-23 19:12:42 +08:00
this.btn_strongPage=Util.GetGameObject(this.content,"btnList/btnStrong")
this.btn_refinePage=Util.GetGameObject(this.content,"btnList/btnRefine")
2022-09-06 10:16:57 +08:00
this.btn_shenyingPage=Util.GetGameObject(this.content,"btnList/btnShenying")
2021-07-26 17:16:29 +08:00
this.btn_strongPageRed=Util.GetGameObject(this.btn_strongPage,"red")
this.btn_refinePageRed=Util.GetGameObject(this.btn_refinePage,"red")
2022-09-06 10:16:57 +08:00
this.btn_shenyingPageRed=Util.GetGameObject(this.btn_shenyingPage,"red")
2021-07-23 19:12:42 +08:00
this.selectBtn=Util.GetGameObject(this.content,"btnList/selectBtn")
2021-07-28 10:51:39 +08:00
this.selectText = Util.GetGameObject(this.selectBtn,"Text"):GetComponent("Text")
2021-07-23 19:12:42 +08:00
this.treasureDatas = {}
2021-07-26 17:16:29 +08:00
this.treasureDatas2 = {}
2021-07-23 19:12:42 +08:00
this.costTreasureDatas = {}
this.properList = {}
this.properList[0] = {}
this.properList[0].go = this.properItemPre
this.properList[0].leftTxt = Util.GetGameObject(this.properItemPre,"leftTxt"):GetComponent("Text")
this.properList[0].rightTxt = Util.GetGameObject(this.properItemPre,"rightTxt"):GetComponent("Text")
local rootHight = this.firstScroll.transform.rect.height
local rootWidth=this.firstScroll.transform.rect.width
2021-07-28 10:51:39 +08:00
this.firstScrollCycleView = SubUIManager.Open(SubUIConfig.ScrollCycleView,this.firstScroll.transform,this.itemPre,nil, Vector2.New(rootWidth,rootHight), 1, 5, Vector2.New(15,50))
2021-07-23 19:12:42 +08:00
this.gongming = Util.GetGameObject(this.content,"gongming")
2021-07-24 16:22:16 +08:00
this.gongming.gameObject:SetActive(false)
2021-07-23 19:12:42 +08:00
this.select = Util.GetGameObject(this.content,"select")
2021-07-28 10:51:39 +08:00
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function EquipTreasureStrongPopup:BindEvent()
--关闭按钮
Util.AddClick(this.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
--强化页签
Util.AddClick(this.btn_strongPage, function()
2021-07-29 18:57:30 +08:00
if type == 1 then
return
end
2021-07-26 17:16:29 +08:00
this:SetWindShow(1,0)
this:RefreshRedPoint(0,false)
2020-05-09 13:31:21 +08:00
end)
--精炼页签
Util.AddClick(this.btn_refinePage, function()
2021-07-29 18:57:30 +08:00
if type == 2 then
return
end
2021-07-26 17:16:29 +08:00
this:SetWindShow(2,0)
this:RefreshRedPoint(0,false)
2020-05-09 13:31:21 +08:00
end)
2022-09-06 10:16:57 +08:00
--神应页签
Util.AddClick(this.btn_shenyingPage, function()
if type == 3 then
return
end
this:SetWindShow(3,0)
2022-09-06 15:47:16 +08:00
this:RefreshRedPoint(0,false)
2022-09-06 10:16:57 +08:00
end)
2020-05-09 13:31:21 +08:00
--强化按钮
2021-07-23 19:12:42 +08:00
Util.AddClick(this.btnStrong, function()
2021-07-28 15:40:50 +08:00
if isGongMing then
2021-07-24 16:22:16 +08:00
return
end
2020-05-09 13:31:21 +08:00
--如果强化界面 强化到最高等级谈提示 精炼界面 就切界面
if type==1 then
if isMax then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[11770])
2020-05-09 13:31:21 +08:00
return
end
else
2021-07-26 17:16:29 +08:00
this:SetWindShow(1,0)
2020-05-09 13:31:21 +08:00
return
end
--材料是否足够
if isMatEnough==false then
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,matId)
return
end
NetManager.EquipTreasureBuildRequest(curEquipData.idDyn,1,nil,function (msg)
EquipTreasureManager.ChangeTreasureLv(curEquipData.idDyn,type)
2021-07-26 17:16:29 +08:00
this.treasureDatas[curIndex]:OnOpen(false, {curEquipData.id,0}, 1, false, false, false, 0,curEquipData.idDyn)
this:SetWindShow(type,0)
this:RefreshRedPoint(0,true)
2020-05-09 13:31:21 +08:00
if isMax then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[11772])
2020-05-09 13:31:21 +08:00
else
2020-06-13 11:47:13 +08:00
--PopupTipPanel.ShowTip("强化成功")
end
2020-12-15 17:27:16 +08:00
local oldWarPowerValue = EquipTreasureManager.CalculateWarForceBySid(curEquipData.id,curEquipData.lv - 1,curEquipData.refineLv,curEquipData.treeLv)
local newWarPowerValue = EquipTreasureManager.CalculateWarForceBySid(curEquipData.id,curEquipData.lv,curEquipData.refineLv,curEquipData.treeLv)
2020-06-13 11:47:13 +08:00
if oldWarPowerValue ~= newWarPowerValue then
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldWarPowerValue,newValue = newWarPowerValue})
2020-05-09 13:31:21 +08:00
end
Game.GlobalEvent:DispatchEvent(GameEvent.Treasure.TreasureLvUp)
end)
end)
--精炼按钮
2021-07-23 19:12:42 +08:00
Util.AddClick(this.btnRefine, function()
2020-05-09 13:31:21 +08:00
--如果精炼界面 精炼到最高等级谈提示 否 强化界面 就切界面
if type==2 then
if isMax then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[11773])
2020-05-09 13:31:21 +08:00
return
end
else
2021-07-26 17:16:29 +08:00
this:SetWindShow(2,0)
2020-05-09 13:31:21 +08:00
return
end
if isMatEnough==false then
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,matId)
return
end
local maters={}
2021-07-26 17:16:29 +08:00
if curEquipData.refineConfig.JewelExpend then
for i = 1, #curEquipData.refineConfig.JewelExpend do
local id = curEquipData.refineConfig.JewelExpend[i]
local type = id[1]
local equips,num=EquipTreasureManager.GetEnoughRefineTreasure(type,curEquipData.idDyn)
local equipValue={}
equipValue.equip=equips
equipValue.needNum=id[2]
haveTreasures[type]=equipValue
end
end
2020-05-09 13:31:21 +08:00
if haveTreasures then
for i, v in pairs(haveTreasures) do
local index=1
if v.equip then
for i, value in pairs(v.equip) do
2020-06-13 11:47:13 +08:00
if #maters < v.needNum then
maters[index]=value.idDyn
index=index+1
2020-05-09 13:31:21 +08:00
end
end
end
end
end
NetManager.EquipTreasureBuildRequest(curEquipData.idDyn,2,maters,function (msg)
if maters then
for i = 1, #maters do
EquipTreasureManager.RemoveTreasureByIdDyn(maters[i])
end
end
EquipTreasureManager.ChangeTreasureLv(curEquipData.idDyn,type)
2021-07-26 17:16:29 +08:00
this:SetWindShow(type,0)
this:RefreshRedPoint(0,true)
this.treasureDatas[curIndex]:OnOpen(false, {curEquipData.id,0}, 1, false, false, false, 0,curEquipData.idDyn)
2020-05-09 13:31:21 +08:00
if isMax then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip(Language[11774])
2020-05-09 13:31:21 +08:00
else
2020-06-13 11:47:13 +08:00
--PopupTipPanel.ShowTip("精炼成功")
end
2020-12-15 17:27:16 +08:00
local oldWarPowerValue = EquipTreasureManager.CalculateWarForceBySid(curEquipData.id,curEquipData.lv ,curEquipData.refineLv - 1,curEquipData.treeLv)
local newWarPowerValue = EquipTreasureManager.CalculateWarForceBySid(curEquipData.id,curEquipData.lv,curEquipData.refineLv,curEquipData.treeLv)
2020-06-13 11:47:13 +08:00
if oldWarPowerValue ~= newWarPowerValue then
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldWarPowerValue,newValue = newWarPowerValue})
2020-05-09 13:31:21 +08:00
end
Game.GlobalEvent:DispatchEvent(GameEvent.Treasure.TreasureLvUp)
end)
return
end)
2022-09-06 10:16:57 +08:00
2022-09-06 15:47:16 +08:00
--神应升级按钮
2022-09-06 10:16:57 +08:00
Util.AddClick(this.btnShenying, function()
2022-09-06 15:47:16 +08:00
--材料是否足够
if isMatEnough==false then
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,matId)
return
end
2022-09-07 13:23:51 +08:00
if isMax then
2022-09-09 18:09:45 +08:00
PopupTipPanel.ShowTip("等级已达上限")
2022-09-07 13:23:51 +08:00
return
end
2022-09-06 10:16:57 +08:00
NetManager.SendUpgradeGodTreeRequest(curEquipData.idDyn,1,function (msg)
PopupTipPanel.ShowTip("升级成功")
2022-09-07 10:14:05 +08:00
EquipTreasureManager.ChangeTreasureLv(curEquipData.idDyn,type)
2022-09-06 15:47:16 +08:00
Timer.New(function()
this:SetWindShow(type,0)
end,0.1):Start()
2022-09-06 10:16:57 +08:00
this.treasureDatas[curIndex]:OnOpen(false, {curEquipData.id,0}, 1, false, false, false, 0,curEquipData.idDyn)
2022-09-06 15:47:16 +08:00
this:RefreshRedPoint(0.2,true)
2022-09-07 10:14:05 +08:00
local oldWarPowerValue = EquipTreasureManager.CalculateWarForceBase(curEquipData.id,curEquipData.lv ,curEquipData.refineLv,curEquipData.treeLv-1,curEquipData)
local newWarPowerValue = EquipTreasureManager.CalculateWarForceBase(curEquipData.id,curEquipData.lv,curEquipData.refineLv,curEquipData.treeLv,curEquipData)
2022-09-06 10:16:57 +08:00
if oldWarPowerValue ~= newWarPowerValue then
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldWarPowerValue,newValue = newWarPowerValue})
end
2022-09-07 11:40:13 +08:00
-- 宝物属性改变需要重新计算战斗力
HeroPropManager.SetDirtyByType(curEquipData.upHeroDid, Hero_Prop_Type.EquipTreasure)
-- EquipTreasureManager.SetTreasureDirty(curEquipData.idDyn, true)
2022-09-07 10:14:05 +08:00
Game.GlobalEvent:DispatchEvent(GameEvent.Treasure.TreasureLvUp)
2022-09-06 10:16:57 +08:00
end)
end)
2020-05-09 13:31:21 +08:00
end
2021-07-26 17:16:29 +08:00
function EquipTreasureStrongPopup:RefreshRedPoint(delta,isRefreshTabRed)
Timer.New(function()
for k,v in pairs(this.treasureDatas2) do
local redShow = HeroManager.CheckIsUpTreasure(v.data.idDyn,type)
v.red.gameObject:SetActive(redShow)
end
this.select.transform:SetParent(curIndex.transform)
2021-07-28 10:51:39 +08:00
this.select:GetComponent("RectTransform").anchoredPosition3D = Vector3.New(-8.5,5.04,0)
2022-09-06 10:16:57 +08:00
if type==1 then
this.selectText.text="强 化"
elseif type==2 then
this.selectText.text="精 炼"
else
this.selectText.text="神 应"
end
-- this.selectText.text = type == 1 and "强 化" or "精 炼"
2021-07-26 17:16:29 +08:00
this.select.transform.localScale = Vector3.one
this.select.gameObject:SetActive(true)
2021-07-28 16:52:41 +08:00
this.select.transform:SetSiblingIndex(1)
2021-07-26 17:16:29 +08:00
end,delta):Start()
if isRefreshTabRed then
2022-09-06 10:16:57 +08:00
local redDataStrong ,redDataRefine,redDataShenying = false,false,false
2021-07-26 17:16:29 +08:00
for k,v in pairs(datas) do
2022-09-06 10:16:57 +08:00
if not redDataStrong then
2021-07-26 17:16:29 +08:00
redDataStrong = HeroManager.CheckIsUpTreasure(v.idDyn,1)
end
2022-09-06 10:16:57 +08:00
if not redDataRefine then
2021-07-26 17:16:29 +08:00
redDataRefine = HeroManager.CheckIsUpTreasure(v.idDyn,2)
end
2022-09-06 10:16:57 +08:00
if not redDataShenying then
redDataShenying = HeroManager.CheckIsUpTreasure(v.idDyn,3)
end
2021-07-26 17:16:29 +08:00
end
this.btn_strongPageRed.gameObject:SetActive(redDataStrong)
this.btn_refinePageRed.gameObject:SetActive(redDataRefine)
2022-09-06 15:47:16 +08:00
this.btn_shenyingPageRed.gameObject:SetActive(redDataShenying)
2021-07-26 17:16:29 +08:00
end
end
2020-05-09 13:31:21 +08:00
--界面打开时调用(用于子类重写)
function EquipTreasureStrongPopup:OnOpen(...)
2021-07-26 17:16:29 +08:00
local args={...}
curEquipData = args[1]
type = args[2]
2020-05-09 13:31:21 +08:00
end
function EquipTreasureStrongPopup:OnShow()
2021-07-26 17:16:29 +08:00
datas = EquipTreasureManager.GetAllHeroEquipedTreasureData()
2022-12-27 16:41:24 +08:00
this.btn_shenyingPage:SetActive(CheckFunctionOpen(FUNCTION_OPEN_TYPE.SACREDTREE))
2021-07-23 19:12:42 +08:00
this.formationInfo = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
table.sort(datas,function(a,b)
local aIsMainFormation = this:GetHeroIsMainFormation(a.upHeroDid)
local bIsMainFormation = this:GetHeroIsMainFormation(b.upHeroDid)
if aIsMainFormation and bIsMainFormation then
if a.upHeroDid ~= b.upHeroDid then
return aIsMainFormation.position < bIsMainFormation.position
else
return a.equipType < b.equipType
end
elseif not aIsMainFormation and not bIsMainFormation then
if a.quantity == b.quantity then
return a.id < b.id
else
return a.quantity > b.quantity
end
else
return aIsMainFormation
end
end)
this:ShowTopDataList(datas)
2021-07-26 17:16:29 +08:00
this:SetWindShow(type,0.2)
2021-07-29 11:53:11 +08:00
this:RefreshRedPoint(0.5,true)
2021-07-23 19:12:42 +08:00
end
function EquipTreasureStrongPopup:GetHeroIsMainFormation(HeroId)
for k,v in ipairs(this.formationInfo.teamHeroInfos) do
if HeroId == v.heroId then
return v
end
end
return nil
end
function EquipTreasureStrongPopup:ShowTopDataList(list)
if not this.treasureDatas then
this.treasureDatas = {}
end
this.firstScrollCycleView:ForeachItemGO(function(index, go)
go.gameObject:SetActive(false)
end)
this.firstScrollCycleView:SetData(list,function(index, go)
this:SetScrollPre(go,list[index],index)
2021-07-26 17:16:29 +08:00
if not this.treasureDatas2[go] then
this.treasureDatas2[go] = {}
end
this.treasureDatas2[go].red = Util.GetGameObject(go,"red")
this.treasureDatas2[go].data = list[index]
2021-07-23 19:12:42 +08:00
end,false,false)
for i = 1,#list do
if list[i].idDyn == curEquipData.idDyn then
this.firstScrollCycleView:SetIndex(i)
break
end
end
end
function EquipTreasureStrongPopup:SetScrollPre(go,data,_index)
if data.idDyn == curEquipData.idDyn then
2021-07-26 17:16:29 +08:00
curIndex = go
2021-07-23 19:12:42 +08:00
end
2021-07-26 17:16:29 +08:00
local btn = Util.GetGameObject(go,"btn")
local name = Util.GetGameObject(go,"nameDi/Text")
2021-07-23 19:12:42 +08:00
go.gameObject:SetActive(true)
2021-07-26 17:16:29 +08:00
if not this.treasureDatas[go] then
this.treasureDatas[go] = SubUIManager.Open(SubUIConfig.ItemView,go.transform)
this.treasureDatas[go].transform:SetAsFirstSibling()
2021-07-23 19:12:42 +08:00
end
2021-07-26 17:16:29 +08:00
this.treasureDatas[go]:OnOpen(false, {data.id,0}, 1, false, false, false, 0,data.idDyn)
name:GetComponent("Text").text = HeroManager.GetSingleHeroData(data.upHeroDid).heroConfig.ReadingName
2021-07-23 19:12:42 +08:00
Util.AddOnceClick(btn,function()
2021-07-30 14:17:44 +08:00
if curEquipData.idDyn == data.idDyn then
return
end
2021-07-23 19:12:42 +08:00
this.select.transform:SetParent(go.transform)
2021-07-28 16:52:41 +08:00
this.select:GetComponent("RectTransform").anchoredPosition3D = Vector3.New(-8.5,5.04,0)
2021-07-23 19:12:42 +08:00
this.select.gameObject:SetActive(true)
2021-07-28 16:52:41 +08:00
this.select.transform:SetSiblingIndex(1)
2021-07-23 19:12:42 +08:00
curEquipData = data
2021-07-26 17:16:29 +08:00
curIndex = go
this:SetWindShow(type,0)
2021-07-23 19:12:42 +08:00
end)
2020-05-09 13:31:21 +08:00
end
2022-09-06 10:16:57 +08:00
--设置界面显示 1.强化 2.精炼 3.神应
2021-07-29 11:53:11 +08:00
function EquipTreasureStrongPopup:SetWindShow(_index)
2020-07-16 10:49:01 +08:00
haveTreasures = {}
2021-07-23 19:12:42 +08:00
type = _index
2020-05-09 13:31:21 +08:00
curEquipData = EquipTreasureManager.GetSingleEquipTreasreData(curEquipData.idDyn)
2021-07-23 19:12:42 +08:00
local items, propertyShow
if _index == 1 then
this.titleTxt.text = Language[11775]
this.btnRefine:SetActive(false)
this.btnStrong:SetActive(true)
2022-09-06 10:16:57 +08:00
this.btnShenying:SetActive(false)
2020-05-09 13:31:21 +08:00
this.SetBtnSelect(this.btn_strongPage)
2021-07-24 16:22:16 +08:00
isMax = curEquipData.lv == curEquipData.maxLv
this.properList[0].leftTxt.text = "强化等级"
2020-05-09 13:31:21 +08:00
if isMax then
2021-07-23 19:12:42 +08:00
this.properList[0].rightTxt.text = Language[11062]
this.btnStrong.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
else
2021-07-23 19:12:42 +08:00
this.btnStrongText.text = Language[11777]
this.properList[0].rightTxt.text = string.format( "%d/%d",curEquipData.lv+1,curEquipData.maxLv)
2020-05-09 13:31:21 +08:00
end
2021-07-23 19:12:42 +08:00
propertyShow = EquipTreasureManager.GetCurrLvAndNextLvPropertyValue(1,curEquipData.levelPool,curEquipData.lv)
2020-05-09 13:31:21 +08:00
--显示消耗
2021-07-26 17:16:29 +08:00
items = HeroManager.GetCostItems(curEquipData.idDyn,curEquipData.strongConfig)
2021-07-28 16:52:41 +08:00
if curEquipData.quantity == 6 then
2021-07-28 10:51:39 +08:00
this.hintTxt.text = "强化等级已达上限"
else
this.hintTxt.text = Language[11778]
end
2022-09-06 10:16:57 +08:00
elseif _index == 2 then
2021-03-02 16:53:12 +08:00
this.titleTxt.text=Language[11779]
2021-07-23 19:12:42 +08:00
this.btnRefine:SetActive(true)
this.btnStrong:SetActive(false)
2022-09-06 10:16:57 +08:00
this.btnShenying:SetActive(false)
2020-05-09 13:31:21 +08:00
this.SetBtnSelect(this.btn_refinePage)
isMax=curEquipData.refineLv==curEquipData.maxRefineLv
2021-07-23 19:12:42 +08:00
this.properList[0].leftTxt.text = "精炼等级"
if isMax then
this.properList[0].rightTxt.text = Language[11062]
this.btnRefine.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
else
2021-07-23 19:12:42 +08:00
this.btnRefineText.text=Language[11781]
this.properList[0].rightTxt.text = string.format( "%d/%s",curEquipData.refineLv+1,curEquipData.maxRefineLv)
2020-05-09 13:31:21 +08:00
end
2021-07-23 19:12:42 +08:00
propertyShow = EquipTreasureManager.GetCurrLvAndNextLvPropertyValue(2,curEquipData.refinePool,curEquipData.refineLv)
2021-07-26 17:16:29 +08:00
items = HeroManager.GetCostItems(curEquipData.idDyn,curEquipData.refineConfig)
2021-07-28 16:52:41 +08:00
if curEquipData.quantity == 6 then
2021-07-28 10:51:39 +08:00
this.hintTxt.text = "精炼等级已达上限"
2020-05-09 13:31:21 +08:00
else
2021-07-28 10:51:39 +08:00
this.hintTxt.text=Language[11782]
2020-05-09 13:31:21 +08:00
end
2022-09-06 10:16:57 +08:00
else
this.titleTxt.text="神应"
this.btnRefine:SetActive(false)
this.btnStrong:SetActive(false)
this.btnShenying:SetActive(true)
this.SetBtnSelect(this.btn_shenyingPage)
2022-09-07 13:21:27 +08:00
isMax=curEquipData.treeLv>=curEquipData.maxTreeLv
2022-09-06 10:16:57 +08:00
this.properList[0].leftTxt.text = "神应等级"..curEquipData.treeLv
if isMax then
this.properList[0].rightTxt.text = Language[11062]
this.btnRefine.gameObject:SetActive(false)
else
this.btnShenyingText.text="升 级"
this.properList[0].rightTxt.text = curEquipData.treeLv+1
end
2023-02-13 14:05:12 +08:00
propertyShow = SacredTreeManager.GetPropText(curEquipData.treeLv,curEquipData.id)
2022-09-06 10:16:57 +08:00
if isMax then
this.hintTxt.text = "神应等级已达上限"
else
2022-09-07 10:14:05 +08:00
items = HeroManager.GetHoodTreeUpCost(curEquipData.treeLv)
2022-09-06 10:16:57 +08:00
end
2020-05-09 13:31:21 +08:00
end
2022-12-27 16:41:24 +08:00
2021-07-28 15:40:50 +08:00
isGongMing = false
2021-09-13 16:17:38 +08:00
--if HarmonyManager.IsInfo(curEquipData.upHeroDid) and HarmonyManager.GetSingleAdditions(index) ~= -1 and _index == 1 then
if HarmonyManager.IsInfo(curEquipData.upHeroDid) and _index == 1 then
2021-07-28 15:40:50 +08:00
isGongMing = true
2021-07-24 16:22:16 +08:00
this.hintTxt.text = "共鸣中的宝物无法强化"
this.hintTxt.gameObject:SetActive(true)
2021-07-28 10:51:39 +08:00
this.Image2.gameObject:SetActive(false)
this.costItemGrid.gameObject:SetActive(false)
this.btnGrid.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
else
2021-07-24 16:22:16 +08:00
this.hintTxt.gameObject:SetActive(isMax)
2021-07-28 10:51:39 +08:00
this.Image2.gameObject:SetActive(not isMax)
this.costItemGrid.gameObject:SetActive(not isMax)
this.btnGrid.gameObject:SetActive(not isMax)
2020-05-09 13:31:21 +08:00
end
2021-07-23 19:12:42 +08:00
this:SetPropertyShow(propertyShow)
this:CostShow(items)
2020-05-09 13:31:21 +08:00
end
2021-07-23 19:12:42 +08:00
function EquipTreasureStrongPopup:CostShow(items)
2021-07-26 17:16:29 +08:00
isMatEnough=true
2021-07-23 19:12:42 +08:00
if not this.costItemPreList then
this.costItemPreList = {}
2020-05-09 13:31:21 +08:00
end
--显示消耗物品
2021-07-28 15:40:50 +08:00
if items then
2021-07-23 19:12:42 +08:00
for i = 1,math.max(#items,#this.costItemPreList) do
if not items[i] then
this.costItemPreList[i].gameObject:SetActive(false)
2021-07-30 17:58:47 +08:00
this.costPreList[i].gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
else
2021-07-30 15:11:56 +08:00
if not this.costPreList[i] then
this.costPreList[i] = newObjToParent(this.costItemPre,this.costItemGrid)
2020-05-09 13:31:21 +08:00
end
2021-07-23 19:12:42 +08:00
if not this.costItemPreList[i] then
2021-07-30 15:11:56 +08:00
this.costItemPreList[i] = SubUIManager.Open(SubUIConfig.ItemView,this.costPreList[i].transform)
2020-05-09 13:31:21 +08:00
end
2021-07-30 17:58:47 +08:00
this.costPreList[i].gameObject:SetActive(true)
2021-07-23 19:12:42 +08:00
this.costItemPreList[i].gameObject:SetActive(true)
this.costItemPreList[i]:OnOpen(false,{items[i].id,0}, 0.8, true, false , false, 0)
2021-07-23 19:12:42 +08:00
if items[i].isEnough then
2021-07-28 10:51:39 +08:00
this.costItemPreList[i].name:GetComponent("Text").text = string.format("<color=#56C789><size=38>%s/%s</size></color>",PrintWanNum2(items[i].haveNum),PrintWanNum2(items[i].needNum))
2020-06-13 11:47:13 +08:00
else
2021-07-23 19:12:42 +08:00
--如果材料不足默认弹第一个不足的材料tip
if isMatEnough then
isMatEnough=false
matId=items[i].id
2020-05-09 13:31:21 +08:00
end
2021-07-28 10:51:39 +08:00
this.costItemPreList[i].name:GetComponent("Text").text = string.format("<color=#E35553><size=38>%s/%s</size></color>",PrintWanNum2(items[i].haveNum),PrintWanNum2(items[i].needNum))
2020-05-09 13:31:21 +08:00
end
end
end
else
2021-07-23 19:12:42 +08:00
this.costItemGrid.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
end
end
--设置属性的显示
2021-07-23 19:12:42 +08:00
function EquipTreasureStrongPopup:SetPropertyShow(_infos)
2021-07-24 16:22:16 +08:00
if this.hintTxt.gameObject.activeInHierarchy then
2022-09-06 10:16:57 +08:00
-- this.properList[0].go.gameObject:SetActive(false)
2021-07-24 16:22:16 +08:00
this.propertyGrid.gameObject:SetActive(false)
return
end
this.propertyGrid.gameObject:SetActive(true)
2021-07-28 15:40:50 +08:00
if isGongMing then
2021-07-23 19:12:42 +08:00
for i = 0, #this.properList do
this.properList[i].go.gameObject:SetActive(false)
end
2021-07-24 16:22:16 +08:00
--this.gongming.gameObject:SetActive(true)
2021-07-23 19:12:42 +08:00
return
2020-05-09 13:31:21 +08:00
end
2021-07-24 16:22:16 +08:00
--this.gongming.gameObject:SetActive(false)
2021-07-23 19:12:42 +08:00
this.properList[0].go.gameObject:SetActive(true)
for i = 1, #this.properList do
this.properList[i].go.gameObject:SetActive(false)
end
local index = 1
2020-05-09 13:31:21 +08:00
for key, value in pairs(_infos) do
2021-07-23 19:12:42 +08:00
if not this.properList[index] then
this.properList[index] = {}
this.properList[index].go = newObjToParent(this.properItemPre,this.propertyGrid)
this.properList[index].leftTxt = Util.GetGameObject(this.properList[index].go,"leftTxt"):GetComponent("Text")
this.properList[index].rightTxt = Util.GetGameObject(this.properList[index].go,"rightTxt"):GetComponent("Text")
end
this.properList[index].go.gameObject:SetActive(true)
2020-05-09 13:31:21 +08:00
local proper=ConfigManager.GetConfigData(ConfigName.PropertyConfig,key)
if proper.Style==1 then
2021-07-23 19:12:42 +08:00
this.properList[index].leftTxt.text=string.format("%s+%s",GetLanguageStrById(proper.Info),value.currValue)
this.properList[index].rightTxt.text= isMax and Language[11062] or value.nextValue
2020-05-09 13:31:21 +08:00
else
2021-07-23 19:12:42 +08:00
this.properList[index].leftTxt.text=GetLanguageStrById(proper.Info).."+"..value.currValue/100 .."%"
this.properList[index].rightTxt.text = isMax and Language[11062] or value.nextValue/100 .."%"
2020-05-09 13:31:21 +08:00
end
2021-07-28 10:51:39 +08:00
index = index + 1
2020-05-09 13:31:21 +08:00
end
2021-07-28 10:51:39 +08:00
LayoutRebuilder.ForceRebuildLayoutImmediate(this.secondScroll.transform)
2020-05-09 13:31:21 +08:00
end
--设置物体选中
function this.SetBtnSelect(_parObj)
this.selectBtn.transform:SetParent(_parObj.transform)
this.selectBtn.transform.localScale = Vector3.one
this.selectBtn.transform.localPosition=Vector3.zero
2021-07-29 11:34:53 +08:00
this.selectBtn.transform:SetSiblingIndex(1)
2020-05-09 13:31:21 +08:00
end
--界面关闭时调用(用于子类重写)
function EquipTreasureStrongPopup:OnClose()
2021-07-23 19:12:42 +08:00
isEnough=true
isMax=false
isMatEnough=false
haveTreasures={}
matId = 0
2020-05-09 13:31:21 +08:00
end
--界面销毁时调用(用于子类重写)
function EquipTreasureStrongPopup:OnDestroy()
2021-07-30 14:05:06 +08:00
curEquipData=nil
type=0
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2021-07-23 19:12:42 +08:00
Util.ClearChild(this.propertyGrid.transform)
this.properList = {}
for i = 1,#this.costItemPreList do
SubUIManager.Close(this.costItemPreList[i])
end
this.costItemPreList = {}
2021-07-30 15:11:56 +08:00
Util.ClearChild(this.costItemGrid.transform)
this.costPreList = {}
2021-07-26 17:16:29 +08:00
for k,v in pairs(this.treasureDatas) do
SubUIManager.Close(v)
2021-07-23 19:12:42 +08:00
end
2021-07-26 17:16:29 +08:00
this.treasureDatas = {}
2021-07-23 19:12:42 +08:00
SubUIManager.Close(this.firstScrollCycleView)
2020-05-09 13:31:21 +08:00
end
return EquipTreasureStrongPopup