mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 07:42:55 +08:00
Merge branch 'fix-mod-icon' into freemods
This commit is contained in:
commit
097ce37e96
@ -30,7 +30,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
|
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
|
||||||
<PackageReference Include="DiscordRichPresence" Version="1.0.169" />
|
<PackageReference Include="DiscordRichPresence" Version="1.0.175" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Resources">
|
<ItemGroup Label="Resources">
|
||||||
<EmbeddedResource Include="lazer.ico" />
|
<EmbeddedResource Include="lazer.ico" />
|
||||||
|
@ -8,16 +8,16 @@ using osu.Game.Users;
|
|||||||
using osuTK;
|
using osuTK;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Overlays.Chat;
|
using osu.Game.Overlays.Chat;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Online
|
namespace osu.Game.Tests.Visual.Online
|
||||||
{
|
{
|
||||||
public class TestSceneStandAloneChatDisplay : OsuTestScene
|
public class TestSceneStandAloneChatDisplay : OsuManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
private readonly Channel testChannel = new Channel();
|
|
||||||
|
|
||||||
private readonly User admin = new User
|
private readonly User admin = new User
|
||||||
{
|
{
|
||||||
Username = "HappyStick",
|
Username = "HappyStick",
|
||||||
@ -46,92 +46,97 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[Cached]
|
[Cached]
|
||||||
private ChannelManager channelManager = new ChannelManager();
|
private ChannelManager channelManager = new ChannelManager();
|
||||||
|
|
||||||
private readonly TestStandAloneChatDisplay chatDisplay;
|
private TestStandAloneChatDisplay chatDisplay;
|
||||||
private readonly TestStandAloneChatDisplay chatDisplay2;
|
private int messageIdSequence;
|
||||||
|
|
||||||
|
private Channel testChannel;
|
||||||
|
|
||||||
public TestSceneStandAloneChatDisplay()
|
public TestSceneStandAloneChatDisplay()
|
||||||
{
|
{
|
||||||
Add(channelManager);
|
Add(channelManager);
|
||||||
|
|
||||||
Add(chatDisplay = new TestStandAloneChatDisplay
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.CentreLeft,
|
|
||||||
Margin = new MarginPadding(20),
|
|
||||||
Size = new Vector2(400, 80)
|
|
||||||
});
|
|
||||||
|
|
||||||
Add(chatDisplay2 = new TestStandAloneChatDisplay(true)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Origin = Anchor.CentreRight,
|
|
||||||
Margin = new MarginPadding(20),
|
|
||||||
Size = new Vector2(400, 150)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
messageIdSequence = 0;
|
||||||
|
channelManager.CurrentChannel.Value = testChannel = new Channel();
|
||||||
|
|
||||||
channelManager.CurrentChannel.Value = testChannel;
|
Children = new[]
|
||||||
|
{
|
||||||
|
chatDisplay = new TestStandAloneChatDisplay
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Margin = new MarginPadding(20),
|
||||||
|
Size = new Vector2(400, 80),
|
||||||
|
Channel = { Value = testChannel },
|
||||||
|
},
|
||||||
|
new TestStandAloneChatDisplay(true)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Margin = new MarginPadding(20),
|
||||||
|
Size = new Vector2(400, 150),
|
||||||
|
Channel = { Value = testChannel },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
chatDisplay.Channel.Value = testChannel;
|
[Test]
|
||||||
chatDisplay2.Channel.Value = testChannel;
|
public void TestManyMessages()
|
||||||
|
{
|
||||||
int sequence = 0;
|
AddStep("message from admin", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||||
|
|
||||||
AddStep("message from admin", () => testChannel.AddNewMessages(new Message(sequence++)
|
|
||||||
{
|
{
|
||||||
Sender = admin,
|
Sender = admin,
|
||||||
Content = "I am a wang!"
|
Content = "I am a wang!"
|
||||||
}));
|
}));
|
||||||
|
|
||||||
AddStep("message from team red", () => testChannel.AddNewMessages(new Message(sequence++)
|
AddStep("message from team red", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||||
{
|
{
|
||||||
Sender = redUser,
|
Sender = redUser,
|
||||||
Content = "I am team red."
|
Content = "I am team red."
|
||||||
}));
|
}));
|
||||||
|
|
||||||
AddStep("message from team red", () => testChannel.AddNewMessages(new Message(sequence++)
|
AddStep("message from team red", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||||
{
|
{
|
||||||
Sender = redUser,
|
Sender = redUser,
|
||||||
Content = "I plan to win!"
|
Content = "I plan to win!"
|
||||||
}));
|
}));
|
||||||
|
|
||||||
AddStep("message from team blue", () => testChannel.AddNewMessages(new Message(sequence++)
|
AddStep("message from team blue", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||||
{
|
{
|
||||||
Sender = blueUser,
|
Sender = blueUser,
|
||||||
Content = "Not on my watch. Prepare to eat saaaaaaaaaand. Lots and lots of saaaaaaand."
|
Content = "Not on my watch. Prepare to eat saaaaaaaaaand. Lots and lots of saaaaaaand."
|
||||||
}));
|
}));
|
||||||
|
|
||||||
AddStep("message from admin", () => testChannel.AddNewMessages(new Message(sequence++)
|
AddStep("message from admin", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||||
{
|
{
|
||||||
Sender = admin,
|
Sender = admin,
|
||||||
Content = "Okay okay, calm down guys. Let's do this!"
|
Content = "Okay okay, calm down guys. Let's do this!"
|
||||||
}));
|
}));
|
||||||
|
|
||||||
AddStep("message from long username", () => testChannel.AddNewMessages(new Message(sequence++)
|
AddStep("message from long username", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||||
{
|
{
|
||||||
Sender = longUsernameUser,
|
Sender = longUsernameUser,
|
||||||
Content = "Hi guys, my new username is lit!"
|
Content = "Hi guys, my new username is lit!"
|
||||||
}));
|
}));
|
||||||
|
|
||||||
AddStep("message with new date", () => testChannel.AddNewMessages(new Message(sequence++)
|
AddStep("message with new date", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||||
{
|
{
|
||||||
Sender = longUsernameUser,
|
Sender = longUsernameUser,
|
||||||
Content = "Message from the future!",
|
Content = "Message from the future!",
|
||||||
Timestamp = DateTimeOffset.Now
|
Timestamp = DateTimeOffset.Now
|
||||||
}));
|
}));
|
||||||
|
|
||||||
AddUntilStep("ensure still scrolled to bottom", () => chatDisplay.ScrolledToBottom);
|
checkScrolledToBottom();
|
||||||
|
|
||||||
const int messages_per_call = 10;
|
const int messages_per_call = 10;
|
||||||
AddRepeatStep("add many messages", () =>
|
AddRepeatStep("add many messages", () =>
|
||||||
{
|
{
|
||||||
for (int i = 0; i < messages_per_call; i++)
|
for (int i = 0; i < messages_per_call; i++)
|
||||||
{
|
{
|
||||||
testChannel.AddNewMessages(new Message(sequence++)
|
testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||||
{
|
{
|
||||||
Sender = longUsernameUser,
|
Sender = longUsernameUser,
|
||||||
Content = "Many messages! " + Guid.NewGuid(),
|
Content = "Many messages! " + Guid.NewGuid(),
|
||||||
@ -153,9 +158,133 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("ensure still scrolled to bottom", () => chatDisplay.ScrolledToBottom);
|
checkScrolledToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests that when a message gets wrapped by the chat display getting contracted while scrolled to bottom, the chat will still keep scrolling down.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestMessageWrappingKeepsAutoScrolling()
|
||||||
|
{
|
||||||
|
fillChat();
|
||||||
|
|
||||||
|
// send message with short words for text wrapping to occur when contracting chat.
|
||||||
|
sendMessage();
|
||||||
|
|
||||||
|
AddStep("contract chat", () => chatDisplay.Width -= 100);
|
||||||
|
checkScrolledToBottom();
|
||||||
|
|
||||||
|
AddStep("send another message", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||||
|
{
|
||||||
|
Sender = admin,
|
||||||
|
Content = "As we were saying...",
|
||||||
|
}));
|
||||||
|
|
||||||
|
checkScrolledToBottom();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestUserScrollOverride()
|
||||||
|
{
|
||||||
|
fillChat();
|
||||||
|
|
||||||
|
sendMessage();
|
||||||
|
checkScrolledToBottom();
|
||||||
|
|
||||||
|
AddStep("User scroll up", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre);
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre + new Vector2(0, chatDisplay.ScreenSpaceDrawQuad.Height));
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNotScrolledToBottom();
|
||||||
|
sendMessage();
|
||||||
|
checkNotScrolledToBottom();
|
||||||
|
|
||||||
|
AddRepeatStep("User scroll to bottom", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre);
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre - new Vector2(0, chatDisplay.ScreenSpaceDrawQuad.Height));
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
}, 5);
|
||||||
|
|
||||||
|
checkScrolledToBottom();
|
||||||
|
sendMessage();
|
||||||
|
checkScrolledToBottom();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestLocalEchoMessageResetsScroll()
|
||||||
|
{
|
||||||
|
fillChat();
|
||||||
|
|
||||||
|
sendMessage();
|
||||||
|
checkScrolledToBottom();
|
||||||
|
|
||||||
|
AddStep("User scroll up", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre);
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre + new Vector2(0, chatDisplay.ScreenSpaceDrawQuad.Height));
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNotScrolledToBottom();
|
||||||
|
sendMessage();
|
||||||
|
checkNotScrolledToBottom();
|
||||||
|
|
||||||
|
sendLocalMessage();
|
||||||
|
checkScrolledToBottom();
|
||||||
|
|
||||||
|
sendMessage();
|
||||||
|
checkScrolledToBottom();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillChat()
|
||||||
|
{
|
||||||
|
AddStep("fill chat", () =>
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||||
|
{
|
||||||
|
Sender = longUsernameUser,
|
||||||
|
Content = $"some stuff {Guid.NewGuid()}",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
checkScrolledToBottom();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendMessage()
|
||||||
|
{
|
||||||
|
AddStep("send lorem ipsum", () => testChannel.AddNewMessages(new Message(messageIdSequence++)
|
||||||
|
{
|
||||||
|
Sender = longUsernameUser,
|
||||||
|
Content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce et bibendum velit.",
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendLocalMessage()
|
||||||
|
{
|
||||||
|
AddStep("send local echo", () => testChannel.AddLocalEcho(new LocalEchoMessage
|
||||||
|
{
|
||||||
|
Sender = longUsernameUser,
|
||||||
|
Content = "This is a local echo message.",
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkScrolledToBottom() =>
|
||||||
|
AddUntilStep("is scrolled to bottom", () => chatDisplay.ScrolledToBottom);
|
||||||
|
|
||||||
|
private void checkNotScrolledToBottom() =>
|
||||||
|
AddUntilStep("not scrolled to bottom", () => !chatDisplay.ScrolledToBottom);
|
||||||
|
|
||||||
private class TestStandAloneChatDisplay : StandAloneChatDisplay
|
private class TestStandAloneChatDisplay : StandAloneChatDisplay
|
||||||
{
|
{
|
||||||
public TestStandAloneChatDisplay(bool textbox = false)
|
public TestStandAloneChatDisplay(bool textbox = false)
|
||||||
@ -165,7 +294,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
|
|
||||||
protected DrawableChannel DrawableChannel => InternalChildren.OfType<DrawableChannel>().First();
|
protected DrawableChannel DrawableChannel => InternalChildren.OfType<DrawableChannel>().First();
|
||||||
|
|
||||||
protected OsuScrollContainer ScrollContainer => (OsuScrollContainer)((Container)DrawableChannel.Child).Child;
|
protected UserTrackingScrollContainer ScrollContainer => (UserTrackingScrollContainer)((Container)DrawableChannel.Child).Child;
|
||||||
|
|
||||||
public FillFlowContainer FillFlow => (FillFlowContainer)ScrollContainer.Child;
|
public FillFlowContainer FillFlow => (FillFlowContainer)ScrollContainer.Child;
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -28,12 +27,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
{
|
{
|
||||||
base.SetUpSteps();
|
base.SetUpSteps();
|
||||||
|
|
||||||
AddStep("push screen", () => LoadScreen(loungeScreen = new PlaylistsLoungeSubScreen
|
AddStep("push screen", () => LoadScreen(loungeScreen = new PlaylistsLoungeSubScreen()));
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Width = 0.5f,
|
|
||||||
}));
|
|
||||||
|
|
||||||
AddUntilStep("wait for present", () => loungeScreen.IsCurrentScreen());
|
AddUntilStep("wait for present", () => loungeScreen.IsCurrentScreen());
|
||||||
}
|
}
|
||||||
|
21
osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs
Normal file
21
osu.Game.Tests/Visual/UserInterface/TestSceneModIcon.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
|
{
|
||||||
|
public class TestSceneModIcon : OsuTestScene
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestChangeModType()
|
||||||
|
{
|
||||||
|
ModIcon icon = null;
|
||||||
|
|
||||||
|
AddStep("create mod icon", () => Child = icon = new ModIcon(new OsuModDoubleTime()));
|
||||||
|
AddStep("change mod", () => icon.Mod = new OsuModEasy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -25,6 +25,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool UserScrolling { get; private set; }
|
public bool UserScrolling { get; private set; }
|
||||||
|
|
||||||
|
public void CancelUserScroll() => UserScrolling = false;
|
||||||
|
|
||||||
public UserTrackingScrollContainer()
|
public UserTrackingScrollContainer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -45,5 +47,11 @@ namespace osu.Game.Graphics.Containers
|
|||||||
UserScrolling = false;
|
UserScrolling = false;
|
||||||
base.ScrollTo(value, animated, distanceDecay);
|
base.ScrollTo(value, animated, distanceDecay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public new void ScrollToEnd(bool animated = true, bool allowDuringDrag = false)
|
||||||
|
{
|
||||||
|
UserScrolling = false;
|
||||||
|
base.ScrollToEnd(animated, allowDuringDrag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Chat
|
namespace osu.Game.Overlays.Chat
|
||||||
@ -24,7 +25,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
{
|
{
|
||||||
public readonly Channel Channel;
|
public readonly Channel Channel;
|
||||||
protected FillFlowContainer ChatLineFlow;
|
protected FillFlowContainer ChatLineFlow;
|
||||||
private OsuScrollContainer scroll;
|
private ChannelScrollContainer scroll;
|
||||||
|
|
||||||
private bool scrollbarVisible = true;
|
private bool scrollbarVisible = true;
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Child = scroll = new OsuScrollContainer
|
Child = scroll = new ChannelScrollContainer
|
||||||
{
|
{
|
||||||
ScrollbarVisible = scrollbarVisible,
|
ScrollbarVisible = scrollbarVisible,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -80,12 +81,6 @@ namespace osu.Game.Overlays.Chat
|
|||||||
Channel.PendingMessageResolved += pendingMessageResolved;
|
Channel.PendingMessageResolved += pendingMessageResolved;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
scrollToEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
@ -113,8 +108,6 @@ namespace osu.Game.Overlays.Chat
|
|||||||
ChatLineFlow.Clear();
|
ChatLineFlow.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldScrollToEnd = scroll.IsScrolledToEnd(10) || !chatLines.Any() || newMessages.Any(m => m is LocalMessage);
|
|
||||||
|
|
||||||
// Add up to last Channel.MAX_HISTORY messages
|
// 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() - Channel.MAX_HISTORY));
|
||||||
|
|
||||||
@ -153,8 +146,10 @@ namespace osu.Game.Overlays.Chat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldScrollToEnd)
|
// due to the scroll adjusts from old messages removal above, a scroll-to-end must be enforced,
|
||||||
scrollToEnd();
|
// to avoid making the container think the user has scrolled back up and unwantedly disable auto-scrolling.
|
||||||
|
if (newMessages.Any(m => m is LocalMessage))
|
||||||
|
scroll.ScrollToEnd();
|
||||||
});
|
});
|
||||||
|
|
||||||
private void pendingMessageResolved(Message existing, Message updated) => Schedule(() =>
|
private void pendingMessageResolved(Message existing, Message updated) => Schedule(() =>
|
||||||
@ -178,8 +173,6 @@ namespace osu.Game.Overlays.Chat
|
|||||||
|
|
||||||
private IEnumerable<ChatLine> chatLines => ChatLineFlow.Children.OfType<ChatLine>();
|
private IEnumerable<ChatLine> chatLines => ChatLineFlow.Children.OfType<ChatLine>();
|
||||||
|
|
||||||
private void scrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd());
|
|
||||||
|
|
||||||
public class DaySeparator : Container
|
public class DaySeparator : Container
|
||||||
{
|
{
|
||||||
public float TextSize
|
public float TextSize
|
||||||
@ -243,5 +236,51 @@ namespace osu.Game.Overlays.Chat
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="OsuScrollContainer"/> with functionality to automatically scroll whenever the maximum scrollable distance increases.
|
||||||
|
/// </summary>
|
||||||
|
private class ChannelScrollContainer : UserTrackingScrollContainer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The chat will be automatically scrolled to end if and only if
|
||||||
|
/// the distance between the current scroll position and the end of the scroll
|
||||||
|
/// is less than this value.
|
||||||
|
/// </summary>
|
||||||
|
private const float auto_scroll_leniency = 10f;
|
||||||
|
|
||||||
|
private float? lastExtent;
|
||||||
|
|
||||||
|
protected override void OnUserScroll(float value, bool animated = true, double? distanceDecay = default)
|
||||||
|
{
|
||||||
|
base.OnUserScroll(value, animated, distanceDecay);
|
||||||
|
lastExtent = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
// If the user has scrolled to the bottom of the container, we should resume tracking new content.
|
||||||
|
if (UserScrolling && IsScrolledToEnd(auto_scroll_leniency))
|
||||||
|
CancelUserScroll();
|
||||||
|
|
||||||
|
// If the user hasn't overridden our behaviour and there has been new content added to the container, we should update our scroll position to track it.
|
||||||
|
bool requiresScrollUpdate = !UserScrolling && (lastExtent == null || Precision.AlmostBigger(ScrollableExtent, lastExtent.Value));
|
||||||
|
|
||||||
|
if (requiresScrollUpdate)
|
||||||
|
{
|
||||||
|
// Schedule required to allow FillFlow to be the correct size.
|
||||||
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
if (!UserScrolling)
|
||||||
|
{
|
||||||
|
ScrollToEnd();
|
||||||
|
lastExtent = ScrollableExtent;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,11 +95,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
@ -109,7 +109,16 @@ namespace osu.Game.Screens.Edit
|
|||||||
if (Beatmap.Value is DummyWorkingBeatmap)
|
if (Beatmap.Value is DummyWorkingBeatmap)
|
||||||
{
|
{
|
||||||
isNewBeatmap = true;
|
isNewBeatmap = true;
|
||||||
Beatmap.Value = beatmapManager.CreateNew(Ruleset.Value, api.LocalUser.Value);
|
|
||||||
|
var newBeatmap = beatmapManager.CreateNew(Ruleset.Value, api.LocalUser.Value);
|
||||||
|
|
||||||
|
// this is a bit haphazard, but guards against setting the lease Beatmap bindable if
|
||||||
|
// the editor has already been exited.
|
||||||
|
if (!ValidForPush)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// this probably shouldn't be set in the asynchronous load method, but everything following relies on it.
|
||||||
|
Beatmap.Value = newBeatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
beatDivisor.Value = Beatmap.Value.BeatmapInfo.BeatDivisor;
|
beatDivisor.Value = Beatmap.Value.BeatmapInfo.BeatDivisor;
|
||||||
|
@ -200,7 +200,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
Child = new GridContainer
|
Child = new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = 300,
|
Height = 500,
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Utils
|
|||||||
|
|
||||||
var options = new SentryOptions
|
var options = new SentryOptions
|
||||||
{
|
{
|
||||||
Dsn = new Dsn("https://5e342cd55f294edebdc9ad604d28bbd3@sentry.io/1255255"),
|
Dsn = "https://5e342cd55f294edebdc9ad604d28bbd3@sentry.io/1255255",
|
||||||
Release = game.Version
|
Release = game.Version
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.128.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.128.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1202.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1202.0" />
|
||||||
<PackageReference Include="Sentry" Version="2.1.8" />
|
<PackageReference Include="Sentry" Version="3.0.1" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
<PackageReference Include="SharpCompress" Version="0.27.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -89,10 +89,10 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.128.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.128.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
<PackageReference Include="SharpCompress" Version="0.27.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2020.923.0" ExcludeAssets="all" />
|
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2021.115.0" ExcludeAssets="all" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user