mirror of
https://github.com/ppy/osu.git
synced 2025-03-15 15:27:20 +08:00
Rename Channel to ChannelChat
This commit is contained in:
parent
ce7000dd50
commit
56de6c1067
@ -57,8 +57,8 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
AvailableChannels =
|
||||
{
|
||||
new Channel { Name = "#english" },
|
||||
new Channel { Name = "#japanese" }
|
||||
new ChannelChat { Name = "#english" },
|
||||
new ChannelChat { Name = "#japanese" }
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -10,10 +10,10 @@ namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetMessagesRequest : APIRequest<List<Message>>
|
||||
{
|
||||
private readonly List<Channel> channels;
|
||||
private readonly List<ChannelChat> channels;
|
||||
private long? since;
|
||||
|
||||
public GetMessagesRequest(List<Channel> channels, long? sinceId)
|
||||
public GetMessagesRequest(List<ChannelChat> channels, long? sinceId)
|
||||
{
|
||||
this.channels = channels;
|
||||
since = sinceId;
|
||||
|
@ -6,7 +6,7 @@ using osu.Game.Online.Chat;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class ListChannelsRequest : APIRequest<List<Channel>>
|
||||
public class ListChannelsRequest : APIRequest<List<ChannelChat>>
|
||||
{
|
||||
protected override string Target => @"chat/channels";
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ using osu.Framework.Lists;
|
||||
|
||||
namespace osu.Game.Online.Chat
|
||||
{
|
||||
public class Channel
|
||||
public class ChannelChat
|
||||
{
|
||||
[JsonProperty(@"name")]
|
||||
public string Name;
|
||||
@ -35,7 +35,7 @@ namespace osu.Game.Online.Chat
|
||||
public const int MAX_HISTORY = 300;
|
||||
|
||||
[JsonConstructor]
|
||||
public Channel()
|
||||
public ChannelChat()
|
||||
{
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)); }
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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++)
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
public Bindable<double> ChatHeight { get; set; }
|
||||
|
||||
public List<Channel> AvailableChannels { get; private set; } = new List<Channel>();
|
||||
public List<ChannelChat> AvailableChannels { get; private set; } = new List<ChannelChat>();
|
||||
private readonly Container channelSelectionContainer;
|
||||
private readonly ChannelSelectionOverlay channelSelection;
|
||||
|
||||
@ -191,7 +191,7 @@ namespace osu.Game.Overlays
|
||||
private double startDragChatHeight;
|
||||
private bool isDragging;
|
||||
|
||||
public void OpenChannel(Channel channel) => addChannel(channel);
|
||||
public void OpenChannel(ChannelChat channel) => addChannel(channel);
|
||||
|
||||
protected override bool OnDragStart(InputState state)
|
||||
{
|
||||
@ -289,7 +289,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
private long? lastMessageId;
|
||||
|
||||
private readonly List<Channel> careChannels = new List<Channel>();
|
||||
private readonly List<ChannelChat> careChannels = new List<ChannelChat>();
|
||||
|
||||
private readonly List<DrawableChannel> loadedChannels = new List<DrawableChannel>();
|
||||
|
||||
@ -300,7 +300,7 @@ namespace osu.Game.Overlays
|
||||
messageRequest?.Cancel();
|
||||
|
||||
ListChannelsRequest req = new ListChannelsRequest();
|
||||
req.Success += delegate (List<Channel> channels)
|
||||
req.Success += delegate (List<ChannelChat> channels)
|
||||
{
|
||||
AvailableChannels = channels;
|
||||
|
||||
@ -328,9 +328,9 @@ namespace osu.Game.Overlays
|
||||
api.Queue(req);
|
||||
}
|
||||
|
||||
private Channel currentChannel;
|
||||
private ChannelChat currentChannel;
|
||||
|
||||
protected Channel CurrentChannel
|
||||
protected ChannelChat CurrentChannel
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -380,7 +380,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
}
|
||||
|
||||
private void addChannel(Channel channel)
|
||||
private void addChannel(ChannelChat channel)
|
||||
{
|
||||
if (channel == null) return;
|
||||
|
||||
@ -407,7 +407,7 @@ namespace osu.Game.Overlays
|
||||
channel.Joined.Value = true;
|
||||
}
|
||||
|
||||
private void removeChannel(Channel channel)
|
||||
private void removeChannel(ChannelChat channel)
|
||||
{
|
||||
if (channel == null) return;
|
||||
|
||||
@ -420,9 +420,9 @@ namespace osu.Game.Overlays
|
||||
channel.Joined.Value = false;
|
||||
}
|
||||
|
||||
private void fetchInitialMessages(Channel channel)
|
||||
private void fetchInitialMessages(ChannelChat channel)
|
||||
{
|
||||
var req = new GetMessagesRequest(new List<Channel> { channel }, null);
|
||||
var req = new GetMessagesRequest(new List<ChannelChat> { channel }, null);
|
||||
|
||||
req.Success += delegate (List<Message> messages)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user