Rename Channel to ChannelChat

This commit is contained in:
miterosan
2018-03-28 21:11:06 +02:00
parent ce7000dd50
commit 56de6c1067
10 changed files with 38 additions and 38 deletions

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Chat
private const float text_size = 15;
private const float transition_duration = 100;
private readonly Channel channel;
private readonly ChannelChat channel;
private readonly Bindable<bool> joinedBind = new Bindable<bool>();
private readonly OsuSpriteText name;
@ -44,10 +44,10 @@ namespace osu.Game.Overlays.Chat
}
}
public Action<Channel> OnRequestJoin;
public Action<Channel> OnRequestLeave;
public Action<ChannelChat> OnRequestJoin;
public Action<ChannelChat> OnRequestLeave;
public ChannelListItem(Channel channel)
public ChannelListItem(ChannelChat channel)
{
this.channel = channel;

View File

@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Chat
set { header.Text = value.ToUpper(); }
}
public IEnumerable<Channel> Channels
public IEnumerable<ChannelChat> Channels
{
set { ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c)); }
}

View File

@ -32,8 +32,8 @@ namespace osu.Game.Overlays.Chat
private readonly SearchTextBox search;
private readonly SearchContainer<ChannelSection> sectionsFlow;
public Action<Channel> OnRequestJoin;
public Action<Channel> OnRequestLeave;
public Action<ChannelChat> OnRequestJoin;
public Action<ChannelChat> OnRequestLeave;
public IEnumerable<ChannelSection> Sections
{

View File

@ -21,11 +21,11 @@ using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Chat
{
public class ChatTabControl : OsuTabControl<Channel>
public class ChatTabControl : OsuTabControl<ChannelChat>
{
private const float shear_width = 10;
public Action<Channel> OnRequestLeave;
public Action<ChannelChat> OnRequestLeave;
public readonly Bindable<bool> ChannelSelectorActive = new Bindable<bool>();
@ -46,12 +46,12 @@ namespace osu.Game.Overlays.Chat
Margin = new MarginPadding(10),
});
AddTabItem(selectorTab = new ChannelTabItem.ChannelSelectorTabItem(new Channel { Name = "+" }));
AddTabItem(selectorTab = new ChannelTabItem.ChannelSelectorTabItem(new ChannelChat { Name = "+" }));
ChannelSelectorActive.BindTo(selectorTab.Active);
}
protected override void AddTabItem(TabItem<Channel> item, bool addToDropdown = true)
protected override void AddTabItem(TabItem<ChannelChat> item, bool addToDropdown = true)
{
if (item != selectorTab && TabContainer.GetLayoutPosition(selectorTab) < float.MaxValue)
// performTabSort might've made selectorTab's position wonky, fix it
@ -63,9 +63,9 @@ namespace osu.Game.Overlays.Chat
SelectTab(item);
}
protected override TabItem<Channel> CreateTabItem(Channel value) => new ChannelTabItem(value) { OnRequestClose = tabCloseRequested };
protected override TabItem<ChannelChat> CreateTabItem(ChannelChat value) => new ChannelTabItem(value) { OnRequestClose = tabCloseRequested };
protected override void SelectTab(TabItem<Channel> tab)
protected override void SelectTab(TabItem<ChannelChat> tab)
{
if (tab is ChannelTabItem.ChannelSelectorTabItem)
{
@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Chat
base.SelectTab(tab);
}
private void tabCloseRequested(TabItem<Channel> tab)
private void tabCloseRequested(TabItem<ChannelChat> tab)
{
int totalTabs = TabContainer.Count - 1; // account for selectorTab
int currentIndex = MathHelper.Clamp(TabContainer.IndexOf(tab), 1, totalTabs);
@ -93,7 +93,7 @@ namespace osu.Game.Overlays.Chat
OnRequestLeave?.Invoke(tab.Value);
}
private class ChannelTabItem : TabItem<Channel>
private class ChannelTabItem : TabItem<ChannelChat>
{
private Color4 backgroundInactive;
private Color4 backgroundHover;
@ -175,7 +175,7 @@ namespace osu.Game.Overlays.Chat
updateState();
}
public ChannelTabItem(Channel value) : base(value)
public ChannelTabItem(ChannelChat value) : base(value)
{
Width = 150;
@ -307,7 +307,7 @@ namespace osu.Game.Overlays.Chat
{
public override bool IsRemovable => false;
public ChannelSelectorTabItem(Channel value) : base(value)
public ChannelSelectorTabItem(ChannelChat value) : base(value)
{
Depth = float.MaxValue;
Width = 45;

View File

@ -17,11 +17,11 @@ namespace osu.Game.Overlays.Chat
{
public class DrawableChannel : Container
{
public readonly Channel Channel;
public readonly ChannelChat Channel;
private readonly ChatLineContainer flow;
private readonly ScrollContainer scroll;
public DrawableChannel(Channel channel)
public DrawableChannel(ChannelChat channel)
{
Channel = channel;
@ -79,7 +79,7 @@ namespace osu.Game.Overlays.Chat
private void newMessagesArrived(IEnumerable<Message> newMessages)
{
// Add up to last Channel.MAX_HISTORY messages
var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MAX_HISTORY));
var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - ChannelChat.MAX_HISTORY));
flow.AddRange(displayMessages.Select(m => new ChatLine(m)));
@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Chat
scrollToEnd();
var staleMessages = flow.Children.Where(c => c.LifetimeEnd == double.MaxValue).ToArray();
int count = staleMessages.Length - Channel.MAX_HISTORY;
int count = staleMessages.Length - ChannelChat.MAX_HISTORY;
for (int i = 0; i < count; i++)
{