2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
2018-12-20 20:06:40 +08:00
|
|
|
|
using System.Linq;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Configuration;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2018-10-02 11:02:47 +08:00
|
|
|
|
using osu.Framework.Input.Events;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Configuration;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
|
using osu.Game.Online.Chat;
|
|
|
|
|
using osu.Game.Overlays.Chat;
|
2018-07-10 01:42:57 +08:00
|
|
|
|
using osu.Game.Overlays.Chat.Selection;
|
2018-07-30 03:18:37 +08:00
|
|
|
|
using osu.Game.Overlays.Chat.Tabs;
|
2018-12-20 20:06:40 +08:00
|
|
|
|
using osuTK.Input;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
|
{
|
2018-04-14 19:31:03 +08:00
|
|
|
|
public class ChatOverlay : OsuFocusedOverlayContainer
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
private const float textbox_height = 60;
|
|
|
|
|
private const float channel_selection_min_height = 0.3f;
|
|
|
|
|
|
2018-04-14 19:31:03 +08:00
|
|
|
|
private ChannelManager channelManager;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-07-10 02:13:34 +08:00
|
|
|
|
private readonly Container<DrawableChannel> currentChannelContainer;
|
2018-07-10 00:23:40 +08:00
|
|
|
|
private readonly List<DrawableChannel> loadedChannels = new List<DrawableChannel>();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
private readonly LoadingAnimation loading;
|
|
|
|
|
|
|
|
|
|
private readonly FocusedTextBox textbox;
|
|
|
|
|
|
|
|
|
|
private const int transition_length = 500;
|
|
|
|
|
|
|
|
|
|
public const float DEFAULT_HEIGHT = 0.4f;
|
|
|
|
|
|
|
|
|
|
public const float TAB_AREA_HEIGHT = 50;
|
|
|
|
|
|
2018-07-30 03:18:37 +08:00
|
|
|
|
private readonly ChannelTabControl channelTabControl;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
private readonly Container chatContainer;
|
2018-10-02 13:41:18 +08:00
|
|
|
|
private readonly TabsArea tabsArea;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
private readonly Box chatBackground;
|
|
|
|
|
private readonly Box tabBackground;
|
|
|
|
|
|
|
|
|
|
public Bindable<double> ChatHeight { get; set; }
|
|
|
|
|
|
|
|
|
|
private readonly Container channelSelectionContainer;
|
2018-12-06 19:56:33 +08:00
|
|
|
|
private readonly ChannelSelectionOverlay channelSelectionOverlay;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-12-06 19:56:33 +08:00
|
|
|
|
public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) || channelSelectionOverlay.State == Visibility.Visible && channelSelectionOverlay.ReceivePositionalInputAt(screenSpacePos);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
public ChatOverlay()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
RelativePositionAxes = Axes.Both;
|
|
|
|
|
Anchor = Anchor.BottomLeft;
|
|
|
|
|
Origin = Anchor.BottomLeft;
|
|
|
|
|
|
|
|
|
|
const float padding = 5;
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
channelSelectionContainer = new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Height = 1f - DEFAULT_HEIGHT,
|
|
|
|
|
Masking = true,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
2018-12-06 19:56:33 +08:00
|
|
|
|
channelSelectionOverlay = new ChannelSelectionOverlay
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
chatContainer = new Container
|
|
|
|
|
{
|
|
|
|
|
Name = @"chat container",
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Height = DEFAULT_HEIGHT,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Name = @"chat area",
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Top = TAB_AREA_HEIGHT },
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
chatBackground = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
2018-07-10 02:13:34 +08:00
|
|
|
|
currentChannelContainer = new Container<DrawableChannel>
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding
|
|
|
|
|
{
|
|
|
|
|
Bottom = textbox_height
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = textbox_height,
|
|
|
|
|
Padding = new MarginPadding
|
|
|
|
|
{
|
|
|
|
|
Top = padding * 2,
|
|
|
|
|
Bottom = padding * 2,
|
|
|
|
|
Left = ChatLine.LEFT_PADDING + padding * 2,
|
|
|
|
|
Right = padding * 2,
|
|
|
|
|
},
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
textbox = new FocusedTextBox
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Height = 1,
|
|
|
|
|
PlaceholderText = "type your message",
|
|
|
|
|
Exit = () => State = Visibility.Hidden,
|
|
|
|
|
OnCommit = postMessage,
|
|
|
|
|
ReleaseFocusOnCommit = false,
|
|
|
|
|
HoldFocus = true,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
loading = new LoadingAnimation(),
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-10-02 13:41:18 +08:00
|
|
|
|
tabsArea = new TabsArea
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
tabBackground = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
},
|
2018-07-30 03:18:37 +08:00
|
|
|
|
channelTabControl = new ChannelTabControl
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-07-30 03:18:37 +08:00
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-11-13 14:20:40 +08:00
|
|
|
|
OnRequestLeave = channel => channelManager.LeaveChannel(channel)
|
2018-07-30 03:18:37 +08:00
|
|
|
|
},
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2018-07-30 03:18:37 +08:00
|
|
|
|
channelTabControl.Current.ValueChanged += chat => channelManager.CurrentChannel.Value = chat;
|
2018-12-06 19:56:33 +08:00
|
|
|
|
channelTabControl.ChannelSelectorActive.ValueChanged += value => channelSelectionOverlay.State = value ? Visibility.Visible : Visibility.Hidden;
|
|
|
|
|
channelSelectionOverlay.StateChanged += state =>
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-12-06 19:56:33 +08:00
|
|
|
|
if (state == Visibility.Hidden && channelManager.CurrentChannel.Value == null)
|
|
|
|
|
{
|
|
|
|
|
channelSelectionOverlay.State = Visibility.Visible;
|
|
|
|
|
State = Visibility.Hidden;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-30 03:18:37 +08:00
|
|
|
|
channelTabControl.ChannelSelectorActive.Value = state == Visibility.Visible;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
if (state == Visibility.Visible)
|
|
|
|
|
{
|
|
|
|
|
textbox.HoldFocus = false;
|
|
|
|
|
if (1f - ChatHeight.Value < channel_selection_min_height)
|
2018-05-02 17:26:23 +08:00
|
|
|
|
this.TransformBindableTo(ChatHeight, 1f - channel_selection_min_height, 800, Easing.OutQuint);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
textbox.HoldFocus = true;
|
|
|
|
|
};
|
2018-11-13 14:20:40 +08:00
|
|
|
|
|
2018-12-06 19:56:33 +08:00
|
|
|
|
channelSelectionOverlay.OnRequestJoin = channel => channelManager.JoinChannel(channel);
|
|
|
|
|
channelSelectionOverlay.OnRequestLeave = channel => channelManager.LeaveChannel(channel);
|
2018-04-14 19:31:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-07-30 03:18:37 +08:00
|
|
|
|
private void currentChannelChanged(Channel channel)
|
2018-04-14 19:31:03 +08:00
|
|
|
|
{
|
2018-07-10 02:13:34 +08:00
|
|
|
|
if (channel == null)
|
2018-04-14 19:31:03 +08:00
|
|
|
|
{
|
|
|
|
|
textbox.Current.Disabled = true;
|
2018-07-10 02:13:34 +08:00
|
|
|
|
currentChannelContainer.Clear(false);
|
2018-12-06 19:56:33 +08:00
|
|
|
|
channelSelectionOverlay.State = Visibility.Visible;
|
2018-04-14 19:31:03 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-10 02:13:34 +08:00
|
|
|
|
textbox.Current.Disabled = channel.ReadOnly;
|
2018-04-14 19:31:03 +08:00
|
|
|
|
|
2018-07-30 03:18:37 +08:00
|
|
|
|
if (channelTabControl.Current.Value != channel)
|
|
|
|
|
Scheduler.Add(() => channelTabControl.Current.Value = channel);
|
2018-04-14 19:31:03 +08:00
|
|
|
|
|
2018-07-10 02:13:34 +08:00
|
|
|
|
var loaded = loadedChannels.Find(d => d.Channel == channel);
|
2018-04-14 19:31:03 +08:00
|
|
|
|
if (loaded == null)
|
|
|
|
|
{
|
2018-07-10 02:13:34 +08:00
|
|
|
|
currentChannelContainer.FadeOut(500, Easing.OutQuint);
|
2018-04-14 19:31:03 +08:00
|
|
|
|
loading.Show();
|
|
|
|
|
|
2018-07-10 02:13:34 +08:00
|
|
|
|
loaded = new DrawableChannel(channel);
|
2018-04-14 19:31:03 +08:00
|
|
|
|
loadedChannels.Add(loaded);
|
|
|
|
|
LoadComponentAsync(loaded, l =>
|
|
|
|
|
{
|
|
|
|
|
loading.Hide();
|
|
|
|
|
|
2018-07-10 02:13:34 +08:00
|
|
|
|
currentChannelContainer.Clear(false);
|
|
|
|
|
currentChannelContainer.Add(loaded);
|
|
|
|
|
currentChannelContainer.FadeIn(500, Easing.OutQuint);
|
2018-04-14 19:31:03 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-07-10 02:13:34 +08:00
|
|
|
|
currentChannelContainer.Clear(false);
|
2018-12-20 20:06:40 +08:00
|
|
|
|
currentChannelContainer.Add(loaded);
|
2018-04-14 19:31:03 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private double startDragChatHeight;
|
|
|
|
|
private bool isDragging;
|
|
|
|
|
|
2018-10-02 11:02:47 +08:00
|
|
|
|
protected override bool OnDragStart(DragStartEvent e)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
isDragging = tabsArea.IsHovered;
|
|
|
|
|
|
|
|
|
|
if (!isDragging)
|
2018-10-02 11:02:47 +08:00
|
|
|
|
return base.OnDragStart(e);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
startDragChatHeight = ChatHeight.Value;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-02 11:02:47 +08:00
|
|
|
|
protected override bool OnDrag(DragEvent e)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
if (isDragging)
|
|
|
|
|
{
|
2018-09-19 19:52:57 +08:00
|
|
|
|
double targetChatHeight = startDragChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
// If the channel selection screen is shown, mind its minimum height
|
2018-12-06 19:56:33 +08:00
|
|
|
|
if (channelSelectionOverlay.State == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
targetChatHeight = 1f - channel_selection_min_height;
|
|
|
|
|
|
|
|
|
|
ChatHeight.Value = targetChatHeight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-02 11:02:47 +08:00
|
|
|
|
protected override bool OnDragEnd(DragEndEvent e)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
isDragging = false;
|
2018-10-02 11:02:47 +08:00
|
|
|
|
return base.OnDragEnd(e);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-12-20 20:06:40 +08:00
|
|
|
|
private void selectTab(int index)
|
|
|
|
|
{
|
|
|
|
|
var channel = channelTabControl.Items.Skip(index).FirstOrDefault();
|
|
|
|
|
if (channel != null && channel.Name != "+")
|
|
|
|
|
channelTabControl.Current.Value = channel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnKeyDown(KeyDownEvent e)
|
|
|
|
|
{
|
|
|
|
|
if (e.AltPressed)
|
|
|
|
|
{
|
|
|
|
|
switch (e.Key)
|
|
|
|
|
{
|
|
|
|
|
case Key.Number1:
|
|
|
|
|
case Key.Number2:
|
|
|
|
|
case Key.Number3:
|
|
|
|
|
case Key.Number4:
|
|
|
|
|
case Key.Number5:
|
|
|
|
|
case Key.Number6:
|
|
|
|
|
case Key.Number7:
|
|
|
|
|
case Key.Number8:
|
|
|
|
|
case Key.Number9:
|
|
|
|
|
selectTab((int)e.Key - (int)Key.Number1);
|
|
|
|
|
return true;
|
|
|
|
|
case Key.Number0:
|
|
|
|
|
selectTab(9);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return base.OnKeyDown(e);
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
public override bool AcceptsFocus => true;
|
|
|
|
|
|
2018-10-02 11:02:47 +08:00
|
|
|
|
protected override void OnFocus(FocusEvent e)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
//this is necessary as textbox is masked away and therefore can't get focus :(
|
|
|
|
|
GetContainingInputManager().ChangeFocus(textbox);
|
2018-10-02 11:02:47 +08:00
|
|
|
|
base.OnFocus(e);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void PopIn()
|
|
|
|
|
{
|
|
|
|
|
this.MoveToY(0, transition_length, Easing.OutQuint);
|
|
|
|
|
this.FadeIn(transition_length, Easing.OutQuint);
|
|
|
|
|
|
|
|
|
|
textbox.HoldFocus = true;
|
|
|
|
|
base.PopIn();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void PopOut()
|
|
|
|
|
{
|
|
|
|
|
this.MoveToY(Height, transition_length, Easing.InSine);
|
|
|
|
|
this.FadeOut(transition_length, Easing.InSine);
|
|
|
|
|
|
|
|
|
|
textbox.HoldFocus = false;
|
|
|
|
|
base.PopOut();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2018-04-14 19:31:03 +08:00
|
|
|
|
private void load(OsuConfigManager config, OsuColour colours, ChannelManager channelManager)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
ChatHeight = config.GetBindable<double>(OsuSetting.ChatDisplayHeight);
|
|
|
|
|
ChatHeight.ValueChanged += h =>
|
|
|
|
|
{
|
|
|
|
|
chatContainer.Height = (float)h;
|
|
|
|
|
channelSelectionContainer.Height = 1f - (float)h;
|
|
|
|
|
tabBackground.FadeTo(h == 1 ? 1 : 0.8f, 200);
|
|
|
|
|
};
|
|
|
|
|
ChatHeight.TriggerChange();
|
|
|
|
|
|
|
|
|
|
chatBackground.Colour = colours.ChatBlue;
|
|
|
|
|
|
|
|
|
|
loading.Show();
|
|
|
|
|
|
2018-04-14 19:31:03 +08:00
|
|
|
|
this.channelManager = channelManager;
|
2018-07-30 03:18:37 +08:00
|
|
|
|
channelManager.CurrentChannel.ValueChanged += currentChannelChanged;
|
2018-11-22 02:15:55 +08:00
|
|
|
|
channelManager.JoinedChannels.ItemsAdded += onChannelAddedToJoinedChannels;
|
|
|
|
|
channelManager.JoinedChannels.ItemsRemoved += onChannelRemovedFromJoinedChannels;
|
|
|
|
|
channelManager.AvailableChannels.ItemsAdded += availableChannelsChanged;
|
|
|
|
|
channelManager.AvailableChannels.ItemsRemoved += availableChannelsChanged;
|
2018-07-24 10:58:40 +08:00
|
|
|
|
|
|
|
|
|
//for the case that channelmanager was faster at fetching the channels than our attachment to CollectionChanged.
|
2018-12-06 19:56:33 +08:00
|
|
|
|
channelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels);
|
2018-11-22 02:15:55 +08:00
|
|
|
|
foreach (Channel channel in channelManager.JoinedChannels)
|
|
|
|
|
channelTabControl.AddChannel(channel);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-22 02:15:55 +08:00
|
|
|
|
private void onChannelAddedToJoinedChannels(IEnumerable<Channel> channels)
|
2018-09-06 14:56:04 +08:00
|
|
|
|
{
|
2018-11-22 02:15:55 +08:00
|
|
|
|
foreach (Channel channel in channels)
|
|
|
|
|
channelTabControl.AddChannel(channel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onChannelRemovedFromJoinedChannels(IEnumerable<Channel> channels)
|
|
|
|
|
{
|
|
|
|
|
foreach (Channel channel in channels)
|
|
|
|
|
{
|
|
|
|
|
channelTabControl.RemoveChannel(channel);
|
|
|
|
|
loadedChannels.Remove(loadedChannels.Find(c => c.Channel == channel));
|
|
|
|
|
}
|
2018-09-06 14:56:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-22 02:15:55 +08:00
|
|
|
|
private void availableChannelsChanged(IEnumerable<Channel> channels)
|
2018-12-06 19:56:33 +08:00
|
|
|
|
=> channelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels);
|
2018-11-22 02:15:55 +08:00
|
|
|
|
|
2018-09-06 14:56:04 +08:00
|
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
|
{
|
|
|
|
|
base.Dispose(isDisposing);
|
2018-09-06 16:11:23 +08:00
|
|
|
|
|
|
|
|
|
if (channelManager != null)
|
|
|
|
|
{
|
|
|
|
|
channelManager.CurrentChannel.ValueChanged -= currentChannelChanged;
|
2018-11-22 02:15:55 +08:00
|
|
|
|
channelManager.JoinedChannels.ItemsAdded -= onChannelAddedToJoinedChannels;
|
|
|
|
|
channelManager.JoinedChannels.ItemsRemoved -= onChannelRemovedFromJoinedChannels;
|
|
|
|
|
channelManager.AvailableChannels.ItemsAdded -= availableChannelsChanged;
|
|
|
|
|
channelManager.AvailableChannels.ItemsRemoved -= availableChannelsChanged;
|
2018-09-06 16:11:23 +08:00
|
|
|
|
}
|
2018-09-06 14:56:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
private void postMessage(TextBox textbox, bool newText)
|
|
|
|
|
{
|
2018-04-14 19:31:03 +08:00
|
|
|
|
var text = textbox.Text.Trim();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-04-14 19:31:03 +08:00
|
|
|
|
if (string.IsNullOrWhiteSpace(text))
|
2018-04-13 17:19:50 +08:00
|
|
|
|
return;
|
|
|
|
|
|
2018-04-14 19:31:03 +08:00
|
|
|
|
if (text[0] == '/')
|
|
|
|
|
channelManager.PostCommand(text.Substring(1));
|
|
|
|
|
else
|
|
|
|
|
channelManager.PostMessage(text);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-04-14 19:31:03 +08:00
|
|
|
|
textbox.Text = string.Empty;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
2018-10-02 13:41:18 +08:00
|
|
|
|
|
|
|
|
|
private class TabsArea : Container
|
|
|
|
|
{
|
|
|
|
|
// IsHovered is used
|
|
|
|
|
public override bool HandlePositionalInput => true;
|
|
|
|
|
|
|
|
|
|
public TabsArea()
|
|
|
|
|
{
|
|
|
|
|
Name = @"tabs area";
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
Height = TAB_AREA_HEIGHT;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|