miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/RewardEquipSingleShowPopup2...

261 lines
12 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

require("Base/BasePanel")
local RewardEquipSingleShowPopup2 = Inherit(BasePanel)
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
local passiveSkillConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
local _BaseProList = {}--基础属性对象
local _suitProList = {}--套装属性对象
local _superProList = {}--白金属性对象
local isShowfenjie =true
--初始化组件(用于子类重写)
function RewardEquipSingleShowPopup2:InitComponent()
self.spLoader = SpriteLoader.New()
self.mask = Util.GetGameObject(self.transform, "mask")
self.content = Util.GetGameObject(self.transform, "Content")
--装备详情--topBar
self.topBar = Util.GetGameObject(self.transform, "Content/topBar")
self.eqiopName = Util.GetGameObject(self.topBar, "name"):GetComponent("Text")
self.icon = Util.GetGameObject(self.topBar, "icon"):GetComponent("Image")
self.frame = Util.GetGameObject(self.topBar, "frame"):GetComponent("Image")
self.equipType=Util.GetGameObject(self.topBar, "equipType"):GetComponent("Text")
self.equipQuaText=Util.GetGameObject(self.topBar, "equipQuaText"):GetComponent("Text")
self.equipInfoText=Util.GetGameObject(self.topBar, "equipInfoText"):GetComponent("Text")
self.powerNum=Util.GetGameObject(self.topBar, "powerNum"):GetComponent("Text")
self.star=Util.GetGameObject(self.topBar, "star")
self.effectbaijin = Util.GetGameObject(self.topBar, "fx_zhuangbeijiemian")
--装备属性--midBar
--basePro
self.midBar = Util.GetGameObject(self.transform, "Content/midBar")
self.basePro = Util.GetGameObject(self.midBar, "basePro")
self.baseProName = Util.GetGameObject(self.basePro, "PropertyName"):GetComponent("Text")
self.baseProGrid = Util.GetGameObject(self.basePro, "grid")
self.baseProPre = Util.GetGameObject(self.basePro, "grid/curProName")
self.baseProPre:SetActive(false)
--suitPro
self.suitPro = Util.GetGameObject(self.midBar, "suitPro")
self.suitProName = Util.GetGameObject(self.suitPro, "PropertyName"):GetComponent("Text")
self.suitProGrid = Util.GetGameObject(self.suitPro, "proGrid")
self.suitProPre = Util.GetGameObject(self.suitPro, "proGrid/proPre")
self.suitProPre:SetActive(false)
--superPro
self.superPro = Util.GetGameObject(self.midBar, "superPro")
self.superProGrid = Util.GetGameObject(self.superPro, "proGrid")
self.superProPre = Util.GetGameObject(self.superPro, "proGrid/Desc")
self.superProPre:SetActive(false)
--分解按钮--btmBar
self.btmBar = Util.GetGameObject(self.transform, "Content/btmBar")
self.btnSure = Util.GetGameObject(self.btmBar, "btnGrid/btnSure")
self.btnJump = Util.GetGameObject(self.btmBar, "btnGrid/btnJump")
--装备获取途径--btmBar
self.canGetPre = Util.GetGameObject(self.btmBar, "scroll/canGetPre")
self.canGetGrid = Util.GetGameObject(self.btmBar, "scroll")
self.canGetScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.canGetGrid.transform,self.canGetPre, nil,
Vector2.New(self.canGetGrid.transform.rect.width, self.canGetGrid.transform.rect.height), 1, 1, Vector2.New(0, 0))
self.canGetScrollView.moveTween.MomentumAmount = 1
self.canGetScrollView.moveTween.Strength = 2
self.canGetScrollView.elastic = false
self.jumpViewList = {}
end
--绑定事件(用于子类重写)
function RewardEquipSingleShowPopup2:BindEvent()
Util.AddClick(self.mask, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
--使用
Util.AddClick(self.btnJump, function()
if self.equipData.itemConfig then
JumpManager.GoJump(self.equipData.itemConfig.UseJump)
end
end)
--分解
Util.AddClick(self.btnSure, function()
--数量大于1 ,弹选择框
if BagManager.GetItemCountById(self.equipData.id) > 1 then
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.EquipSingleSell,self.equipData)
self:ClosePanel()
elseif BagManager.GetItemCountById(self.equipData.id) == 1 then
--只有一个分解品质大于4 弹框
if self.equipData.itemConfig.Quantity>=4 then
UIManager.OpenPanel(UIName.BagResolveAnCompoundPanel,2,self.equipData.itemConfig.ItemBaseType,self.equipData)
else
local curResolveAllItemList={}
local equip = {}
equip.itemId = self.equipData.id
equip.itemNum = 1
table.insert(curResolveAllItemList,equip)
local type = 1
NetManager.UseAndPriceItemRequest(type,curResolveAllItemList,function (drop)
self.SendBackResolveReCallBack(drop)
end)
end
else
PopupTipPanel.ShowTip(Language[11506])
end
end)
end
--添加事件监听(用于子类重写)
function RewardEquipSingleShowPopup2:AddListener()
end
--移除事件监听(用于子类重写)
function RewardEquipSingleShowPopup2:RemoveListener()
end
--界面打开时调用(用于子类重写)
function RewardEquipSingleShowPopup2:OnOpen(_equipData,_openType,_isRewardItemPop,_curHeroData)
if not _equipData then
return
end
self.equipData = _equipData
self.openType = _openType
self.isRewardItemPop = _isRewardItemPop and _isRewardItemPop or false
self.curHeroData = _curHeroData
end
function RewardEquipSingleShowPopup2:OnShow()
--上部装备基础信息
LogBlue(self.equipData.id)
local equipConfigData=ConfigManager.GetConfigData(ConfigName.EquipConfig, tonumber(self.equipData.id))
local itemConfigData=ConfigManager.GetConfigData(ConfigName.ItemConfig, tonumber(self.equipData.id))
self.btnSure:SetActive(itemConfigData.IfResolve==1)
self.topBar:GetComponent("Image").sprite = self.spLoader:LoadSprite("t_tongyong_di_"..equipConfigData.Quality)
self.equipQuaText.text=GetStringByEquipQua(equipConfigData.Quality,GetQuaStringByEquipQua(equipConfigData.Quality))
self.eqiopName.text=GetStringByEquipQua(equipConfigData.Quality,GetLanguageStrById(equipConfigData.Name))
self.frame.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(equipConfigData.Quality))
self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfigData.ResourceID))
self.equipInfoText.text=GetLanguageStrById(itemConfigData.ItemDescribe)
self.powerNum.text=EquipManager.CalculateWarForce(self.equipData.id)
EquipManager.SetEquipStarShow(self.spLoader, self.star,equipConfigData.Id)
self.equipType.text=Language[11089]..GetEquipPosStrByEquipPosNum(equipConfigData.Position)
--下部按钮信息
self.btnJump:SetActive(itemConfigData.UseJump and itemConfigData.UseJump > 0 and BagManager.isBagPanel)
self.effectbaijin:SetActive(equipConfigData.Quality==7)
Util.SetParticleSortLayer(self.effectbaijin,self.sortingOrder + 1)
--basePro基础属性
if equipConfigData.Property then
self.basePro:SetActive(true)
for index, prop in ipairs(equipConfigData.Property) do
local proConfigData = ConfigManager.GetConfigData(ConfigName.PropertyConfig, prop[1])
if proConfigData then
if not _BaseProList[index] then
_BaseProList[index] = newObjToParent(self.baseProPre, self.baseProGrid)
end
_BaseProList[index]:SetActive(true)
_BaseProList[index]:GetComponent("Text").text = GetLanguageStrById(proConfigData.Info)
local vText = Util.GetGameObject(_BaseProList[index], "curProVale"):GetComponent("Text")
if prop[2] > 0 then
vText.text = "+"..GetPropertyFormatStr(proConfigData.Style, prop[2])
else
vText.text = GetPropertyFormatStr(proConfigData.Style, prop[2])
end
end
end
else
self.basePro:SetActive(false)
end
--suitPro套装属性
if self.curHeroData then
-- body
end
local equipSuit = HeroManager.GetCurHeroEquipSuitPros(self.curHeroData.equipIdList)
local suitConFig = ConfigManager.GetConfig(ConfigName.EquipSuiteConfig)
if suitConFig[equipConfigData.Star] then
self.suitPro:SetActive(true)
local curSuitConFig = suitConFig[equipConfigData.Star]
if curSuitConFig then
for i = 1, math.max(#curSuitConFig.SuiteValue, #_suitProList) do
if not _suitProList[i] then
_suitProList[i] = newObjToParent(self.suitProPre, self.suitProGrid)
end
_suitProList[i].gameObject:SetActive(true)
end
for i = 1, #curSuitConFig.SuiteValue do
_suitProList[i].gameObject:SetActive(true)
local name = Util.GetGameObject(_suitProList[i].transform, "proName"):GetComponent("Text")
local value = Util.GetGameObject(_suitProList[i].transform, "proVale"):GetComponent("Text")
name.text = "<color=#FCEBCA>" .. GetLanguageStrById(propertyConfig[curSuitConFig.SuiteValue[i][2]].Info) .."+ "..GetPropertyFormatStr(propertyConfig[curSuitConFig.SuiteValue[i][2]].Style,curSuitConFig.SuiteValue[i][3]) .. "</color>"
value.text = "<color=#FCEBCA>(" .. curSuitConFig.SuiteValue[i][1] .. Language[11091]
end
end
else
self.suitPro:SetActive(false)
end
--super白金套装属性
local suitConFig = ConfigManager.GetConfig(ConfigName.EquipSuiteConfig)
local curSuitConFig = suitConFig[equipConfigData.Star]
if curSuitConFig and curSuitConFig.SuiteSkill then
self.superPro:SetActive(true)
if curSuitConFig then
for i = 1, math.max(#curSuitConFig.SuiteSkill, #_superProList) do
if not _superProList[i] then
_superProList[i] = newObjToParent(self.superProPre, self.superProGrid)
end
_superProList[i].gameObject:SetActive(true)
end
for i = 1, #curSuitConFig.SuiteSkill do
local go = _superProList[i]
go.gameObject:SetActive(true)
local Star = curSuitConFig.Id
local suitNum = curSuitConFig.SuiteSkill[i][1]
local passiveId = curSuitConFig.SuiteSkill[i][2]
go:GetComponent("Text").text = "<color=#FCEBCA>" .. GetLanguageStrById(passiveSkillConfig[passiveId].Desc) .. "</color>"
Util.GetGameObject(go.transform, "Name/vale"):GetComponent("Text").text = "<color=#FCEBCA>(" .. GetEquipSuitStr(Star,suitNum) .. ")</color>"
Util.GetGameObject(go.transform, "Name"):GetComponent("Text").text = "不朽天赋" .. i .. ""
end
end
else
self.superPro:SetActive(false)
end
--(此处需要三遍才能完全打开)
ForceRebuildLayout(self.midBar.transform)
ForceRebuildLayout(self.midBar.transform)
ForceRebuildLayout(self.midBar.transform)
--获取途径
if self.jumpViewList and #self.jumpViewList > 0 then
for i = 1,#self.jumpViewList do
SubUIManager.Close(self.jumpViewList[i])
end
end
local curitemData = itemConfig[tonumber(self.equipData.id)]
if curitemData and curitemData.Jump then
if curitemData.Jump and #curitemData.Jump>0 then
self.canGetScrollView:SetData(curitemData.Jump,function (index, item)
local tempView = nil
if self.isRewardItemPop then
tempView = SubUIManager.Open(SubUIConfig.JumpView, item.transform, curitemData.Jump[index],false)
else
tempView = SubUIManager.Open(SubUIConfig.JumpView, item.transform, curitemData.Jump[index],true)
end
table.insert(self.jumpViewList,tempView)
end,true,true)
end
end
end
--界面关闭时调用(用于子类重写)
function RewardEquipSingleShowPopup2:OnClose()
for i = 1, #self.jumpViewList do
destroy(self.jumpViewList[i].gameObject)
end
end
--界面销毁时调用(用于子类重写)
function RewardEquipSingleShowPopup2:OnDestroy()
self.spLoader:Destroy()
_BaseProList = {}
_suitProList = {}
_superProList = {}
self.jumpViewList = {}
end
return RewardEquipSingleShowPopup2