128 lines
5.1 KiB
Lua
128 lines
5.1 KiB
Lua
----- 招募二次确认弹窗 -----
|
||
local this = {}
|
||
--传入父脚本模块
|
||
local parent
|
||
--传入特效层级
|
||
local sortingOrder=0
|
||
|
||
local i
|
||
local func
|
||
|
||
function this:InitComponent(gameObject)
|
||
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[11351]
|
||
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[12373],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[12376],d[2])
|
||
--灵兽抽卡
|
||
elseif _args[1] == RecruitType.LingShowSingle then
|
||
var=PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.LingShowTen
|
||
this.rootText.text = string.format("确认花费%s妖晶进行1次灵兽召唤?",_args[3])
|
||
elseif _args[1] == RecruitType.LingShowTen then
|
||
var = PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.LingShowTen
|
||
this.rootText.text = string.format("确认花费%s妖晶进行10次灵兽召唤?",_args[3])
|
||
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.FindFairy then
|
||
var = PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.TimeLimitTen
|
||
local d = RecruitManager.GetExpendData(data.Id)
|
||
if data.PerCount == 1 then
|
||
this.rootText.text = string.format(Language[12375],d[2])
|
||
else
|
||
this.rootText.text = string.format(Language[12378],d[2])
|
||
end
|
||
elseif 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[12374],d[2])
|
||
else
|
||
this.rootText.text = string.format(Language[12377],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("确认花费%s妖晶进行1次灵兽召唤?",d[2])
|
||
else
|
||
this.rootText.text = string.format("确认花费%s妖晶进行10次灵兽召唤?",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("确认花费%s妖晶进行1次降妖夺宝?",d[2])
|
||
else
|
||
this.rootText.text = string.format("确认花费%s妖晶进行10次降妖夺宝?",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.btn={}
|
||
end
|
||
|
||
return this |