2021-12-31 18:13:10 +08:00
|
|
|
|
----- --家园特权 -----
|
|
|
|
|
local this = {}
|
|
|
|
|
local HomeLand = ConfigManager.GetConfig(ConfigName.HomeLand)
|
|
|
|
|
local HomeLandLevel = ConfigManager.GetConfig(ConfigName.HomeLandLevel)
|
|
|
|
|
local HomeLandTask = ConfigManager.GetConfig(ConfigName.HomeLandTask)
|
2022-11-07 15:06:33 +08:00
|
|
|
|
--local price = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig,1120).Price
|
2021-12-31 18:13:10 +08:00
|
|
|
|
--传入父脚本模块
|
|
|
|
|
local parent
|
|
|
|
|
--传入特效层级
|
|
|
|
|
local sortingOrder=0
|
|
|
|
|
local data=nil
|
|
|
|
|
function this:InitComponent(gameObject)
|
|
|
|
|
this.spLoader = SpriteLoader.New()
|
|
|
|
|
this.cancelBtn = Util.GetGameObject(gameObject,"BtnCancel")
|
|
|
|
|
|
|
|
|
|
this.leftTime = Util.GetGameObject(gameObject,"leftTime"):GetComponent("Text")
|
|
|
|
|
this.btn = Util.GetGameObject(gameObject,"Content/BtnDo")
|
|
|
|
|
this.btnText = Util.GetGameObject(gameObject,"Content/BtnDo/Text"):GetComponent("Text")
|
2022-01-06 10:33:08 +08:00
|
|
|
|
this.text1 = Util.GetGameObject(gameObject,"Content/Text1"):GetComponent("Text")
|
|
|
|
|
this.text2 = Util.GetGameObject(gameObject,"Content/Text2"):GetComponent("Text")
|
2022-06-10 14:42:35 +08:00
|
|
|
|
this.text3 = Util.GetGameObject(gameObject,"Content/Text3"):GetComponent("Text")
|
2021-12-31 18:13:10 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:BindEvent()
|
|
|
|
|
Util.AddClick(this.cancelBtn,function()
|
|
|
|
|
parent:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.btn,function()
|
|
|
|
|
PayManager.Pay(1120, function()
|
|
|
|
|
HomeLandManager.CheckPrivilege(function ()
|
2021-12-31 18:58:04 +08:00
|
|
|
|
HomeLandManager.CheckPrivilege()
|
2021-12-31 18:13:10 +08:00
|
|
|
|
this:Refresh()
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:AddListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:RemoveListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnShow(_parent,_args)
|
|
|
|
|
data = _args
|
|
|
|
|
parent=_parent
|
|
|
|
|
sortingOrder =_parent.sortingOrder
|
|
|
|
|
parent.contents:GetComponent("Image").enabled = false
|
|
|
|
|
this:Refresh()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:Refresh()
|
|
|
|
|
|
2022-06-10 14:42:35 +08:00
|
|
|
|
this.text1.text = "洞府各资源建筑(玉清居、祈福斋、望月居)产量<color=#d6821a>增加50%</color>"
|
|
|
|
|
this.text2.text = "每日可使用<color=#d6821a>五次特权加速</color>功能,每次可减少<color=#d6821a>8小时</color>建筑升级时间"
|
|
|
|
|
this.text3.text = "购买后赠送<color=#d6821a>唤元神符*2</color>以及<color=#d6821a>金币*150万</color>"
|
2022-01-06 10:33:08 +08:00
|
|
|
|
this.leftTime.text = "购买后持续30天"
|
2022-11-07 15:06:33 +08:00
|
|
|
|
--this.btnText.text = string.format("%s元",price)
|
2021-12-31 18:13:10 +08:00
|
|
|
|
Util.SetGray(this.btn,false)
|
|
|
|
|
this.btn:GetComponent("Button").enabled = true
|
|
|
|
|
local data = PrivilegeManager.GetSerData(4022)
|
|
|
|
|
if data and data.endTime > GetTimeStamp() then
|
|
|
|
|
this.leftTime.text = "(有效时间30天)"
|
2022-01-05 14:17:53 +08:00
|
|
|
|
this.btnText.text = "已激活"
|
2021-12-31 18:13:10 +08:00
|
|
|
|
Util.SetGray(this.btn,true)
|
|
|
|
|
this.btn:GetComponent("Button").enabled = false
|
|
|
|
|
|
|
|
|
|
if this.timer then
|
|
|
|
|
this.timer:Stop()
|
|
|
|
|
this.timer = nil
|
|
|
|
|
end
|
|
|
|
|
local leftTime = data.endTime - GetTimeStamp()
|
2022-01-06 10:33:08 +08:00
|
|
|
|
this.leftTime.text = string.format("剩余%s天",TimeToD(leftTime))
|
2022-01-10 18:22:20 +08:00
|
|
|
|
if leftTime <= 86400 then
|
2022-01-11 13:29:58 +08:00
|
|
|
|
this.leftTime.text = string.format("剩余:%s",TimeToFelaxible(leftTime))
|
2022-01-10 18:22:20 +08:00
|
|
|
|
end
|
2021-12-31 18:13:10 +08:00
|
|
|
|
this.timer = Timer.New(function ()
|
|
|
|
|
leftTime = leftTime - 1
|
2022-01-10 18:22:20 +08:00
|
|
|
|
if leftTime <= 86400 then
|
2022-01-11 13:29:58 +08:00
|
|
|
|
this.leftTime.text = string.format("剩余:%s",TimeToFelaxible(leftTime))
|
2022-01-10 18:22:20 +08:00
|
|
|
|
else
|
|
|
|
|
this.leftTime.text = string.format("剩余%s天",TimeToD(leftTime))
|
|
|
|
|
end
|
2021-12-31 18:13:10 +08:00
|
|
|
|
end,1,-1)
|
|
|
|
|
this.timer:Start()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnClose()
|
2022-01-04 18:58:34 +08:00
|
|
|
|
if this.timer then
|
|
|
|
|
this.timer:Stop()
|
|
|
|
|
this.timer = nil
|
|
|
|
|
end
|
2021-12-31 18:13:10 +08:00
|
|
|
|
data=nil
|
|
|
|
|
if parent then
|
|
|
|
|
parent.contents:GetComponent("Image").enabled = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnDestroy()
|
|
|
|
|
this.spLoader:Destroy()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return this
|