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

545 lines
22 KiB
Lua
Raw Normal View History

2025-03-14 11:58:20 +08:00
require("Base/BasePanel")
2023-02-17 19:43:00 +08:00
FaXiangStrongPopup = Inherit(BasePanel)
2024-09-06 10:38:56 +08:00
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local jewelConfig = ConfigManager.GetConfig(ConfigName.JewelConfig)
local this = FaXiangStrongPopup
2023-02-17 19:43:00 +08:00
local curEquipData
2024-09-06 10:38:56 +08:00
local haveTreasures = {}
2023-02-17 19:43:00 +08:00
local type
2024-09-06 10:38:56 +08:00
local isMatEnough = true
local matId = 0
local isMax = false
2023-02-17 19:43:00 +08:00
local isEnough = false
2024-09-06 10:38:56 +08:00
local curIndex
2023-02-17 19:43:00 +08:00
local datas
local isGongMing = false
--初始化组件(用于子类重写)
function FaXiangStrongPopup:InitComponent()
this.spLoader = SpriteLoader.New()
this.Image2 = Util.GetGameObject(self.transform, "bg/Image")
this.content = Util.GetGameObject(self.transform, "bg/content")
2024-09-06 10:38:56 +08:00
this.btnBack = Util.GetGameObject(this.content, "btnBack")
this.titleTxt = Util.GetGameObject(this.content, "name"):GetComponent("Text")
this.skillInfo = Util.GetGameObject(this.content, "skillInfo"):GetComponent("Text")
this.itemPre = Util.GetGameObject(this.content, "itemView")
this.firstScroll = Util.GetGameObject(this.content, "firstScroll")
this.secondScroll = Util.GetGameObject(this.content, "secondScroll")
this.properItemPre = Util.GetGameObject(this.content, "propertyPre")
this.propertyGrid = Util.GetGameObject(this.secondScroll, "grid")
this.costItemPre = Util.GetGameObject(this.content, "costItemPre")
2023-02-17 19:43:00 +08:00
this.costPreList = {}
2024-09-06 10:38:56 +08:00
this.costItemGrid = Util.GetGameObject(this.content, "costGrid")
this.hintTxt = Util.GetGameObject(this.content, "hintTxt"):GetComponent("Text")
2023-02-18 22:21:24 +08:00
this.hintTxt.gameObject:SetActive(false)
2024-09-06 10:38:56 +08:00
this.btnGrid = Util.GetGameObject(this.content, "btnGrid")
this.btnRefine = Util.GetGameObject(this.btnGrid, "btnRefine")
this.btnRefineText = Util.GetGameObject(this.btnRefine, "Text"):GetComponent("Text")
this.btnStrong = Util.GetGameObject(this.btnGrid, "btnStrong")
this.btnStrongText = Util.GetGameObject(this.btnStrong, "Text"):GetComponent("Text")
this.btnShenying = Util.GetGameObject(this.btnGrid, "btnShenying")
this.btnShenyingText = Util.GetGameObject(this.btnShenying, "Text"):GetComponent("Text")
this.btn_strongPage = Util.GetGameObject(this.content, "btnList/btnStrong")
this.btn_refinePage = Util.GetGameObject(this.content, "btnList/btnRefine")
this.btn_shenyingPage = Util.GetGameObject(this.content, "btnList/btnShenying")
this.btn_strongPageRed = Util.GetGameObject(this.btn_strongPage, "red")
this.btn_refinePageRed = Util.GetGameObject(this.btn_refinePage, "red")
this.btn_shenyingPageRed = Util.GetGameObject(this.btn_shenyingPage, "red")
this.selectBtn = Util.GetGameObject(this.content, "btnList/selectBtn")
this.selectText = Util.GetGameObject(this.selectBtn, "Text"):GetComponent("Text")
2023-02-17 19:43:00 +08:00
this.treasureDatas = {}
this.treasureDatas2 = {}
this.costTreasureDatas = {}
this.properList = {}
this.properList[0] = {}
this.properList[0].go = this.properItemPre
2024-09-06 10:38:56 +08:00
this.properList[0].leftTxt = Util.GetGameObject(this.properItemPre, "leftTxt"):GetComponent("Text")
this.properList[0].rightTxt = Util.GetGameObject(this.properItemPre, "rightTxt"):GetComponent("Text")
2023-02-17 19:43:00 +08:00
local rootHight = this.firstScroll.transform.rect.height
2024-09-06 10:38:56 +08:00
local rootWidth = this.firstScroll.transform.rect.width
this.firstScrollCycleView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.firstScroll.transform, this.itemPre,
nil, Vector2.New(rootWidth, rootHight), 1, 5, Vector2.New(15, 50))
this.gongming = Util.GetGameObject(this.content, "gongming")
2023-02-17 19:43:00 +08:00
this.gongming.gameObject:SetActive(false)
2024-09-06 10:38:56 +08:00
this.select = Util.GetGameObject(this.content, "select")
2023-02-17 19:43:00 +08:00
end
--绑定事件(用于子类重写)
function FaXiangStrongPopup:BindEvent()
--关闭按钮
Util.AddClick(this.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
--强化页签
Util.AddClick(this.btn_strongPage, function()
if type == 1 then
return
end
2024-09-06 10:38:56 +08:00
this:SetWindShow(1, 0)
this:RefreshRedPoint(0, false)
2023-02-17 19:43:00 +08:00
end)
--精炼页签
Util.AddClick(this.btn_refinePage, function()
if type == 2 then
return
end
2024-09-06 10:38:56 +08:00
this:SetWindShow(2, 0)
this:RefreshRedPoint(0, false)
2023-02-17 19:43:00 +08:00
end)
--神应页签
Util.AddClick(this.btn_shenyingPage, function()
2024-09-06 10:38:56 +08:00
2023-02-17 19:43:00 +08:00
end)
--强化按钮
Util.AddClick(this.btnStrong, function()
if isGongMing then
return
end
--如果强化界面 强化到最高等级谈提示 精炼界面 就切界面
2024-09-06 10:38:56 +08:00
if type == 1 then
2023-02-17 19:43:00 +08:00
if isMax then
2024-08-29 21:36:51 +08:00
PopupTipPanel.ShowTip(Language[12673])
2023-02-17 19:43:00 +08:00
return
end
else
2024-09-06 10:38:56 +08:00
this:SetWindShow(1, 0)
2023-02-17 19:43:00 +08:00
return
end
--材料是否足够
2024-09-06 10:38:56 +08:00
if isMatEnough == false then
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, matId)
2023-02-17 19:43:00 +08:00
return
end
2024-09-06 10:38:56 +08:00
LogError("curEquipData.lv=====" .. curEquipData.lv)
NetManager.StrongthenFaxiangEquipRequest(curEquipData.idDyn, curEquipData.lv + 1, 1, curEquipData, function(msg)
FaXiangManager.ChangeTreasureLv(curEquipData.idDyn, 1)
this.treasureDatas[curIndex]:OnOpen(false, { curEquipData.id, 0 }, 1, false, false, false, 0,
curEquipData.idDyn)
this:SetWindShow(type, 0)
2023-02-20 14:46:37 +08:00
HeroPropManager.SetDirtyByType(curEquipData.upHeroDid, Hero_Prop_Type.FaXiang)
2024-09-06 10:38:56 +08:00
this:RefreshRedPoint(0, true)
2023-02-17 19:43:00 +08:00
if isMax then
2024-08-29 21:36:51 +08:00
PopupTipPanel.ShowTip(Language[12653])
2023-02-17 19:43:00 +08:00
else
--PopupTipPanel.ShowTip("强化成功")
end
2024-09-06 10:38:56 +08:00
local oldWarPowerValue = FaXiangManager.CalculateWarForceBySid(curEquipData.id, curEquipData.lv - 1,
curEquipData.refineLv)
local newWarPowerValue = FaXiangManager.CalculateWarForceBySid(curEquipData.id, curEquipData.lv,
curEquipData.refineLv)
2023-02-17 19:43:00 +08:00
if oldWarPowerValue ~= newWarPowerValue then
2024-09-06 10:38:56 +08:00
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,
{ oldValue = oldWarPowerValue, newValue = newWarPowerValue })
2023-02-17 19:43:00 +08:00
end
Game.GlobalEvent:DispatchEvent(GameEvent.Treasure.TreasureLvUp)
end)
end)
2023-02-18 22:21:24 +08:00
--升星按钮
2023-02-17 19:43:00 +08:00
Util.AddClick(this.btnRefine, function()
--如果精炼界面 精炼到最高等级谈提示 否 强化界面 就切界面
2024-09-06 10:38:56 +08:00
if type == 2 then
2023-02-17 19:43:00 +08:00
if isMax then
2024-08-29 21:36:51 +08:00
PopupTipPanel.ShowTip(Language[12674])
2023-02-17 19:43:00 +08:00
return
end
else
2024-09-06 10:38:56 +08:00
this:SetWindShow(2, 0)
2023-02-17 19:43:00 +08:00
return
end
2024-09-06 10:38:56 +08:00
if isMatEnough == false then
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, matId)
2023-02-17 19:43:00 +08:00
return
end
2024-09-06 10:38:56 +08:00
NetManager.StrongthenFaxiangEquipRequest(curEquipData.idDyn, curEquipData.refineLv + 1, 2, curEquipData,
function(msg)
FaXiangManager.ChangeTreasureLv(curEquipData.idDyn, 2)
this:SetWindShow(2, 0)
HeroPropManager.SetDirtyByType(curEquipData.upHeroDid, Hero_Prop_Type.FaXiang)
this:RefreshRedPoint(0, true)
this.treasureDatas[curIndex]:OnOpen(false, { curEquipData.id, 0 }, 1, false, false, false, 0,
curEquipData.idDyn)
if isMax then
PopupTipPanel.ShowTip(Language[12675])
else
--PopupTipPanel.ShowTip("精炼成功")
end
local oldWarPowerValue = FaXiangManager.CalculateWarForceBySid(curEquipData.id, curEquipData.lv,
curEquipData.refineLv - 1)
local newWarPowerValue = FaXiangManager.CalculateWarForceBySid(curEquipData.id, curEquipData.lv,
curEquipData.refineLv + 1)
if oldWarPowerValue ~= newWarPowerValue then
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,
{ oldValue = oldWarPowerValue, newValue = newWarPowerValue })
end
Game.GlobalEvent:DispatchEvent(GameEvent.Treasure.TreasureLvUp)
end)
2023-02-17 19:43:00 +08:00
return
end)
--神应升级按钮
Util.AddClick(this.btnShenying, function()
2024-09-06 10:38:56 +08:00
2023-02-17 19:43:00 +08:00
end)
end
2024-09-06 10:38:56 +08:00
function FaXiangStrongPopup:RefreshRedPoint(delta, isRefreshTabRed)
2023-02-17 19:43:00 +08:00
Timer.New(function()
2024-09-06 10:38:56 +08:00
for k, v in pairs(this.treasureDatas2) do
local redShow = FaXiangManager.CheckIsShowRed(v.data.idDyn, type)
2023-02-20 17:38:59 +08:00
v.red.gameObject:SetActive(redShow)
end
2023-02-17 19:43:00 +08:00
this.select.transform:SetParent(curIndex.transform)
2024-09-06 10:38:56 +08:00
this.select:GetComponent("RectTransform").anchoredPosition3D = Vector3.New(-8.5, 5.04, 0)
if type == 1 then
this.selectText.text = Language[11497]
elseif type == 2 then
this.selectText.text = Language[11626]
2023-02-17 19:43:00 +08:00
end
-- this.selectText.text = type == 1 and "强 化" or "精 炼"
this.select.transform.localScale = Vector3.one
this.select.gameObject:SetActive(true)
this.select.transform:SetSiblingIndex(1)
2024-09-06 10:38:56 +08:00
end, delta):Start()
2023-02-20 17:38:59 +08:00
if isRefreshTabRed then
2024-09-06 10:38:56 +08:00
local redDataStrong, redDataRefine, redDataShenying = false, false, false
2023-02-20 17:38:59 +08:00
--for k,v in pairs(datas) do
2024-09-06 10:38:56 +08:00
if not redDataStrong then
redDataStrong = FaXiangManager.CheckIsShowRed(curEquipData.idDyn, 1)
end
if not redDataRefine then
redDataRefine = FaXiangManager.CheckIsShowRed(curEquipData.idDyn, 2)
end
2023-02-20 17:38:59 +08:00
--end
this.btn_strongPageRed.gameObject:SetActive(redDataStrong)
this.btn_refinePageRed.gameObject:SetActive(redDataRefine)
end
2023-02-17 19:43:00 +08:00
end
--界面打开时调用(用于子类重写)
function FaXiangStrongPopup:OnOpen(...)
2024-09-06 10:38:56 +08:00
local args = { ... }
2023-02-17 19:43:00 +08:00
curEquipData = args[1]
2024-09-06 10:38:56 +08:00
type = args[2]
2023-02-17 19:43:00 +08:00
end
function FaXiangStrongPopup:OnShow()
datas = FaXiangManager.GetAllHeroEquipedTreasureData()
this.btn_shenyingPage:SetActive(false)
this.formationInfo = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
2024-09-06 10:38:56 +08:00
table.sort(datas, function(a, b)
2023-02-17 19:43:00 +08:00
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
2024-09-06 10:38:56 +08:00
end
2023-02-17 19:43:00 +08:00
else
return aIsMainFormation
end
end)
this:ShowTopDataList(datas)
2024-09-06 10:38:56 +08:00
this:SetWindShow(type, 0.2)
this:RefreshRedPoint(0.5, true)
2023-02-17 19:43:00 +08:00
end
function FaXiangStrongPopup:GetHeroIsMainFormation(HeroId)
2024-09-06 10:38:56 +08:00
for k, v in ipairs(this.formationInfo.teamHeroInfos) do
2023-02-17 19:43:00 +08:00
if HeroId == v.heroId then
return v
end
2024-09-06 10:38:56 +08:00
end
2023-02-17 19:43:00 +08:00
return nil
end
function FaXiangStrongPopup:ShowTopDataList(list)
if not this.treasureDatas then
this.treasureDatas = {}
end
this.firstScrollCycleView:ForeachItemGO(function(index, go)
go.gameObject:SetActive(false)
end)
2024-09-06 10:38:56 +08:00
this.firstScrollCycleView:SetData(list, function(index, go)
this:SetScrollPre(go, list[index], index)
2023-02-17 19:43:00 +08:00
if not this.treasureDatas2[go] then
this.treasureDatas2[go] = {}
end
2024-09-06 10:38:56 +08:00
this.treasureDatas2[go].red = Util.GetGameObject(go, "red")
2023-02-17 19:43:00 +08:00
this.treasureDatas2[go].data = list[index]
2024-09-06 10:38:56 +08:00
end, false, false)
2023-02-17 19:43:00 +08:00
2024-09-06 10:38:56 +08:00
for i = 1, #list do
2023-02-17 19:43:00 +08:00
if list[i].idDyn == curEquipData.idDyn then
this.firstScrollCycleView:SetIndex(i)
break
end
end
end
2024-09-06 10:38:56 +08:00
function FaXiangStrongPopup:SetScrollPre(go, data, _index)
2023-02-17 19:43:00 +08:00
if data.idDyn == curEquipData.idDyn then
curIndex = go
end
2024-09-06 10:38:56 +08:00
local btn = Util.GetGameObject(go, "btn")
local name = Util.GetGameObject(go, "nameDi/Text")
2023-02-17 19:43:00 +08:00
go.gameObject:SetActive(true)
if not this.treasureDatas[go] then
2024-09-06 10:38:56 +08:00
this.treasureDatas[go] = SubUIManager.Open(SubUIConfig.ItemView, go.transform)
2023-02-17 19:43:00 +08:00
this.treasureDatas[go].transform:SetAsFirstSibling()
end
2024-09-06 10:38:56 +08:00
this.treasureDatas[go]:OnOpen(false, { data.id, 0 }, 1, false, false, false, 0, data.idDyn)
2024-11-15 17:54:56 +08:00
name:GetComponent("Text").text = SubString2(GetLanguageStrById(HeroManager.GetSingleHeroData(data.upHeroDid).heroConfig.ReadingName),8)
2024-09-06 10:38:56 +08:00
Util.AddOnceClick(btn, function()
2023-02-17 19:43:00 +08:00
if curEquipData.idDyn == data.idDyn then
return
end
this.select.transform:SetParent(go.transform)
2024-09-06 10:38:56 +08:00
this.select:GetComponent("RectTransform").anchoredPosition3D = Vector3.New(-8.5, 5.04, 0)
2023-02-17 19:43:00 +08:00
this.select.gameObject:SetActive(true)
this.select.transform:SetSiblingIndex(1)
curEquipData = data
curIndex = go
2024-09-06 10:38:56 +08:00
this:SetWindShow(type, 0)
2023-02-17 19:43:00 +08:00
end)
end
--设置界面显示 1.强化 2.精炼 3.神应
function FaXiangStrongPopup:SetWindShow(_index)
2024-09-06 10:38:56 +08:00
haveTreasures = {}
2023-02-17 19:43:00 +08:00
type = _index
curEquipData = FaXiangManager.GetSingleEquipTreasreData(curEquipData.idDyn)
local items, propertyShow
if _index == 1 then
2024-08-29 21:36:51 +08:00
this.titleTxt.text = Language[12676]
2023-02-17 19:43:00 +08:00
this.btnRefine:SetActive(false)
this.btnStrong:SetActive(true)
this.btnShenying:SetActive(false)
this.SetBtnSelect(this.btn_strongPage)
isMax = curEquipData.lv == curEquipData.maxLv
2024-08-29 21:36:51 +08:00
this.properList[0].leftTxt.text = Language[12658]
2023-02-17 19:43:00 +08:00
if isMax then
2024-08-29 21:36:51 +08:00
this.properList[0].rightTxt.text = Language[10209]
2023-02-17 19:43:00 +08:00
this.btnStrong.gameObject:SetActive(false)
else
2024-08-29 21:36:51 +08:00
this.btnStrongText.text = Language[11497]
2024-09-06 10:38:56 +08:00
this.properList[0].rightTxt.text = string.format("%d/%d", curEquipData.lv + 1, curEquipData.maxLv)
2023-02-17 19:43:00 +08:00
end
2024-09-06 10:38:56 +08:00
propertyShow = FaXiangManager.GetCurrLvAndNextLvPropertyValue(curEquipData.levelPool, curEquipData.lv,
curEquipData)
2023-02-17 19:43:00 +08:00
--显示消耗
2024-09-06 10:38:56 +08:00
LogError("curEquipData.strongConfig.id==" .. curEquipData.strongConfig.Id)
2023-02-17 19:43:00 +08:00
--items = FaXiangManager.GetCostItems(curEquipData.idDyn,curEquipData.strongConfig)
2024-09-06 10:38:56 +08:00
items = FaXiangManager.GetFaXiangLevelCost(curEquipData.levelPool, curEquipData.lv)
local skills = curEquipData.faXiangConfig.PassiveSkill
local skillId = skills[curEquipData.refineLv + 1]
local des = ""
2023-02-18 22:21:24 +08:00
for i = 1, #skillId do
2024-11-15 17:54:56 +08:00
LogError(ConfigManager.GetConfigData(ConfigName.PassiveSkillConfig, skillId[i]).Desc)
des = des .. GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PassiveSkillConfig, skillId[i]).Desc)
2023-02-17 19:43:00 +08:00
end
2024-09-06 10:38:56 +08:00
this.hintTxt.text = Language[12677]
this.skillInfo.text = "<color=#492E00>" .. Language[12678] .. "</color>" .. des
2023-02-17 19:43:00 +08:00
elseif _index == 2 then
2024-09-06 10:38:56 +08:00
this.titleTxt.text = Language[12679]
2023-02-17 19:43:00 +08:00
this.btnRefine:SetActive(true)
this.btnStrong:SetActive(false)
this.btnShenying:SetActive(false)
this.SetBtnSelect(this.btn_refinePage)
2024-09-06 10:38:56 +08:00
isMax = curEquipData.refineLv == curEquipData.maxRefineLv
2024-08-29 21:36:51 +08:00
this.properList[0].leftTxt.text = Language[12680]
2024-09-06 10:38:56 +08:00
if isMax then
2024-08-29 21:36:51 +08:00
this.properList[0].rightTxt.text = Language[10209]
2023-02-17 19:43:00 +08:00
this.btnRefine.gameObject:SetActive(false)
else
2024-09-06 10:38:56 +08:00
this.btnRefineText.text = Language[11626]
this.properList[0].rightTxt.text = string.format("%d/%s", curEquipData.refineLv + 1, curEquipData
.maxRefineLv)
2023-02-17 19:43:00 +08:00
end
2024-09-06 10:38:56 +08:00
propertyShow = FaXiangManager.GetCurrStarAndNextStarPropertyValue(2, curEquipData.lv, curEquipData)
items = FaXiangManager.GetFaXiangStarCost(curEquipData.refinePool, curEquipData.refineLv, curEquipData)
local skills = curEquipData.faXiangConfig.PassiveSkill
local lv = 0
2023-02-18 22:21:24 +08:00
if isMax then
2024-09-06 10:38:56 +08:00
lv = curEquipData.refineLv + 1
2023-02-17 19:43:00 +08:00
else
2024-09-06 10:38:56 +08:00
lv = curEquipData.refineLv + 2
2023-02-18 22:21:24 +08:00
end
2024-09-06 10:38:56 +08:00
local skillId = skills[lv]
local des = ""
2023-02-18 22:21:24 +08:00
for i = 1, #skillId do
2024-11-15 17:54:56 +08:00
des = des .. GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PassiveSkillConfig, skillId[i]).Desc)
2023-02-17 19:43:00 +08:00
end
2024-09-06 10:38:56 +08:00
this.skillInfo.text = "<color=#4BAB60>" .. Language[12681] .. "</color>" .. des
this.hintTxt.text = Language[12682]
2023-02-17 19:43:00 +08:00
end
2023-02-20 17:38:59 +08:00
this.hintTxt.gameObject:SetActive(isMax)
2023-02-17 19:43:00 +08:00
isGongMing = false
--if HarmonyManager.IsInfo(curEquipData.upHeroDid) and HarmonyManager.GetSingleAdditions(index) ~= -1 and _index == 1 then
2023-02-20 16:20:17 +08:00
-- if HarmonyManager.IsInfo(curEquipData.upHeroDid) and _index == 1 then
-- isGongMing = true
-- this.hintTxt.text = "共鸣中的宝物无法强化"
-- this.hintTxt.gameObject:SetActive(true)
-- this.Image2.gameObject:SetActive(false)
-- this.costItemGrid.gameObject:SetActive(false)
-- this.btnGrid.gameObject:SetActive(false)
-- else
-- -- this.hintTxt.gameObject:SetActive(isMax)
-- this.Image2.gameObject:SetActive(not isMax)
-- this.costItemGrid.gameObject:SetActive(not isMax)
-- this.btnGrid.gameObject:SetActive(not isMax)
-- end
2023-02-17 19:43:00 +08:00
this:SetPropertyShow(propertyShow)
this:CostShow(items)
end
function FaXiangStrongPopup:CostShow(items)
2024-09-06 10:38:56 +08:00
isMatEnough = true
2023-02-17 19:43:00 +08:00
if not this.costItemPreList then
this.costItemPreList = {}
end
--显示消耗物品
if items then
2024-09-06 10:38:56 +08:00
for i = 1, math.max(#items, #this.costItemPreList) do
2023-02-17 19:43:00 +08:00
if not items[i] then
this.costItemPreList[i].gameObject:SetActive(false)
this.costPreList[i].gameObject:SetActive(false)
else
if not this.costPreList[i] then
2024-09-06 10:38:56 +08:00
this.costPreList[i] = newObjToParent(this.costItemPre, this.costItemGrid)
2023-02-17 19:43:00 +08:00
end
if not this.costItemPreList[i] then
2024-09-06 10:38:56 +08:00
this.costItemPreList[i] = SubUIManager.Open(SubUIConfig.ItemView, this.costPreList[i].transform)
2023-02-17 19:43:00 +08:00
end
this.costPreList[i].gameObject:SetActive(true)
this.costItemPreList[i].gameObject:SetActive(true)
2024-09-06 10:38:56 +08:00
this.costItemPreList[i]:OnOpen(false, { items[i].id, 0 }, 0.8, true, false, false, 0)
2023-02-17 19:43:00 +08:00
if items[i].isEnough then
2024-09-06 10:38:56 +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))
2023-02-17 19:43:00 +08:00
else
--如果材料不足默认弹第一个不足的材料tip
if isMatEnough then
2024-09-06 10:38:56 +08:00
isMatEnough = false
matId = items[i].id
2023-02-17 19:43:00 +08:00
end
2024-09-06 10:38:56 +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))
2023-02-17 19:43:00 +08:00
end
end
end
else
this.costItemGrid.gameObject:SetActive(false)
end
end
--设置属性的显示
function FaXiangStrongPopup:SetPropertyShow(_infos)
2023-02-18 22:21:24 +08:00
-- if this.hintTxt.gameObject.activeInHierarchy then
-- -- this.properList[0].go.gameObject:SetActive(false)
-- this.propertyGrid.gameObject:SetActive(false)
-- return
-- end
2023-02-17 19:43:00 +08:00
this.propertyGrid.gameObject:SetActive(true)
if isGongMing then
for i = 0, #this.properList do
this.properList[i].go.gameObject:SetActive(false)
end
--this.gongming.gameObject:SetActive(true)
return
end
--this.gongming.gameObject:SetActive(false)
this.properList[0].go.gameObject:SetActive(true)
for i = 1, #this.properList do
this.properList[i].go.gameObject:SetActive(false)
end
local index = 1
for key, value in pairs(_infos) do
2023-02-20 16:20:17 +08:00
--LogError("key======"..key)
2023-02-17 19:43:00 +08:00
if not this.properList[index] then
this.properList[index] = {}
2024-09-06 10:38:56 +08:00
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")
2023-02-17 19:43:00 +08:00
end
this.properList[index].go.gameObject:SetActive(true)
2024-09-06 10:38:56 +08:00
if value.proId == 100 then
this.properList[index].leftTxt.text = Language[12683] .. "+" .. value.currValue * 100 .. "%"
this.properList[index].rightTxt.text = isMax and Language[10209] or value.nextValue * 100 .. "%"
2023-02-17 19:43:00 +08:00
else
2024-09-06 10:38:56 +08:00
local proper = ConfigManager.GetConfigData(ConfigName.PropertyConfig, value.proId)
if proper.Style == 1 then
this.properList[index].leftTxt.text = string.format("%s+%s", GetLanguageStrById(proper.Info),
value.currValue)
this.properList[index].rightTxt.text = isMax and Language[10209] or value.nextValue
2023-02-20 16:20:17 +08:00
else
2024-09-06 10:38:56 +08:00
this.properList[index].leftTxt.text = GetLanguageStrById(proper.Info) .. "+" .. value.currValue / 100 ..
"%"
this.properList[index].rightTxt.text = isMax and Language[10209] or value.nextValue / 100 .. "%"
2023-02-20 16:20:17 +08:00
end
2023-02-17 19:43:00 +08:00
end
2024-09-06 10:38:56 +08:00
2023-02-17 19:43:00 +08:00
index = index + 1
end
LayoutRebuilder.ForceRebuildLayoutImmediate(this.secondScroll.transform)
end
--设置物体选中
function this.SetBtnSelect(_parObj)
this.selectBtn.transform:SetParent(_parObj.transform)
this.selectBtn.transform.localScale = Vector3.one
2024-09-06 10:38:56 +08:00
this.selectBtn.transform.localPosition = Vector3.zero
2023-02-17 19:43:00 +08:00
this.selectBtn.transform:SetSiblingIndex(1)
end
--界面关闭时调用(用于子类重写)
function FaXiangStrongPopup:OnClose()
2024-09-06 10:38:56 +08:00
isEnough = true
isMax = false
isMatEnough = false
haveTreasures = {}
2023-02-17 19:43:00 +08:00
matId = 0
end
--界面销毁时调用(用于子类重写)
function FaXiangStrongPopup:OnDestroy()
2024-09-06 10:38:56 +08:00
curEquipData = nil
type = 0
2023-02-17 19:43:00 +08:00
this.spLoader:Destroy()
Util.ClearChild(this.propertyGrid.transform)
this.properList = {}
2024-09-06 10:38:56 +08:00
for i = 1, #this.costItemPreList do
2023-02-17 19:43:00 +08:00
SubUIManager.Close(this.costItemPreList[i])
end
this.costItemPreList = {}
Util.ClearChild(this.costItemGrid.transform)
this.costPreList = {}
2024-09-06 10:38:56 +08:00
for k, v in pairs(this.treasureDatas) do
2023-02-17 19:43:00 +08:00
SubUIManager.Close(v)
end
this.treasureDatas = {}
SubUIManager.Close(this.firstScrollCycleView)
end
2024-09-06 10:38:56 +08:00
return FaXiangStrongPopup