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

94 lines
3.5 KiB
Lua
Raw Normal View History

2020-08-06 17:52:32 +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)
this.rootText.text = string.format("确认花费%s妖晶进行1次神将召唤",d[2])
2020-07-28 15:24:11 +08:00
elseif _args[1] == RecruitType.QianKunBoxSingle then
var=PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.QianKunBoxTen
2020-08-15 23:23:38 +08:00
local d=RecruitManager.GetExpendData(RecruitType.QianKunBoxSingle)
this.rootText.text = string.format("确认花费%s妖晶抽取1次乾坤宝盒",d[2])
2020-07-28 15:24:11 +08:00
elseif _args[1] == RecruitType.TimeLimitSingle then
var=PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.TimeLimitTen
2020-08-15 23:23:38 +08:00
local d=RecruitManager.GetExpendData(RecruitType.TimeLimitSingle)
this.rootText.text = string.format("确认花费%s妖晶进行1次限时召唤",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)
this.rootText.text = string.format("确认花费%s妖晶进行10次神将召唤",d[2])
2020-07-28 15:24:11 +08:00
elseif _args[1] == RecruitType.QianKunBoxTen then
var=PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.QianKunBoxTen
2020-08-15 23:23:38 +08:00
local d=RecruitManager.GetExpendData(RecruitType.QianKunBoxTen)
this.rootText.text = string.format("确认花费%s妖晶抽取10次乾坤宝盒",d[2])
2020-07-28 15:24:11 +08:00
elseif _args[1] == RecruitType.TimeLimitTen then
var=PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.TimeLimitTen
2020-08-15 23:23:38 +08:00
local d=RecruitManager.GetExpendData(RecruitType.TimeLimitTen)
this.rootText.text = string.format("确认花费%s妖晶进行10次限时召唤",d[2])
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