Inheritance: UnityEngine.EventSystems.UIBehaviour
コード例 #1
0
ファイル: GemToggle.cs プロジェクト: xiekaren/phobia-game
        private void SetToggleGroup(GemToggleGroup newGroup, bool setMemberValue)
        {
            GemToggleGroup oldGroup = m_Group;

            // Sometimes IsActive returns false in OnDisable so don't check for it.
            // Rather remove the toggle too oftem than too little.
            if (m_Group != null)
            {
                m_Group.UnregisterToggle(this);
            }

            // At runtime the group variable should be set but not when calling this method from OnEnable or OnDisable.
            // That's why we use the setMemberValue parameter.
            if (setMemberValue)
            {
                m_Group = newGroup;
            }

            // Only register to the new group if this Toggle is active.
            if (m_Group != null && IsActive())
            {
                m_Group.RegisterToggle(this);
            }

            // If we are in a new group, and this toggle is on, notify group.
            // Note: Don't refer to m_Group here as it's not guaranteed to have been set.
            if (newGroup != null && newGroup != oldGroup && isOn && IsActive())
            {
                m_Group.NotifyToggleOn(this);
            }
        }