177 lines
7.4 KiB
Lua
177 lines
7.4 KiB
Lua
require("Base/BasePanel")
|
|
local RewardTailsmanChipShowPopup = 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 typeToUpdate = {
|
|
[2] = 2,--已穿戴->卸载单件
|
|
[3] = 1,--未穿戴->穿单件
|
|
[4] = 3,--未穿戴->替换单件
|
|
}
|
|
--初始化组件(用于子类重写)
|
|
function RewardTailsmanChipShowPopup: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.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)
|
|
|
|
--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/howGet")
|
|
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 RewardTailsmanChipShowPopup:BindEvent()
|
|
Util.AddClick(self.mask, function()
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
self:ClosePanel()
|
|
end)
|
|
end
|
|
|
|
--添加事件监听(用于子类重写)
|
|
function RewardTailsmanChipShowPopup:AddListener()
|
|
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function RewardTailsmanChipShowPopup:RemoveListener()
|
|
|
|
end
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
function RewardTailsmanChipShowPopup:OnOpen(_equipData,_func)
|
|
if not _equipData then
|
|
return
|
|
end
|
|
self.equipData = _equipData --当前装备数据
|
|
self.func = _func
|
|
end
|
|
|
|
function RewardTailsmanChipShowPopup:OnShow()
|
|
local itemConfigData = IncarnationManager.GetIncarnationDataById(self.equipData)
|
|
local equipConfigData = ConfigManager.GetConfigData(ConfigName.ItemConfig,self.equipData)
|
|
self.topBar:GetComponent("Image").sprite = self.spLoader:LoadSprite("t_tongyong_di_"..equipConfigData.Quantity)
|
|
|
|
self.equipQuaText.text=GetStringByEquipQua(equipConfigData.Quantity,GetQuaStringByEquipQua(equipConfigData.Quantity))
|
|
self.eqiopName.text=GetStringByEquipQua(equipConfigData.Quantity,GetLanguageStrById(equipConfigData.Name))
|
|
self.frame.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(equipConfigData.Quantity))
|
|
self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(equipConfigData.ResourceID))
|
|
self.equipInfoText.text = GetLanguageStrById(equipConfigData.ItemDescribe)
|
|
self.equipType.text = ""
|
|
|
|
--下部按钮信息
|
|
self.effectbaijin:SetActive(equipConfigData.Quantity==7)
|
|
Util.SetParticleSortLayer(self.effectbaijin,self.sortingOrder + 1)
|
|
|
|
--basePro基础属性
|
|
if itemConfigData.proDatas then
|
|
self.basePro:SetActive(true)
|
|
for _, pro in ipairs(_BaseProList) do
|
|
pro:SetActive(false)
|
|
end
|
|
for index, prop in ipairs(itemConfigData.proDatas) do
|
|
local proConfigData = ConfigManager.GetConfigData(ConfigName.PropertyConfig, index)
|
|
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 > 0 then
|
|
vText.text = "+"..GetPropertyFormatStr(proConfigData.Style, prop)
|
|
else
|
|
vText.text = GetPropertyFormatStr(proConfigData.Style, prop)
|
|
end
|
|
end
|
|
end
|
|
else
|
|
self.basePro:SetActive(false)
|
|
end
|
|
if not _superProList[1] then
|
|
_superProList[1] = newObjToParent(self.superProPre, self.superProGrid)
|
|
end
|
|
_superProList[1].gameObject:SetActive(true)
|
|
_superProList[1]:GetComponent("Text").text = itemConfigData.skillDes
|
|
|
|
--获取途径
|
|
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)]
|
|
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.isShowGo then
|
|
tempView = SubUIManager.Open(SubUIConfig.JumpView, item.transform, curitemData.Jump[index],true)
|
|
else
|
|
tempView = SubUIManager.Open(SubUIConfig.JumpView, item.transform, curitemData.Jump[index],false)
|
|
end
|
|
table.insert(self.jumpViewList,tempView)
|
|
end,true,true)
|
|
end
|
|
end
|
|
|
|
|
|
--(此处需要三遍才能完全打开)
|
|
ForceRebuildLayout(self.midBar.transform)
|
|
ForceRebuildLayout(self.midBar.transform)
|
|
ForceRebuildLayout(self.midBar.transform)
|
|
|
|
if self.func then
|
|
self.func()
|
|
end
|
|
end
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function RewardTailsmanChipShowPopup:OnClose()
|
|
for i = 1, #self.jumpViewList do
|
|
destroy(self.jumpViewList[i].gameObject)
|
|
end
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function RewardTailsmanChipShowPopup:OnDestroy()
|
|
self.spLoader:Destroy()
|
|
_BaseProList = {}
|
|
_suitProList = {}
|
|
_superProList = {}
|
|
self.jumpViewList = {}
|
|
end
|
|
|
|
return RewardTailsmanChipShowPopup |