【七界试炼】遗物

dev_chengFeng
ZhangBiao 2021-09-13 13:54:58 +08:00
parent 8c9f31f028
commit c68496654f
4 changed files with 36 additions and 10 deletions

View File

@ -38,7 +38,11 @@ end
--绑定事件(用于子类重写)
function QiJieTreasure:BindEvent()
Util.AddClick(self.goBtn,function ()
UIManager.OpenPanel(UIName.GeneralInfoPopup,GENERALINFO_TYPE.QiJieAllTreasure,{1,2,3,4,5,6})
if #QiJieShiLianManager.treasureActiveList <= 0 then
PopupTipPanel.ShowTip("暂无遗物加成。")
return
end
UIManager.OpenPanel(UIName.GeneralInfoPopup,GENERALINFO_TYPE.QiJieAllTreasure,QiJieShiLianManager.treasureActiveList)
end)
end

View File

@ -53,7 +53,9 @@ end
--界面关闭时调用(用于子类重写)
function this:OnClose()
parent.contents:GetComponent("RectTransform").localPosition = Vector2(0,0)
if parent then
parent.contents:GetComponent("RectTransform").localPosition = Vector2(0,0)
end
end
--界面销毁时调用(用于子类重写)

View File

@ -15,12 +15,16 @@ function QiJieSingleTreasure:InitComponent(gameObject)
self.costIcon = Util.GetGameObject(gameObject,"cost/Icon"):GetComponent("Image")
self.costNum = Util.GetGameObject(gameObject,"cost/Num"):GetComponent("Text")
self.activeBtn = Util.GetGameObject(gameObject,"activeBtn")
self.activeText = Util.GetGameObject(self.activeBtn,"Text")
self.activeText = Util.GetGameObject(self.activeBtn,"Text"):GetComponent("Text")
end
function QiJieSingleTreasure:BindEvent()
Util.AddClick(self.activeBtn,function()
PopupTipPanel.ShowTip("我知道了")
if BagManager.GetTotalItemNum(self.data.Cost[1])>=self.data.Cost[2] then
NetManager.SevenWorldRelicRequest(self.data.Id,function ()
self:Refresh()
end)
end
end)
end
@ -34,14 +38,28 @@ function QiJieSingleTreasure:OnShow(_parent,...)
self.parent =_parent
self.data = ...
self.sortingOrder =_parent.sortingOrder
self:Refresh()
end
function QiJieSingleTreasure:Refresh()
self.title.text = self.data.Name
self.Img.sprite = self.spLoader:LoadSprite(artResourcesConfig[self.data.Icon].Name)
self.costIcon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(self.data.Cost[1]))
local text1 = string.format( "%s/%s",BagManager.GetTotalItemNum(self.data.Cost[1]),self.data.Cost[2])
if BagManager.GetTotalItemNum(self.data.Cost[1]) < self.data.Cost[2] then
text1 = string.format( "<color=#d70f09>%s</color>",text1)
if self.data.state == 2 then
self.Img.sprite = self.spLoader:LoadSprite(artResourcesConfig[self.data.Icon].Name)
self.costIcon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(self.data.Cost[1]))
local text1 = string.format( "%s/%s",BagManager.GetTotalItemNum(self.data.Cost[1]),self.data.Cost[2])
if BagManager.GetTotalItemNum(self.data.Cost[1]) < self.data.Cost[2] then
text1 = string.format( "<color=#d70f09>%s</color>",text1)
end
self.costNum.text = text1
self.activeText.text = "解 锁"
else
self.cost:SetActive(false)
if self.data.state == 1 then
self.activeText.text = "取消激活"
elseif self.data.state == 2 then
self.activeText.text = "激 活"
end
end
self.costNum.text = text1
local text2,text3 = QiJieShiLianManager.GetTreasureEffect({self.data.Id})
self.attriText.text = text2.."\n"..tostring(QiJieShiLianManager.GetSring(text3))
ForceRebuildLayout(self.cost.transform)

View File

@ -18,6 +18,7 @@ function this.Initialize()
this.curProgress = 0
this.treasureList = {}
this.treasureActiveList = {}
this.InitTreasureData()
this.battleResult = {}
end
@ -149,6 +150,7 @@ end
--把服务器发来的遗物数据加到本地数据中
function this.MixTreasureServerAndLocalData(msg)
this.treasureActiveList = msg.info
for i = 1, #msg.info do
if this.treasureList[msg.info[i].id] then
this.treasureList[msg.info[i].id].state = msg.info[i].status