private void SelectChannelButton(ChannelTab channelTab) { // this button is already selected if (_activeChannel == channelTab.Channel) { return; // set the previous button to non-selected } else if (_activeChannel != null) { _activeChannelTab.SetImage(_channelButtonInactiveSprite); _activeChannelTab.SetState(ChannelButtonState.Inactive); } // set the button as selected _activeChannel = channelTab.Channel; _activeChannelTab = channelTab; _activeChannelTab.SetImage(_channelButtonActiveSprite); _activeChannelTab.SetState(ChannelButtonState.Active); _consoleBuffer.ResetTalkHistory(_knownChannels[_activeChannel.Id].talkHistory); _buttonCloseChannel.gameObject.SetActive(_activeChannel.Closable); _toggleShowServerMessages.gameObject.SetActive(_activeChannel.Closable); _toggleShowServerMessages.onValueChanged.RemoveListener(OnShowServerMessagesToggleValueChanged); //_toggleShowServerMessages.isOn = _activeChannel.ShowServerMessages; _toggleShowServerMessages.onValueChanged.AddListener(OnShowServerMessagesToggleValueChanged); }
private void SelectChannelButton(ChannelTab channelTab) { // this button is already selected if (_activeChannel == channelTab.channel) { return; // set the previous button to non-selected } else if (_activeChannel != null) { _activeChannelTab.state = ChannelButtonState.Inactive; } // set the button as selected _activeChannel = channelTab.channel; _activeChannelTab = channelTab; _activeChannelTab.state = ChannelButtonState.Active; _consoleBuffer.ResetChannelHistory(_activeChannel.History); _closeButton.gameObject.SetActive(_activeChannel.Closable); _showServerMessagesToggle.gameObject.SetActive(_activeChannel.Closable); _newChannelButton.onClick.AddListener(OnNewChannelButtonClick); _showServerMessagesToggle.onValueChanged.RemoveListener(OnShowServerMessagesToggleValueChanged); //_showServerMessagesToggle.isOn = _activeChannel.ShowServerMessages; _showServerMessagesToggle.onValueChanged.AddListener(OnShowServerMessagesToggleValueChanged); }
private void OnCloseChannelButtonClicked() { if (!_activeChannelTab || !_activeChannel.Closable) { return; } _channelTabs.Remove(_activeChannel.Id); OpenTibiaUnity.ChatStorage.LeaveChannel(_activeChannel.Id); _activeChannel.onAddChannelMessage.RemoveListener(OnAddChannelMessage); var channelButtonRectTransform = _activeChannelTab.rectTransform; int index = channelButtonRectTransform.GetSiblingIndex(); int relativeIndex; if (index == 0) { relativeIndex = 1; } else { relativeIndex = index - 1; } var otherChannelButton = channelButtonRectTransform.parent.GetChild(relativeIndex).GetComponent <ChannelTab>(); Destroy(_activeChannelTab.gameObject); _activeChannel = null; _activeChannelTab = null; SelectChannelButton(otherChannelButton); }
private void OnClearChannels() { foreach (var p in _channelTabs) { Destroy(p.Value.gameObject); } _channelTabs.Clear(); _activeChannel = null; _activeChannelTab = null; }
private void OnClearChannels() { foreach (var p in m_ChannelTabs) { Destroy(p.Value.gameObject); } m_ChannelTabs.Clear(); m_KnownChannels.Clear(); m_ActiveChannel = null; m_ActiveChannelTab = null; }
private void OnChannelButtonClicked(ChannelTab channelTab) { SelectChannelButton(channelTab); }