mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 04:13:00 +08:00
Fix the crash in the visual testcase
This commit is contained in:
parent
ec914a5095
commit
290b6e5f1d
@ -3,6 +3,7 @@
|
||||
|
||||
using System.ComponentModel;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
|
@ -15,6 +15,7 @@ using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays.Chat;
|
||||
using osu.Game.Overlays.Chat.Tabs;
|
||||
using osu.Game.Users;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Online.Chat
|
||||
private IAPIProvider api;
|
||||
private ScheduledDelegate fetchMessagesScheduleder;
|
||||
private GetMessagesRequest fetchMsgReq;
|
||||
private GetPrivateMessagesRequest fetchPrivateMsgReq;
|
||||
private GetPrivateMessagesRequest fetchUserMsgReq;
|
||||
private long? lastChannelMsgId;
|
||||
private long? lastUserMsgId;
|
||||
|
||||
@ -170,16 +170,16 @@ namespace osu.Game.Online.Chat
|
||||
);
|
||||
|
||||
|
||||
if (fetchPrivateMsgReq == null)
|
||||
if (fetchUserMsgReq == null)
|
||||
fetchMessages(
|
||||
() => new GetPrivateMessagesRequest(lastChannelMsgId),
|
||||
() => new GetPrivateMessagesRequest(lastUserMsgId),
|
||||
messages =>
|
||||
{
|
||||
if (messages == null)
|
||||
return;
|
||||
handleUserMessages(messages);
|
||||
lastUserMsgId = messages.LastOrDefault()?.Id ?? lastUserMsgId;
|
||||
fetchPrivateMsgReq = null;
|
||||
lastUserMsgId = messages.Max(m => m.Id) ?? lastUserMsgId;
|
||||
fetchUserMsgReq = null;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -124,6 +124,7 @@ namespace osu.Game
|
||||
var channelManager = new ChannelManager();
|
||||
dependencies.Inject(channelManager);
|
||||
dependencies.Cache(channelManager);
|
||||
AddInternal(channelManager);
|
||||
|
||||
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory));
|
||||
dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage));
|
||||
|
@ -332,7 +332,6 @@ namespace osu.Game.Overlays
|
||||
channelManager.CurrentChannel.ValueChanged += currentChatChanged;
|
||||
channelManager.JoinedChannels.CollectionChanged += joinedChannelsChanged;
|
||||
channelManager.AvailableChannels.CollectionChanged += (sender, args) => channelSelection.UpdateAvailableChannels(channelManager.AvailableChannels);
|
||||
Add(channelManager);
|
||||
}
|
||||
|
||||
private void postMessage(TextBox textbox, bool newText)
|
||||
|
Loading…
Reference in New Issue
Block a user