diff options
author | chai <chaifix@163.com> | 2021-04-07 19:10:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-04-07 19:10:30 +0800 |
commit | e7dfbec8e8634e767d78959941daf71a96e021cf (patch) | |
tree | 58895a7c60df0bd3f316e6461051eabd1c0a51e1 /Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/ToggleGroup.cs | |
parent | ff5a3fbf31db349db11bbc5c60ba199d26780f19 (diff) |
*移动目录
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/ToggleGroup.cs')
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/ToggleGroup.cs | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/ToggleGroup.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/ToggleGroup.cs deleted file mode 100644 index da5e021..0000000 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/ToggleGroup.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using UnityEngine.EventSystems; - -namespace UnityEngine.UI -{ - [AddComponentMenu("UI/Toggle Group", 32)] - [DisallowMultipleComponent] - public class ToggleGroup : UIBehaviour - { - [SerializeField] private bool m_AllowSwitchOff = false; - public bool allowSwitchOff { get { return m_AllowSwitchOff; } set { m_AllowSwitchOff = value; } } - - private List<Toggle> m_Toggles = new List<Toggle>(); - - protected ToggleGroup() - {} - - private void ValidateToggleIsInGroup(Toggle toggle) - { - if (toggle == null || !m_Toggles.Contains(toggle)) - throw new ArgumentException(string.Format("Toggle {0} is not part of ToggleGroup {1}", new object[] {toggle, this})); - } - - public void NotifyToggleOn(Toggle toggle) - { - ValidateToggleIsInGroup(toggle); - - // disable all toggles in the group - for (var i = 0; i < m_Toggles.Count; i++) - { - if (m_Toggles[i] == toggle) - continue; - - m_Toggles[i].isOn = false; - } - } - - public void UnregisterToggle(Toggle toggle) - { - if (m_Toggles.Contains(toggle)) - m_Toggles.Remove(toggle); - } - - public void RegisterToggle(Toggle toggle) - { - if (!m_Toggles.Contains(toggle)) - m_Toggles.Add(toggle); - } - - public bool AnyTogglesOn() - { - return m_Toggles.Find(x => x.isOn) != null; - } - - public IEnumerable<Toggle> ActiveToggles() - { - return m_Toggles.Where(x => x.isOn); - } - - public void SetAllTogglesOff() - { - bool oldAllowSwitchOff = m_AllowSwitchOff; - m_AllowSwitchOff = true; - - for (var i = 0; i < m_Toggles.Count; i++) - m_Toggles[i].isOn = false; - - m_AllowSwitchOff = oldAllowSwitchOff; - } - } -} |