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

71 lines
1.8 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
----- 试练设置弹窗 -----
2020-06-03 19:09:01 +08:00
local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder=0
local btns={}
local btnClick={}
function this:InitComponent(gameObject)
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-06-03 19:09:01 +08:00
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.root = Util.GetGameObject(gameObject, "Root")
for i = 1, 3 do
btns[i]=Util.GetGameObject(this.root,"Btn"..i)
end
end
function this:BindEvent()
for i = 1, 3 do
Util.AddClick(btns[i],function()
local o=btns[i]
local go=Util.GetGameObject(o,"Go")
2020-06-13 11:47:13 +08:00
local var=PlayerManager.uid.."GeneralPopup_TrialSettingBtn"..i
2020-06-03 19:09:01 +08:00
btnClick[i]=(btnClick[i] and btnClick[i]==1) and 0 or 1
2020-06-13 11:47:13 +08:00
LogPink(btnClick[i])
PlayerPrefs.SetInt(var,btnClick[i])
go:SetActive(PlayerPrefs.GetInt(var)==1)
2020-06-03 19:09:01 +08:00
end)
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 = {...}
2021-03-02 16:53:12 +08:00
this.titleText.text=Language[11621]
2020-06-03 19:09:01 +08:00
for i = 1, 3 do
local o=btns[i]
local go=Util.GetGameObject(o,"Go")
2020-06-13 11:47:13 +08:00
local var=PlayerManager.uid.."GeneralPopup_TrialSettingBtn"..i
if PlayerPrefs.HasKey(var) then
go:SetActive(PlayerPrefs.GetInt(var)==1)
2020-06-03 19:09:01 +08:00
else
go:SetActive(false)
end
end
2020-08-19 19:37:59 +08:00
btns[2]:SetActive(MapManager.curCarbonType == CarBonTypeId.TRIAL)
btns[3]:SetActive(MapManager.curCarbonType == CarBonTypeId.TRIAL)
2020-06-03 19:09:01 +08:00
end
function this:OnClose()
end
function this:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-06-03 19:09:01 +08:00
btns={}
end
2020-06-23 18:36:24 +08:00
return this