コード例 #1
0
ファイル: ChatTextBar.cs プロジェクト: omkelderman/osu
 private void chatTextBoxChange(ValueChangedEvent <string> change)
 {
     if (ShowSearch.Value)
     {
         OnSearchTermsChanged?.Invoke(change.NewValue);
     }
 }
コード例 #2
0
ファイル: ChatTextBar.cs プロジェクト: omkelderman/osu
        protected override void LoadComplete()
        {
            base.LoadComplete();

            chatTextBox.Current.ValueChanged += chatTextBoxChange;
            chatTextBox.OnCommit             += chatTextBoxCommit;

            ShowSearch.BindValueChanged(change =>
            {
                bool showSearch = change.NewValue;

                chattingTextContainer.FadeTo(showSearch ? 0 : 1);
                searchIconContainer.FadeTo(showSearch ? 1 : 0);

                // Clear search terms if any exist when switching back to chat mode
                if (!showSearch)
                {
                    OnSearchTermsChanged?.Invoke(string.Empty);
                }
            }, true);

            currentChannel.BindValueChanged(change =>
            {
                Channel newChannel = change.NewValue;

                switch (newChannel?.Type)
                {
                case ChannelType.Public:
                    chattingText.Text = $"chatting in {newChannel.Name}";
                    break;

                case ChannelType.PM:
                    chattingText.Text = $"chatting with {newChannel.Name}";
                    break;

                default:
                    chattingText.Text = string.Empty;
                    break;
                }
            }, true);
        }