static int AnyTogglesOn(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UnityEngine.UI.ToggleGroup obj = (UnityEngine.UI.ToggleGroup)ToLua.CheckObject <UnityEngine.UI.ToggleGroup>(L, 1); bool o = obj.AnyTogglesOn(); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private void Set(bool value, bool sendCallback) { if (m_IsOn != value) { m_IsOn = value; if (m_Group != null && IsActive() && (m_IsOn || (!m_Group.AnyTogglesOn() && !m_Group.allowSwitchOff))) { m_IsOn = true; m_Group.NotifyToggleOn(this); } PlayEffect(toggleTransition == ToggleTransition.None); if (sendCallback) { onValueChanged.Invoke(m_IsOn); } } }
void Set(bool value, bool sendCallback) { if (m_IsOn == value) return; // if we are in a group and set to true, do group logic m_IsOn = value; if (m_Group != null && IsActive()) { if (m_IsOn || (!m_Group.AnyTogglesOn() && !m_Group.allowSwitchOff)) { m_IsOn = true; m_Group.NotifyToggleOn(this); } } // Always send event when toggle is clicked, even if value didn't change // due to already active toggle in a toggle group being clicked. // Controls like Dropdown rely on this. // It's up to the user to ignore a selection being set to the same value it already was, if desired. PlayEffect(toggleTransition == ToggleTransition.None); if (sendCallback) onValueChanged.Invoke(m_IsOn); }