Ejemplo n.º 1
0
    public void Toggle_Channel(bool turnOn)
    {
        _ = SoundManager.Play(SingletonSOSounds.Instance.Click01);
        GameObject curObject = EventSystem.current.currentSelectedGameObject;

        if (!curObject)
        {
            return;
        }

        UIToggleChannel source = curObject.GetComponent <UIToggleChannel>();

        if (!source)
        {
            return;
        }

        if (turnOn)
        {
            EnableChannel(source.channel);
        }
        else
        {
            DisableChannel(source.channel);
        }
    }
Ejemplo n.º 2
0
    public void Toggle_Channel(bool isOn)
    {
        SoundManager.Play("Click01");
        GameObject curObject = EventSystem.current.currentSelectedGameObject;

        if (!curObject)
        {
            return;
        }

        UIToggleChannel source = curObject.GetComponent <UIToggleChannel>();

        if (!source)
        {
            return;
        }
        ChatChannel curChannel = source.channel;

        if (isOn)
        {
            //Deselect all other channels in UI if OOC was selected
            if (curChannel == ChatChannel.OOC)
            {
                DisableAllExceptChannel(curChannel);
                PlayerManager.LocalPlayerScript.SelectedChannels = curChannel;
            }
            else
            {
                TryDisableOOC();
                PlayerManager.LocalPlayerScript.SelectedChannels |= curChannel;
            }
        }
        else
        {
            // Make some exceptions for Local and OOC buttons
            if (curChannel == ChatChannel.Local)
            {
                // Disable all of the other channels
                DisableAllExceptChannel(ChatChannel.Local);

                // Make sure Local is still selected so player can't select ChatChannel.None
                ChannelToggles[ChatChannel.Local].isOn           = true;
                PlayerManager.LocalPlayerScript.SelectedChannels = ChatChannel.Local;
            }
            else if (curChannel == ChatChannel.OOC)
            {
                // Leave OOC on, don't let players disable it by pressing it again
                ChannelToggles[ChatChannel.OOC].isOn = true;
            }
            else
            {
                // Disable the current channel
                PlayerManager.LocalPlayerScript.SelectedChannels &= ~curChannel;
            }
        }

        UpdateChannelToggleText();
    }
Ejemplo n.º 3
0
        public void Toggle_Channel(bool isOn)
        {
            SoundManager.Play("Click01");
            UIToggleChannel source = EventSystem.current.currentSelectedGameObject.GetComponent <UIToggleChannel>();

            if (!source)
            {
                return;
            }
            ChatChannel channel = source.channel;

            if (isOn)
            {
                PlayerManager.LocalPlayerScript.SelectedChannels |= channel;
            }
            else
            {
                PlayerManager.LocalPlayerScript.SelectedChannels &= ~channel;
            }

            UpdateChannelToggleText();
        }
Ejemplo n.º 4
0
        public void Toggle_Channel(bool isOn)
        {
            SoundManager.Play("Click01");
            GameObject curObject = EventSystem.current.currentSelectedGameObject;

            if (!curObject)
            {
                return;
            }

            UIToggleChannel source = curObject.GetComponent <UIToggleChannel>();

            if (!source)
            {
                return;
            }
            ChatChannel curChannel = source.channel;

            if (isOn)
            {
                //Deselect all other channels in UI if OOC was selected
                if (curChannel == ChatChannel.OOC)
                {
                    DisableAllButOOC(curChannel);
                    PlayerManager.LocalPlayerScript.SelectedChannels = curChannel;
                }
                else
                {
                    TryDisableOOC();
                    PlayerManager.LocalPlayerScript.SelectedChannels |= curChannel;
                }
            }
            else
            {
                PlayerManager.LocalPlayerScript.SelectedChannels &= ~curChannel;
            }

            UpdateChannelToggleText();
        }
Ejemplo n.º 5
0
        private bool isChannelListUpToDate()
        {
            ChatChannel availableChannels = PlayerManager.LocalPlayerScript.GetAvailableChannelsMask();
            int         availableCount    = EnumUtils.GetSetBitCount((long)availableChannels);

            UIToggleChannel[] displayedChannels = channelPanel.GetComponentsInChildren <UIToggleChannel>();

            if (availableCount != displayedChannels.Length)
            {
                return(false);
            }

            for (var i = 0; i < displayedChannels.Length; i++)
            {
                UIToggleChannel toggleChannel = displayedChannels[i];
                if ((availableChannels & toggleChannel.channel) != toggleChannel.channel)
                {
                    return(false);
                }
            }

            return(true);
        }