Initial version - 1.2.0.60
EN: 1.2.0.60 CN: 1.2.0.61 JP: 1.2.0.63 KR: 1.2.0.67
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
local OptionSwitchCtrl = class("OptionSwitchCtrl", BaseCtrl)
|
||||
OptionSwitchCtrl._mapNodeConfig = {
|
||||
txtOptionTitle = {sComponentName = "TMP_Text"},
|
||||
btnSwitch = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Switch"
|
||||
},
|
||||
SwitchOn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Settings_ON_EN"
|
||||
},
|
||||
SwitchOff = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Settings_OFF_EN"
|
||||
}
|
||||
}
|
||||
OptionSwitchCtrl._mapEventConfig = {}
|
||||
function OptionSwitchCtrl:SetText(sTitle)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtOptionTitle, sTitle)
|
||||
end
|
||||
function OptionSwitchCtrl:Init(callback, bOn)
|
||||
self.bOn = bOn
|
||||
self.callback = callback
|
||||
self._mapNode.btnSwitch[1].gameObject:SetActive(not self.bOn)
|
||||
self._mapNode.btnSwitch[2].gameObject:SetActive(self.bOn)
|
||||
end
|
||||
function OptionSwitchCtrl:OnBtnClick_Switch(btn, nIndex)
|
||||
self.bOn = not self.bOn
|
||||
self.callback()
|
||||
self._mapNode.btnSwitch[1].gameObject:SetActive(nIndex == 2)
|
||||
self._mapNode.btnSwitch[2].gameObject:SetActive(nIndex == 1)
|
||||
end
|
||||
return OptionSwitchCtrl
|
||||
Reference in New Issue
Block a user