miduo_client/Assets/ManagedResources/~Lua/Modules/GeneralPanel/View2/GeneralInfoPopup_HomeLandBu...

81 lines
3.0 KiB
Lua
Raw Normal View History

2021-12-23 14:38:02 +08:00
----- --家园建筑详情 -----
local this = {}
local HomeLand = ConfigManager.GetConfig(ConfigName.HomeLand)
local HomeLandLevel = ConfigManager.GetConfig(ConfigName.HomeLandLevel)
local HomeLandTask = ConfigManager.GetConfig(ConfigName.HomeLandTask)
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
local data=nil
function this:InitComponent(gameObject)
this.spLoader = SpriteLoader.New()
this.cancelBtn = Util.GetGameObject(gameObject,"BtnCancel")
this.buildName = Util.GetGameObject(gameObject,"Content/buildName"):GetComponent("Text")
2021-12-24 18:20:18 +08:00
this.harvest = Util.GetGameObject(gameObject,"Content/harvest")
2021-12-23 14:38:02 +08:00
this.harvestNum = Util.GetGameObject(gameObject,"Content/harvest/Num"):GetComponent("Text")
this.harvestIcon = Util.GetGameObject(gameObject,"Content/harvest/Icon"):GetComponent("Image")
this.upgradeAdd = Util.GetGameObject(gameObject,"Content/upgrade/Num"):GetComponent("Text")
2021-12-24 18:20:18 +08:00
this.limit = Util.GetGameObject(gameObject,"Content/limit")
2021-12-23 14:38:02 +08:00
this.limitIcon = Util.GetGameObject(gameObject,"Content/limit/Icon"):GetComponent("Image")
this.limitNum = Util.GetGameObject(gameObject,"Content/limit/Num"):GetComponent("Text")
2021-12-31 16:30:53 +08:00
this.Desc = Util.GetGameObject(gameObject,"Content/GameObject/Desc"):GetComponent("Text")
2021-12-23 14:38:02 +08:00
end
function this:BindEvent()
Util.AddClick(this.cancelBtn,function()
parent:ClosePanel()
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent,_args)
data = _args
parent=_parent
sortingOrder =_parent.sortingOrder
2022-01-11 18:20:12 +08:00
parent.contents:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_tanchuangdi3")
2021-12-23 14:38:02 +08:00
this.buildName.text = data.dataSingle.Name
2021-12-24 18:20:18 +08:00
if data.dataSingle.Rule then
this.upgradeAdd.text = string.format("%s%s级",HomeLand[data.dataSingle.Rule[1]].Name,data.dataSingle.Rule[2])
else
this.upgradeAdd.text = ""
end
if data.dataMain.Id == 5 then
this.limit:SetActive(false)
this.harvest:SetActive(false)
else
this.limit:SetActive(true)
this.harvest:SetActive(true)
this.limitIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(data.dataSingle.Storage[1][1]))
2022-01-04 15:10:35 +08:00
this.limitNum.text = data.dataSingle.Storage[1][2]
2022-01-05 16:21:20 +08:00
local v = ConfigManager.GetConfigData(ConfigName.PrivilegeTypeConfig,4022).Condition[1][2]/10000-1
local priValue = HomeLandManager.activePrivilege and string.format("<color=#00FF00>+%s</color>",math.ceil(data.dataSingle.Gain[2]*v)) or ""
2022-01-08 11:36:31 +08:00
this.harvestNum.text = string.format("%s %s/分钟",data.dataSingle.Gain[2],priValue)
2021-12-24 18:20:18 +08:00
this.harvestIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(data.dataSingle.Gain[1]))
end
2021-12-31 16:30:53 +08:00
this.Desc.text = data.dataMain.Desc
2021-12-23 14:38:02 +08:00
end
function this:OnClose()
data=nil
2022-01-11 18:20:12 +08:00
if parent then
parent.contents:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_tanchuangdi")
end
2021-12-23 14:38:02 +08:00
end
function this:OnDestroy()
this.spLoader:Destroy()
end
return this