mirror of
https://github.com/osukey/osukey.git
synced 2025-05-20 21:17:32 +09:00
Merge branch 'master' into seek-to-endtime-on-placement
This commit is contained in:
commit
f3c47dc8c9
@ -89,7 +89,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
public IReadOnlyList<Color4> UsableComboColours =>
|
public IReadOnlyList<Color4> UsableComboColours =>
|
||||||
GameplayClockContainer.ChildrenOfType<BeatmapSkinProvidingContainer>()
|
GameplayClockContainer.ChildrenOfType<BeatmapSkinProvidingContainer>()
|
||||||
.First()
|
.First()
|
||||||
.GetConfig<GlobalSkinConfiguration, IReadOnlyList<Color4>>(GlobalSkinConfiguration.ComboColours)?.Value;
|
.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CustomSkinWorkingBeatmap : ClockBackedTestWorkingBeatmap
|
private class CustomSkinWorkingBeatmap : ClockBackedTestWorkingBeatmap
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
@ -8,6 +9,7 @@ using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
|
|||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
|
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
|
||||||
{
|
{
|
||||||
@ -29,22 +31,31 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
|
if (isPlacingEnd)
|
||||||
|
HitObject.EndTime = Math.Max(HitObject.StartTime, EditorClock.CurrentTime);
|
||||||
|
|
||||||
piece.UpdateFrom(HitObject);
|
piece.UpdateFrom(HitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
{
|
{
|
||||||
if (isPlacingEnd)
|
if (isPlacingEnd)
|
||||||
{
|
{
|
||||||
|
if (e.Button != MouseButton.Right)
|
||||||
|
return false;
|
||||||
|
|
||||||
HitObject.EndTime = EditorClock.CurrentTime;
|
HitObject.EndTime = EditorClock.CurrentTime;
|
||||||
EndPlacement(true);
|
EndPlacement(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isPlacingEnd = true;
|
if (e.Button != MouseButton.Left)
|
||||||
piece.FadeTo(1f, 150, Easing.OutQuint);
|
return false;
|
||||||
|
|
||||||
BeginPlacement();
|
BeginPlacement();
|
||||||
|
piece.FadeTo(1f, 150, Easing.OutQuint);
|
||||||
|
|
||||||
|
isPlacingEnd = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -36,6 +36,9 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
|
|
||||||
protected override DistanceSnapGrid CreateDistanceSnapGrid(IEnumerable<HitObject> selectedHitObjects)
|
protected override DistanceSnapGrid CreateDistanceSnapGrid(IEnumerable<HitObject> selectedHitObjects)
|
||||||
{
|
{
|
||||||
|
if (BlueprintContainer.CurrentTool is SpinnerCompositionTool)
|
||||||
|
return null;
|
||||||
|
|
||||||
var objects = selectedHitObjects.ToList();
|
var objects = selectedHitObjects.ToList();
|
||||||
|
|
||||||
if (objects.Count == 0)
|
if (objects.Count == 0)
|
||||||
@ -89,6 +92,9 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
targetIndex++;
|
targetIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sourceObject is Spinner)
|
||||||
|
return null;
|
||||||
|
|
||||||
return new OsuDistanceSnapGrid((OsuHitObject)sourceObject, (OsuHitObject)targetObject);
|
return new OsuDistanceSnapGrid((OsuHitObject)sourceObject, (OsuHitObject)targetObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,13 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
public class Spinner : OsuHitObject, IHasEndTime
|
public class Spinner : OsuHitObject, IHasEndTime
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double EndTime
|
||||||
public double Duration => EndTime - StartTime;
|
{
|
||||||
|
get => StartTime + Duration;
|
||||||
|
set => Duration = value - StartTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double Duration { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of spins required to finish the spinner without miss.
|
/// Number of spins required to finish the spinner without miss.
|
||||||
|
@ -46,17 +46,20 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
|||||||
switch (osuComponent.Component)
|
switch (osuComponent.Component)
|
||||||
{
|
{
|
||||||
case OsuSkinComponents.FollowPoint:
|
case OsuSkinComponents.FollowPoint:
|
||||||
return this.GetAnimation(component.LookupName, true, false);
|
return this.GetAnimation(component.LookupName, true, false, true);
|
||||||
|
|
||||||
case OsuSkinComponents.SliderFollowCircle:
|
case OsuSkinComponents.SliderFollowCircle:
|
||||||
var followCircle = this.GetAnimation("sliderfollowcircle", true, true);
|
var followCircle = this.GetAnimation("sliderfollowcircle", true, true, true);
|
||||||
if (followCircle != null)
|
if (followCircle != null)
|
||||||
// follow circles are 2x the hitcircle resolution in legacy skins (since they are scaled down from >1x
|
// follow circles are 2x the hitcircle resolution in legacy skins (since they are scaled down from >1x
|
||||||
followCircle.Scale *= 0.5f;
|
followCircle.Scale *= 0.5f;
|
||||||
return followCircle;
|
return followCircle;
|
||||||
|
|
||||||
case OsuSkinComponents.SliderBall:
|
case OsuSkinComponents.SliderBall:
|
||||||
var sliderBallContent = this.GetAnimation("sliderb", true, true, "");
|
var sliderBallContent = this.GetAnimation("sliderb", true, true, animationSeparator: "");
|
||||||
|
|
||||||
|
// todo: slider ball has a custom frame delay based on velocity
|
||||||
|
// Math.Max((150 / Velocity) * GameBase.SIXTY_FRAME_TIME, GameBase.SIXTY_FRAME_TIME);
|
||||||
|
|
||||||
if (sliderBallContent != null)
|
if (sliderBallContent != null)
|
||||||
{
|
{
|
||||||
|
@ -126,10 +126,10 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
{
|
{
|
||||||
switch (lookup)
|
switch (lookup)
|
||||||
{
|
{
|
||||||
case GlobalSkinConfiguration global:
|
case GlobalSkinColours global:
|
||||||
switch (global)
|
switch (global)
|
||||||
{
|
{
|
||||||
case GlobalSkinConfiguration.ComboColours:
|
case GlobalSkinColours.ComboColours:
|
||||||
return SkinUtils.As<TValue>(new Bindable<IReadOnlyList<Color4>>(ComboColours));
|
return SkinUtils.As<TValue>(new Bindable<IReadOnlyList<Color4>>(ComboColours));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ namespace osu.Game.Tests.Skins
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestGlobalLookup()
|
public void TestGlobalLookup()
|
||||||
{
|
{
|
||||||
AddAssert("Check combo colours", () => requester.GetConfig<GlobalSkinConfiguration, IReadOnlyList<Color4>>(GlobalSkinConfiguration.ComboColours)?.Value?.Count > 0);
|
AddAssert("Check combo colours", () => requester.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value?.Count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -121,7 +121,7 @@ namespace osu.Game.Tests.Skins
|
|||||||
public void TestEmptyComboColours()
|
public void TestEmptyComboColours()
|
||||||
{
|
{
|
||||||
AddAssert("Check retrieved combo colours is skin default colours", () =>
|
AddAssert("Check retrieved combo colours is skin default colours", () =>
|
||||||
requester.GetConfig<GlobalSkinConfiguration, IReadOnlyList<Color4>>(GlobalSkinConfiguration.ComboColours)?.Value?.SequenceEqual(SkinConfiguration.DefaultComboColours) ?? false);
|
requester.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value?.SequenceEqual(SkinConfiguration.DefaultComboColours) ?? false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -136,7 +136,7 @@ namespace osu.Game.Tests.Skins
|
|||||||
AddStep("Disallow default colours fallback in source2", () => source2.Configuration.AllowDefaultComboColoursFallback = false);
|
AddStep("Disallow default colours fallback in source2", () => source2.Configuration.AllowDefaultComboColoursFallback = false);
|
||||||
|
|
||||||
AddAssert("Check retrieved combo colours from source1", () =>
|
AddAssert("Check retrieved combo colours from source1", () =>
|
||||||
requester.GetConfig<GlobalSkinConfiguration, IReadOnlyList<Color4>>(GlobalSkinConfiguration.ComboColours)?.Value?.SequenceEqual(source1.Configuration.ComboColours) ?? false);
|
requester.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value?.SequenceEqual(source1.Configuration.ComboColours) ?? false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -38,8 +38,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
public void TestButtonShowsOnCustomisableMod()
|
public void TestButtonShowsOnCustomisableMod()
|
||||||
{
|
{
|
||||||
createModSelect();
|
createModSelect();
|
||||||
|
openModSelect();
|
||||||
|
|
||||||
AddStep("open", () => modSelect.Show());
|
|
||||||
AddAssert("button disabled", () => !modSelect.CustomiseButton.Enabled.Value);
|
AddAssert("button disabled", () => !modSelect.CustomiseButton.Enabled.Value);
|
||||||
AddUntilStep("wait for button load", () => modSelect.ButtonsLoaded);
|
AddUntilStep("wait for button load", () => modSelect.ButtonsLoaded);
|
||||||
AddStep("select mod", () => modSelect.SelectMod(testCustomisableMod));
|
AddStep("select mod", () => modSelect.SelectMod(testCustomisableMod));
|
||||||
@ -58,19 +58,21 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
AddAssert("mods still active", () => SelectedMods.Value.Count == 1);
|
AddAssert("mods still active", () => SelectedMods.Value.Count == 1);
|
||||||
|
|
||||||
AddStep("open", () => modSelect.Show());
|
openModSelect();
|
||||||
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
|
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestCustomisationOpensOnModSelect()
|
public void TestCustomisationMenuVisibility()
|
||||||
{
|
{
|
||||||
createModSelect();
|
createModSelect();
|
||||||
|
openModSelect();
|
||||||
|
|
||||||
AddStep("open", () => modSelect.Show());
|
|
||||||
AddAssert("Customisation closed", () => modSelect.ModSettingsContainer.Alpha == 0);
|
AddAssert("Customisation closed", () => modSelect.ModSettingsContainer.Alpha == 0);
|
||||||
AddStep("select mod", () => modSelect.SelectMod(testCustomisableAutoOpenMod));
|
AddStep("select mod", () => modSelect.SelectMod(testCustomisableAutoOpenMod));
|
||||||
AddAssert("Customisation opened", () => modSelect.ModSettingsContainer.Alpha == 1);
|
AddAssert("Customisation opened", () => modSelect.ModSettingsContainer.Alpha == 1);
|
||||||
|
AddStep("deselect mod", () => modSelect.SelectMod(testCustomisableAutoOpenMod));
|
||||||
|
AddAssert("Customisation closed", () => modSelect.ModSettingsContainer.Alpha == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createModSelect()
|
private void createModSelect()
|
||||||
@ -86,6 +88,12 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void openModSelect()
|
||||||
|
{
|
||||||
|
AddStep("open", () => modSelect.Show());
|
||||||
|
AddUntilStep("wait for ready", () => modSelect.State.Value == Visibility.Visible && modSelect.ButtonsLoaded);
|
||||||
|
}
|
||||||
|
|
||||||
private class TestModSelectOverlay : ModSelectOverlay
|
private class TestModSelectOverlay : ModSelectOverlay
|
||||||
{
|
{
|
||||||
public new Container ModSettingsContainer => base.ModSettingsContainer;
|
public new Container ModSettingsContainer => base.ModSettingsContainer;
|
||||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
hitObject.ApplyDefaults(this.beatmap.ControlPointInfo, this.beatmap.BeatmapInfo.BaseDifficulty);
|
hitObject.ApplyDefaults(this.beatmap.ControlPointInfo, this.beatmap.BeatmapInfo.BaseDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool ShouldSkipLine(string line) => base.ShouldSkipLine(line) || line.StartsWith(" ", StringComparison.Ordinal) || line.StartsWith("_", StringComparison.Ordinal);
|
protected override bool ShouldSkipLine(string line) => base.ShouldSkipLine(line) || line.StartsWith(' ') || line.StartsWith('_');
|
||||||
|
|
||||||
protected override void ParseLine(Beatmap beatmap, Section section, string line)
|
protected override void ParseLine(Beatmap beatmap, Section section, string line)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
if (ShouldSkipLine(line))
|
if (ShouldSkipLine(line))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (line.StartsWith(@"[", StringComparison.Ordinal) && line.EndsWith(@"]", StringComparison.Ordinal))
|
if (line.StartsWith('[') && line.EndsWith(']'))
|
||||||
{
|
{
|
||||||
if (!Enum.TryParse(line[1..^1], out section))
|
if (!Enum.TryParse(line[1..^1], out section))
|
||||||
{
|
{
|
||||||
|
@ -64,15 +64,16 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
private void handleEvents(string line)
|
private void handleEvents(string line)
|
||||||
{
|
{
|
||||||
var depth = 0;
|
var depth = 0;
|
||||||
var lineSpan = line.AsSpan();
|
|
||||||
|
|
||||||
while (lineSpan.StartsWith(" ", StringComparison.Ordinal) || lineSpan.StartsWith("_", StringComparison.Ordinal))
|
foreach (char c in line)
|
||||||
{
|
{
|
||||||
lineSpan = lineSpan.Slice(1);
|
if (c == ' ' || c == '_')
|
||||||
++depth;
|
depth++;
|
||||||
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
line = lineSpan.ToString();
|
line = line.Substring(depth);
|
||||||
|
|
||||||
decodeVariables(ref line);
|
decodeVariables(ref line);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Beatmaps
|
|||||||
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
||||||
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
||||||
|
|
||||||
track = new RecyclableLazy<Track>(() => GetTrack() ?? GetVirtualTrack());
|
track = new RecyclableLazy<Track>(() => GetTrack() ?? GetVirtualTrack(1000));
|
||||||
background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid);
|
background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid);
|
||||||
waveform = new RecyclableLazy<Waveform>(GetWaveform);
|
waveform = new RecyclableLazy<Waveform>(GetWaveform);
|
||||||
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
|
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
|
||||||
@ -48,7 +48,7 @@ namespace osu.Game.Beatmaps
|
|||||||
total_count.Value++;
|
total_count.Value++;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Track GetVirtualTrack()
|
protected virtual Track GetVirtualTrack(double emptyLength = 0)
|
||||||
{
|
{
|
||||||
const double excess_length = 1000;
|
const double excess_length = 1000;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ namespace osu.Game.Beatmaps
|
|||||||
switch (lastObject)
|
switch (lastObject)
|
||||||
{
|
{
|
||||||
case null:
|
case null:
|
||||||
length = excess_length;
|
length = emptyLength;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IHasEndTime endTime:
|
case IHasEndTime endTime:
|
||||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuSetting.MenuParallax, true);
|
Set(OsuSetting.MenuParallax, true);
|
||||||
|
|
||||||
// Gameplay
|
// Gameplay
|
||||||
Set(OsuSetting.DimLevel, 0.3, 0, 1, 0.01);
|
Set(OsuSetting.DimLevel, 0.8, 0, 1, 0.01);
|
||||||
Set(OsuSetting.BlurLevel, 0, 0, 1, 0.01);
|
Set(OsuSetting.BlurLevel, 0, 0, 1, 0.01);
|
||||||
Set(OsuSetting.LightenDuringBreaks, true);
|
Set(OsuSetting.LightenDuringBreaks, true);
|
||||||
|
|
||||||
|
@ -59,9 +59,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
Track track = null;
|
Track track = null;
|
||||||
IBeatmap beatmap = null;
|
IBeatmap beatmap = null;
|
||||||
|
|
||||||
double currentTrackTime;
|
double currentTrackTime = 0;
|
||||||
TimingControlPoint timingPoint;
|
TimingControlPoint timingPoint = null;
|
||||||
EffectControlPoint effectPoint;
|
EffectControlPoint effectPoint = null;
|
||||||
|
|
||||||
if (Beatmap.Value.TrackLoaded && Beatmap.Value.BeatmapLoaded)
|
if (Beatmap.Value.TrackLoaded && Beatmap.Value.BeatmapLoaded)
|
||||||
{
|
{
|
||||||
@ -69,24 +69,18 @@ namespace osu.Game.Graphics.Containers
|
|||||||
beatmap = Beatmap.Value.Beatmap;
|
beatmap = Beatmap.Value.Beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (track != null && beatmap != null && track.IsRunning)
|
if (track != null && beatmap != null && track.IsRunning && track.Length > 0)
|
||||||
{
|
{
|
||||||
currentTrackTime = track.Length > 0 ? track.CurrentTime + EarlyActivationMilliseconds : Clock.CurrentTime;
|
currentTrackTime = track.CurrentTime + EarlyActivationMilliseconds;
|
||||||
|
|
||||||
timingPoint = beatmap.ControlPointInfo.TimingPointAt(currentTrackTime);
|
timingPoint = beatmap.ControlPointInfo.TimingPointAt(currentTrackTime);
|
||||||
effectPoint = beatmap.ControlPointInfo.EffectPointAt(currentTrackTime);
|
effectPoint = beatmap.ControlPointInfo.EffectPointAt(currentTrackTime);
|
||||||
|
|
||||||
if (timingPoint.BeatLength == 0)
|
|
||||||
{
|
|
||||||
IsBeatSyncedWithTrack = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IsBeatSyncedWithTrack = true;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
IsBeatSyncedWithTrack = timingPoint?.BeatLength > 0;
|
||||||
|
|
||||||
|
if (timingPoint == null || !IsBeatSyncedWithTrack)
|
||||||
{
|
{
|
||||||
IsBeatSyncedWithTrack = false;
|
|
||||||
currentTrackTime = Clock.CurrentTime;
|
currentTrackTime = Clock.CurrentTime;
|
||||||
timingPoint = defaultTiming;
|
timingPoint = defaultTiming;
|
||||||
effectPoint = defaultEffect;
|
effectPoint = defaultEffect;
|
||||||
|
@ -9,7 +9,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
@ -22,7 +22,7 @@ using SixLabors.ImageSharp;
|
|||||||
|
|
||||||
namespace osu.Game.Graphics
|
namespace osu.Game.Graphics
|
||||||
{
|
{
|
||||||
public class ScreenshotManager : Container, IKeyBindingHandler<GlobalAction>, IHandleGlobalKeyboardInput
|
public class ScreenshotManager : Component, IKeyBindingHandler<GlobalAction>, IHandleGlobalKeyboardInput
|
||||||
{
|
{
|
||||||
private readonly BindableBool cursorVisibility = new BindableBool(true);
|
private readonly BindableBool cursorVisibility = new BindableBool(true);
|
||||||
|
|
||||||
|
@ -2,13 +2,18 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -59,5 +64,91 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) };
|
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) };
|
||||||
|
|
||||||
|
protected override Caret CreateCaret() => new OsuCaret
|
||||||
|
{
|
||||||
|
CaretWidth = CaretWidth,
|
||||||
|
SelectionColour = SelectionColour,
|
||||||
|
};
|
||||||
|
|
||||||
|
private class OsuCaret : Caret
|
||||||
|
{
|
||||||
|
private const float caret_move_time = 60;
|
||||||
|
|
||||||
|
private readonly CaretBeatSyncedContainer beatSync;
|
||||||
|
|
||||||
|
public OsuCaret()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y;
|
||||||
|
Size = new Vector2(1, 0.9f);
|
||||||
|
|
||||||
|
Colour = Color4.Transparent;
|
||||||
|
Anchor = Anchor.CentreLeft;
|
||||||
|
Origin = Anchor.CentreLeft;
|
||||||
|
|
||||||
|
Masking = true;
|
||||||
|
CornerRadius = 1;
|
||||||
|
InternalChild = beatSync = new CaretBeatSyncedContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Hide() => this.FadeOut(200);
|
||||||
|
|
||||||
|
public float CaretWidth { get; set; }
|
||||||
|
|
||||||
|
public Color4 SelectionColour { get; set; }
|
||||||
|
|
||||||
|
public override void DisplayAt(Vector2 position, float? selectionWidth)
|
||||||
|
{
|
||||||
|
beatSync.HasSelection = selectionWidth != null;
|
||||||
|
|
||||||
|
if (selectionWidth != null)
|
||||||
|
{
|
||||||
|
this.MoveTo(new Vector2(position.X, position.Y), 60, Easing.Out);
|
||||||
|
this.ResizeWidthTo(selectionWidth.Value + CaretWidth / 2, caret_move_time, Easing.Out);
|
||||||
|
this.FadeColour(SelectionColour, 200, Easing.Out);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.MoveTo(new Vector2(position.X - CaretWidth / 2, position.Y), 60, Easing.Out);
|
||||||
|
this.ResizeWidthTo(CaretWidth, caret_move_time, Easing.Out);
|
||||||
|
this.FadeColour(Color4.White, 200, Easing.Out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CaretBeatSyncedContainer : BeatSyncedContainer
|
||||||
|
{
|
||||||
|
private bool hasSelection;
|
||||||
|
|
||||||
|
public bool HasSelection
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
hasSelection = value;
|
||||||
|
if (value)
|
||||||
|
|
||||||
|
this.FadeTo(0.5f, 200, Easing.Out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CaretBeatSyncedContainer()
|
||||||
|
{
|
||||||
|
MinimumBeatLength = 300;
|
||||||
|
InternalChild = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.White,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
||||||
|
{
|
||||||
|
if (!hasSelection)
|
||||||
|
this.FadeTo(0.7f).FadeTo(0.4f, timingPoint.BeatLength, Easing.InOutSine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -29,10 +30,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
|
private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
|
||||||
|
|
||||||
protected override string FormatCount(double count)
|
protected override string FormatCount(double count) => count.FormatAccuracy();
|
||||||
{
|
|
||||||
return $@"{count:P2}";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override double GetProportionalDuration(double currentValue, double newValue)
|
protected override double GetProportionalDuration(double currentValue, double newValue)
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
new TableColumn("max combo", Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 70, maxSize: 90))
|
new TableColumn("max combo", Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 70, maxSize: 90))
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var statistic in score.Statistics)
|
foreach (var statistic in score.SortedStatistics)
|
||||||
columns.Add(new TableColumn(statistic.Key.GetDescription(), Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70)));
|
columns.Add(new TableColumn(statistic.Key.GetDescription(), Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70)));
|
||||||
|
|
||||||
columns.AddRange(new[]
|
columns.AddRange(new[]
|
||||||
@ -150,7 +150,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var kvp in score.Statistics)
|
foreach (var kvp in score.SortedStatistics)
|
||||||
{
|
{
|
||||||
content.Add(new OsuSpriteText
|
content.Add(new OsuSpriteText
|
||||||
{
|
{
|
||||||
|
@ -99,9 +99,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
maxComboColumn.Text = $@"{value.MaxCombo:N0}x";
|
maxComboColumn.Text = $@"{value.MaxCombo:N0}x";
|
||||||
ppColumn.Text = $@"{value.PP:N0}";
|
ppColumn.Text = $@"{value.PP:N0}";
|
||||||
|
|
||||||
statisticsColumns.ChildrenEnumerable = value.Statistics
|
statisticsColumns.ChildrenEnumerable = value.SortedStatistics.Select(kvp => createStatisticsColumn(kvp.Key, kvp.Value));
|
||||||
.OrderByDescending(pair => pair.Key)
|
|
||||||
.Select(kvp => createStatisticsColumn(kvp.Key, kvp.Value));
|
|
||||||
modsColumn.Mods = value.Mods;
|
modsColumn.Mods = value.Mods;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,9 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IBeatSnapProvider beatSnapProvider { get; set; }
|
private IBeatSnapProvider beatSnapProvider { get; set; }
|
||||||
|
|
||||||
|
protected ComposeBlueprintContainer BlueprintContainer { get; private set; }
|
||||||
|
|
||||||
private DrawableEditRulesetWrapper<TObject> drawableRulesetWrapper;
|
private DrawableEditRulesetWrapper<TObject> drawableRulesetWrapper;
|
||||||
private ComposeBlueprintContainer blueprintContainer;
|
|
||||||
private Container distanceSnapGridContainer;
|
private Container distanceSnapGridContainer;
|
||||||
private DistanceSnapGrid distanceSnapGrid;
|
private DistanceSnapGrid distanceSnapGrid;
|
||||||
private readonly List<Container> layerContainers = new List<Container>();
|
private readonly List<Container> layerContainers = new List<Container>();
|
||||||
@ -94,7 +95,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both }
|
new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both }
|
||||||
});
|
});
|
||||||
|
|
||||||
var layerAboveRuleset = drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer().WithChild(blueprintContainer = CreateBlueprintContainer());
|
var layerAboveRuleset = drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer().WithChild(BlueprintContainer = CreateBlueprintContainer());
|
||||||
|
|
||||||
layerContainers.Add(layerBelowRuleset);
|
layerContainers.Add(layerBelowRuleset);
|
||||||
layerContainers.Add(layerAboveRuleset);
|
layerContainers.Add(layerAboveRuleset);
|
||||||
@ -142,7 +143,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
setSelectTool();
|
setSelectTool();
|
||||||
|
|
||||||
blueprintContainer.SelectionChanged += selectionChanged;
|
BlueprintContainer.SelectionChanged += selectionChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
@ -174,7 +175,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (EditorClock.CurrentTime != lastGridUpdateTime && !(blueprintContainer.CurrentTool is SelectTool))
|
if (EditorClock.CurrentTime != lastGridUpdateTime && !(BlueprintContainer.CurrentTool is SelectTool))
|
||||||
showGridFor(Enumerable.Empty<HitObject>());
|
showGridFor(Enumerable.Empty<HitObject>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +211,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
private void toolSelected(HitObjectCompositionTool tool)
|
private void toolSelected(HitObjectCompositionTool tool)
|
||||||
{
|
{
|
||||||
blueprintContainer.CurrentTool = tool;
|
BlueprintContainer.CurrentTool = tool;
|
||||||
|
|
||||||
if (tool is SelectTool)
|
if (tool is SelectTool)
|
||||||
distanceSnapGridContainer.Hide();
|
distanceSnapGridContainer.Hide();
|
||||||
|
@ -349,7 +349,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
{
|
{
|
||||||
if (HitObject is IHasComboInformation combo)
|
if (HitObject is IHasComboInformation combo)
|
||||||
{
|
{
|
||||||
var comboColours = CurrentSkin.GetConfig<GlobalSkinConfiguration, IReadOnlyList<Color4>>(GlobalSkinConfiguration.ComboColours)?.Value;
|
var comboColours = CurrentSkin.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value;
|
||||||
AccentColour.Value = comboColours?.Count > 0 ? comboColours[combo.ComboIndex % comboColours.Count] : Color4.White;
|
AccentColour.Value = comboColours?.Count > 0 ? comboColours[combo.ComboIndex % comboColours.Count] : Color4.White;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,6 +151,8 @@ namespace osu.Game.Scoring
|
|||||||
[JsonProperty("statistics")]
|
[JsonProperty("statistics")]
|
||||||
public Dictionary<HitResult, int> Statistics = new Dictionary<HitResult, int>();
|
public Dictionary<HitResult, int> Statistics = new Dictionary<HitResult, int>();
|
||||||
|
|
||||||
|
public IOrderedEnumerable<KeyValuePair<HitResult, int>> SortedStatistics => Statistics.OrderByDescending(pair => pair.Key);
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[Column("Statistics")]
|
[Column("Statistics")]
|
||||||
public string StatisticsJson
|
public string StatisticsJson
|
||||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
protected DragBox DragBox { get; private set; }
|
protected DragBox DragBox { get; private set; }
|
||||||
|
|
||||||
protected Container<SelectionBlueprint> SelectionBlueprints;
|
protected Container<SelectionBlueprint> SelectionBlueprints { get; private set; }
|
||||||
|
|
||||||
private SelectionHandler selectionHandler;
|
private SelectionHandler selectionHandler;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
public readonly BindableList<HitObject> SelectedHitObjects = new BindableList<HitObject>();
|
public readonly BindableList<HitObject> SelectedHitObjects = new BindableList<HitObject>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current placement
|
/// The current placement. Null if there's no active placement.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly Bindable<HitObject> PlacementObject = new Bindable<HitObject>();
|
public readonly Bindable<HitObject> PlacementObject = new Bindable<HitObject>();
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ namespace osu.Game.Screens.Edit
|
|||||||
private const float vertical_margins = 10;
|
private const float vertical_margins = 10;
|
||||||
private const float horizontal_margins = 20;
|
private const float horizontal_margins = 20;
|
||||||
|
|
||||||
|
private const float timeline_height = 110;
|
||||||
|
|
||||||
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
|
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
|
||||||
|
|
||||||
private Container timelineContainer;
|
private Container timelineContainer;
|
||||||
@ -32,65 +34,57 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new GridContainer
|
mainContent = new Container
|
||||||
{
|
{
|
||||||
|
Name = "Main content",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Content = new[]
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
new Drawable[]
|
Horizontal = horizontal_margins,
|
||||||
|
Top = vertical_margins + timeline_height,
|
||||||
|
Bottom = vertical_margins
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Name = "Timeline",
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = timeline_height,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
{
|
{
|
||||||
new Container
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.Black.Opacity(0.5f)
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Name = "Timeline content",
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding { Horizontal = horizontal_margins, Vertical = vertical_margins },
|
||||||
|
Child = new GridContainer
|
||||||
{
|
{
|
||||||
Name = "Timeline",
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
new Box
|
new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
timelineContainer = new Container
|
||||||
Colour = Color4.Black.Opacity(0.5f)
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Name = "Timeline content",
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Padding = new MarginPadding { Horizontal = horizontal_margins, Vertical = vertical_margins },
|
|
||||||
Child = new GridContainer
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Content = new[]
|
Padding = new MarginPadding { Right = 5 },
|
||||||
{
|
|
||||||
new Drawable[]
|
|
||||||
{
|
|
||||||
timelineContainer = new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Padding = new MarginPadding { Right = 5 },
|
|
||||||
},
|
|
||||||
new BeatDivisorControl(beatDivisor) { RelativeSizeAxes = Axes.Both }
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ColumnDimensions = new[]
|
|
||||||
{
|
|
||||||
new Dimension(),
|
|
||||||
new Dimension(GridSizeMode.Absolute, 90),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
new BeatDivisorControl(beatDivisor) { RelativeSizeAxes = Axes.Both }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ColumnDimensions = new[]
|
||||||
|
{
|
||||||
|
new Dimension(),
|
||||||
|
new Dimension(GridSizeMode.Absolute, 90),
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
|
||||||
new Drawable[]
|
|
||||||
{
|
|
||||||
mainContent = new Container
|
|
||||||
{
|
|
||||||
Name = "Main content",
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Padding = new MarginPadding { Horizontal = horizontal_margins, Vertical = vertical_margins },
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
RowDimensions = new[] { new Dimension(GridSizeMode.Absolute, 110) }
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
Color4 defaultColour = Color4.White.Opacity(0.2f);
|
Color4 defaultColour = Color4.White.Opacity(0.2f);
|
||||||
|
|
||||||
if (user.Value?.IsSupporter ?? false)
|
if (user.Value?.IsSupporter ?? false)
|
||||||
AccentColour = skin.Value.GetConfig<GlobalSkinColour, Color4>(GlobalSkinColour.MenuGlow)?.Value ?? defaultColour;
|
AccentColour = skin.Value.GetConfig<GlobalSkinColours, Color4>(GlobalSkinColours.MenuGlow)?.Value ?? defaultColour;
|
||||||
else
|
else
|
||||||
AccentColour = defaultColour;
|
AccentColour = defaultColour;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
Color4 baseColour = colours.Blue;
|
Color4 baseColour = colours.Blue;
|
||||||
|
|
||||||
if (user.Value?.IsSupporter ?? false)
|
if (user.Value?.IsSupporter ?? false)
|
||||||
baseColour = skin.Value.GetConfig<GlobalSkinColour, Color4>(GlobalSkinColour.MenuGlow)?.Value ?? baseColour;
|
baseColour = skin.Value.GetConfig<GlobalSkinColours, Color4>(GlobalSkinColours.MenuGlow)?.Value ?? baseColour;
|
||||||
|
|
||||||
// linear colour looks better in this case, so let's use it for now.
|
// linear colour looks better in this case, so let's use it for now.
|
||||||
Color4 gradientDark = baseColour.Opacity(0).ToLinear();
|
Color4 gradientDark = baseColour.Opacity(0).ToLinear();
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.Break
|
namespace osu.Game.Screens.Play.Break
|
||||||
{
|
{
|
||||||
@ -85,6 +86,6 @@ namespace osu.Game.Screens.Play.Break
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string Format(double count) => $@"{count:P2}";
|
protected override string Format(double count) => count.FormatAccuracy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
// Lazer's audio timings in general doesn't match stable. This is the result of user testing, albeit limited.
|
// Lazer's audio timings in general doesn't match stable. This is the result of user testing, albeit limited.
|
||||||
// This only seems to be required on windows. We need to eventually figure out why, with a bit of luck.
|
// This only seems to be required on windows. We need to eventually figure out why, with a bit of luck.
|
||||||
platformOffsetClock = new FramedOffsetClock(adjustableClock) { Offset = RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? 22 : 0 };
|
platformOffsetClock = new FramedOffsetClock(adjustableClock) { Offset = RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? 15 : 0 };
|
||||||
|
|
||||||
// the final usable gameplay clock with user-set offsets applied.
|
// the final usable gameplay clock with user-set offsets applied.
|
||||||
userOffsetClock = new FramedOffsetClock(platformOffsetClock);
|
userOffsetClock = new FramedOffsetClock(platformOffsetClock);
|
||||||
|
@ -188,7 +188,7 @@ namespace osu.Game.Screens.Ranking.Pages
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
statisticsContainer.ChildrenEnumerable = Score.Statistics.OrderByDescending(p => p.Key).Select(s => new DrawableScoreStatistic(s));
|
statisticsContainer.ChildrenEnumerable = Score.SortedStatistics.Select(s => new DrawableScoreStatistic(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -31,10 +31,10 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
// todo: this code is pulled from LegacySkin and should not exist.
|
// todo: this code is pulled from LegacySkin and should not exist.
|
||||||
// will likely change based on how databased storage of skin configuration goes.
|
// will likely change based on how databased storage of skin configuration goes.
|
||||||
case GlobalSkinConfiguration global:
|
case GlobalSkinColours global:
|
||||||
switch (global)
|
switch (global)
|
||||||
{
|
{
|
||||||
case GlobalSkinConfiguration.ComboColours:
|
case GlobalSkinColours.ComboColours:
|
||||||
return SkinUtils.As<TValue>(new Bindable<IReadOnlyList<Color4>>(Configuration.ComboColours));
|
return SkinUtils.As<TValue>(new Bindable<IReadOnlyList<Color4>>(Configuration.ComboColours));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
public enum GlobalSkinColour
|
public enum GlobalSkinColours
|
||||||
{
|
{
|
||||||
|
ComboColours,
|
||||||
MenuGlow
|
MenuGlow
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,6 +5,6 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
public enum GlobalSkinConfiguration
|
public enum GlobalSkinConfiguration
|
||||||
{
|
{
|
||||||
ComboColours
|
AnimationFramerate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,22 +68,22 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
switch (lookup)
|
switch (lookup)
|
||||||
{
|
{
|
||||||
case GlobalSkinConfiguration global:
|
case GlobalSkinColours colour:
|
||||||
switch (global)
|
switch (colour)
|
||||||
{
|
{
|
||||||
case GlobalSkinConfiguration.ComboColours:
|
case GlobalSkinColours.ComboColours:
|
||||||
var comboColours = Configuration.ComboColours;
|
var comboColours = Configuration.ComboColours;
|
||||||
if (comboColours != null)
|
if (comboColours != null)
|
||||||
return SkinUtils.As<TValue>(new Bindable<IReadOnlyList<Color4>>(comboColours));
|
return SkinUtils.As<TValue>(new Bindable<IReadOnlyList<Color4>>(comboColours));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return SkinUtils.As<TValue>(getCustomColour(colour.ToString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GlobalSkinColour colour:
|
|
||||||
return SkinUtils.As<TValue>(getCustomColour(colour.ToString()));
|
|
||||||
|
|
||||||
case LegacySkinConfiguration.LegacySetting legacy:
|
case LegacySkinConfiguration.LegacySetting legacy:
|
||||||
switch (legacy)
|
switch (legacy)
|
||||||
{
|
{
|
||||||
@ -100,6 +100,8 @@ namespace osu.Game.Skinning
|
|||||||
return SkinUtils.As<TValue>(getCustomColour(customColour.Lookup.ToString()));
|
return SkinUtils.As<TValue>(getCustomColour(customColour.Lookup.ToString()));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
// handles lookups like GlobalSkinConfiguration
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Configuration.ConfigDictionary.TryGetValue(lookup.ToString(), out var val))
|
if (Configuration.ConfigDictionary.TryGetValue(lookup.ToString(), out var val))
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Animations;
|
using osu.Framework.Graphics.Animations;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -10,48 +12,62 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
public static class LegacySkinExtensions
|
public static class LegacySkinExtensions
|
||||||
{
|
{
|
||||||
public static Drawable GetAnimation(this ISkin source, string componentName, bool animatable, bool looping, string animationSeparator = "-")
|
public static Drawable GetAnimation(this ISkin source, string componentName, bool animatable, bool looping, bool applyConfigFrameRate = false, string animationSeparator = "-")
|
||||||
{
|
{
|
||||||
const double default_frame_time = 1000 / 60d;
|
|
||||||
|
|
||||||
Texture texture;
|
Texture texture;
|
||||||
|
|
||||||
Texture getFrameTexture(int frame) => source.GetTexture($"{componentName}{animationSeparator}{frame}");
|
|
||||||
|
|
||||||
TextureAnimation animation = null;
|
|
||||||
|
|
||||||
if (animatable)
|
if (animatable)
|
||||||
{
|
{
|
||||||
for (int i = 0; true; i++)
|
var textures = getTextures().ToArray();
|
||||||
|
|
||||||
|
if (textures.Length > 0)
|
||||||
{
|
{
|
||||||
if ((texture = getFrameTexture(i)) == null)
|
var animation = new TextureAnimation
|
||||||
break;
|
|
||||||
|
|
||||||
if (animation == null)
|
|
||||||
{
|
{
|
||||||
animation = new TextureAnimation
|
DefaultFrameLength = getFrameLength(source, applyConfigFrameRate, textures),
|
||||||
{
|
Repeat = looping,
|
||||||
DefaultFrameLength = default_frame_time,
|
};
|
||||||
Repeat = looping
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
animation.AddFrame(texture);
|
foreach (var t in textures)
|
||||||
|
animation.AddFrame(t);
|
||||||
|
|
||||||
|
return animation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animation != null)
|
// if an animation was not allowed or not found, fall back to a sprite retrieval.
|
||||||
return animation;
|
|
||||||
|
|
||||||
if ((texture = source.GetTexture(componentName)) != null)
|
if ((texture = source.GetTexture(componentName)) != null)
|
||||||
{
|
return new Sprite { Texture = texture };
|
||||||
return new Sprite
|
|
||||||
{
|
|
||||||
Texture = texture
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
IEnumerable<Texture> getTextures()
|
||||||
|
{
|
||||||
|
for (int i = 0; true; i++)
|
||||||
|
{
|
||||||
|
if ((texture = source.GetTexture($"{componentName}{animationSeparator}{i}")) == null)
|
||||||
|
break;
|
||||||
|
|
||||||
|
yield return texture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private const double default_frame_time = 1000 / 60d;
|
||||||
|
|
||||||
|
private static double getFrameLength(ISkin source, bool applyConfigFrameRate, Texture[] textures)
|
||||||
|
{
|
||||||
|
if (applyConfigFrameRate)
|
||||||
|
{
|
||||||
|
var iniRate = source.GetConfig<GlobalSkinConfiguration, int>(GlobalSkinConfiguration.AnimationFramerate);
|
||||||
|
|
||||||
|
if (iniRate != null)
|
||||||
|
return 1000f / iniRate.Value;
|
||||||
|
|
||||||
|
return 1000f / textures.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
return default_frame_time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,13 @@ namespace osu.Game.Tests.Visual
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Beatmap.Value = CreateWorkingBeatmap(ruleset.RulesetInfo);
|
Beatmap.Value = CreateWorkingBeatmap(ruleset.RulesetInfo);
|
||||||
|
}
|
||||||
|
|
||||||
LoadScreen(new Editor());
|
public override void SetUpSteps()
|
||||||
|
{
|
||||||
|
base.SetUpSteps();
|
||||||
|
|
||||||
|
AddStep("Load editor", () => LoadScreen(new Editor()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,6 +203,21 @@ namespace osu.Game.Users
|
|||||||
public int ID;
|
public int ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonProperty("monthly_playcounts")]
|
||||||
|
public UserHistoryCount[] MonthlyPlaycounts;
|
||||||
|
|
||||||
|
[JsonProperty("replays_watched_counts")]
|
||||||
|
public UserHistoryCount[] ReplaysWatchedCounts;
|
||||||
|
|
||||||
|
public class UserHistoryCount
|
||||||
|
{
|
||||||
|
[JsonProperty("start_date")]
|
||||||
|
public DateTime Date;
|
||||||
|
|
||||||
|
[JsonProperty("count")]
|
||||||
|
public long Count;
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString() => Username;
|
public override string ToString() => Username;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -7,18 +7,16 @@ namespace osu.Game.Utils
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
||||||
/// Omits all decimal places when <paramref name="accuracy"/> equals 1d.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="accuracy">The accuracy to be formatted</param>
|
/// <param name="accuracy">The accuracy to be formatted</param>
|
||||||
/// <returns>formatted accuracy in percentage</returns>
|
/// <returns>formatted accuracy in percentage</returns>
|
||||||
public static string FormatAccuracy(this double accuracy) => accuracy == 1 ? "100%" : $"{accuracy:0.00%}";
|
public static string FormatAccuracy(this double accuracy) => $"{accuracy:0.00%}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
||||||
/// Omits all decimal places when <paramref name="accuracy"/> equals 100m.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="accuracy">The accuracy to be formatted</param>
|
/// <param name="accuracy">The accuracy to be formatted</param>
|
||||||
/// <returns>formatted accuracy in percentage</returns>
|
/// <returns>formatted accuracy in percentage</returns>
|
||||||
public static string FormatAccuracy(this decimal accuracy) => accuracy == 100 ? "100%" : $"{accuracy:0.00}%";
|
public static string FormatAccuracy(this decimal accuracy) => $"{accuracy:0.00}%";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user