1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Merge branch 'master' into use-normalised-precise-scrolling

This commit is contained in:
Bartłomiej Dach 2022-05-27 16:55:13 +02:00
commit e511c1dfff
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
91 changed files with 1230 additions and 630 deletions

View File

@ -78,15 +78,6 @@ jobs:
with:
dotnet-version: "6.0.x"
# FIXME: libavformat is not included in Ubuntu. Let's fix that.
# https://github.com/ppy/osu-framework/issues/4349
# Remove this once https://github.com/actions/virtual-environments/issues/3306 has been resolved.
- name: Install libavformat-dev
if: ${{matrix.os.fullname == 'ubuntu-latest'}}
run: |
sudo apt-get update && \
sudo apt-get -y install libavformat-dev
- name: Compile
run: dotnet build -c Debug -warnaserror osu.Desktop.slnf

View File

@ -51,7 +51,7 @@
<Reference Include="Java.Interop" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.513.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.527.0" />
</ItemGroup>
<ItemGroup Label="Transitive Dependencies">

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Database;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Screens.Edit;
@ -45,6 +46,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
{
(typeof(EditorBeatmap), editorBeatmap),
(typeof(IBeatSnapProvider), editorBeatmap),
(typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Green)),
},
Child = new ComposeScreen { State = { Value = Visibility.Visible } },
};

View File

@ -898,5 +898,24 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.That(controlPoints[3].Type, Is.Null);
}
}
[Test]
public void TestLegacyDuplicateInitialCatmullPointIsMerged()
{
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
using (var resStream = TestResources.OpenResource("catmull-duplicate-initial-controlpoint.osu"))
using (var stream = new LineBufferedReader(resStream))
{
var decoded = decoder.Decode(stream);
var controlPoints = ((IHasPath)decoded.HitObjects[0]).Path.ControlPoints;
Assert.That(controlPoints.Count, Is.EqualTo(4));
Assert.That(controlPoints[0].Type, Is.EqualTo(PathType.Catmull));
Assert.That(controlPoints[0].Position, Is.EqualTo(Vector2.Zero));
Assert.That(controlPoints[1].Type, Is.Null);
Assert.That(controlPoints[1].Position, Is.Not.EqualTo(Vector2.Zero));
}
}
}
}

View File

@ -0,0 +1,2 @@
[HitObjects]
200,304,23875,6,0,C|200:304|288:304|288:208|352:208,1,260,8|0

View File

@ -5,11 +5,13 @@ using System;
using System.Diagnostics;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Testing;
using osu.Game.Overlays;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components;
using osuTK;
@ -23,7 +25,10 @@ namespace osu.Game.Tests.Visual.Editing
private BindableBeatDivisor bindableBeatDivisor;
private SliderBar<int> tickSliderBar => beatDivisorControl.ChildrenOfType<SliderBar<int>>().Single();
private EquilateralTriangle tickMarkerHead => tickSliderBar.ChildrenOfType<EquilateralTriangle>().Single();
private Triangle tickMarkerHead => tickSliderBar.ChildrenOfType<Triangle>().Single();
[Cached]
private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
[SetUp]
public void SetUp() => Schedule(() =>

View File

@ -9,6 +9,7 @@ using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Beatmaps;
@ -47,6 +48,7 @@ namespace osu.Game.Tests.Visual.Editing
{
(typeof(EditorBeatmap), editorBeatmap),
(typeof(IBeatSnapProvider), editorBeatmap),
(typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Green)),
},
Child = new ComposeScreen { State = { Value = Visibility.Visible } },
};

View File

@ -2,10 +2,13 @@
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Components;
using osu.Game.Tests.Beatmaps;
using osuTK;
namespace osu.Game.Tests.Visual.Editing
@ -13,6 +16,9 @@ namespace osu.Game.Tests.Visual.Editing
[TestFixture]
public class TestSceneEditorClock : EditorClockTestScene
{
[Cached]
private EditorBeatmap editorBeatmap = new EditorBeatmap(new TestBeatmap(new OsuRuleset().RulesetInfo));
public TestSceneEditorClock()
{
Add(new FillFlowContainer

View File

@ -2,10 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Screens.Edit.Components.Menus;
namespace osu.Game.Tests.Visual.Editing
@ -13,6 +15,9 @@ namespace osu.Game.Tests.Visual.Editing
[TestFixture]
public class TestSceneEditorMenuBar : OsuTestScene
{
[Cached]
private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
public TestSceneEditorMenuBar()
{
Add(new Container

View File

@ -12,7 +12,7 @@ using osuTK;
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestScenePlaybackControl : OsuTestScene
public class TestScenePlaybackControl : EditorClockTestScene
{
[BackgroundDependencyLoader]
private void load()

View File

@ -4,15 +4,15 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Timing;
using osuTK;
@ -22,9 +22,9 @@ namespace osu.Game.Tests.Visual.Editing
[TestFixture]
public class TestSceneTapTimingControl : EditorClockTestScene
{
[Cached(typeof(EditorBeatmap))]
[Cached(typeof(IBeatSnapProvider))]
private readonly EditorBeatmap editorBeatmap;
private EditorBeatmap editorBeatmap => editorBeatmapContainer?.EditorBeatmap;
private TestSceneHitObjectComposer.EditorBeatmapContainer editorBeatmapContainer;
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
@ -33,38 +33,48 @@ namespace osu.Game.Tests.Visual.Editing
private Bindable<ControlPointGroup> selectedGroup = new Bindable<ControlPointGroup>();
private TapTimingControl control;
private OsuSpriteText timingInfo;
public TestSceneTapTimingControl()
[Resolved]
private AudioManager audio { get; set; }
[SetUpSteps]
public void SetUpSteps()
{
var playableBeatmap = CreateBeatmap(new OsuRuleset().RulesetInfo);
AddStep("create beatmap", () =>
{
Beatmap.Value = new WaveformTestBeatmap(audio);
});
// Ensure time doesn't end while testing
playableBeatmap.BeatmapInfo.Length = 1200000;
AddStep("Create component", () =>
{
Child = editorBeatmapContainer = new TestSceneHitObjectComposer.EditorBeatmapContainer(Beatmap.Value)
{
Children = new Drawable[]
{
new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Y,
Width = 400,
Scale = new Vector2(1.5f),
Child = control = new TapTimingControl(),
},
timingInfo = new OsuSpriteText(),
}
};
editorBeatmap = new EditorBeatmap(playableBeatmap);
selectedGroup.Value = editorBeatmap.ControlPointInfo.Groups.First();
selectedGroup.Value = editorBeatmap.ControlPointInfo.Groups.First();
});
}
protected override void LoadComplete()
protected override void Update()
{
base.LoadComplete();
base.Update();
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
Beatmap.Disabled = true;
Children = new Drawable[]
{
new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Y,
Width = 400,
Scale = new Vector2(1.5f),
Child = control = new TapTimingControl(),
}
};
if (selectedGroup.Value != null)
timingInfo.Text = $"offset: {selectedGroup.Value.Time:N2} bpm: {selectedGroup.Value.ControlPoints.OfType<TimingControlPoint>().First().BPM:N2}";
}
[Test]
@ -104,7 +114,13 @@ namespace osu.Game.Tests.Visual.Editing
.TriggerClick();
});
AddSliderStep("BPM", 30, 400, 60, bpm => editorBeatmap.ControlPointInfo.TimingPoints.First().BeatLength = 60000f / bpm);
AddSliderStep("BPM", 30, 400, 128, bpm =>
{
if (editorBeatmap == null)
return;
editorBeatmap.ControlPointInfo.TimingPoints.First().BeatLength = 60000f / bpm;
});
}
protected override void Dispose(bool isDisposing)

View File

@ -4,6 +4,7 @@
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Overlays;
using osu.Game.Screens.Edit.Compose.Components;
using osuTK;
@ -14,6 +15,9 @@ namespace osu.Game.Tests.Visual.Editing
{
public override Drawable CreateTestComponent() => Empty(); // tick display is implicitly inside the timeline.
[Cached]
private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Green);
[BackgroundDependencyLoader]
private void load()
{

View File

@ -9,7 +9,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Testing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Mods;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Mods;
@ -73,19 +72,23 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
createFreeModSelect();
AddAssert("select all button enabled", () => this.ChildrenOfType<SelectAllModsButton>().Single().Enabled.Value);
AddStep("click select all button", () =>
{
InputManager.MoveMouseTo(this.ChildrenOfType<ShearedButton>().ElementAt(1));
InputManager.MoveMouseTo(this.ChildrenOfType<SelectAllModsButton>().Single());
InputManager.Click(MouseButton.Left);
});
AddUntilStep("all mods selected", assertAllAvailableModsSelected);
AddAssert("select all button disabled", () => !this.ChildrenOfType<SelectAllModsButton>().Single().Enabled.Value);
AddStep("click deselect all button", () =>
{
InputManager.MoveMouseTo(this.ChildrenOfType<ShearedButton>().Last());
InputManager.MoveMouseTo(this.ChildrenOfType<DeselectAllModsButton>().Single());
InputManager.Click(MouseButton.Left);
});
AddUntilStep("all mods deselected", () => !freeModSelectOverlay.SelectedMods.Value.Any());
AddAssert("select all button enabled", () => this.ChildrenOfType<SelectAllModsButton>().Single().Enabled.Value);
}
private void createFreeModSelect()

View File

@ -40,7 +40,7 @@ namespace osu.Game.Tests.Visual.Navigation
typeof(DashboardOverlay),
typeof(NewsOverlay),
typeof(ChannelManager),
typeof(ChatOverlay),
typeof(ChatOverlayV2),
typeof(SettingsOverlay),
typeof(UserProfileOverlay),
typeof(BeatmapSetOverlay),

View File

@ -86,9 +86,9 @@ namespace osu.Game.Tests.Visual.Navigation
[Test]
public void TestOverlaysAlwaysClosed()
{
ChatOverlay chat = null;
ChatOverlayV2 chat = null;
AddUntilStep("is at menu", () => Game.ScreenStack.CurrentScreen is MainMenu);
AddUntilStep("wait for chat load", () => (chat = Game.ChildrenOfType<ChatOverlay>().SingleOrDefault()) != null);
AddUntilStep("wait for chat load", () => (chat = Game.ChildrenOfType<ChatOverlayV2>().SingleOrDefault()) != null);
AddStep("show chat", () => InputManager.Key(Key.F8));

View File

@ -8,9 +8,11 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Collections;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Leaderboards;
@ -54,6 +56,39 @@ namespace osu.Game.Tests.Visual.Navigation
exitViaEscapeAndConfirm();
}
[Test]
public void TestSongSelectBackActionHandling()
{
TestPlaySongSelect songSelect = null;
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
AddStep("set filter", () => songSelect.ChildrenOfType<SearchTextBox>().Single().Current.Value = "test");
AddStep("press back", () => InputManager.Click(MouseButton.Button1));
AddAssert("still at song select", () => Game.ScreenStack.CurrentScreen == songSelect);
AddAssert("filter cleared", () => string.IsNullOrEmpty(songSelect.ChildrenOfType<SearchTextBox>().Single().Current.Value));
AddStep("set filter again", () => songSelect.ChildrenOfType<SearchTextBox>().Single().Current.Value = "test");
AddStep("open collections dropdown", () =>
{
InputManager.MoveMouseTo(songSelect.ChildrenOfType<CollectionFilterDropdown>().Single());
InputManager.Click(MouseButton.Left);
});
AddStep("press back once", () => InputManager.Click(MouseButton.Button1));
AddAssert("still at song select", () => Game.ScreenStack.CurrentScreen == songSelect);
AddAssert("collections dropdown closed", () => songSelect
.ChildrenOfType<CollectionFilterDropdown>().Single()
.ChildrenOfType<Dropdown<CollectionFilterMenuItem>.DropdownMenu>().Single().State == MenuState.Closed);
AddStep("press back a second time", () => InputManager.Click(MouseButton.Button1));
AddAssert("filter cleared", () => string.IsNullOrEmpty(songSelect.ChildrenOfType<SearchTextBox>().Single().Current.Value));
AddStep("press back a third time", () => InputManager.Click(MouseButton.Button1));
ConfirmAtMainMenu();
}
/// <summary>
/// This tests that the F1 key will open the mod select overlay, and not be handled / blocked by the music controller (which has the same default binding
/// but should be handled *after* song select).
@ -487,6 +522,9 @@ namespace osu.Game.Tests.Visual.Navigation
AddStep("move cursor to background", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.BottomRight));
AddStep("click left mouse button", () => InputManager.Click(MouseButton.Left));
AddAssert("now playing is hidden", () => nowPlayingOverlay.State.Value == Visibility.Hidden);
// move the mouse firmly inside game bounds to avoid interfering with other tests.
AddStep("center cursor", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre));
}
[Test]

View File

@ -10,7 +10,10 @@ using osu.Game.Rulesets;
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Testing;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.BeatmapSet.Scores;
using APIUser = osu.Game.Online.API.Requests.Responses.APIUser;
namespace osu.Game.Tests.Visual.Online
@ -101,6 +104,14 @@ namespace osu.Game.Tests.Visual.Online
AddStep("show many difficulties", () => overlay.ShowBeatmapSet(createManyDifficultiesBeatmapSet()));
downloadAssert(true);
AddAssert("status is loved", () => overlay.ChildrenOfType<BeatmapSetOnlineStatusPill>().Single().Status == BeatmapOnlineStatus.Loved);
AddAssert("scores container is visible", () => overlay.ChildrenOfType<ScoresContainer>().Single().Alpha == 1);
AddStep("go to second beatmap", () => overlay.ChildrenOfType<BeatmapPicker.DifficultySelectorButton>().ElementAt(1).TriggerClick());
AddAssert("status is graveyard", () => overlay.ChildrenOfType<BeatmapSetOnlineStatusPill>().Single().Status == BeatmapOnlineStatus.Graveyard);
AddAssert("scores container is hidden", () => overlay.ChildrenOfType<ScoresContainer>().Single().Alpha == 0);
}
[Test]
@ -232,6 +243,7 @@ namespace osu.Game.Tests.Visual.Online
Fails = Enumerable.Range(1, 100).Select(j => j % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(j => j % 12 - 6).ToArray(),
},
Status = i % 2 == 0 ? BeatmapOnlineStatus.Graveyard : BeatmapOnlineStatus.Loved,
});
}

View File

@ -12,7 +12,6 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Chat;
using osu.Game.Overlays;
using osu.Game.Overlays.Chat;
using osuTK.Graphics;
@ -22,12 +21,10 @@ namespace osu.Game.Tests.Visual.Online
public class TestSceneChatLink : OsuTestScene
{
private readonly TestChatLineContainer textContainer;
private readonly DialogOverlay dialogOverlay;
private Color4 linkColour;
public TestSceneChatLink()
{
Add(dialogOverlay = new DialogOverlay { Depth = float.MinValue });
Add(textContainer = new TestChatLineContainer
{
Padding = new MarginPadding { Left = 20, Right = 20 },
@ -47,9 +44,6 @@ namespace osu.Game.Tests.Visual.Online
availableChannels.Add(new Channel { Name = "#english" });
availableChannels.Add(new Channel { Name = "#japanese" });
Dependencies.Cache(chatManager);
Dependencies.Cache(new ChatOverlay());
Dependencies.CacheAs<IDialogOverlay>(dialogOverlay);
}
[SetUp]

View File

@ -12,6 +12,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Logging;
using osu.Framework.Testing;
using osu.Framework.Utils;
@ -63,7 +64,7 @@ namespace osu.Game.Tests.Visual.Online
Children = new Drawable[]
{
channelManager,
chatOverlay = new TestChatOverlayV2 { RelativeSizeAxes = Axes.Both },
chatOverlay = new TestChatOverlayV2(),
},
};
});
@ -417,6 +418,67 @@ namespace osu.Game.Tests.Visual.Online
AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1);
}
[Test]
public void TestKeyboardCloseAndRestoreChannel()
{
AddStep("Show overlay with channel 1", () =>
{
channelManager.JoinChannel(testChannel1);
chatOverlay.Show();
});
AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1);
AddStep("Press document close keys", () => InputManager.Keys(PlatformAction.DocumentClose));
AddAssert("Listing is visible", () => listingIsVisible);
AddStep("Press tab restore keys", () => InputManager.Keys(PlatformAction.TabRestore));
AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1);
}
[Test]
public void TestKeyboardNewChannel()
{
AddStep("Show overlay with channel 1", () =>
{
channelManager.JoinChannel(testChannel1);
chatOverlay.Show();
});
AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1);
AddStep("Press tab new keys", () => InputManager.Keys(PlatformAction.TabNew));
AddAssert("Listing is visible", () => listingIsVisible);
}
[Test]
public void TestKeyboardNextChannel()
{
Channel pmChannel1 = createPrivateChannel();
Channel pmChannel2 = createPrivateChannel();
AddStep("Show overlay with channels", () =>
{
channelManager.JoinChannel(testChannel1);
channelManager.JoinChannel(testChannel2);
channelManager.JoinChannel(pmChannel1);
channelManager.JoinChannel(pmChannel2);
chatOverlay.Show();
});
AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1);
AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext));
AddAssert("Channel 2 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel2);
AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext));
AddAssert("PM Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == pmChannel1);
AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext));
AddAssert("PM Channel 2 displayed", () => channelIsVisible && currentDrawableChannel.Channel == pmChannel2);
AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext));
AddAssert("Channel 1 displayed", () => channelIsVisible && currentDrawableChannel.Channel == testChannel1);
}
private bool listingIsVisible =>
chatOverlay.ChildrenOfType<ChannelListing>().Single().State.Value == Visibility.Visible;
@ -467,6 +529,16 @@ namespace osu.Game.Tests.Visual.Online
Type = ChannelType.Public,
};
private Channel createPrivateChannel()
{
int id = RNG.Next(0, 10000);
return new Channel(new APIUser
{
Id = id,
Username = $"test user {id}",
});
}
private class TestChatOverlayV2 : ChatOverlayV2
{
public bool SlowLoading { get; set; }

View File

@ -208,7 +208,7 @@ namespace osu.Game.Tests.Visual.Online
};
[Cached]
public ChatOverlay ChatOverlay { get; } = new ChatOverlay();
public ChatOverlayV2 ChatOverlay { get; } = new ChatOverlayV2();
private readonly MessageNotifier messageNotifier = new MessageNotifier();

View File

@ -185,7 +185,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{
AddStep("step to next", () => overlay.NextButton.TriggerClick());
AddAssert("is at known screen", () => overlay.CurrentScreen is ScreenBeatmaps);
AddAssert("is at known screen", () => overlay.CurrentScreen is ScreenUIScale);
AddStep("hide", () => overlay.Hide());
AddAssert("overlay hidden", () => overlay.State.Value == Visibility.Hidden);
@ -195,7 +195,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("run notification action", () => lastNotification.Activated());
AddAssert("overlay shown", () => overlay.State.Value == Visibility.Visible);
AddAssert("is resumed", () => overlay.CurrentScreen is ScreenBeatmaps);
AddAssert("is resumed", () => overlay.CurrentScreen is ScreenUIScale);
}
// interface mocks break hot reload, mocking this stub implementation instead works around it.

View File

@ -435,15 +435,19 @@ namespace osu.Game.Tests.Visual.UserInterface
createScreen();
changeRuleset(0);
AddAssert("deselect all button disabled", () => !this.ChildrenOfType<DeselectAllModsButton>().Single().Enabled.Value);
AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() });
AddAssert("DT + HD selected", () => modSelectOverlay.ChildrenOfType<ModPanel>().Count(panel => panel.Active.Value) == 2);
AddAssert("deselect all button enabled", () => this.ChildrenOfType<DeselectAllModsButton>().Single().Enabled.Value);
AddStep("click deselect all button", () =>
{
InputManager.MoveMouseTo(this.ChildrenOfType<ShearedButton>().Last());
InputManager.MoveMouseTo(this.ChildrenOfType<DeselectAllModsButton>().Single());
InputManager.Click(MouseButton.Left);
});
AddUntilStep("all mods deselected", () => !SelectedMods.Value.Any());
AddAssert("deselect all button disabled", () => !this.ChildrenOfType<DeselectAllModsButton>().Single().Enabled.Value);
}
[Test]

View File

@ -5,9 +5,12 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
namespace osu.Game.Tests.Visual.UserInterface
{
@ -15,14 +18,31 @@ namespace osu.Game.Tests.Visual.UserInterface
{
private readonly BindableBool enabled = new BindableBool(true);
protected override Drawable CreateContent() => new RoundedButton
protected override Drawable CreateContent()
{
Width = 400,
Text = "Test button",
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Enabled = { BindTarget = enabled },
};
return new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new RoundedButton
{
Width = 400,
Text = "Test button",
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Enabled = { BindTarget = enabled },
},
new SettingsButton
{
Text = "Test button",
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Enabled = { BindTarget = enabled },
},
}
};
}
[Test]
public void TestDisabled()
@ -34,7 +54,8 @@ namespace osu.Game.Tests.Visual.UserInterface
public void TestBackgroundColour()
{
AddStep("set red scheme", () => CreateThemedContent(OverlayColourScheme.Red));
AddAssert("first button has correct colour", () => Cell(0, 1).ChildrenOfType<RoundedButton>().First().BackgroundColour == new OverlayColourProvider(OverlayColourScheme.Red).Highlight1);
AddAssert("rounded button has correct colour", () => Cell(0, 1).ChildrenOfType<RoundedButton>().First().BackgroundColour == new OsuColour().Blue3);
AddAssert("settings button has correct colour", () => Cell(0, 1).ChildrenOfType<SettingsButton>().First().BackgroundColour == new OverlayColourProvider(OverlayColourScheme.Red).Highlight1);
}
}
}

View File

@ -1,6 +1,8 @@
// 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.
#nullable enable
using osu.Framework.Bindables;
using osu.Game.Beatmaps.Timing;
using osu.Game.Graphics;

View File

@ -59,7 +59,7 @@ namespace osu.Game.Beatmaps.Formats
}
catch (Exception e)
{
Logger.Log($"Failed to process line \"{line}\" into \"{output}\": {e.Message}", LoggingTarget.Runtime, LogLevel.Important);
Logger.Log($"Failed to process line \"{line}\" into \"{output}\": {e.Message}");
}
}
}

View File

@ -46,7 +46,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation);
SetDefault(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2f, 1f);
SetDefault(OsuSetting.ChatDisplayHeight, ChatOverlayV2.DEFAULT_HEIGHT, 0.2f, 1f);
SetDefault(OsuSetting.BeatmapListingCardSize, BeatmapCardSize.Normal);

View File

@ -12,9 +12,12 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Input.Bindings;
using osu.Game.Overlays;
using osuTK;
using osuTK.Graphics;
@ -31,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface
#region OsuDropdownMenu
protected class OsuDropdownMenu : DropdownMenu
protected class OsuDropdownMenu : DropdownMenu, IKeyBindingHandler<GlobalAction>
{
public override bool HandleNonPositionalInput => State == MenuState.Open;
@ -275,6 +278,23 @@ namespace osu.Game.Graphics.UserInterface
}
#endregion
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (e.Repeat) return false;
if (e.Action == GlobalAction.Back)
{
State = MenuState.Closed;
return true;
}
return false;
}
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}
}
#endregion

View File

@ -154,7 +154,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
[BackgroundDependencyLoader(true)]
private void load(OverlayColourProvider? colourProvider, OsuColour osuColour)
{
background.Colour = colourProvider?.Background4 ?? Color4Extensions.FromHex(@"1c2125");
background.Colour = colourProvider?.Background5 ?? Color4Extensions.FromHex(@"1c2125");
descriptionText.Colour = osuColour.Yellow;
}

View File

@ -2,13 +2,11 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
namespace osu.Game.Graphics.UserInterfaceV2
{
@ -27,9 +25,12 @@ namespace osu.Game.Graphics.UserInterfaceV2
}
[BackgroundDependencyLoader(true)]
private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours)
private void load(OsuColour colours)
{
DefaultBackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3;
// According to flyte, buttons are supposed to have explicit colours for now.
// Not sure this is the correct direction, but we haven't decided on an `OverlayColourProvider` stand-in yet.
// This is a better default. See `SettingsButton` for an override which uses `OverlayColourProvider`.
DefaultBackgroundColour = colours.Blue3;
}
protected override void LoadComplete()

View File

@ -13,5 +13,6 @@ namespace osu.Game.Online.Chat
PM,
Group,
System,
Announce,
}
}

View File

@ -27,7 +27,7 @@ namespace osu.Game.Online.Chat
private INotificationOverlay notifications { get; set; }
[Resolved]
private ChatOverlay chatOverlay { get; set; }
private ChatOverlayV2 chatOverlay { get; set; }
[Resolved]
private ChannelManager channelManager { get; set; }
@ -170,7 +170,7 @@ namespace osu.Game.Online.Chat
public override bool IsImportant => false;
[BackgroundDependencyLoader]
private void load(OsuColour colours, ChatOverlay chatOverlay, INotificationOverlay notificationOverlay)
private void load(OsuColour colours, ChatOverlayV2 chatOverlay, INotificationOverlay notificationOverlay)
{
IconBackground.Colour = colours.PurpleDark;

View File

@ -75,7 +75,7 @@ namespace osu.Game
public Toolbar Toolbar;
private ChatOverlay chatOverlay;
private ChatOverlayV2 chatOverlay;
private ChannelManager channelManager;
@ -848,7 +848,7 @@ namespace osu.Game
loadComponentSingleFile(news = new NewsOverlay(), overlayContent.Add, true);
var rankingsOverlay = loadComponentSingleFile(new RankingsOverlay(), overlayContent.Add, true);
loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal, true);
loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add, true);
loadComponentSingleFile(chatOverlay = new ChatOverlayV2(), overlayContent.Add, true);
loadComponentSingleFile(new MessageNotifier(), AddInternal, true);
loadComponentSingleFile(Settings = new SettingsOverlay(), leftFloatingOverlayContent.Add, true);
loadComponentSingleFile(changelogOverlay = new ChangelogOverlay(), overlayContent.Add, true);

View File

@ -32,6 +32,9 @@ namespace osu.Game.Overlays.BeatmapListing
[Description("Pending & WIP")]
Pending,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.StatusWip))]
Wip,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.StatusGraveyard))]
Graveyard,

View File

@ -21,6 +21,9 @@ namespace osu.Game.Overlays.BeatmapListing
[Description("Subscribed mappers")]
Follows,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.GeneralSpotlights))]
Spotlights,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.GeneralFeaturedArtists))]
[Description("Featured artists")]
FeaturedArtists

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
@ -229,6 +230,8 @@ namespace osu.Game.Overlays.BeatmapSet
{
Details.BeatmapInfo = b.NewValue;
externalLink.Link = $@"{api.WebsiteRootUrl}/beatmapsets/{BeatmapSet.Value?.OnlineID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineID}";
onlineStatusPill.Status = b.NewValue?.Status ?? BeatmapOnlineStatus.None;
};
}
@ -272,7 +275,6 @@ namespace osu.Game.Overlays.BeatmapSet
featuredArtist.Alpha = setInfo.NewValue.TrackId != null ? 1 : 0;
onlineStatusPill.FadeIn(500, Easing.OutQuint);
onlineStatusPill.Status = setInfo.NewValue.Status;
downloadButtonsContainer.FadeIn(transition_duration);
favouriteButton.FadeIn(transition_duration);

View File

@ -253,7 +253,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
noScoresPlaceholder.Hide();
if (Beatmap.Value == null || Beatmap.Value.OnlineID <= 0 || (Beatmap.Value.BeatmapSet as IBeatmapSetOnlineInfo)?.Status <= BeatmapOnlineStatus.Pending)
if (Beatmap.Value == null || Beatmap.Value.OnlineID <= 0 || (Beatmap.Value.Status <= BeatmapOnlineStatus.Pending))
{
Scores = null;
Hide();

View File

@ -4,16 +4,20 @@
#nullable enable
using System;
using System.Linq;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat;
using osu.Game.Overlays.Chat.Listing;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Chat.ChannelList
{
@ -22,10 +26,13 @@ namespace osu.Game.Overlays.Chat.ChannelList
public Action<Channel>? OnRequestSelect;
public Action<Channel>? OnRequestLeave;
public IEnumerable<Channel> Channels => publicChannelFlow.Channels.Concat(privateChannelFlow.Channels);
public readonly ChannelListing.ChannelListingChannel ChannelListingChannel = new ChannelListing.ChannelListingChannel();
private readonly Dictionary<Channel, ChannelListItem> channelMap = new Dictionary<Channel, ChannelListItem>();
private OsuScrollContainer scroll = null!;
private ChannelListItemFlow publicChannelFlow = null!;
private ChannelListItemFlow privateChannelFlow = null!;
private ChannelListItem selector = null!;
@ -40,7 +47,7 @@ namespace osu.Game.Overlays.Chat.ChannelList
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background6,
},
new OsuScrollContainer
scroll = new OsuScrollContainer
{
Padding = new MarginPadding { Vertical = 7 },
RelativeSizeAxes = Axes.Both,
@ -53,12 +60,14 @@ namespace osu.Game.Overlays.Chat.ChannelList
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
publicChannelFlow = new ChannelListItemFlow("CHANNELS"),
new ChannelListLabel(ChatStrings.ChannelsListTitlePUBLIC.ToUpper()),
publicChannelFlow = new ChannelListItemFlow(),
selector = new ChannelListItem(ChannelListingChannel)
{
Margin = new MarginPadding { Bottom = 10 },
},
privateChannelFlow = new ChannelListItemFlow("DIRECT MESSAGES"),
new ChannelListLabel(ChatStrings.ChannelsListTitlePM.ToUpper()),
privateChannelFlow = new ChannelListItemFlow(),
},
},
},
@ -101,6 +110,8 @@ namespace osu.Game.Overlays.Chat.ChannelList
return channelMap[channel];
}
public void ScrollChannelIntoView(Channel channel) => scroll.ScrollIntoView(GetItem(channel));
private ChannelListItemFlow getFlowForChannel(Channel channel)
{
switch (channel.Type)
@ -112,24 +123,29 @@ namespace osu.Game.Overlays.Chat.ChannelList
return privateChannelFlow;
default:
throw new ArgumentOutOfRangeException();
return publicChannelFlow;
}
}
private class ChannelListItemFlow : FillFlowContainer
private class ChannelListLabel : OsuSpriteText
{
public ChannelListItemFlow(string label)
public ChannelListLabel(LocalisableString label)
{
Text = label;
Margin = new MarginPadding { Left = 18, Bottom = 5 };
Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold);
}
}
private class ChannelListItemFlow : FillFlowContainer<ChannelListItem>
{
public IEnumerable<Channel> Channels => Children.Select(c => c.Channel);
public ChannelListItemFlow()
{
Direction = FillDirection.Vertical;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Add(new OsuSpriteText
{
Text = label,
Margin = new MarginPadding { Left = 18, Bottom = 5 },
Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold),
});
}
}
}

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
using osuTK;
using osuTK.Graphics;
@ -58,7 +59,7 @@ namespace osu.Game.Overlays.Chat
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = "osu!chat",
Text = ChatStrings.TitleCompact,
Font = OsuFont.Torus.With(size: 16, weight: FontWeight.SemiBold),
Margin = new MarginPadding { Bottom = 2f },
},

View File

@ -14,6 +14,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat;
using osu.Game.Resources.Localisation.Web;
using osuTK;
namespace osu.Game.Overlays.Chat
@ -141,11 +142,11 @@ namespace osu.Game.Overlays.Chat
switch (newChannel?.Type)
{
case ChannelType.Public:
chattingText.Text = $"chatting in {newChannel.Name}";
chattingText.Text = ChatStrings.TalkingIn(newChannel.Name);
break;
case ChannelType.PM:
chattingText.Text = $"chatting with {newChannel.Name}";
chattingText.Text = ChatStrings.TalkingWith(newChannel.Name);
break;
default:

View File

@ -5,6 +5,7 @@
using osu.Framework.Bindables;
using osu.Game.Graphics.UserInterface;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Chat
{
@ -22,7 +23,7 @@ namespace osu.Game.Overlays.Chat
{
bool showSearch = change.NewValue;
PlaceholderText = showSearch ? "type here to search" : "type here";
PlaceholderText = showSearch ? HomeStrings.SearchPlaceholder : ChatStrings.InputPlaceholder;
Text = string.Empty;
}, true);
}

View File

@ -3,7 +3,6 @@
#nullable enable
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
@ -13,6 +12,8 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Configuration;
@ -26,7 +27,7 @@ using osu.Game.Overlays.Chat.Listing;
namespace osu.Game.Overlays
{
public class ChatOverlayV2 : OsuFocusedOverlayContainer, INamedOverlayComponent
public class ChatOverlayV2 : OsuFocusedOverlayContainer, INamedOverlayComponent, IKeyBindingHandler<PlatformAction>
{
public string IconTexture => "Icons/Hexacons/messaging";
public LocalisableString Title => ChatStrings.HeaderTitle;
@ -47,8 +48,9 @@ namespace osu.Game.Overlays
private bool isDraggingTopBar;
private float dragStartChatHeight;
public const float DEFAULT_HEIGHT = 0.4f;
private const int transition_length = 500;
private const float default_chat_height = 0.4f;
private const float top_bar_height = 40;
private const float side_bar_width = 190;
private const float chat_bar_height = 60;
@ -70,7 +72,7 @@ namespace osu.Game.Overlays
public ChatOverlayV2()
{
Height = default_chat_height;
Height = DEFAULT_HEIGHT;
Masking = true;
@ -82,6 +84,7 @@ namespace osu.Game.Overlays
Margin = new MarginPadding { Bottom = -corner_radius };
Padding = new MarginPadding { Bottom = corner_radius };
RelativeSizeAxes = Axes.Both;
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
}
@ -153,13 +156,15 @@ namespace osu.Game.Overlays
chatHeight.BindValueChanged(height => { Height = height.NewValue; }, true);
currentChannel.BindTo(channelManager.CurrentChannel);
currentChannel.BindValueChanged(currentChannelChanged, true);
joinedChannels.BindTo(channelManager.JoinedChannels);
joinedChannels.BindCollectionChanged(joinedChannelsChanged, true);
availableChannels.BindTo(channelManager.AvailableChannels);
availableChannels.BindCollectionChanged(availableChannelsChanged, true);
Schedule(() =>
{
currentChannel.BindValueChanged(currentChannelChanged, true);
joinedChannels.BindCollectionChanged(joinedChannelsChanged, true);
availableChannels.BindCollectionChanged(availableChannelsChanged, true);
});
channelList.OnRequestSelect += channel => channelManager.CurrentChannel.Value = channel;
channelList.OnRequestLeave += channel => channelManager.LeaveChannel(channel);
@ -193,6 +198,39 @@ namespace osu.Game.Overlays
Show();
}
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
switch (e.Action)
{
case PlatformAction.TabNew:
currentChannel.Value = channelList.ChannelListingChannel;
return true;
case PlatformAction.DocumentClose:
channelManager.LeaveChannel(currentChannel.Value);
return true;
case PlatformAction.TabRestore:
channelManager.JoinLastClosedChannel();
return true;
case PlatformAction.DocumentPrevious:
cycleChannel(-1);
return true;
case PlatformAction.DocumentNext:
cycleChannel(1);
return true;
default:
return false;
}
}
public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{
}
protected override bool OnDragStart(DragStartEvent e)
{
isDraggingTopBar = topBar.IsHovered;
@ -294,6 +332,10 @@ namespace osu.Game.Overlays
});
}
}
// Mark channel as read when channel switched
if (newChannel.Messages.Any())
channelManager.MarkChannelAsRead(newChannel);
}
protected virtual ChatOverlayDrawableChannel CreateDrawableChannel(Channel newChannel) => new ChatOverlayDrawableChannel(newChannel);
@ -303,7 +345,7 @@ namespace osu.Game.Overlays
switch (args.Action)
{
case NotifyCollectionChangedAction.Add:
IEnumerable<Channel> newChannels = filterChannels(args.NewItems);
IEnumerable<Channel> newChannels = args.NewItems.OfType<Channel>().Where(isChatChannel);
foreach (var channel in newChannels)
channelList.AddChannel(channel);
@ -311,7 +353,7 @@ namespace osu.Game.Overlays
break;
case NotifyCollectionChangedAction.Remove:
IEnumerable<Channel> leftChannels = filterChannels(args.OldItems);
IEnumerable<Channel> leftChannels = args.OldItems.OfType<Channel>().Where(isChatChannel);
foreach (var channel in leftChannels)
{
@ -333,9 +375,6 @@ namespace osu.Game.Overlays
private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
=> channelListing.UpdateAvailableChannels(channelManager.AvailableChannels);
private IEnumerable<Channel> filterChannels(IList channels)
=> channels.Cast<Channel>().Where(c => c.Type == ChannelType.Public || c.Type == ChannelType.PM);
private void handleChatMessage(string message)
{
if (string.IsNullOrWhiteSpace(message))
@ -346,5 +385,36 @@ namespace osu.Game.Overlays
else
channelManager.PostMessage(message);
}
private void cycleChannel(int direction)
{
List<Channel> overlayChannels = channelList.Channels.ToList();
if (overlayChannels.Count < 2)
return;
int currentIndex = overlayChannels.IndexOf(currentChannel.Value);
currentChannel.Value = overlayChannels[(currentIndex + direction + overlayChannels.Count) % overlayChannels.Count];
channelList.ScrollChannelIntoView(currentChannel.Value);
}
/// <summary>
/// Whether a channel should be displayed in this overlay, based on its type.
/// </summary>
private static bool isChatChannel(Channel channel)
{
switch (channel.Type)
{
case ChannelType.Multiplayer:
case ChannelType.Spectator:
case ChannelType.Temporary:
return false;
default:
return true;
}
}
}
}

View File

@ -76,10 +76,10 @@ namespace osu.Game.Overlays
private void load(OsuColour colours, LegacyImportManager? legacyImportManager)
{
steps.Add(typeof(ScreenWelcome));
steps.Add(typeof(ScreenUIScale));
steps.Add(typeof(ScreenBeatmaps));
if (legacyImportManager?.SupportsImportFromStable == true)
steps.Add(typeof(ScreenImportFromStable));
steps.Add(typeof(ScreenUIScale));
steps.Add(typeof(ScreenBehaviour));
Header.Title = FirstRunSetupOverlayStrings.FirstRunSetupTitle;

View File

@ -0,0 +1,54 @@
// 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 System.Collections.Generic;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Input.Bindings;
using osu.Game.Localisation;
using osu.Game.Rulesets.Mods;
namespace osu.Game.Overlays.Mods
{
public class DeselectAllModsButton : ShearedButton, IKeyBindingHandler<GlobalAction>
{
private readonly Bindable<IReadOnlyList<Mod>> selectedMods = new Bindable<IReadOnlyList<Mod>>();
public DeselectAllModsButton(ModSelectOverlay modSelectOverlay)
: base(ModSelectOverlay.BUTTON_WIDTH)
{
Text = CommonStrings.DeselectAll;
Action = modSelectOverlay.DeselectAll;
selectedMods.BindTo(modSelectOverlay.SelectedMods);
}
protected override void LoadComplete()
{
base.LoadComplete();
selectedMods.BindValueChanged(_ => updateEnabledState(), true);
}
private void updateEnabledState()
{
Enabled.Value = selectedMods.Value.Any();
}
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (e.Repeat || e.Action != GlobalAction.DeselectAllMods)
return false;
TriggerClick();
return true;
}
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}
}
}

View File

@ -267,7 +267,7 @@ namespace osu.Game.Overlays.Mods
{
cancellationTokenSource?.Cancel();
var panels = availableMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0)));
var panels = availableMods.Select(mod => CreateModPanel(mod).With(panel => panel.Shear = Vector2.Zero));
Task? loadTask;

View File

@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Mods
Content.Masking = true;
Content.CornerRadius = CORNER_RADIUS;
Content.BorderThickness = 2;
Content.Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0);
Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0);
Children = new Drawable[]
{

View File

@ -29,11 +29,20 @@ namespace osu.Game.Overlays.Mods
{
public abstract class ModSelectOverlay : ShearedOverlayContainer, ISamplePlaybackDisabler
{
protected const int BUTTON_WIDTH = 200;
public const int BUTTON_WIDTH = 200;
[Cached]
public Bindable<IReadOnlyList<Mod>> SelectedMods { get; private set; } = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
/// <summary>
/// Contains a dictionary with the current <see cref="ModState"/> of all mods applicable for the current ruleset.
/// </summary>
/// <remarks>
/// Contrary to <see cref="OsuGameBase.AvailableMods"/> and <see cref="globalAvailableMods"/>, the <see cref="Mod"/> instances
/// inside the <see cref="ModState"/> objects are owned solely by this <see cref="ModSelectOverlay"/> instance.
/// </remarks>
public Bindable<Dictionary<ModType, IReadOnlyList<ModState>>> AvailableMods { get; } = new Bindable<Dictionary<ModType, IReadOnlyList<ModState>>>(new Dictionary<ModType, IReadOnlyList<ModState>>());
private Func<Mod, bool> isValidMod = m => true;
/// <summary>
@ -76,16 +85,12 @@ namespace osu.Game.Overlays.Mods
};
}
yield return deselectAllButton = new ShearedButton(BUTTON_WIDTH)
{
Text = CommonStrings.DeselectAll,
Action = DeselectAll
};
yield return new DeselectAllModsButton(this);
}
private readonly Bindable<Dictionary<ModType, IReadOnlyList<Mod>>> availableMods = new Bindable<Dictionary<ModType, IReadOnlyList<Mod>>>();
private readonly Dictionary<ModType, IReadOnlyList<ModState>> localAvailableMods = new Dictionary<ModType, IReadOnlyList<ModState>>();
private IEnumerable<ModState> allLocalAvailableMods => localAvailableMods.SelectMany(pair => pair.Value);
private readonly Bindable<Dictionary<ModType, IReadOnlyList<Mod>>> globalAvailableMods = new Bindable<Dictionary<ModType, IReadOnlyList<Mod>>>();
private IEnumerable<ModState> allAvailableMods => AvailableMods.Value.SelectMany(pair => pair.Value);
private readonly BindableBool customisationVisible = new BindableBool();
@ -98,7 +103,6 @@ namespace osu.Game.Overlays.Mods
private DifficultyMultiplierDisplay? multiplierDisplay;
private ShearedToggleButton? customisationButton;
private ShearedButton? deselectAllButton;
protected ModSelectOverlay(OverlayColourScheme colourScheme = OverlayColourScheme.Green)
: base(colourScheme)
@ -209,13 +213,13 @@ namespace osu.Game.Overlays.Mods
})
};
availableMods.BindTo(game.AvailableMods);
globalAvailableMods.BindTo(game.AvailableMods);
}
protected override void LoadComplete()
{
// this is called before base call so that the mod state is populated early, and the transition in `PopIn()` can play out properly.
availableMods.BindValueChanged(_ => createLocalMods(), true);
globalAvailableMods.BindValueChanged(_ => createLocalMods(), true);
base.LoadComplete();
@ -247,7 +251,7 @@ namespace osu.Game.Overlays.Mods
/// <summary>
/// Select all visible mods in all columns.
/// </summary>
protected void SelectAll()
public void SelectAll()
{
foreach (var column in columnFlow.Columns)
column.SelectAll();
@ -256,7 +260,7 @@ namespace osu.Game.Overlays.Mods
/// <summary>
/// Deselect all visible mods in all columns.
/// </summary>
protected void DeselectAll()
public void DeselectAll()
{
foreach (var column in columnFlow.Columns)
column.DeselectAll();
@ -280,9 +284,9 @@ namespace osu.Game.Overlays.Mods
private void createLocalMods()
{
localAvailableMods.Clear();
var newLocalAvailableMods = new Dictionary<ModType, IReadOnlyList<ModState>>();
foreach (var (modType, mods) in availableMods.Value)
foreach (var (modType, mods) in globalAvailableMods.Value)
{
var modStates = mods.SelectMany(ModUtils.FlattenMod)
.Select(mod => new ModState(mod.DeepClone()))
@ -291,18 +295,19 @@ namespace osu.Game.Overlays.Mods
foreach (var modState in modStates)
modState.Active.BindValueChanged(_ => updateFromInternalSelection());
localAvailableMods[modType] = modStates;
newLocalAvailableMods[modType] = modStates;
}
AvailableMods.Value = newLocalAvailableMods;
filterMods();
foreach (var column in columnFlow.Columns)
column.AvailableMods = localAvailableMods.GetValueOrDefault(column.ModType, Array.Empty<ModState>());
column.AvailableMods = AvailableMods.Value.GetValueOrDefault(column.ModType, Array.Empty<ModState>());
}
private void filterMods()
{
foreach (var modState in allLocalAvailableMods)
foreach (var modState in allAvailableMods)
modState.Filtered.Value = !modState.Mod.HasImplementation || !IsValidMod.Invoke(modState.Mod);
}
@ -383,7 +388,7 @@ namespace osu.Game.Overlays.Mods
var newSelection = new List<Mod>();
foreach (var modState in allLocalAvailableMods)
foreach (var modState in allAvailableMods)
{
var matchingSelectedMod = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == modState.Mod.GetType());
@ -410,9 +415,9 @@ namespace osu.Game.Overlays.Mods
if (externalSelectionUpdateInProgress)
return;
var candidateSelection = allLocalAvailableMods.Where(modState => modState.Active.Value)
.Select(modState => modState.Mod)
.ToArray();
var candidateSelection = allAvailableMods.Where(modState => modState.Active.Value)
.Select(modState => modState.Mod)
.ToArray();
SelectedMods.Value = ComputeNewModsFromSelection(SelectedMods.Value, candidateSelection);
}
@ -514,10 +519,6 @@ namespace osu.Game.Overlays.Mods
hideOverlay(true);
return true;
}
case GlobalAction.DeselectAllMods:
deselectAllButton?.TriggerClick();
return true;
}
return base.OnPressed(e);

View File

@ -0,0 +1,61 @@
// 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 System.Collections.Generic;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.OnlinePlay;
namespace osu.Game.Overlays.Mods
{
public class SelectAllModsButton : ShearedButton, IKeyBindingHandler<PlatformAction>
{
private readonly Bindable<IReadOnlyList<Mod>> selectedMods = new Bindable<IReadOnlyList<Mod>>();
private readonly Bindable<Dictionary<ModType, IReadOnlyList<ModState>>> availableMods = new Bindable<Dictionary<ModType, IReadOnlyList<ModState>>>();
public SelectAllModsButton(FreeModSelectOverlay modSelectOverlay)
: base(ModSelectOverlay.BUTTON_WIDTH)
{
Text = CommonStrings.SelectAll;
Action = modSelectOverlay.SelectAll;
selectedMods.BindTo(modSelectOverlay.SelectedMods);
availableMods.BindTo(modSelectOverlay.AvailableMods);
}
protected override void LoadComplete()
{
base.LoadComplete();
selectedMods.BindValueChanged(_ => Scheduler.AddOnce(updateEnabledState));
availableMods.BindValueChanged(_ => Scheduler.AddOnce(updateEnabledState));
updateEnabledState();
}
private void updateEnabledState()
{
Enabled.Value = availableMods.Value
.SelectMany(pair => pair.Value)
.Any(modState => !modState.Active.Value && !modState.Filtered.Value);
}
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
if (e.Repeat || e.Action != PlatformAction.SelectAll)
return false;
TriggerClick();
return true;
}
public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{
}
}
}

View File

@ -72,6 +72,9 @@ namespace osu.Game.Overlays
case OverlayColourScheme.Green:
return 125 / 360f;
case OverlayColourScheme.Aquamarine:
return 160 / 360f;
case OverlayColourScheme.Purple:
return 255 / 360f;
@ -94,5 +97,6 @@ namespace osu.Game.Overlays
Purple,
Blue,
Plum,
Aquamarine
}
}

View File

@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
private UserProfileOverlay userOverlay { get; set; }
[Resolved(CanBeNull = true)]
private ChatOverlay chatOverlay { get; set; }
private ChatOverlayV2 chatOverlay { get; set; }
[Resolved]
private IAPIProvider apiProvider { get; set; }

View File

@ -3,9 +3,12 @@
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Overlays.Settings
@ -18,6 +21,12 @@ namespace osu.Game.Overlays.Settings
Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS, Right = SettingsPanel.CONTENT_MARGINS };
}
[BackgroundDependencyLoader(true)]
private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours)
{
DefaultBackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3;
}
public LocalisableString TooltipText { get; set; }
public override IEnumerable<LocalisableString> FilterTerms

View File

@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Toolbar
}
[BackgroundDependencyLoader(true)]
private void load(ChatOverlay chat)
private void load(ChatOverlayV2 chat)
{
StateContainer = chat;
}

View File

@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Edit
{
AddInternal(RightSideToolboxContainer = new ExpandingToolboxContainer(130, 250)
{
Padding = new MarginPadding { Right = 10 },
Padding = new MarginPadding(10),
Alpha = DistanceSpacingMultiplier.Disabled ? 0 : 1,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,

View File

@ -114,9 +114,9 @@ namespace osu.Game.Rulesets.Edit
.WithChild(BlueprintContainer = CreateBlueprintContainer())
}
},
new ExpandingToolboxContainer(80, 200)
new ExpandingToolboxContainer(90, 200)
{
Padding = new MarginPadding { Left = 10 },
Padding = new MarginPadding(10),
Children = new Drawable[]
{
new EditorToolboxGroup("toolbox (1-9)")

View File

@ -340,8 +340,10 @@ namespace osu.Game.Rulesets.Objects.Legacy
if (vertices[endIndex].Position != vertices[endIndex - 1].Position)
continue;
// Adjacent legacy Catmull segments should be treated as a single segment.
if (FormatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION && type == PathType.Catmull)
// Legacy Catmull sliders don't support multiple segments, so adjacent Catmull segments should be treated as a single one.
// Importantly, this is not applied to the first control point, which may duplicate the slider path's position
// resulting in a duplicate (0,0) control point in the resultant list.
if (type == PathType.Catmull && endIndex > 1 && FormatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION)
continue;
// The last control point of each segment is not allowed to start a new implicit segment.

View File

@ -5,6 +5,7 @@ using System.Linq;
using osu.Framework.Bindables;
using osu.Game.Graphics;
using osu.Game.Screens.Edit.Compose.Components;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit
@ -100,6 +101,32 @@ namespace osu.Game.Screens.Edit
}
}
/// <summary>
/// Get a relative display size for the specified divisor.
/// </summary>
/// <param name="beatDivisor">The beat divisor.</param>
/// <returns>A relative size which can be used to display ticks.</returns>
public static Vector2 GetSize(int beatDivisor)
{
switch (beatDivisor)
{
case 1:
case 2:
return new Vector2(0.6f, 0.9f);
case 3:
case 4:
return new Vector2(0.5f, 0.8f);
case 6:
case 8:
return new Vector2(0.4f, 0.7f);
default:
return new Vector2(0.3f, 0.6f);
}
}
/// <summary>
/// Retrieves the applicable divisor for a specific beat index.
/// </summary>

View File

@ -0,0 +1,70 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Overlays;
using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osuTK;
namespace osu.Game.Screens.Edit
{
internal class BottomBar : CompositeDrawable
{
public TestGameplayButton TestGameplayButton { get; private set; }
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, Editor editor)
{
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomLeft;
RelativeSizeAxes = Axes.X;
Height = 60;
InternalChildren = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background4,
},
new Container
{
RelativeSizeAxes = Axes.Both,
Child = new GridContainer
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.Absolute, 170),
new Dimension(),
new Dimension(GridSizeMode.Absolute, 220),
new Dimension(GridSizeMode.Absolute, 120),
},
Content = new[]
{
new Drawable[]
{
new TimeInfoContainer { RelativeSizeAxes = Axes.Both },
new SummaryTimeline { RelativeSizeAxes = Axes.Both },
new PlaybackControl { RelativeSizeAxes = Axes.Both },
TestGameplayButton = new TestGameplayButton
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = 10 },
Size = new Vector2(1),
Action = editor.TestGameplay,
}
},
}
},
}
};
}
}
}

View File

@ -8,20 +8,19 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Components
{
public class BottomBarContainer : Container
{
private const float corner_radius = 5;
private const float contents_padding = 15;
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
protected readonly IBindable<Track> Track = new Bindable<Track>();
private readonly Drawable background;
protected readonly Drawable Background;
private readonly Container content;
protected override Container<Drawable> Content => content;
@ -29,11 +28,14 @@ namespace osu.Game.Screens.Edit.Components
public BottomBarContainer()
{
Masking = true;
CornerRadius = corner_radius;
InternalChildren = new[]
{
background = new Box { RelativeSizeAxes = Axes.Both },
Background = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Transparent,
},
content = new Container
{
RelativeSizeAxes = Axes.Both,
@ -43,12 +45,10 @@ namespace osu.Game.Screens.Edit.Components
}
[BackgroundDependencyLoader]
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours, EditorClock clock)
private void load(IBindable<WorkingBeatmap> beatmap, EditorClock clock)
{
Beatmap.BindTo(beatmap);
Track.BindTo(clock.Track);
background.Colour = colours.Gray1;
}
}
}

View File

@ -2,16 +2,13 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Components.Menus
{
@ -24,7 +21,12 @@ namespace osu.Game.Screens.Edit.Components.Menus
MaskingContainer.CornerRadius = 0;
ItemsContainer.Padding = new MarginPadding { Left = 100 };
BackgroundColour = Color4Extensions.FromHex("111");
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
BackgroundColour = colourProvider.Background3;
}
protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu();
@ -33,29 +35,26 @@ namespace osu.Game.Screens.Edit.Components.Menus
private class DrawableEditorBarMenuItem : DrawableOsuMenuItem
{
private BackgroundBox background;
public DrawableEditorBarMenuItem(MenuItem item)
: base(item)
{
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
StateChanged += stateChanged;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
ForegroundColour = colours.BlueLight;
BackgroundColour = Color4.Transparent;
ForegroundColourHover = Color4.White;
BackgroundColourHover = colours.Gray3;
ForegroundColour = colourProvider.Light3;
BackgroundColour = colourProvider.Background2;
ForegroundColourHover = colourProvider.Content1;
BackgroundColourHover = colourProvider.Background1;
}
public override void SetFlowDirection(Direction direction)
protected override void LoadComplete()
{
AutoSizeAxes = Axes.Both;
base.LoadComplete();
Foreground.Anchor = Anchor.CentreLeft;
Foreground.Origin = Anchor.CentreLeft;
}
protected override void UpdateBackgroundColour()
@ -74,54 +73,16 @@ namespace osu.Game.Screens.Edit.Components.Menus
base.UpdateForegroundColour();
}
private void stateChanged(MenuItemState newState)
{
if (newState == MenuItemState.Selected)
background.Expand();
else
background.Contract();
}
protected override Drawable CreateBackground() => background = new BackgroundBox();
protected override DrawableOsuMenuItem.TextContainer CreateTextContainer() => new TextContainer();
private new class TextContainer : DrawableOsuMenuItem.TextContainer
{
public TextContainer()
{
NormalText.Font = NormalText.Font.With(size: 14);
BoldText.Font = BoldText.Font.With(size: 14);
NormalText.Margin = BoldText.Margin = new MarginPadding { Horizontal = 10, Vertical = MARGIN_VERTICAL };
NormalText.Font = OsuFont.TorusAlternate;
BoldText.Font = OsuFont.TorusAlternate.With(weight: FontWeight.Bold);
}
}
private class BackgroundBox : CompositeDrawable
{
private readonly Container innerBackground;
public BackgroundBox()
{
RelativeSizeAxes = Axes.Both;
Masking = true;
InternalChild = innerBackground = new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 4,
Child = new Box { RelativeSizeAxes = Axes.Both }
};
}
/// <summary>
/// Expands the background such that it doesn't show the bottom corners.
/// </summary>
public void Expand() => innerBackground.Height = 2;
/// <summary>
/// Contracts the background such that it shows the bottom corners.
/// </summary>
public void Contract() => innerBackground.Height = 1;
}
}
private class SubMenu : OsuMenu
@ -129,14 +90,15 @@ namespace osu.Game.Screens.Edit.Components.Menus
public SubMenu()
: base(Direction.Vertical)
{
OriginPosition = new Vector2(5, 1);
ItemsContainer.Padding = new MarginPadding { Top = 5, Bottom = 5 };
ItemsContainer.Padding = new MarginPadding();
MaskingContainer.CornerRadius = 0;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
BackgroundColour = colours.Gray3;
BackgroundColour = colourProvider.Background2;
}
protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu();
@ -147,9 +109,47 @@ namespace osu.Game.Screens.Edit.Components.Menus
{
case EditorMenuItemSpacer spacer:
return new DrawableSpacer(spacer);
case StatefulMenuItem stateful:
return new EditorStatefulMenuItem(stateful);
default:
return new EditorMenuItem(item);
}
}
private class EditorStatefulMenuItem : DrawableStatefulMenuItem
{
public EditorStatefulMenuItem(StatefulMenuItem item)
: base(item)
{
}
return base.CreateDrawableMenuItem(item);
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
BackgroundColour = colourProvider.Background2;
BackgroundColourHover = colourProvider.Background1;
Foreground.Padding = new MarginPadding { Vertical = 2 };
}
}
private class EditorMenuItem : DrawableOsuMenuItem
{
public EditorMenuItem(MenuItem item)
: base(item)
{
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
BackgroundColour = colourProvider.Background2;
BackgroundColourHover = colourProvider.Background1;
Foreground.Padding = new MarginPadding { Vertical = 2 };
}
}
private class DrawableSpacer : DrawableOsuMenuItem
@ -157,6 +157,7 @@ namespace osu.Game.Screens.Edit.Components.Menus
public DrawableSpacer(MenuItem item)
: base(item)
{
Scale = new Vector2(1, 0.3f);
}
protected override bool OnHover(HoverEvent e) => true;

View File

@ -2,42 +2,38 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Components.Menus
{
public class ScreenSelectionTabControl : OsuTabControl<EditorScreenMode>
public class EditorScreenSwitcherControl : OsuTabControl<EditorScreenMode>
{
public ScreenSelectionTabControl()
public EditorScreenSwitcherControl()
{
AutoSizeAxes = Axes.X;
RelativeSizeAxes = Axes.Y;
TabContainer.RelativeSizeAxes &= ~Axes.X;
TabContainer.AutoSizeAxes = Axes.X;
TabContainer.Padding = new MarginPadding();
AddInternal(new Box
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
Height = 1,
Colour = Color4.White.Opacity(0.2f),
});
TabContainer.Padding = new MarginPadding(10);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
AccentColour = colours.Yellow;
AccentColour = colourProvider.Light3;
AddInternal(new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background2,
});
}
protected override Dropdown<EditorScreenMode> CreateDropdown() => null;
@ -54,6 +50,15 @@ namespace osu.Game.Screens.Edit.Components.Menus
Text.Margin = new MarginPadding();
Text.Anchor = Anchor.CentreLeft;
Text.Origin = Anchor.CentreLeft;
Text.Font = OsuFont.TorusAlternate;
Bar.Expire();
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
}
protected override void OnActivated()

View File

@ -16,6 +16,7 @@ using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osuTK.Input;
namespace osu.Game.Screens.Edit.Components
@ -155,10 +156,10 @@ namespace osu.Game.Screens.Edit.Components
private Color4 normalColour;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
text.Colour = normalColour = colours.YellowDarker;
textBold.Colour = hoveredColour = colours.Yellow;
text.Colour = normalColour = colourProvider.Light3;
textBold.Colour = hoveredColour = colourProvider.Content1;
}
protected override bool OnHover(HoverEvent e)

View File

@ -6,28 +6,43 @@ using osu.Game.Graphics.Sprites;
using osu.Framework.Allocation;
using osu.Game.Extensions;
using osu.Game.Graphics;
using osu.Game.Overlays;
using osuTK;
namespace osu.Game.Screens.Edit.Components
{
public class TimeInfoContainer : BottomBarContainer
{
private readonly OsuSpriteText trackTimer;
private OsuSpriteText trackTimer;
private OsuSpriteText bpm;
[Resolved]
private EditorBeatmap editorBeatmap { get; set; }
[Resolved]
private EditorClock editorClock { get; set; }
public TimeInfoContainer()
[BackgroundDependencyLoader]
private void load(OsuColour colours, OverlayColourProvider colourProvider)
{
Background.Colour = colourProvider.Background5;
Children = new Drawable[]
{
trackTimer = new OsuSpriteText
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
// intentionally fudged centre to avoid movement of the number portion when
// going negative.
X = -35,
Font = OsuFont.GetFont(size: 25, fixedWidth: true),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Spacing = new Vector2(-2, 0),
Font = OsuFont.Torus.With(size: 36, fixedWidth: true, weight: FontWeight.Light),
Y = -10,
},
bpm = new OsuSpriteText
{
Colour = colours.Orange1,
Anchor = Anchor.CentreLeft,
Font = OsuFont.Torus.With(size: 18, weight: FontWeight.SemiBold),
Position = new Vector2(2, 5),
}
};
}
@ -36,6 +51,7 @@ namespace osu.Game.Screens.Edit.Components
{
base.Update();
trackTimer.Text = editorClock.CurrentTime.ToEditorFormattedString();
bpm.Text = @$"{editorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime).BPM:0} BPM";
}
}
}

View File

@ -1,13 +1,13 @@
// 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 osuTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Overlays;
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
using osuTK;
namespace osu.Game.Screens.Edit.Components.Timelines.Summary
{
@ -17,8 +17,10 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
public class SummaryTimeline : BottomBarContainer
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
Background.Colour = colourProvider.Background6;
Children = new Drawable[]
{
new MarkerPart { RelativeSizeAxes = Axes.Both },
@ -41,7 +43,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
{
Name = "centre line",
RelativeSizeAxes = Axes.Both,
Colour = colours.Gray5,
Colour = colourProvider.Background2,
Children = new Drawable[]
{
new Circle

View File

@ -28,6 +28,8 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
BackgroundColour = colours.Orange1;
SpriteText.Colour = colourProvider.Background6;
Content.CornerRadius = 0;
Text = "Test!";
}
}

View File

@ -8,9 +8,7 @@ using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
@ -22,6 +20,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
@ -38,18 +37,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
Masking = true;
CornerRadius = 5;
InternalChildren = new Drawable[]
{
new Box
{
Name = "Gray Background",
Name = "Main background",
RelativeSizeAxes = Axes.Both,
Colour = colours.Gray4
Colour = colourProvider.Background3,
},
new GridContainer
{
@ -65,9 +63,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
new Box
{
Name = "Black Background",
Name = "Tick area background",
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black
Colour = colourProvider.Background5,
},
new TickSliderBar(beatDivisor)
{
@ -86,7 +84,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colours.Gray4
Colour = colourProvider.Background3
},
new Container
{
@ -139,11 +137,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colours.Gray4
},
new Container
{
RelativeSizeAxes = Axes.Both,
@ -402,15 +395,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
ClearInternal();
CurrentNumber.ValueChanged -= moveMarker;
foreach (int t in beatDivisor.ValidDivisors.Value.Presets)
foreach (int divisor in beatDivisor.ValidDivisors.Value.Presets)
{
AddInternal(new Tick
AddInternal(new Tick(divisor)
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopCentre,
RelativePositionAxes = Axes.X,
Colour = BindableBeatDivisor.GetColourFor(t, colours),
X = getMappedPosition(t)
Anchor = Anchor.CentreLeft,
Origin = Anchor.Centre,
RelativePositionAxes = Axes.Both,
Colour = BindableBeatDivisor.GetColourFor(divisor, colours),
X = getMappedPosition(divisor),
});
}
@ -422,7 +415,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void moveMarker(ValueChangedEvent<int> divisor)
{
marker.MoveToX(getMappedPosition(divisor.NewValue), 100, Easing.OutQuint);
marker.Flash();
}
protected override void UpdateValue(float value)
@ -453,6 +445,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected override bool OnMouseDown(MouseDownEvent e)
{
marker.Active = true;
handleMouseInput(e.ScreenSpaceMousePosition);
return base.OnMouseDown(e);
}
@ -489,52 +482,36 @@ namespace osu.Game.Screens.Edit.Compose.Components
private float getMappedPosition(float divisor) => MathF.Pow((divisor - 1) / (beatDivisor.ValidDivisors.Value.Presets.Last() - 1), 0.90f);
private class Tick : CompositeDrawable
private class Tick : Circle
{
public Tick()
public Tick(int divisor)
{
Size = new Vector2(2.5f, 10);
Size = new Vector2(6f, 12) * BindableBeatDivisor.GetSize(divisor);
InternalChild = new Box { RelativeSizeAxes = Axes.Both };
CornerRadius = 0.5f;
Masking = true;
}
}
private class Marker : CompositeDrawable
{
private Color4 defaultColour;
private const float size = 7;
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load()
{
Colour = defaultColour = colours.Gray4;
Anchor = Anchor.TopLeft;
Origin = Anchor.TopCentre;
Colour = colourProvider.Background3;
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomCentre;
Size = new Vector2(8, 6.5f);
Width = size;
RelativeSizeAxes = Axes.Y;
RelativePositionAxes = Axes.X;
InternalChildren = new Drawable[]
{
new Box
new Triangle
{
Width = 2,
RelativeSizeAxes = Axes.Y,
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
Colour = ColourInfo.GradientVertical(Color4.White.Opacity(0.2f), Color4.White),
Blending = BlendingParameters.Additive,
},
new EquilateralTriangle
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
Height = size,
RelativeSizeAxes = Axes.Both,
EdgeSmoothness = new Vector2(1),
Colour = Color4.White,
}
@ -548,22 +525,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
get => active;
set
{
this.FadeColour(value ? Color4.White : defaultColour, 500, Easing.OutQuint);
this.FadeColour(value ? colourProvider.Background1 : colourProvider.Background3, 500, Easing.OutQuint);
active = value;
}
}
public void Flash()
{
bool wasActive = active;
Active = true;
if (wasActive) return;
using (BeginDelayedSequence(50))
Active = false;
}
}
}
}

View File

@ -163,10 +163,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
base.LoadComplete();
WaveformVisible.BindValueChanged(_ => updateWaveformOpacity());
waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), true);
WaveformVisible.ValueChanged += _ => updateWaveformOpacity();
TicksVisible.ValueChanged += visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
TicksVisible.BindValueChanged(visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint), true);
ControlPointsVisible.BindValueChanged(visible =>
{
if (visible.NewValue)

View File

@ -2,12 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osuTK;
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
@ -27,10 +27,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}
[BackgroundDependencyLoader]
private void load()
private void load(OverlayColourProvider colourProvider)
{
Masking = true;
CornerRadius = 5;
OsuCheckbox waveformCheckbox;
OsuCheckbox controlPointsCheckbox;
@ -41,7 +40,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex("111")
Colour = colourProvider.Background5
},
new GridContainer
{
@ -55,12 +54,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Name = @"Toggle controls",
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex("222")
Colour = colourProvider.Background2,
},
new FillFlowContainer
{
@ -94,12 +94,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Name = @"Zoom controls",
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex("333")
Colour = colourProvider.Background3,
},
new Container<TimelineButton>
{

View File

@ -11,6 +11,7 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;
using osuTK;
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
@ -132,10 +133,15 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
// even though "bar lines" take up the full vertical space, we render them in two pieces because it allows for less anchor/origin churn.
Vector2 size = Vector2.One;
if (indexInBar != 1)
size = BindableBeatDivisor.GetSize(divisor);
var line = getNextUsableLine();
line.X = xPos;
line.Width = PointVisualisation.MAX_WIDTH * getWidth(indexInBar, divisor);
line.Height = 0.9f * getHeight(indexInBar, divisor);
line.Width = PointVisualisation.MAX_WIDTH * size.X;
line.Height = 0.9f * size.Y;
line.Colour = colour;
}
@ -170,54 +176,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}
}
private static float getWidth(int indexInBar, int divisor)
{
if (indexInBar == 0)
return 1;
switch (divisor)
{
case 1:
case 2:
return 0.6f;
case 3:
case 4:
return 0.5f;
case 6:
case 8:
return 0.4f;
default:
return 0.3f;
}
}
private static float getHeight(int indexInBar, int divisor)
{
if (indexInBar == 0)
return 1;
switch (divisor)
{
case 1:
case 2:
return 0.9f;
case 3:
case 4:
return 0.8f;
case 6:
case 8:
return 0.7f;
default:
return 0.6f;
}
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);

View File

@ -12,7 +12,6 @@ using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
@ -26,7 +25,6 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.UserInterface;
using osu.Game.Input.Bindings;
@ -37,9 +35,7 @@ using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Edit.Components.Menus;
using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osu.Game.Screens.Edit.Compose;
using osu.Game.Screens.Edit.Design;
using osu.Game.Screens.Edit.GameplayTest;
@ -48,7 +44,6 @@ using osu.Game.Screens.Edit.Timing;
using osu.Game.Screens.Edit.Verify;
using osu.Game.Screens.Play;
using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
@ -119,13 +114,13 @@ namespace osu.Game.Screens.Edit
private IBeatmap playableBeatmap;
private EditorBeatmap editorBeatmap;
private BottomBar bottomBar;
[CanBeNull] // Should be non-null once it can support custom rulesets.
private EditorChangeHandler changeHandler;
private DependencyContainer dependencies;
private TestGameplayButton testGameplayButton;
private bool isNewBeatmap;
protected override UserActivity InitialActivity => new UserActivity.Editing(Beatmap.Value.BeatmapInfo);
@ -140,7 +135,7 @@ namespace osu.Game.Screens.Edit
public readonly EditorClipboard Clipboard = new EditorClipboard();
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
public Editor(EditorLoader loader = null)
{
@ -148,7 +143,7 @@ namespace osu.Game.Screens.Edit
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, OsuConfigManager config)
private void load(OsuConfigManager config)
{
var loadableBeatmap = Beatmap.Value;
@ -226,7 +221,7 @@ namespace osu.Game.Screens.Edit
AddInternal(new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.Both,
Children = new[]
Children = new Drawable[]
{
new Container
{
@ -278,7 +273,7 @@ namespace osu.Game.Screens.Edit
}
}
},
new ScreenSelectionTabControl
new EditorScreenSwitcherControl
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
@ -287,67 +282,7 @@ namespace osu.Game.Screens.Edit
},
},
},
new Container
{
Name = "Bottom bar",
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
Height = 60,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colours.Gray2
},
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Vertical = 5, Horizontal = 10 },
Child = new GridContainer
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.Absolute, 220),
new Dimension(),
new Dimension(GridSizeMode.Absolute, 220),
new Dimension(GridSizeMode.Absolute, 120),
},
Content = new[]
{
new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Right = 10 },
Child = new TimeInfoContainer { RelativeSizeAxes = Axes.Both },
},
new SummaryTimeline
{
RelativeSizeAxes = Axes.Both,
},
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = 10 },
Child = new PlaybackControl { RelativeSizeAxes = Axes.Both },
},
testGameplayButton = new TestGameplayButton
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = 10 },
Size = new Vector2(1),
Action = testGameplay
}
},
}
},
}
}
},
bottomBar = new BottomBar(),
}
});
@ -392,6 +327,24 @@ namespace osu.Game.Screens.Edit
Clipboard.Content.Value = state.ClipboardContent;
});
public void TestGameplay()
{
if (HasUnsavedChanges)
{
dialogOverlay.Push(new SaveBeforeGameplayTestDialog(() =>
{
Save();
pushEditorPlayer();
}));
}
else
{
pushEditorPlayer();
}
void pushEditorPlayer() => this.Push(new EditorPlayerLoader(this));
}
/// <summary>
/// Saves the currently edited beatmap.
/// </summary>
@ -589,7 +542,7 @@ namespace osu.Game.Screens.Edit
return true;
case GlobalAction.EditorTestGameplay:
testGameplayButton.TriggerClick();
bottomBar.TestGameplayButton.TriggerClick();
return true;
default:
@ -777,6 +730,7 @@ namespace osu.Game.Screens.Edit
if ((currentScreen = screenContainer.SingleOrDefault(s => s.Type == e.NewValue)) != null)
{
screenContainer.ChangeChildDepth(currentScreen, lastScreen?.Depth + 1 ?? 0);
currentScreen.Show();
return;
}
@ -934,24 +888,6 @@ namespace osu.Game.Screens.Edit
loader?.CancelPendingDifficultySwitch();
}
private void testGameplay()
{
if (HasUnsavedChanges)
{
dialogOverlay.Push(new SaveBeforeGameplayTestDialog(() =>
{
Save();
pushEditorPlayer();
}));
}
else
{
pushEditorPlayer();
}
void pushEditorPlayer() => this.Push(new EditorPlayerLoader(this));
}
public double SnapTime(double time, double? referenceTime) => editorBeatmap.SnapTime(time, referenceTime);
public double GetBeatLengthAtTime(double referenceTime) => editorBeatmap.GetBeatLengthAtTime(referenceTime);

View File

@ -1,53 +0,0 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Overlays;
namespace osu.Game.Screens.Edit
{
public class EditorRoundedScreen : EditorScreen
{
public const int HORIZONTAL_PADDING = 100;
private Container roundedContent;
protected override Container<Drawable> Content => roundedContent;
public EditorRoundedScreen(EditorScreenMode mode)
: base(mode)
{
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
base.Content.Add(new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(50),
Child = new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 10,
Children = new Drawable[]
{
new Box
{
Colour = colourProvider.Background3,
RelativeSizeAxes = Axes.Both,
},
roundedContent = new Container
{
RelativeSizeAxes = Axes.Both,
},
}
}
});
}
}
}

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays;
using osuTK;
namespace osu.Game.Screens.Edit
{
@ -22,7 +23,7 @@ namespace osu.Game.Screens.Edit
{
new Box
{
Colour = colours.Background4,
Colour = colours.Background6,
RelativeSizeAxes = Axes.Both,
},
new OsuScrollContainer
@ -33,6 +34,8 @@ namespace osu.Game.Screens.Edit
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Padding = new MarginPadding(10),
Spacing = new Vector2(10),
Children = CreateSections()
},
}

View File

@ -33,17 +33,9 @@ namespace osu.Game.Screens.Edit
InternalChild = content = new PopoverContainer { RelativeSizeAxes = Axes.Both };
}
protected override void PopIn()
{
this.ScaleTo(1f, 200, Easing.OutQuint)
.FadeIn(200, Easing.OutQuint);
}
protected override void PopIn() => this.FadeIn();
protected override void PopOut()
{
this.ScaleTo(0.98f, 200, Easing.OutQuint)
.FadeOut(200, Easing.OutQuint);
}
protected override void PopOut() => this.FadeOut();
#region Clipboard operations

View File

@ -3,21 +3,19 @@
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit
{
public abstract class EditorScreenWithTimeline : EditorScreen
{
private const float vertical_margins = 10;
private const float horizontal_margins = 20;
private const float padding = 10;
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
@ -33,7 +31,7 @@ namespace osu.Game.Screens.Edit
private LoadingSpinner spinner;
[BackgroundDependencyLoader(true)]
private void load([CanBeNull] BindableBeatDivisor beatDivisor)
private void load(OverlayColourProvider colourProvider, [CanBeNull] BindableBeatDivisor beatDivisor)
{
if (beatDivisor != null)
this.beatDivisor.BindTo(beatDivisor);
@ -60,14 +58,14 @@ namespace osu.Game.Screens.Edit
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0.5f)
Colour = colourProvider.Background4
},
new Container
{
Name = "Timeline content",
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = horizontal_margins, Vertical = vertical_margins },
Padding = new MarginPadding { Horizontal = padding, Top = padding },
Child = new GridContainer
{
RelativeSizeAxes = Axes.X,
@ -106,12 +104,6 @@ namespace osu.Game.Screens.Edit
Name = "Main content",
RelativeSizeAxes = Axes.Both,
Depth = float.MaxValue,
Padding = new MarginPadding
{
Horizontal = horizontal_margins,
Top = vertical_margins,
Bottom = vertical_margins
},
Child = spinner = new LoadingSpinner(true)
{
State = { Value = Visibility.Visible },
@ -133,18 +125,10 @@ namespace osu.Game.Screens.Edit
mainContent.Add(content);
content.FadeInFromZero(300, Easing.OutQuint);
LoadComponentAsync(new TimelineArea(CreateTimelineContent()), t =>
{
timelineContainer.Add(t);
OnTimelineLoaded(t);
});
LoadComponentAsync(new TimelineArea(CreateTimelineContent()), timelineContainer.Add);
});
}
protected virtual void OnTimelineLoaded(TimelineArea timelineArea)
{
}
protected abstract Drawable CreateMainContent();
protected virtual Drawable CreateTimelineContent() => new Container();

View File

@ -4,11 +4,13 @@
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays;
namespace osu.Game.Screens.Edit.Setup
{
public class SetupScreen : EditorRoundedScreen
public class SetupScreen : EditorScreen
{
[Cached]
private SectionsContainer<SetupSection> sections { get; } = new SetupScreenSectionsContainer();
@ -22,7 +24,7 @@ namespace osu.Game.Screens.Edit.Setup
}
[BackgroundDependencyLoader]
private void load(EditorBeatmap beatmap)
private void load(EditorBeatmap beatmap, OverlayColourProvider colourProvider)
{
var sectionsEnumerable = new List<SetupSection>
{
@ -37,6 +39,12 @@ namespace osu.Game.Screens.Edit.Setup
if (rulesetSpecificSection != null)
sectionsEnumerable.Add(rulesetSpecificSection);
Add(new Box
{
Colour = colourProvider.Background2,
RelativeSizeAxes = Axes.Both,
});
Add(sections.With(s =>
{
s.RelativeSizeAxes = Axes.Both;

View File

@ -93,7 +93,7 @@ namespace osu.Game.Screens.Edit.Setup
public SetupScreenTabControl()
{
TabContainer.Margin = new MarginPadding { Horizontal = EditorRoundedScreen.HORIZONTAL_PADDING };
TabContainer.Margin = new MarginPadding { Horizontal = 100 };
AddInternal(background = new Box
{

View File

@ -40,7 +40,7 @@ namespace osu.Game.Screens.Edit.Setup
Padding = new MarginPadding
{
Vertical = 10,
Horizontal = EditorRoundedScreen.HORIZONTAL_PADDING
Horizontal = 100
};
InternalChild = new FillFlowContainer

View File

@ -17,7 +17,7 @@ namespace osu.Game.Screens.Edit.Timing
{
private LabelledTextBox textBox;
private TriangleButton button;
private OsuButton button;
[Resolved]
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; }
@ -53,7 +53,7 @@ namespace osu.Game.Screens.Edit.Timing
{
Label = "Time"
},
button = new TriangleButton
button = new RoundedButton
{
Text = "Use current time",
RelativeSizeAxes = Axes.X,

View File

@ -44,9 +44,15 @@ namespace osu.Game.Screens.Edit.Timing
AutoSizeAxes = Axes.Y;
Masking = true;
CornerRadius = 5;
InternalChildren = new Drawable[]
{
new Box
{
Colour = colours.Background4,
RelativeSizeAxes = Axes.Both,
},
new Container
{
RelativeSizeAxes = Axes.X,
@ -69,11 +75,6 @@ namespace osu.Game.Screens.Edit.Timing
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
new Box
{
Colour = colours.Background3,
RelativeSizeAxes = Axes.Both,
},
Flow = new FillFlowContainer
{
Padding = new MarginPadding(20),

View File

@ -11,6 +11,7 @@ using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays.Settings;
using osu.Game.Utils;
using osuTK;
namespace osu.Game.Screens.Edit.Timing
{
@ -33,6 +34,7 @@ namespace osu.Game.Screens.Edit.Timing
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(20),
Children = new Drawable[]
{
textBox = new LabelledTextBox

View File

@ -24,8 +24,8 @@ namespace osu.Game.Screens.Edit.Timing
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, OsuColour colours)
{
Height = 200;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
CornerRadius = LabelledDrawable<Drawable>.CORNER_RADIUS;
Masking = true;
@ -39,20 +39,44 @@ namespace osu.Game.Screens.Edit.Timing
},
new GridContainer
{
RelativeSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
RowDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 200),
new Dimension(GridSizeMode.Absolute, 60),
},
Content = new[]
{
new Drawable[]
{
new MetronomeDisplay
new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
new GridContainer
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension()
},
Content = new[]
{
new Drawable[]
{
new MetronomeDisplay
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
new WaveformComparisonDisplay(),
}
},
}
}
}
},
new Drawable[]

View File

@ -10,12 +10,13 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osuTK;
namespace osu.Game.Screens.Edit.Timing
{
public class TimingScreen : EditorRoundedScreen
public class TimingScreen : EditorScreenWithTimeline
{
[Cached]
private Bindable<ControlPointGroup> selectedGroup = new Bindable<ControlPointGroup>();
@ -25,27 +26,23 @@ namespace osu.Game.Screens.Edit.Timing
{
}
[BackgroundDependencyLoader]
private void load()
protected override Drawable CreateMainContent() => new GridContainer
{
Add(new GridContainer
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
new Dimension(),
new Dimension(GridSizeMode.Absolute, 350),
},
Content = new[]
{
new Drawable[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 350),
new ControlPointList(),
new ControlPointSettings(),
},
Content = new[]
{
new Drawable[]
{
new ControlPointList(),
new ControlPointSettings(),
},
}
});
}
}
};
public class ControlPointList : CompositeDrawable
{
@ -76,12 +73,12 @@ namespace osu.Game.Screens.Edit.Timing
{
new Box
{
Colour = colours.Background3,
Colour = colours.Background4,
RelativeSizeAxes = Axes.Both,
},
new Box
{
Colour = colours.Background2,
Colour = colours.Background3,
RelativeSizeAxes = Axes.Y,
Width = ControlPointTable.TIMING_COLUMN_WIDTH + margins,
},
@ -100,7 +97,7 @@ namespace osu.Game.Screens.Edit.Timing
Spacing = new Vector2(5),
Children = new Drawable[]
{
deleteButton = new OsuButton
deleteButton = new RoundedButton
{
Text = "-",
Size = new Vector2(30, 30),
@ -108,7 +105,7 @@ namespace osu.Game.Screens.Edit.Timing
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
},
new OsuButton
new RoundedButton
{
Text = "+ Add at current time",
Action = addNew,

View File

@ -0,0 +1,218 @@
// 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.
#nullable enable
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Audio;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Timing
{
internal class WaveformComparisonDisplay : CompositeDrawable
{
private const int total_waveforms = 8;
private readonly BindableNumber<double> beatLength = new BindableDouble();
[Resolved]
private IBindable<WorkingBeatmap> beatmap { get; set; } = null!;
[Resolved]
private EditorBeatmap editorBeatmap { get; set; } = null!;
[Resolved]
private Bindable<ControlPointGroup?> selectedGroup { get; set; } = null!;
[Resolved]
private EditorClock editorClock { get; set; } = null!;
private TimingControlPoint timingPoint = TimingControlPoint.DEFAULT;
private int lastDisplayedBeatIndex;
private double selectedGroupStartTime;
private double selectedGroupEndTime;
private readonly IBindableList<ControlPointGroup> controlPointGroups = new BindableList<ControlPointGroup>();
public WaveformComparisonDisplay()
{
RelativeSizeAxes = Axes.Both;
CornerRadius = LabelledDrawable<Drawable>.CORNER_RADIUS;
Masking = true;
}
protected override void LoadComplete()
{
base.LoadComplete();
for (int i = 0; i < total_waveforms; i++)
{
AddInternal(new WaveformRow
{
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both,
Height = 1f / total_waveforms,
Y = (float)i / total_waveforms,
});
}
AddInternal(new Circle
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = Color4.White,
RelativeSizeAxes = Axes.Y,
Width = 3,
});
selectedGroup.BindValueChanged(_ => updateTimingGroup(), true);
controlPointGroups.BindTo(editorBeatmap.ControlPointInfo.Groups);
controlPointGroups.BindCollectionChanged((_, __) => updateTimingGroup());
beatLength.BindValueChanged(_ => showFrom(lastDisplayedBeatIndex), true);
}
private void updateTimingGroup()
{
beatLength.UnbindBindings();
selectedGroupStartTime = 0;
selectedGroupEndTime = beatmap.Value.Track.Length;
var tcp = selectedGroup.Value?.ControlPoints.OfType<TimingControlPoint>().FirstOrDefault();
if (tcp == null)
{
timingPoint = new TimingControlPoint();
return;
}
timingPoint = tcp;
beatLength.BindTo(timingPoint.BeatLengthBindable);
selectedGroupStartTime = selectedGroup.Value?.Time ?? 0;
var nextGroup = editorBeatmap.ControlPointInfo.TimingPoints
.SkipWhile(g => g != tcp)
.Skip(1)
.FirstOrDefault();
if (nextGroup != null)
selectedGroupEndTime = nextGroup.Time;
}
protected override bool OnHover(HoverEvent e) => true;
protected override bool OnMouseMove(MouseMoveEvent e)
{
float trackLength = (float)beatmap.Value.Track.Length;
int totalBeatsAvailable = (int)(trackLength / timingPoint.BeatLength);
Scheduler.AddOnce(showFrom, (int)(e.MousePosition.X / DrawWidth * totalBeatsAvailable));
return base.OnMouseMove(e);
}
protected override void Update()
{
base.Update();
if (!IsHovered)
{
int currentBeat = (int)Math.Floor((editorClock.CurrentTimeAccurate - selectedGroupStartTime) / timingPoint.BeatLength);
showFrom(currentBeat);
}
}
private void showFrom(int beatIndex)
{
if (lastDisplayedBeatIndex == beatIndex)
return;
// Chosen as a pretty usable number across all BPMs.
// Optimally we'd want this to scale with the BPM in question, but performing
// scaling of the display is both expensive in resampling, and decreases usability
// (as it is harder to track the waveform when making realtime adjustments).
const float visible_width = 300;
float trackLength = (float)beatmap.Value.Track.Length;
float scale = trackLength / visible_width;
// Start displaying from before the current beat
beatIndex -= total_waveforms / 2;
foreach (var row in InternalChildren.OfType<WaveformRow>())
{
// offset to the required beat index.
double time = selectedGroupStartTime + beatIndex * timingPoint.BeatLength;
float offset = (float)(time - visible_width / 2) / trackLength * scale;
row.Alpha = time < selectedGroupStartTime || time > selectedGroupEndTime ? 0.2f : 1;
row.WaveformOffset = -offset;
row.WaveformScale = new Vector2(scale, 1);
row.BeatIndex = beatIndex++;
}
lastDisplayedBeatIndex = beatIndex;
}
internal class WaveformRow : CompositeDrawable
{
private OsuSpriteText beatIndexText = null!;
private WaveformGraph waveformGraph = null!;
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
[BackgroundDependencyLoader]
private void load(IBindable<WorkingBeatmap> beatmap)
{
InternalChildren = new Drawable[]
{
waveformGraph = new WaveformGraph
{
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both,
Waveform = beatmap.Value.Waveform,
Resolution = 1,
BaseColour = colourProvider.Colour0,
LowColour = colourProvider.Colour1,
MidColour = colourProvider.Colour2,
HighColour = colourProvider.Colour4,
},
beatIndexText = new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Padding = new MarginPadding(5),
Colour = colourProvider.Content2
}
};
}
public int BeatIndex { set => beatIndexText.Text = value.ToString(); }
public Vector2 WaveformScale { set => waveformGraph.Scale = value; }
public float WaveformOffset { set => waveformGraph.X = value; }
}
}
}

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks.Components;
@ -67,7 +67,7 @@ namespace osu.Game.Screens.Edit.Verify
Margin = new MarginPadding(20),
Children = new Drawable[]
{
new TriangleButton
new RoundedButton
{
Text = "Refresh",
Action = refresh,

View File

@ -11,7 +11,7 @@ using osu.Game.Rulesets.Edit.Checks.Components;
namespace osu.Game.Screens.Edit.Verify
{
[Cached]
public class VerifyScreen : EditorRoundedScreen
public class VerifyScreen : EditorScreen
{
public readonly Bindable<Issue> SelectedIssue = new Bindable<Issue>();
@ -32,7 +32,6 @@ namespace osu.Game.Screens.Edit.Verify
InterpretedDifficulty.Default = BeatmapDifficultyCache.GetDifficultyRating(EditorBeatmap.BeatmapInfo.StarRating);
InterpretedDifficulty.SetDefault();
IssueList = new IssueList();
Child = new Container
{
RelativeSizeAxes = Axes.Both,
@ -48,7 +47,7 @@ namespace osu.Game.Screens.Edit.Verify
{
new Drawable[]
{
IssueList,
IssueList = new IssueList(),
new IssueSettings(),
},
}

View File

@ -6,18 +6,14 @@ using osu.Game.Overlays;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Mods;
using osu.Game.Rulesets.Mods;
using osuTK.Input;
using osu.Game.Localisation;
namespace osu.Game.Screens.OnlinePlay
{
public class FreeModSelectOverlay : ModSelectOverlay, IKeyBindingHandler<PlatformAction>
public class FreeModSelectOverlay : ModSelectOverlay
{
protected override bool ShowTotalMultiplier => false;
@ -29,8 +25,6 @@ namespace osu.Game.Screens.OnlinePlay
set => base.IsValidMod = m => m.UserPlayable && value.Invoke(m);
}
private ShearedButton selectAllButton;
public FreeModSelectOverlay()
: base(OverlayColourScheme.Plum)
{
@ -40,31 +34,10 @@ namespace osu.Game.Screens.OnlinePlay
protected override ModColumn CreateModColumn(ModType modType, Key[] toggleKeys = null) => new ModColumn(modType, true, toggleKeys);
protected override IEnumerable<ShearedButton> CreateFooterButtons() => base.CreateFooterButtons().Prepend(
selectAllButton = new ShearedButton(BUTTON_WIDTH)
new SelectAllModsButton(this)
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Text = CommonStrings.SelectAll,
Action = SelectAll
});
public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
{
if (e.Repeat)
return false;
switch (e.Action)
{
case PlatformAction.SelectAll:
selectAllButton.TriggerClick();
return true;
}
return false;
}
public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
{
}
}
}

View File

@ -38,13 +38,13 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
var req = new GetRoomLeaderboardRequest(roomId.Value ?? 0);
req.Success += r =>
req.Success += r => Schedule(() =>
{
if (cancellationToken.IsCancellationRequested)
return;
SetScores(r.Leaderboard, r.UserScore);
};
});
return req;
}

View File

@ -149,9 +149,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
protected override void StartGameplay()
{
// We can enter this screen one of two ways:
// 1. Via the automatic natural progression of PlayerLoader into Player.
// We'll arrive here in a Loaded state, and we need to let the server know that we're ready to start.
// 2. Via the server forcefully starting gameplay because players have been hanging out in PlayerLoader for too long.
// We'll arrive here in a Playing state, and we should neither show the loading spinner nor tell the server that we're ready to start (gameplay has already started).
//
// The base call is blocked here because in both cases gameplay is started only when the server says so via onGameplayStarted().
if (client.LocalUser?.State == MultiplayerUserState.Loaded)
{
// block base call, but let the server know we are ready to start.
loadingDisplay.Show();
client.ChangeState(MultiplayerUserState.ReadyForGameplay);
}

View File

@ -26,8 +26,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
}
protected override bool ReadyForGameplay =>
base.ReadyForGameplay
// The server is forcefully starting gameplay.
(
// The user is ready to enter gameplay.
base.ReadyForGameplay
// And the server has received the message that we're loaded.
&& multiplayerClient.LocalUser?.State == MultiplayerUserState.Loaded
)
// Or the server is forcefully starting gameplay.
|| multiplayerClient.LocalUser?.State == MultiplayerUserState.Playing;
protected override void OnPlayerLoaded()

View File

@ -35,6 +35,7 @@ namespace osu.Game.Tests.Beatmaps
BeatmapInfo.Length = 75000;
BeatmapInfo.OnlineInfo = new APIBeatmap();
BeatmapInfo.OnlineID = Interlocked.Increment(ref onlineBeatmapID);
BeatmapInfo.Status = BeatmapOnlineStatus.Ranked;
Debug.Assert(BeatmapInfo.BeatmapSet != null);

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Screens.Edit;
namespace osu.Game.Tests.Visual
@ -15,7 +16,12 @@ namespace osu.Game.Tests.Visual
/// </summary>
public abstract class EditorClockTestScene : OsuManualInputManagerTestScene
{
[Cached]
private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
protected readonly BindableBeatDivisor BeatDivisor = new BindableBeatDivisor();
[Cached]
protected new readonly EditorClock Clock;
protected virtual bool ScrollUsingMouseWheel => true;

View File

@ -36,7 +36,7 @@
</PackageReference>
<PackageReference Include="Realm" Version="10.11.2" />
<PackageReference Include="ppy.osu.Framework" Version="2022.527.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.513.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" />
<PackageReference Include="Sentry" Version="3.17.1" />
<PackageReference Include="SharpCompress" Version="0.31.0" />
<PackageReference Include="NUnit" Version="3.13.3" />

View File

@ -62,7 +62,7 @@
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.527.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.513.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" />
</ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) -->
<PropertyGroup>