2021-09-09 11:10:43 +08:00
|
|
|
----- --七界试炼单个遗物 -----
|
|
|
|
local QiJieSingleTreasure = {}
|
|
|
|
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
local artResourcesConfig =ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
|
|
|
|
local QijieHolyConfig=ConfigManager.GetConfig(ConfigName.QijieHolyConfig)
|
2021-09-10 10:30:50 +08:00
|
|
|
local PropertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
2021-09-09 11:10:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
function QiJieSingleTreasure:InitComponent(gameObject)
|
|
|
|
self.spLoader = SpriteLoader.New()
|
|
|
|
self.attriText = Util.GetGameObject(gameObject,"AttriText"):GetComponent("Text")
|
|
|
|
self.title = Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
|
|
|
|
self.Img = Util.GetGameObject(gameObject,"Image"):GetComponent("Image")
|
2021-09-10 15:23:15 +08:00
|
|
|
self.cost = Util.GetGameObject(gameObject,"cost")
|
2021-09-09 11:10:43 +08:00
|
|
|
self.costIcon = Util.GetGameObject(gameObject,"cost/Icon"):GetComponent("Image")
|
|
|
|
self.costNum = Util.GetGameObject(gameObject,"cost/Num"):GetComponent("Text")
|
|
|
|
self.activeBtn = Util.GetGameObject(gameObject,"activeBtn")
|
2021-09-13 13:54:58 +08:00
|
|
|
self.activeText = Util.GetGameObject(self.activeBtn,"Text"):GetComponent("Text")
|
2021-09-09 11:10:43 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function QiJieSingleTreasure:BindEvent()
|
|
|
|
Util.AddClick(self.activeBtn,function()
|
2021-09-13 13:54:58 +08:00
|
|
|
if BagManager.GetTotalItemNum(self.data.Cost[1])>=self.data.Cost[2] then
|
|
|
|
NetManager.SevenWorldRelicRequest(self.data.Id,function ()
|
|
|
|
self:Refresh()
|
|
|
|
end)
|
|
|
|
end
|
2021-09-09 11:10:43 +08:00
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
function QiJieSingleTreasure:AddListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
function QiJieSingleTreasure:RemoveListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
function QiJieSingleTreasure:OnShow(_parent,...)
|
|
|
|
self.parent =_parent
|
|
|
|
self.data = ...
|
|
|
|
self.sortingOrder =_parent.sortingOrder
|
2021-09-13 13:54:58 +08:00
|
|
|
self:Refresh()
|
|
|
|
end
|
|
|
|
|
|
|
|
function QiJieSingleTreasure:Refresh()
|
2021-09-09 11:10:43 +08:00
|
|
|
self.title.text = self.data.Name
|
2021-09-13 13:54:58 +08:00
|
|
|
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
|
2021-09-10 10:30:50 +08:00
|
|
|
end
|
2021-09-13 11:42:14 +08:00
|
|
|
local text2,text3 = QiJieShiLianManager.GetTreasureEffect({self.data.Id})
|
|
|
|
self.attriText.text = text2.."\n"..tostring(QiJieShiLianManager.GetSring(text3))
|
2021-09-10 15:23:15 +08:00
|
|
|
ForceRebuildLayout(self.cost.transform)
|
2021-09-09 11:10:43 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function QiJieSingleTreasure:OnClose()
|
|
|
|
end
|
|
|
|
|
|
|
|
function QiJieSingleTreasure:OnDestroy()
|
|
|
|
self.spLoader:Destroy()
|
|
|
|
end
|
|
|
|
|
|
|
|
return QiJieSingleTreasure
|