miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_RecruitConfirm...

139 lines
5.5 KiB
Lua

----- 招募二次确认弹窗 -----
local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder = 0
local i
local func
function this:InitComponent(gameObject)
this.spLoader = SpriteLoader.New()
this.titleText = Util.GetGameObject(gameObject, "TitleText"):GetComponent("Text")
this.root = Util.GetGameObject(gameObject, "Root")
this.confirm = Util.GetGameObject(gameObject, "ConfirmBtn")
this.cancel = Util.GetGameObject(gameObject, "CancelBtn")
this.btn = Util.GetGameObject(this.root, "Btn1")
this.rootText = Util.GetGameObject(this.root, "Text"):GetComponent("Text")
end
function this:BindEvent()
Util.AddClick(this.confirm, function()
parent:ClosePanel()
if func then
func()
end
end)
Util.AddClick(this.cancel, function()
parent:ClosePanel()
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent, ...)
parent = _parent
sortingOrder = _parent.sortingOrder
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
local _args = { ... }
func = _args[2]
this.titleText.text = Language[11030]
local go = Util.GetGameObject(this.btn, "Go")
local var
--点将台抽卡
if _args[1] == RecruitType.Single then
var = PlayerManager.uid .. "GeneralPopup_RecruitConfirm" .. RecruitType.Ten
local d = RecruitManager.GetExpendData(RecruitType.Single)
this.rootText.text = string.format(Language[12364], d[2])
elseif _args[1] == RecruitType.Ten then
var = PlayerManager.uid .. "GeneralPopup_RecruitConfirm" .. RecruitType.Ten
local d = RecruitManager.GetExpendData(RecruitType.Ten)
this.rootText.text = string.format(Language[12365], d[2])
--灵兽抽卡
elseif _args[1] == RecruitType.LingShowSingle then
var = PlayerManager.uid .. "GeneralPopup_RecruitConfirm" .. RecruitType.LingShowTen
this.rootText.text = string.format(Language[12366], _args[3])
elseif _args[1] == RecruitType.LingShowTen then
var = PlayerManager.uid .. "GeneralPopup_RecruitConfirm" .. RecruitType.LingShowTen
this.rootText.text = string.format(Language[12367], _args[3])
elseif _args[1] == "timeLimitHero" then
local wishSettingConfig = ConfigManager.GetConfigData(ConfigName.WishActivitySetting, 1)
local num = PrivilegeManager.GetPrivilegeRemainValue(wishSettingConfig.DiamondMaxTimes)
var = PlayerManager.uid .. "GeneralPopup_RecruitConfirm" .. RecruitType.PrayerTen
local d = 0
if _args[3] == 1 then
d = RecruitManager.GetExpendDataByCostItem(wishSettingConfig.CostItemSingle, 1, num)
elseif _args[3] == 2 then
d = RecruitManager.GetExpendDataByCostItem(wishSettingConfig.CostItemMul, 2, num)
end
if _args[3] == 1 then
this.rootText.text = string.format(Language[12368], d[2])
else
this.rootText.text = string.format(Language[12369], d[2])
end
else --在主题活动里面的抽卡
local data = ConfigManager.GetConfigData(ConfigName.LotterySetting, _args[1])
local activityData = ConfigManager.GetConfigData(ConfigName.GlobalActivity, data.ActivityId)
if data.LotteryType == 3 then --限时招募
if activityData.Type == ActivityTypeDef.QianKunBox then --乾坤宝盒
var = PlayerManager.uid .. "GeneralPopup_RecruitConfirm" .. RecruitType.QianKunBoxTen
local d = RecruitManager.GetExpendData(data.Id)
if data.PerCount == 1 then
this.rootText.text = string.format(Language[12370], d[2])
else
this.rootText.text = string.format(Language[12371], d[2])
end
end
elseif data.LotteryType == 10 then --灵兽宝阁
if activityData.Type == ActivityTypeDef.LingShouBaoGe then
var = PlayerManager.uid .. "GeneralPopup_RecruitConfirm" .. RecruitType.BaoGeTen
local d = RecruitManager.GetExpendData(data.Id)
if data.PerCount == 1 then
this.rootText.text = string.format(Language[12366], d[2])
else
this.rootText.text = string.format(Language[12367], d[2])
end
end
elseif data.LotteryType == 11 then --降妖夺宝
if activityData.Type == ActivityTypeDef.XiangYaoDuoBao then
var = PlayerManager.uid .. "GeneralPopup_RecruitConfirm" .. RecruitType.XiangYaoTen
local d = RecruitManager.GetExpendData(data.Id)
if data.PerCount == 1 then
this.rootText.text = string.format(Language[12372], d[2])
else
this.rootText.text = string.format(Language[12373], d[2])
end
end
end
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 this:OnClose()
end
function this:OnDestroy()
this.spLoader:Destroy()
this.btn = {}
end
return this