miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/View/ChangeHeroProConfirmWindow.lua

90 lines
2.8 KiB
Lua

require("Base/BasePanel")
local ChangeHeroProConfirmWindow = Inherit(BasePanel)
----- 招募二次确认弹窗 -----
local this = ChangeHeroProConfirmWindow
local costConfig = ConfigManager.GetConfigData(ConfigName.SpecialConfig, 147)
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local func
function ChangeHeroProConfirmWindow:InitComponent()
-- LogError("1111111111111")
local gameObject = self.gameObject
this.bgBtn = gameObject
this.titleText = Util.GetGameObject(gameObject, "content/TitleText"):GetComponent("Text")
this.root = Util.GetGameObject(gameObject, "Root")
this.confirm = Util.GetGameObject(gameObject, "ConfirmBtn")
this.cancel = Util.GetGameObject(gameObject, "CancelBtn")
this.closeBtn = Util.GetGameObject(gameObject, "content/BG/BackBtn")
this.btn = Util.GetGameObject(this.root, "Btn1")
this.rootText = Util.GetGameObject(this.root, "Text"):GetComponent("Text")
end
function ChangeHeroProConfirmWindow:BindEvent()
Util.AddClick(this.confirm, function()
self:ClosePanel()
if func then
func()
end
end)
Util.AddClick(this.cancel, function()
self:ClosePanel()
end)
Util.AddClick(this.closeBtn, function()
self:ClosePanel()
end)
Util.AddClick(this.bgBtn, function()
self:ClosePanel()
end)
end
function ChangeHeroProConfirmWindow:AddListener()
end
function ChangeHeroProConfirmWindow:RemoveListener()
end
function ChangeHeroProConfirmWindow:OnOpen(...)
--parent=_parent
--sortingOrder = _parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
local _args = { ... }
func = _args[2]
this.titleText.text = Language[11030]
if costConfig then
local cost = string.split(costConfig.Value, ('#'))
this.rootText.text = Language[12270] .. cost[2] .. itemConfig[tonumber(cost[1])].Name .. Language[12271]
else
this.rootText.text = Language[12272]
end
local go = Util.GetGameObject(this.btn, "Go")
local var
--点将台抽卡
if _args[1] == CostConfirmType.ChangeHeroPro then
var = PlayerManager.uid .. "GeneralPopup_ChangeHeroProConfirm"
end
Util.AddOnceClick(this.btn, function()
this.btnClick = (this.btnClick and this.btnClick == 1) and 0 or 1
LogPink(var .. ":" .. this.btnClick)
PlayerPrefs.SetInt(var, this.btnClick)
go:SetActive(PlayerPrefs.GetInt(var) == 1)
end)
if PlayerPrefs.HasKey(var) then
go:SetActive(PlayerPrefs.GetInt(var) == 1)
else
go:SetActive(false)
end
end
function ChangeHeroProConfirmWindow:OnClose()
end
function ChangeHeroProConfirmWindow:OnDestroy()
end
return ChangeHeroProConfirmWindow