Compare commits
2 Commits
7d38e6c8eb
...
7074dcea8d
| Author | SHA1 | Date | |
|---|---|---|---|
| 7074dcea8d | |||
| d78de26260 |
@@ -1,305 +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 System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.UserInterface;
|
|
||||||
using osu.Framework.Testing;
|
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
|
||||||
using osu.Game.Extensions;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Resources.Localisation.Web;
|
|
||||||
using osu.Game.Rulesets;
|
|
||||||
using osu.Game.Rulesets.Catch;
|
|
||||||
using osu.Game.Rulesets.Mania;
|
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.Objects.Legacy;
|
|
||||||
using osu.Game.Rulesets.Osu;
|
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
|
||||||
using osu.Game.Rulesets.Taiko;
|
|
||||||
using osu.Game.Screens.Select;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.SongSelect
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public partial class TestSceneBeatmapInfoWedge : OsuTestScene
|
|
||||||
{
|
|
||||||
[Resolved]
|
|
||||||
private RulesetStore rulesets { get; set; } = null!;
|
|
||||||
|
|
||||||
private TestBeatmapInfoWedge infoWedge = null!;
|
|
||||||
private readonly List<IBeatmap> beatmaps = new List<IBeatmap>();
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
Add(infoWedge = new TestBeatmapInfoWedge
|
|
||||||
{
|
|
||||||
Size = new Vector2(0.5f, 245),
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Margin = new MarginPadding { Top = 20 }
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStep("show", () => infoWedge.Show());
|
|
||||||
|
|
||||||
selectBeatmap(Beatmap.Value.Beatmap);
|
|
||||||
|
|
||||||
AddWaitStep("wait for select", 3);
|
|
||||||
|
|
||||||
AddStep("hide", () => { infoWedge.Hide(); });
|
|
||||||
|
|
||||||
AddWaitStep("wait for hide", 3);
|
|
||||||
|
|
||||||
AddStep("show", () => { infoWedge.Show(); });
|
|
||||||
|
|
||||||
AddSliderStep("change star difficulty", 0, 11.9, 5.55, v =>
|
|
||||||
{
|
|
||||||
foreach (var hasCurrentValue in infoWedge.Info.ChildrenOfType<IHasCurrentValue<StarDifficulty>>())
|
|
||||||
hasCurrentValue.Current.Value = new StarDifficulty(v, 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach (var rulesetInfo in rulesets.AvailableRulesets)
|
|
||||||
{
|
|
||||||
var instance = rulesetInfo.CreateInstance();
|
|
||||||
var testBeatmap = CreateTestBeatmap(rulesetInfo);
|
|
||||||
|
|
||||||
beatmaps.Add(testBeatmap);
|
|
||||||
|
|
||||||
setRuleset(rulesetInfo);
|
|
||||||
|
|
||||||
selectBeatmap(testBeatmap);
|
|
||||||
|
|
||||||
testBeatmapLabels(instance);
|
|
||||||
|
|
||||||
switch (instance)
|
|
||||||
{
|
|
||||||
case OsuRuleset:
|
|
||||||
testInfoLabels(5);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TaikoRuleset:
|
|
||||||
testInfoLabels(5);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CatchRuleset:
|
|
||||||
testInfoLabels(5);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ManiaRuleset:
|
|
||||||
testInfoLabels(4);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
testInfoLabels(2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void testBeatmapLabels(Ruleset ruleset)
|
|
||||||
{
|
|
||||||
AddAssert("check version", () => infoWedge.Info.VersionLabel.Current.Value == $"{ruleset.ShortName}Version");
|
|
||||||
AddAssert("check title", () => infoWedge.Info.TitleLabel.Current.Value == $"{ruleset.ShortName}Title");
|
|
||||||
AddAssert("check artist", () => infoWedge.Info.ArtistLabel.Current.Value == $"{ruleset.ShortName}Artist");
|
|
||||||
AddAssert("check author", () => infoWedge.Info.MapperContainer.ChildrenOfType<OsuSpriteText>().Any(s => s.Current.Value == $"{ruleset.ShortName}Author"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void testInfoLabels(int expectedCount)
|
|
||||||
{
|
|
||||||
AddAssert("check info labels exists", () => infoWedge.Info.ChildrenOfType<BeatmapInfoWedge.WedgeInfoText.InfoLabel>().Any());
|
|
||||||
AddAssert("check info labels count", () => infoWedge.Info.ChildrenOfType<BeatmapInfoWedge.WedgeInfoText.InfoLabel>().Count() >= expectedCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
[SetUpSteps]
|
|
||||||
public void SetUpSteps()
|
|
||||||
{
|
|
||||||
AddStep("reset mods", () => SelectedMods.SetDefault());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestTruncation()
|
|
||||||
{
|
|
||||||
selectBeatmap(CreateLongMetadata());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestNullBeatmap()
|
|
||||||
{
|
|
||||||
selectBeatmap(null);
|
|
||||||
AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Current.Value));
|
|
||||||
AddAssert("check default title", () => infoWedge.Info.TitleLabel.Current.Value == Beatmap.Default.BeatmapInfo.Metadata.Title);
|
|
||||||
AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Current.Value == Beatmap.Default.BeatmapInfo.Metadata.Artist);
|
|
||||||
AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.ChildrenOfType<OsuSpriteText>().Any());
|
|
||||||
AddAssert("check no info labels", () => !infoWedge.Info.ChildrenOfType<BeatmapInfoWedge.WedgeInfoText.InfoLabel>().Any());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestBPMUpdates()
|
|
||||||
{
|
|
||||||
const double bpm = 120;
|
|
||||||
IBeatmap beatmap = CreateTestBeatmap(new OsuRuleset().RulesetInfo);
|
|
||||||
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 60 * 1000 / bpm });
|
|
||||||
|
|
||||||
OsuModDoubleTime doubleTime = null!;
|
|
||||||
|
|
||||||
selectBeatmap(beatmap);
|
|
||||||
checkDisplayedBPM($"{bpm}");
|
|
||||||
|
|
||||||
AddStep("select DT", () => SelectedMods.Value = new[] { doubleTime = new OsuModDoubleTime() });
|
|
||||||
checkDisplayedBPM($"{bpm * 1.5f}");
|
|
||||||
|
|
||||||
AddStep("change DT rate", () => doubleTime.SpeedChange.Value = 2);
|
|
||||||
checkDisplayedBPM($"{bpm * 2}");
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestCase(120, 125, null, "120-125 (mostly 120)")]
|
|
||||||
[TestCase(120, 120.6, null, "120-121 (mostly 120)")]
|
|
||||||
[TestCase(120, 120.4, null, "120")]
|
|
||||||
[TestCase(120, 120.6, "DT", "180-181 (mostly 180)")]
|
|
||||||
[TestCase(120, 120.4, "DT", "180-181 (mostly 180)")]
|
|
||||||
public void TestVaryingBPM(double commonBpm, double otherBpm, string? mod, string expectedDisplay)
|
|
||||||
{
|
|
||||||
IBeatmap beatmap = CreateTestBeatmap(new OsuRuleset().RulesetInfo);
|
|
||||||
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 60 * 1000 / commonBpm });
|
|
||||||
beatmap.ControlPointInfo.Add(100, new TimingControlPoint { BeatLength = 60 * 1000 / otherBpm });
|
|
||||||
beatmap.ControlPointInfo.Add(200, new TimingControlPoint { BeatLength = 60 * 1000 / commonBpm });
|
|
||||||
|
|
||||||
if (mod != null)
|
|
||||||
AddStep($"select {mod}", () => SelectedMods.Value = new[] { Ruleset.Value.CreateInstance().CreateModFromAcronym(mod) });
|
|
||||||
|
|
||||||
selectBeatmap(beatmap);
|
|
||||||
checkDisplayedBPM(expectedDisplay);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkDisplayedBPM(string target)
|
|
||||||
{
|
|
||||||
AddUntilStep($"displayed bpm is {target}", () =>
|
|
||||||
{
|
|
||||||
var label = infoWedge.DisplayedContent.ChildrenOfType<BeatmapInfoWedge.WedgeInfoText.InfoLabel>().Single(l => l.Statistic.Name == BeatmapsetsStrings.ShowStatsBpm);
|
|
||||||
return label.Statistic.Content == target;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestCase]
|
|
||||||
public void TestLengthUpdates()
|
|
||||||
{
|
|
||||||
IBeatmap beatmap = CreateTestBeatmap(new OsuRuleset().RulesetInfo);
|
|
||||||
double drain = beatmap.CalculateDrainLength();
|
|
||||||
beatmap.BeatmapInfo.Length = drain;
|
|
||||||
|
|
||||||
OsuModDoubleTime doubleTime = null!;
|
|
||||||
|
|
||||||
selectBeatmap(beatmap);
|
|
||||||
checkDisplayedLength(drain);
|
|
||||||
|
|
||||||
AddStep("select DT", () => SelectedMods.Value = new[] { doubleTime = new OsuModDoubleTime() });
|
|
||||||
checkDisplayedLength(Math.Round(drain / 1.5f));
|
|
||||||
|
|
||||||
AddStep("change DT rate", () => doubleTime.SpeedChange.Value = 2);
|
|
||||||
checkDisplayedLength(Math.Round(drain / 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkDisplayedLength(double drain)
|
|
||||||
{
|
|
||||||
var displayedLength = drain.ToFormattedDuration();
|
|
||||||
|
|
||||||
AddUntilStep($"check map drain ({displayedLength})", () =>
|
|
||||||
{
|
|
||||||
var label = infoWedge.DisplayedContent.ChildrenOfType<BeatmapInfoWedge.WedgeInfoText.InfoLabel>()
|
|
||||||
.Single(l => l.Statistic.Name == BeatmapsetsStrings.ShowStatsTotalLength(displayedLength));
|
|
||||||
return label.Statistic.Content == displayedLength.ToString();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setRuleset(RulesetInfo rulesetInfo)
|
|
||||||
{
|
|
||||||
Container? containerBefore = null;
|
|
||||||
|
|
||||||
AddStep("set ruleset", () =>
|
|
||||||
{
|
|
||||||
// wedge content is only refreshed if the ruleset changes, so only wait for load in that case.
|
|
||||||
if (!rulesetInfo.Equals(Ruleset.Value))
|
|
||||||
containerBefore = infoWedge.DisplayedContent;
|
|
||||||
|
|
||||||
Ruleset.Value = rulesetInfo;
|
|
||||||
});
|
|
||||||
|
|
||||||
AddUntilStep("wait for async load", () => infoWedge.DisplayedContent != containerBefore);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void selectBeatmap(IBeatmap? b)
|
|
||||||
{
|
|
||||||
Container? containerBefore = null;
|
|
||||||
|
|
||||||
AddStep($"select {b?.Metadata.Title ?? "null"} beatmap", () =>
|
|
||||||
{
|
|
||||||
containerBefore = infoWedge.DisplayedContent;
|
|
||||||
infoWedge.Beatmap = Beatmap.Value = b == null ? Beatmap.Default : CreateWorkingBeatmap(b);
|
|
||||||
});
|
|
||||||
|
|
||||||
AddUntilStep("wait for async load", () => infoWedge.DisplayedContent != containerBefore);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IBeatmap CreateTestBeatmap(RulesetInfo ruleset)
|
|
||||||
{
|
|
||||||
List<HitObject> objects = new List<HitObject>();
|
|
||||||
for (double i = 0; i < 50000; i += 1000)
|
|
||||||
objects.Add(new TestHitObject { StartTime = i });
|
|
||||||
|
|
||||||
return new Beatmap
|
|
||||||
{
|
|
||||||
BeatmapInfo = new BeatmapInfo
|
|
||||||
{
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Author = { Username = $"{ruleset.ShortName}Author" },
|
|
||||||
Artist = $"{ruleset.ShortName}Artist",
|
|
||||||
Source = $"{ruleset.ShortName}Source",
|
|
||||||
Title = $"{ruleset.ShortName}Title"
|
|
||||||
},
|
|
||||||
Ruleset = ruleset,
|
|
||||||
StarRating = 6,
|
|
||||||
DifficultyName = $"{ruleset.ShortName}Version",
|
|
||||||
Difficulty = new BeatmapDifficulty()
|
|
||||||
},
|
|
||||||
HitObjects = objects
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IBeatmap CreateLongMetadata()
|
|
||||||
{
|
|
||||||
return new Beatmap
|
|
||||||
{
|
|
||||||
BeatmapInfo = new BeatmapInfo
|
|
||||||
{
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Author = { Username = "WWWWWWWWWWWWWWW" },
|
|
||||||
Artist = "Verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long Artist",
|
|
||||||
Source = "Verrrrry long Source",
|
|
||||||
Title = "Verrrrry long Title"
|
|
||||||
},
|
|
||||||
DifficultyName = "Verrrrrrrrrrrrrrrrrrrrrrrrrrrrry long Version",
|
|
||||||
Status = BeatmapOnlineStatus.Graveyard,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private partial class TestBeatmapInfoWedge : BeatmapInfoWedge
|
|
||||||
{
|
|
||||||
public new Container DisplayedContent => base.DisplayedContent;
|
|
||||||
|
|
||||||
public new WedgeInfoText Info => base.Info;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TestHitObject : ConvertHitObject;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,99 +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 System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
|
||||||
using osu.Game.Screens.Select;
|
|
||||||
using osu.Game.Utils;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.UserInterface
|
|
||||||
{
|
|
||||||
public partial class TestSceneFooterButtonMods : OsuTestScene
|
|
||||||
{
|
|
||||||
private readonly TestFooterButtonMods footerButtonMods;
|
|
||||||
|
|
||||||
public TestSceneFooterButtonMods()
|
|
||||||
{
|
|
||||||
Add(footerButtonMods = new TestFooterButtonMods());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestIncrementMultiplier()
|
|
||||||
{
|
|
||||||
var hiddenMod = new Mod[] { new OsuModHidden() };
|
|
||||||
AddStep(@"Add Hidden", () => changeMods(hiddenMod));
|
|
||||||
AddAssert(@"Check Hidden multiplier", () => assertModsMultiplier(hiddenMod));
|
|
||||||
|
|
||||||
var hardRockMod = new Mod[] { new OsuModHardRock() };
|
|
||||||
AddStep(@"Add HardRock", () => changeMods(hardRockMod));
|
|
||||||
AddAssert(@"Check HardRock multiplier", () => assertModsMultiplier(hardRockMod));
|
|
||||||
|
|
||||||
var doubleTimeMod = new Mod[] { new OsuModDoubleTime() };
|
|
||||||
AddStep(@"Add DoubleTime", () => changeMods(doubleTimeMod));
|
|
||||||
AddAssert(@"Check DoubleTime multiplier", () => assertModsMultiplier(doubleTimeMod));
|
|
||||||
|
|
||||||
var multipleIncrementMods = new Mod[] { new OsuModDoubleTime(), new OsuModHidden(), new OsuModHardRock() };
|
|
||||||
AddStep(@"Add multiple Mods", () => changeMods(multipleIncrementMods));
|
|
||||||
AddAssert(@"Check multiple mod multiplier", () => assertModsMultiplier(multipleIncrementMods));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestDecrementMultiplier()
|
|
||||||
{
|
|
||||||
var easyMod = new Mod[] { new OsuModEasy() };
|
|
||||||
AddStep(@"Add Easy", () => changeMods(easyMod));
|
|
||||||
AddAssert(@"Check Easy multiplier", () => assertModsMultiplier(easyMod));
|
|
||||||
|
|
||||||
var noFailMod = new Mod[] { new OsuModNoFail() };
|
|
||||||
AddStep(@"Add NoFail", () => changeMods(noFailMod));
|
|
||||||
AddAssert(@"Check NoFail multiplier", () => assertModsMultiplier(noFailMod));
|
|
||||||
|
|
||||||
var multipleDecrementMods = new Mod[] { new OsuModEasy(), new OsuModNoFail() };
|
|
||||||
AddStep(@"Add Multiple Mods", () => changeMods(multipleDecrementMods));
|
|
||||||
AddAssert(@"Check multiple mod multiplier", () => assertModsMultiplier(multipleDecrementMods));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestClearMultiplier()
|
|
||||||
{
|
|
||||||
var multipleMods = new Mod[] { new OsuModDoubleTime(), new OsuModFlashlight() };
|
|
||||||
AddStep(@"Add mods", () => changeMods(multipleMods));
|
|
||||||
AddStep(@"Clear selected mod", () => changeMods(Array.Empty<Mod>()));
|
|
||||||
AddAssert(@"Check empty multiplier", () => assertModsMultiplier(Array.Empty<Mod>()));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestUnrankedBadge()
|
|
||||||
{
|
|
||||||
AddStep(@"Add unranked mod", () => changeMods(new[] { new OsuModAutoplay() }));
|
|
||||||
AddAssert("Unranked badge shown", () => footerButtonMods.UnrankedBadge.Alpha == 1);
|
|
||||||
AddStep(@"Clear selected mod", () => changeMods(Array.Empty<Mod>()));
|
|
||||||
AddAssert("Unranked badge not shown", () => footerButtonMods.UnrankedBadge.Alpha == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void changeMods(IReadOnlyList<Mod> mods)
|
|
||||||
{
|
|
||||||
footerButtonMods.Current.Value = mods;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool assertModsMultiplier(IEnumerable<Mod> mods)
|
|
||||||
{
|
|
||||||
double multiplier = mods.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier);
|
|
||||||
string expectedValue = multiplier == 1 ? string.Empty : ModUtils.FormatScoreMultiplier(multiplier).ToString();
|
|
||||||
|
|
||||||
return expectedValue == footerButtonMods.MultiplierText.Current.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private partial class TestFooterButtonMods : FooterButtonMods
|
|
||||||
{
|
|
||||||
public new OsuSpriteText MultiplierText => base.MultiplierText;
|
|
||||||
public new Drawable UnrankedBadge => base.UnrankedBadge;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -138,6 +138,7 @@ namespace osu.Game.Configuration
|
|||||||
SetDefault(OsuSetting.CursorRotation, true);
|
SetDefault(OsuSetting.CursorRotation, true);
|
||||||
|
|
||||||
SetDefault(OsuSetting.MenuParallax, true);
|
SetDefault(OsuSetting.MenuParallax, true);
|
||||||
|
SetDefault(OsuSetting.ParallaxStrength, 1.0f, 0.01f, 10.00f, 0.01f);
|
||||||
|
|
||||||
// See https://stackoverflow.com/a/63307411 for default sourcing.
|
// See https://stackoverflow.com/a/63307411 for default sourcing.
|
||||||
SetDefault(OsuSetting.Prefer24HourTime, !CultureInfoHelper.SystemCulture.DateTimeFormat.ShortTimePattern.Contains(@"tt"));
|
SetDefault(OsuSetting.Prefer24HourTime, !CultureInfoHelper.SystemCulture.DateTimeFormat.ShortTimePattern.Contains(@"tt"));
|
||||||
@@ -400,6 +401,7 @@ namespace osu.Game.Configuration
|
|||||||
MenuTips,
|
MenuTips,
|
||||||
CursorRotation,
|
CursorRotation,
|
||||||
MenuParallax,
|
MenuParallax,
|
||||||
|
ParallaxStrength,
|
||||||
Prefer24HourTime,
|
Prefer24HourTime,
|
||||||
BeatmapDetailTab,
|
BeatmapDetailTab,
|
||||||
BeatmapLeaderboardSortMode,
|
BeatmapLeaderboardSortMode,
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
public float ParallaxAmount = DEFAULT_PARALLAX_AMOUNT;
|
public float ParallaxAmount = DEFAULT_PARALLAX_AMOUNT;
|
||||||
|
|
||||||
private Bindable<bool> parallaxEnabled;
|
private Bindable<bool> parallaxEnabled;
|
||||||
|
private Bindable<float> parallaxStrength;
|
||||||
|
|
||||||
private const float parallax_duration = 100;
|
private const float parallax_duration = 100;
|
||||||
|
|
||||||
@@ -58,12 +59,21 @@ namespace osu.Game.Graphics.Containers
|
|||||||
content.Scale = new Vector2(1 + Math.Abs(ParallaxAmount));
|
content.Scale = new Vector2(1 + Math.Abs(ParallaxAmount));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
parallaxStrength = config.GetBindable<float>(OsuSetting.ParallaxStrength);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
input = GetContainingInputManager();
|
input = GetContainingInputManager();
|
||||||
|
|
||||||
|
parallaxStrength?.BindValueChanged(
|
||||||
|
d =>
|
||||||
|
{
|
||||||
|
ParallaxAmount = DEFAULT_PARALLAX_AMOUNT * parallaxStrength.Value;
|
||||||
|
}, true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@@ -76,6 +86,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
if (input.CurrentState.Mouse != null)
|
if (input.CurrentState.Mouse != null)
|
||||||
{
|
{
|
||||||
|
ParallaxAmount = DEFAULT_PARALLAX_AMOUNT * parallaxStrength.Value;
|
||||||
|
|
||||||
var sizeDiv2 = DrawSize / 2;
|
var sizeDiv2 = DrawSize / 2;
|
||||||
|
|
||||||
Vector2 relativeAmount = ToLocalSpace(input.CurrentState.Mouse.Position) - sizeDiv2;
|
Vector2 relativeAmount = ToLocalSpace(input.CurrentState.Mouse.Position) - sizeDiv2;
|
||||||
|
|||||||
@@ -18,6 +18,20 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
|
FormCheckBox parallaxEnabled = new FormCheckBox
|
||||||
|
{
|
||||||
|
Caption = UserInterfaceStrings.Parallax,
|
||||||
|
Current = config.GetBindable<bool>(OsuSetting.MenuParallax)
|
||||||
|
};
|
||||||
|
|
||||||
|
FormSliderBar<float> parallaxStrength = new FormSliderBar<float>
|
||||||
|
{
|
||||||
|
Caption = "Parallax strength",
|
||||||
|
Current = config.GetBindable<float>(OsuSetting.ParallaxStrength),
|
||||||
|
KeyboardStep = 0.01f,
|
||||||
|
LabelFormat = v => $"{v:0.##}x"
|
||||||
|
};
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SettingsItemV2(new FormCheckBox
|
new SettingsItemV2(new FormCheckBox
|
||||||
@@ -35,11 +49,8 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
|||||||
KeyboardStep = 0.01f,
|
KeyboardStep = 0.01f,
|
||||||
LabelFormat = v => $"{v:0.##}x"
|
LabelFormat = v => $"{v:0.##}x"
|
||||||
}),
|
}),
|
||||||
new SettingsItemV2(new FormCheckBox
|
new SettingsItemV2(parallaxEnabled),
|
||||||
{
|
new SettingsItemV2(parallaxStrength),
|
||||||
Caption = UserInterfaceStrings.Parallax,
|
|
||||||
Current = config.GetBindable<bool>(OsuSetting.MenuParallax)
|
|
||||||
}),
|
|
||||||
new SettingsItemV2(new FormSliderBar<double>
|
new SettingsItemV2(new FormSliderBar<double>
|
||||||
{
|
{
|
||||||
Caption = UserInterfaceStrings.HoldToConfirmActivationTime,
|
Caption = UserInterfaceStrings.HoldToConfirmActivationTime,
|
||||||
|
|||||||
Reference in New Issue
Block a user