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

104 lines
3.5 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
----- 招募二次确认弹窗 -----
2020-07-28 15:24:11 +08:00
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
2020-08-15 23:23:38 +08:00
local d=RecruitManager.GetExpendData(RecruitType.Single)
2020-08-25 15:46:38 +08:00
this.rootText.text = string.format(Language[12373],d[2])
2020-07-28 15:24:11 +08:00
elseif _args[1] == RecruitType.Ten then
var=PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.Ten
2020-08-15 23:23:38 +08:00
local d=RecruitManager.GetExpendData(RecruitType.Ten)
2020-08-25 15:46:38 +08:00
this.rootText.text = string.format(Language[12376],d[2])
else
LogBlue("_args[1]:".._args[1])
local data = ConfigManager.GetConfigData(ConfigName.LotterySetting,_args[1])
LogBlue("data.PerCount:"..data.PerCount)
LogBlue("data.ActivityId:"..data.ActivityId)
local activityData
if data.LotteryType == 3 then
activityData = ConfigManager.GetConfigData(ConfigName.GlobalActivity,data.ActivityId)
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
end
2020-07-28 15:24:11 +08:00
end
Util.AddOnceClick(this.btn,function()
this.btnClick=(this.btnClick and this.btnClick==1) and 0 or 1
LogPink(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