244 lines
11 KiB
Lua
244 lines
11 KiB
Lua
|
require("Base/BasePanel")
|
|||
|
RewardEquipSingleShowPopup = Inherit(BasePanel)
|
|||
|
local this=RewardEquipSingleShowPopup
|
|||
|
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|||
|
local equipData
|
|||
|
local func
|
|||
|
local isRewardItemPop
|
|||
|
local curSuitProGo = {}--当前套装属性对象
|
|||
|
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
|||
|
--初始化组件(用于子类重写)
|
|||
|
function RewardEquipSingleShowPopup:InitComponent()
|
|||
|
|
|||
|
this.eqiopName = Util.GetGameObject(self.transform, "Content/bg/Text"):GetComponent("Text")
|
|||
|
this.BtnBack = Util.GetGameObject(self.transform, "Content/bg/btnBack")
|
|||
|
--装备详情
|
|||
|
this.icon = Util.GetGameObject(self.transform, "Content/bg/armorInfo/icon"):GetComponent("Image")
|
|||
|
this.frame = Util.GetGameObject(self.transform, "Content/bg/armorInfo/frame"):GetComponent("Image")
|
|||
|
this.equipType=Util.GetGameObject(self.transform, "Content/bg/armorInfo/grid/equipType"):GetComponent("Text")
|
|||
|
-- this.equipPos=Util.GetGameObject(self.transform, "Content/bg/armorInfo/grid/equipPos"):GetComponent("Text")--装备关闭职业限定
|
|||
|
this.equipRebuildLv=Util.GetGameObject(self.transform, "Content/bg/armorInfo/grid/equipRebuildLv")
|
|||
|
this.equipRebuildLv:SetActive(false)
|
|||
|
this.equipQuaText=Util.GetGameObject(self.transform, "Content/bg/armorInfo/equipQuaText"):GetComponent("Text")
|
|||
|
this.equipInfoText=Util.GetGameObject(self.transform, "Content/bg/armorInfo/equipInfoText"):GetComponent("Text")
|
|||
|
this.powerNum=Util.GetGameObject(self.transform, "Content/bg/armorInfo/powerNum"):GetComponent("Text")
|
|||
|
this.star=Util.GetGameObject(self.transform, "Content/bg/armorInfo/star")
|
|||
|
--装备属性
|
|||
|
this.equipOtherProPre=Util.GetGameObject(self.transform, "Content/proPre")
|
|||
|
this.equipProGrid=Util.GetGameObject(self.transform, "Content/proRect/proGrid")
|
|||
|
this.mainPro=Util.GetGameObject(self.transform, "Content/bg/mainPro")
|
|||
|
this.mainProName=Util.GetGameObject(self.transform, "Content/bg/mainPro/proName"):GetComponent("Text")
|
|||
|
this.mainProVale=Util.GetGameObject(self.transform, "Content/bg/mainPro/proVale"):GetComponent("Text")
|
|||
|
--装备获取途径
|
|||
|
--this.getTuPre=Util.GetGameObject(self.transform, "Content/bg/getTuPre")
|
|||
|
this.getTuGrid=Util.GetGameObject(self.transform, "Content/bg/scroll/grid")
|
|||
|
--装备被动技能
|
|||
|
this.skillObject=Util.GetGameObject(self.transform, "Content/skillObject")
|
|||
|
this.skillInfo=Util.GetGameObject(self.transform, "Content/skillObject/skillInfo"):GetComponent("Text")
|
|||
|
this.skillObject:SetActive(false)
|
|||
|
--分解按钮
|
|||
|
this.btnSure = Util.GetGameObject(self.transform, "Content/bg/btnGrid/btnSure")
|
|||
|
this.btnJump = Util.GetGameObject(self.transform, "Content/bg/btnGrid/btnJump")
|
|||
|
this.btnLock = Util.GetGameObject(self.transform, "Content/bg/btnLock")
|
|||
|
this.upLockImage = Util.GetGameObject(self.transform, "Content/bg/btnLock/upLock")
|
|||
|
this.downLockImage = Util.GetGameObject(self.transform, "Content/bg/btnLock/downLock")
|
|||
|
end
|
|||
|
|
|||
|
--绑定事件(用于子类重写)
|
|||
|
function RewardEquipSingleShowPopup:BindEvent()
|
|||
|
|
|||
|
Util.AddClick(this.BtnBack, function()
|
|||
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|||
|
self:ClosePanel()
|
|||
|
end)
|
|||
|
Util.AddClick(this.btnJump, function()
|
|||
|
if itemConfig[equipData.equipId] then
|
|||
|
JumpManager.GoJump(itemConfig[equipData.equipId].UseJump)
|
|||
|
end
|
|||
|
end)
|
|||
|
Util.AddClick(this.btnSure, function()
|
|||
|
if itemConfig[equipData.equipId].Quantity>=4 then
|
|||
|
UIManager.OpenPanel(UIName.BagResolveAnCompoundPanel,2,itemConfig[equipData.equipId].ItemBaseType,equipData,function () func() end)
|
|||
|
else
|
|||
|
local curResolveAllItemList={}
|
|||
|
table.insert(curResolveAllItemList,equipData.id)
|
|||
|
--0使用 1 分解物品 2 分解装备 3 分解妖灵师
|
|||
|
local type=-1
|
|||
|
if itemConfig[equipData.equipId].ItemBaseType==ItemBaseType.Equip then
|
|||
|
type=2
|
|||
|
else
|
|||
|
type=1
|
|||
|
end
|
|||
|
NetManager.UseAndPriceItemRequest(type,curResolveAllItemList,function (drop)
|
|||
|
this.SendBackResolveReCallBack(drop)
|
|||
|
end)
|
|||
|
end
|
|||
|
end)
|
|||
|
Util.AddClick(this.btnLock, function()
|
|||
|
self:OnLockClickEvent()
|
|||
|
|
|||
|
end)
|
|||
|
end
|
|||
|
|
|||
|
--添加事件监听(用于子类重写)
|
|||
|
function RewardEquipSingleShowPopup:AddListener()
|
|||
|
|
|||
|
end
|
|||
|
|
|||
|
--移除事件监听(用于子类重写)
|
|||
|
function RewardEquipSingleShowPopup:RemoveListener()
|
|||
|
|
|||
|
end
|
|||
|
|
|||
|
--界面打开时调用(用于子类重写)
|
|||
|
function RewardEquipSingleShowPopup:OnOpen(_equipData, _func,_isRewardItemPop)
|
|||
|
|
|||
|
if not _equipData then
|
|||
|
return
|
|||
|
end
|
|||
|
equipData=_equipData
|
|||
|
func=_func
|
|||
|
isRewardItemPop = _isRewardItemPop and _isRewardItemPop or false
|
|||
|
end
|
|||
|
function RewardEquipSingleShowPopup:OnShow()
|
|||
|
|
|||
|
--装备基础信息
|
|||
|
local equipConfigData=ConfigManager.GetConfigData(ConfigName.EquipConfig, equipData.equipId)
|
|||
|
local itemConfigData=ConfigManager.GetConfigData(ConfigName.ItemConfig, equipData.equipId)
|
|||
|
this.btnSure:SetActive(false)
|
|||
|
local curEquipData = {}
|
|||
|
if func and itemConfigData.IfResolve==1 then
|
|||
|
curEquipData = EquipManager.GetSingleEquipData(equipData.id)
|
|||
|
if curEquipData and curEquipData.upHeroDid == "0" then
|
|||
|
this.btnSure:SetActive(true)
|
|||
|
end
|
|||
|
end
|
|||
|
if curEquipData then
|
|||
|
--Log("equipData.isLocked "..curEquipData.isLocked)
|
|||
|
--this.upLockImage:SetActive(curEquipData.isLocked == 1)
|
|||
|
--this.downLockImage:SetActive(curEquipData.isLocked == 0)
|
|||
|
end
|
|||
|
this.equipQuaText.text=GetStringByEquipQua(equipConfigData.Quality,GetQuaStringByEquipQua(equipConfigData.Quality))
|
|||
|
this.eqiopName.text=GetStringByEquipQua(equipConfigData.Quality,equipConfigData.Name)
|
|||
|
|
|||
|
--if equipConfigData.IfClear==0 then
|
|||
|
-- this.equipRebuildLv:GetComponent("Text").text="不可重铸"
|
|||
|
--elseif equipConfigData.IfClear==1 then
|
|||
|
-- this.equipRebuildLv:GetComponent("Text").text="重铸等级:"..equipData.rebuildLevel
|
|||
|
--end
|
|||
|
this.frame.sprite = Util.LoadSprite(GetQuantityImageByquality(equipConfigData.Quality))
|
|||
|
this.icon.sprite = Util.LoadSprite(GetResourcePath(itemConfigData.ResourceID))
|
|||
|
this.equipInfoText.text=itemConfigData.ItemDescribe
|
|||
|
this.powerNum.text=EquipManager.CalculateWarForce(equipData.id,equipData)
|
|||
|
EquipManager.SetEquipStarShow(this.star,equipConfigData.Id)
|
|||
|
this.btnJump:SetActive(itemConfigData.UseJump and itemConfigData.UseJump > 0 and BagManager.isBagPanel)
|
|||
|
local passiveCfg={}
|
|||
|
if equipData.skillId and equipData.skillId>0 then
|
|||
|
passiveCfg = ConfigManager.GetConfigData(ConfigName.PassiveSkillConfig, equipData.skillId)
|
|||
|
end
|
|||
|
--if passiveCfg and equipData.skillId and equipData.skillId>0 then
|
|||
|
-- this.skillObject:SetActive(true)
|
|||
|
-- this.skillInfo.text=passiveCfg.Desc
|
|||
|
--else
|
|||
|
-- this.skillObject:SetActive(false)
|
|||
|
--end
|
|||
|
this.equipType.text="道具种类:"..GetEquipPosStrByEquipPosNum(equipConfigData.Position)
|
|||
|
-- this.equipPos.text=string.format("职业限定:%s",GetJobStrByJobNum(equipConfigData.ProfessionLimit)) --装备关闭职业限定
|
|||
|
--装备属性
|
|||
|
local proConfigData = ConfigManager.GetConfigData(ConfigName.PropertyConfig, equipData.mainAttribute.propertyId)
|
|||
|
this.mainProName.text=proConfigData.Info
|
|||
|
this.mainProVale.text = GetPropertyFormatStr(proConfigData.Style,equipData.mainAttribute.propertyValue)
|
|||
|
|
|||
|
--套装属性
|
|||
|
if equipConfigData.SuiteID and equipConfigData.SuiteID > 0 then
|
|||
|
Util.GetGameObject(self.transform, "Content/proRect"):SetActive(true)
|
|||
|
local curSuitConFig = ConfigManager.GetConfigData(ConfigName.EquipSuiteConfig,equipConfigData.SuiteID)
|
|||
|
if curSuitConFig then
|
|||
|
for i = 1, math.max(#curSuitConFig.SuiteValue, #curSuitProGo) do
|
|||
|
local go = curSuitProGo[i]
|
|||
|
if not go then
|
|||
|
go = newObject(this.equipOtherProPre)
|
|||
|
go.transform:SetParent(this.equipProGrid.transform)
|
|||
|
go.transform.localScale = Vector3.one
|
|||
|
go.transform.localPosition = Vector3.zero
|
|||
|
curSuitProGo[i] = go
|
|||
|
end
|
|||
|
go.gameObject:SetActive(false)
|
|||
|
end
|
|||
|
for i = 1, #curSuitConFig.SuiteValue do
|
|||
|
local go = curSuitProGo[i]
|
|||
|
go.gameObject:SetActive(true)
|
|||
|
Util.GetGameObject(go.transform, "proName"):GetComponent("Text").text = "<color=#B9AC97>" .. propertyConfig[curSuitConFig.SuiteValue[i][2]].Info .."+ "..GetPropertyFormatStr(propertyConfig[curSuitConFig.SuiteValue[i][2]].Style,curSuitConFig.SuiteValue[i][3]) .. "</color>"
|
|||
|
Util.GetGameObject(go.transform, "proVale"):GetComponent("Text").text = "<color=#B9AC97>(" .. curSuitConFig.SuiteValue[i][1] .. "件激活)</color>"
|
|||
|
end
|
|||
|
end
|
|||
|
else
|
|||
|
Util.GetGameObject(self.transform, "Content/proRect"):SetActive(false)
|
|||
|
end
|
|||
|
--装备获得途径
|
|||
|
Util.ClearChild(this.getTuGrid.transform)
|
|||
|
local curitemData = itemConfig[equipData.equipId]
|
|||
|
if curitemData and curitemData.Jump then
|
|||
|
if curitemData.Jump and #curitemData.Jump>0 then
|
|||
|
for i = 1, #curitemData.Jump do
|
|||
|
if isRewardItemPop then
|
|||
|
SubUIManager.Open(SubUIConfig.JumpView, this.getTuGrid.transform, curitemData.Jump[i],false)
|
|||
|
else
|
|||
|
SubUIManager.Open(SubUIConfig.JumpView, this.getTuGrid.transform, curitemData.Jump[i],true)
|
|||
|
end
|
|||
|
end
|
|||
|
end
|
|||
|
end
|
|||
|
end
|
|||
|
--道具 和 装备分解 发送请求后 回调
|
|||
|
function this.SendBackResolveReCallBack(drop)
|
|||
|
local isShowReward=false
|
|||
|
if drop.itemlist~=nil and #drop.itemlist>0 then
|
|||
|
for i = 1, #drop.itemlist do
|
|||
|
if drop.itemlist[i].itemNum>0 then
|
|||
|
isShowReward=true
|
|||
|
break
|
|||
|
end
|
|||
|
end
|
|||
|
end
|
|||
|
if isShowReward then
|
|||
|
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1,function ()
|
|||
|
BagManager.OnShowTipDropNumZero(drop)
|
|||
|
end)
|
|||
|
else
|
|||
|
BagManager.OnShowTipDropNumZero(drop)
|
|||
|
end
|
|||
|
EquipManager.DeleteSingleEquip(equipData.id)
|
|||
|
if func then
|
|||
|
func()
|
|||
|
end
|
|||
|
this:ClosePanel()
|
|||
|
end
|
|||
|
function RewardEquipSingleShowPopup:OnLockClickEvent()
|
|||
|
if equipData and equipData.isLocked == 0 then--未上锁
|
|||
|
NetManager.EquipLockRequest({equipData.id}, 1,function ()
|
|||
|
this.upLockImage:SetActive(true)
|
|||
|
this.downLockImage:SetActive(false)
|
|||
|
end)
|
|||
|
elseif equipData and equipData.isLocked == 1 then--已上锁
|
|||
|
NetManager.EquipLockRequest({equipData.id}, 2,function ()
|
|||
|
this.upLockImage:SetActive(false)
|
|||
|
this.downLockImage:SetActive(true)
|
|||
|
end)
|
|||
|
end
|
|||
|
end
|
|||
|
--界面关闭时调用(用于子类重写)
|
|||
|
function RewardEquipSingleShowPopup:OnClose()
|
|||
|
|
|||
|
--if func then
|
|||
|
-- func()
|
|||
|
--end
|
|||
|
end
|
|||
|
|
|||
|
--界面销毁时调用(用于子类重写)
|
|||
|
function RewardEquipSingleShowPopup:OnDestroy()
|
|||
|
curSuitProGo = {}
|
|||
|
end
|
|||
|
|
|||
|
return RewardEquipSingleShowPopup
|