mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 04:13:00 +08:00
Merge branch 'master' into not-available-to-download
This commit is contained in:
commit
f4e765cf99
@ -72,7 +72,7 @@ If the build fails, try to restore nuget packages with `dotnet restore`.
|
||||
|
||||
On Linux, the environment variable `LD_LIBRARY_PATH` must point to the build directory, located at `osu.Desktop/bin/Debug/$NETCORE_VERSION`.
|
||||
|
||||
`$NETCORE_VERSION` is the version of .NET Core SDK. You can have it with `grep TargetFramework osu.Desktop/osu.Desktop.csproj | sed -r 's/.*>(.*)<\/.*/\1/'`.
|
||||
`$NETCORE_VERSION` is the version of the targeted .NET Core SDK. You can check it by running `grep TargetFramework osu.Desktop/osu.Desktop.csproj | sed -r 's/.*>(.*)<\/.*/\1/'`.
|
||||
|
||||
For example, you can run osu! with the following command:
|
||||
|
||||
|
105
osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs
Normal file
105
osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs
Normal file
@ -0,0 +1,105 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
using osu.Game.Tests.Visual;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneCatcher : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(CatcherSprite),
|
||||
};
|
||||
|
||||
private readonly Container container;
|
||||
|
||||
public TestSceneCatcher()
|
||||
{
|
||||
Child = container = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AddStep("show default catcher implementation", () => { container.Child = new CatcherSprite(); });
|
||||
|
||||
AddStep("show custom catcher implementation", () =>
|
||||
{
|
||||
container.Child = new CatchCustomSkinSourceContainer
|
||||
{
|
||||
Child = new CatcherSprite()
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private class CatcherCustomSkin : Container
|
||||
{
|
||||
public CatcherCustomSkin()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Blue
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = "custom"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[Cached(typeof(ISkinSource))]
|
||||
private class CatchCustomSkinSourceContainer : Container, ISkinSource
|
||||
{
|
||||
public event Action SourceChanged
|
||||
{
|
||||
add { }
|
||||
remove { }
|
||||
}
|
||||
|
||||
public Drawable GetDrawableComponent(string componentName)
|
||||
{
|
||||
switch (componentName)
|
||||
{
|
||||
case "Play/Catch/fruit-catcher-idle":
|
||||
return new CatcherCustomSkin();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public SampleChannel GetSample(string sampleName) =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
public Texture GetTexture(string componentName) =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration =>
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -6,8 +6,6 @@ using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -141,7 +139,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
Children = new[]
|
||||
{
|
||||
caughtFruit = new Container<DrawableHitObject>
|
||||
{
|
||||
@ -212,7 +210,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
Scheduler.AddDelayed(beginTrail, HyperDashing ? 25 : 50);
|
||||
}
|
||||
|
||||
private Sprite createCatcherSprite() => new CatcherSprite();
|
||||
private Drawable createCatcherSprite() => new CatcherSprite();
|
||||
|
||||
/// <summary>
|
||||
/// Add a caught fruit to the catcher's stack.
|
||||
@ -444,23 +442,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
|
||||
fruit.Expire();
|
||||
}
|
||||
|
||||
private class CatcherSprite : Sprite
|
||||
{
|
||||
public CatcherSprite()
|
||||
{
|
||||
Size = new Vector2(CATCHER_SIZE);
|
||||
|
||||
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.
|
||||
OriginPosition = new Vector2(-0.02f, 0.06f) * CATCHER_SIZE;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Texture = textures.Get(@"Play/Catch/fruit-catcher-idle");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
33
osu.Game.Rulesets.Catch/UI/CatcherSprite.cs
Normal file
33
osu.Game.Rulesets.Catch/UI/CatcherSprite.cs
Normal file
@ -0,0 +1,33 @@
|
||||
// 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.Game.Skinning;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.UI
|
||||
{
|
||||
public class CatcherSprite : CompositeDrawable
|
||||
{
|
||||
public CatcherSprite()
|
||||
{
|
||||
Size = new Vector2(CatcherArea.CATCHER_SIZE);
|
||||
|
||||
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.
|
||||
OriginPosition = new Vector2(-0.02f, 0.06f) * CatcherArea.CATCHER_SIZE;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = new SkinnableSprite(@"Play/Catch/fruit-catcher-idle")
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
@ -25,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Child = new SkinnableDrawable("Play/osu/approachcircle", name => new Sprite { Texture = textures.Get(name) });
|
||||
Child = new SkinnableSprite("Play/osu/approachcircle");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -73,7 +74,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
{
|
||||
case OsuAction.LeftButton:
|
||||
case OsuAction.RightButton:
|
||||
if (--downCount == 0)
|
||||
// Todo: Math.Max() is required as a temporary measure to address https://github.com/ppy/osu-framework/issues/2576
|
||||
downCount = Math.Max(0, downCount - 1);
|
||||
|
||||
if (downCount == 0)
|
||||
updateExpandedState();
|
||||
break;
|
||||
}
|
||||
|
68
osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs
Normal file
68
osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoSuddenDeath.cs
Normal file
@ -0,0 +1,68 @@
|
||||
// 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.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Beatmaps;
|
||||
using osu.Game.Rulesets.Taiko.Mods;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
public class TestSceneTaikoSuddenDeath : PlayerTestScene
|
||||
{
|
||||
public TestSceneTaikoSuddenDeath()
|
||||
: base(new TaikoRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool AllowFail => true;
|
||||
|
||||
protected override Player CreatePlayer(Ruleset ruleset)
|
||||
{
|
||||
Mods.Value = Mods.Value.Concat(new[] { new TaikoModSuddenDeath() }).ToArray();
|
||||
return new ScoreAccessiblePlayer();
|
||||
}
|
||||
|
||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) =>
|
||||
new TaikoBeatmap
|
||||
{
|
||||
HitObjects =
|
||||
{
|
||||
new Swell { StartTime = 1500 },
|
||||
new Hit { StartTime = 100000 },
|
||||
},
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = new TaikoRuleset().RulesetInfo
|
||||
}
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void TestSpinnerDoesNotFail()
|
||||
{
|
||||
bool judged = false;
|
||||
AddStep("Setup judgements", () =>
|
||||
{
|
||||
judged = false;
|
||||
((ScoreAccessiblePlayer)Player).ScoreProcessor.NewJudgement += b => judged = true;
|
||||
});
|
||||
AddUntilStep("swell judged", () => judged);
|
||||
AddAssert("not failed", () => !Player.HasFailed);
|
||||
}
|
||||
|
||||
private class ScoreAccessiblePlayer : TestPlayer
|
||||
{
|
||||
public ScoreAccessiblePlayer()
|
||||
: base(false, false)
|
||||
{
|
||||
}
|
||||
|
||||
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
||||
}
|
||||
}
|
||||
}
|
@ -14,94 +14,132 @@ namespace osu.Game.Tests.Visual.Components
|
||||
[TestFixture]
|
||||
public class TestSceneIdleTracker : ManualInputManagerTestScene
|
||||
{
|
||||
private readonly IdleTrackingBox box1;
|
||||
private readonly IdleTrackingBox box2;
|
||||
private readonly IdleTrackingBox box3;
|
||||
private readonly IdleTrackingBox box4;
|
||||
private IdleTrackingBox box1;
|
||||
private IdleTrackingBox box2;
|
||||
private IdleTrackingBox box3;
|
||||
private IdleTrackingBox box4;
|
||||
|
||||
public TestSceneIdleTracker()
|
||||
private IdleTrackingBox[] boxes;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
Children = new Drawable[]
|
||||
InputManager.MoveMouseTo(Vector2.Zero);
|
||||
|
||||
Children = boxes = new[]
|
||||
{
|
||||
box1 = new IdleTrackingBox(1000)
|
||||
box1 = new IdleTrackingBox(2000)
|
||||
{
|
||||
Name = "TopLeft",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Red,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
},
|
||||
box2 = new IdleTrackingBox(2000)
|
||||
box2 = new IdleTrackingBox(4000)
|
||||
{
|
||||
Name = "TopRight",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Green,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
},
|
||||
box3 = new IdleTrackingBox(3000)
|
||||
box3 = new IdleTrackingBox(6000)
|
||||
{
|
||||
Name = "BottomLeft",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Blue,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
},
|
||||
box4 = new IdleTrackingBox(4000)
|
||||
box4 = new IdleTrackingBox(8000)
|
||||
{
|
||||
Name = "BottomRight",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Orange,
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
},
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestNudge()
|
||||
{
|
||||
AddStep("move mouse to top left", () => InputManager.MoveMouseTo(box1.ScreenSpaceDrawQuad.Centre));
|
||||
AddStep("move to top left", () => InputManager.MoveMouseTo(box1));
|
||||
|
||||
AddUntilStep("Wait for all idle", () => box1.IsIdle && box2.IsIdle && box3.IsIdle && box4.IsIdle);
|
||||
waitForAllIdle();
|
||||
|
||||
AddStep("nudge mouse", () => InputManager.MoveMouseTo(box1.ScreenSpaceDrawQuad.Centre + new Vector2(1)));
|
||||
|
||||
AddAssert("check not idle", () => !box1.IsIdle);
|
||||
AddAssert("check idle", () => box2.IsIdle);
|
||||
AddAssert("check idle", () => box3.IsIdle);
|
||||
AddAssert("check idle", () => box4.IsIdle);
|
||||
checkIdleStatus(1, false);
|
||||
checkIdleStatus(2, true);
|
||||
checkIdleStatus(3, true);
|
||||
checkIdleStatus(4, true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMovement()
|
||||
{
|
||||
AddStep("move mouse", () => InputManager.MoveMouseTo(box2.ScreenSpaceDrawQuad.Centre));
|
||||
AddStep("move to top right", () => InputManager.MoveMouseTo(box2));
|
||||
|
||||
AddAssert("check not idle", () => box1.IsIdle);
|
||||
AddAssert("check not idle", () => !box2.IsIdle);
|
||||
AddAssert("check idle", () => box3.IsIdle);
|
||||
AddAssert("check idle", () => box4.IsIdle);
|
||||
checkIdleStatus(1, true);
|
||||
checkIdleStatus(2, false);
|
||||
checkIdleStatus(3, true);
|
||||
checkIdleStatus(4, true);
|
||||
|
||||
AddStep("move mouse", () => InputManager.MoveMouseTo(box3.ScreenSpaceDrawQuad.Centre));
|
||||
AddStep("move mouse", () => InputManager.MoveMouseTo(box4.ScreenSpaceDrawQuad.Centre));
|
||||
AddStep("move to bottom left", () => InputManager.MoveMouseTo(box3));
|
||||
AddStep("move to bottom right", () => InputManager.MoveMouseTo(box4));
|
||||
|
||||
AddAssert("check not idle", () => box1.IsIdle);
|
||||
AddAssert("check not idle", () => !box2.IsIdle);
|
||||
AddAssert("check idle", () => !box3.IsIdle);
|
||||
AddAssert("check idle", () => !box4.IsIdle);
|
||||
checkIdleStatus(1, true);
|
||||
checkIdleStatus(2, false);
|
||||
checkIdleStatus(3, false);
|
||||
checkIdleStatus(4, false);
|
||||
|
||||
AddUntilStep("Wait for all idle", () => box1.IsIdle && box2.IsIdle && box3.IsIdle && box4.IsIdle);
|
||||
waitForAllIdle();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTimings()
|
||||
{
|
||||
AddStep("move mouse", () => InputManager.MoveMouseTo(ScreenSpaceDrawQuad.Centre));
|
||||
AddStep("move to centre", () => InputManager.MoveMouseTo(Content));
|
||||
|
||||
checkIdleStatus(1, false);
|
||||
checkIdleStatus(2, false);
|
||||
checkIdleStatus(3, false);
|
||||
checkIdleStatus(4, false);
|
||||
|
||||
AddAssert("check not idle", () => !box1.IsIdle && !box2.IsIdle && !box3.IsIdle && !box4.IsIdle);
|
||||
AddUntilStep("Wait for idle", () => box1.IsIdle);
|
||||
AddAssert("check not idle", () => !box2.IsIdle && !box3.IsIdle && !box4.IsIdle);
|
||||
|
||||
checkIdleStatus(1, true);
|
||||
checkIdleStatus(2, false);
|
||||
checkIdleStatus(3, false);
|
||||
checkIdleStatus(4, false);
|
||||
|
||||
AddUntilStep("Wait for idle", () => box2.IsIdle);
|
||||
AddAssert("check not idle", () => !box3.IsIdle && !box4.IsIdle);
|
||||
|
||||
checkIdleStatus(1, true);
|
||||
checkIdleStatus(2, true);
|
||||
checkIdleStatus(3, false);
|
||||
checkIdleStatus(4, false);
|
||||
|
||||
AddUntilStep("Wait for idle", () => box3.IsIdle);
|
||||
|
||||
checkIdleStatus(1, true);
|
||||
checkIdleStatus(2, true);
|
||||
checkIdleStatus(3, true);
|
||||
checkIdleStatus(4, false);
|
||||
|
||||
waitForAllIdle();
|
||||
}
|
||||
|
||||
private void checkIdleStatus(int box, bool expectedIdle)
|
||||
{
|
||||
AddAssert($"box {box} is {(expectedIdle ? "idle" : "active")}", () => boxes[box - 1].IsIdle == expectedIdle);
|
||||
}
|
||||
|
||||
private void waitForAllIdle()
|
||||
{
|
||||
AddUntilStep("Wait for all idle", () => box1.IsIdle && box2.IsIdle && box3.IsIdle && box4.IsIdle);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
ScoreProcessor.FailConditions += _ => true;
|
||||
ScoreProcessor.FailConditions += (_, __) => true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
52
osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs
Normal file
52
osu.Game.Tests/Visual/UserInterface/TestSceneBackButton.cs
Normal file
@ -0,0 +1,52 @@
|
||||
// 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 osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public class TestSceneBackButton : OsuTestScene
|
||||
{
|
||||
private readonly BackButton button;
|
||||
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(TwoLayerButton)
|
||||
};
|
||||
|
||||
public TestSceneBackButton()
|
||||
{
|
||||
Child = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(300),
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.SlateGray
|
||||
},
|
||||
button = new BackButton
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Action = () => button.Hide(),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
AddStep("show button", () => button.Show());
|
||||
AddStep("hide button", () => button.Hide());
|
||||
}
|
||||
}
|
||||
}
|
@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
public void TestOsuMods()
|
||||
{
|
||||
var ruleset = rulesets.AvailableRulesets.First(r => r.ID == 0);
|
||||
AddStep("change ruleset", () => { Ruleset.Value = ruleset; });
|
||||
changeRuleset(ruleset);
|
||||
|
||||
var instance = ruleset.CreateInstance();
|
||||
|
||||
@ -108,7 +108,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
public void TestManiaMods()
|
||||
{
|
||||
var ruleset = rulesets.AvailableRulesets.First(r => r.ID == 3);
|
||||
AddStep("change ruleset", () => { Ruleset.Value = ruleset; });
|
||||
changeRuleset(ruleset);
|
||||
|
||||
testRankedText(ruleset.CreateInstance().GetModsFor(ModType.Conversion).First(m => m is ManiaModRandom));
|
||||
}
|
||||
@ -119,7 +119,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
var rulesetOsu = rulesets.AvailableRulesets.First(r => r.ID == 0);
|
||||
var rulesetMania = rulesets.AvailableRulesets.First(r => r.ID == 3);
|
||||
|
||||
AddStep("change ruleset to null", () => { Ruleset.Value = null; });
|
||||
changeRuleset(null);
|
||||
|
||||
var instance = rulesetOsu.CreateInstance();
|
||||
var easierMods = instance.GetModsFor(ModType.DifficultyReduction);
|
||||
@ -127,15 +127,15 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
AddStep("set mods externally", () => { modDisplay.Current.Value = new[] { noFailMod }; });
|
||||
|
||||
AddStep("change ruleset to osu", () => { Ruleset.Value = rulesetOsu; });
|
||||
changeRuleset(rulesetOsu);
|
||||
|
||||
AddAssert("ensure mods still selected", () => modDisplay.Current.Value.Single(m => m is OsuModNoFail) != null);
|
||||
|
||||
AddStep("change ruleset to mania", () => { Ruleset.Value = rulesetMania; });
|
||||
changeRuleset(rulesetMania);
|
||||
|
||||
AddAssert("ensure mods not selected", () => !modDisplay.Current.Value.Any(m => m is OsuModNoFail));
|
||||
|
||||
AddStep("change ruleset to osu", () => { Ruleset.Value = rulesetOsu; });
|
||||
changeRuleset(rulesetOsu);
|
||||
|
||||
AddAssert("ensure mods not selected", () => !modDisplay.Current.Value.Any());
|
||||
}
|
||||
@ -216,14 +216,11 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
private void testRankedText(Mod mod)
|
||||
{
|
||||
waitForLoad();
|
||||
AddAssert("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
||||
AddUntilStep("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
||||
selectNext(mod);
|
||||
waitForLoad();
|
||||
AddAssert("check for unranked", () => modSelect.UnrankedLabel.Alpha != 0);
|
||||
AddUntilStep("check for unranked", () => modSelect.UnrankedLabel.Alpha != 0);
|
||||
selectPrevious(mod);
|
||||
waitForLoad();
|
||||
AddAssert("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
||||
AddUntilStep("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
||||
}
|
||||
|
||||
private void selectNext(Mod mod) => AddStep($"left click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectNext(1));
|
||||
@ -232,7 +229,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
private void checkSelected(Mod mod)
|
||||
{
|
||||
waitForLoad();
|
||||
AddAssert($"check {mod.Name} is selected", () =>
|
||||
{
|
||||
var button = modSelect.GetModButton(mod);
|
||||
@ -240,14 +236,17 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
});
|
||||
}
|
||||
|
||||
private void waitForLoad()
|
||||
private void changeRuleset(RulesetInfo ruleset)
|
||||
{
|
||||
AddUntilStep("wait for icons to load", () => modSelect.AllLoaded);
|
||||
AddStep($"change ruleset to {ruleset}", () => { Ruleset.Value = ruleset; });
|
||||
waitForLoad();
|
||||
}
|
||||
|
||||
private void waitForLoad() =>
|
||||
AddUntilStep("wait for icons to load", () => modSelect.AllLoaded);
|
||||
|
||||
private void checkNotSelected(Mod mod)
|
||||
{
|
||||
waitForLoad();
|
||||
AddAssert($"check {mod.Name} is not selected", () =>
|
||||
{
|
||||
var button = modSelect.GetModButton(mod);
|
||||
|
55
osu.Game.Tests/Visual/UserInterface/TestSceneNumberBox.cs
Normal file
55
osu.Game.Tests/Visual/UserInterface/TestSceneNumberBox.cs
Normal file
@ -0,0 +1,55 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneNumberBox : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(OsuNumberBox),
|
||||
};
|
||||
|
||||
private OsuNumberBox numberBox;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Child = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Padding = new MarginPadding { Horizontal = 250 },
|
||||
Child = numberBox = new OsuNumberBox
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
PlaceholderText = "Insert numbers here"
|
||||
}
|
||||
};
|
||||
|
||||
clearInput();
|
||||
AddStep("enter numbers", () => numberBox.Text = "987654321");
|
||||
expectedValue("987654321");
|
||||
clearInput();
|
||||
AddStep("enter text + single number", () => numberBox.Text = "1 hello 2 world 3");
|
||||
expectedValue("123");
|
||||
clearInput();
|
||||
}
|
||||
|
||||
private void clearInput() => AddStep("clear input", () => numberBox.Text = null);
|
||||
|
||||
private void expectedValue(string value) => AddAssert("expect number", () => numberBox.Text == value);
|
||||
}
|
||||
}
|
@ -1,17 +1,26 @@
|
||||
// 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.ComponentModel;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
[Description("mostly back button")]
|
||||
public class TestSceneTwoLayerButton : OsuTestScene
|
||||
{
|
||||
public TestSceneTwoLayerButton()
|
||||
{
|
||||
Add(new BackButton());
|
||||
Add(new TwoLayerButton
|
||||
{
|
||||
Position = new Vector2(100),
|
||||
Text = "button",
|
||||
Icon = FontAwesome.Solid.Check,
|
||||
BackgroundColour = Color4.SlateGray,
|
||||
HoverColour = Color4.SlateGray.Darken(0.2f)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SettingsTextBox
|
||||
new SettingsNumberBox
|
||||
{
|
||||
LabelText = "Beatmap ID",
|
||||
RelativeSizeAxes = Axes.None,
|
||||
|
@ -231,7 +231,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SettingsTextBox
|
||||
new SettingsNumberBox
|
||||
{
|
||||
LabelText = "User ID",
|
||||
RelativeSizeAxes = Axes.None,
|
||||
|
@ -5,7 +5,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
@ -191,8 +190,6 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
|
||||
public RoundDisplay()
|
||||
{
|
||||
CornerRadius = 10;
|
||||
Masking = true;
|
||||
Width = 200;
|
||||
Height = 20;
|
||||
}
|
||||
@ -208,11 +205,6 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = new Color4(47, 71, 67, 255),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
|
@ -51,8 +51,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
name = round.Name.GetBoundCopy();
|
||||
name.BindValueChanged(n => textName.Text = ((losers ? "Losers " : "") + round.Name).ToUpper(), true);
|
||||
|
||||
description = round.Name.GetBoundCopy();
|
||||
description.BindValueChanged(n => textDescription.Text = round.Description.Value.ToUpper(), true);
|
||||
description = round.Description.GetBoundCopy();
|
||||
description.BindValueChanged(n => textDescription.Text = round.Description.Value?.ToUpper(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,17 +6,25 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.Showcase
|
||||
{
|
||||
public class TournamentLogo : CompositeDrawable
|
||||
{
|
||||
public TournamentLogo()
|
||||
public TournamentLogo(bool includeRoundBackground = true)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 95;
|
||||
Margin = new MarginPadding { Vertical = 5 };
|
||||
|
||||
if (includeRoundBackground)
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
Masking = true;
|
||||
Height = 100;
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -27,9 +35,6 @@ namespace osu.Game.Tournament.Screens.Showcase
|
||||
Texture = textures.Get("game-screen-logo"),
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
FillMode = FillMode.Fit,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = Vector2.One
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Loop = true,
|
||||
},
|
||||
new TournamentLogo(),
|
||||
new TournamentLogo(false),
|
||||
mainContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -222,6 +222,7 @@ namespace osu.Game.Tournament
|
||||
sw.Write(JsonConvert.SerializeObject(ladder,
|
||||
new JsonSerializerSettings
|
||||
{
|
||||
Formatting = Formatting.Indented,
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore,
|
||||
}));
|
||||
|
@ -9,7 +9,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -26,7 +25,7 @@ namespace osu.Game.Audio
|
||||
private TrackManagerPreviewTrack current;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, FrameworkConfigManager config)
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
// this is a temporary solution to get around muting ourselves.
|
||||
// todo: update this once we have a BackgroundTrackManager or similar.
|
||||
@ -36,8 +35,6 @@ namespace osu.Game.Audio
|
||||
trackStore.AddAdjustment(AdjustableProperty.Volume, audio.VolumeTrack);
|
||||
|
||||
this.audio = audio;
|
||||
|
||||
config.BindWith(FrameworkSetting.VolumeMusic, trackStore.Volume);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,26 +1,65 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class BackButton : TwoLayerButton
|
||||
public class BackButton : VisibilityContainer, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
public Action Action;
|
||||
|
||||
private readonly TwoLayerButton button;
|
||||
|
||||
public BackButton()
|
||||
{
|
||||
Text = @"back";
|
||||
Icon = OsuIcon.LeftCircle;
|
||||
Anchor = Anchor.BottomLeft;
|
||||
Origin = Anchor.BottomLeft;
|
||||
Size = TwoLayerButton.SIZE_EXTENDED;
|
||||
|
||||
Child = button = new TwoLayerButton
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Text = @"back",
|
||||
Icon = OsuIcon.LeftCircle,
|
||||
Action = () => Action?.Invoke()
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
BackgroundColour = colours.Pink;
|
||||
HoverColour = colours.PinkDark;
|
||||
button.BackgroundColour = colours.Pink;
|
||||
button.HoverColour = colours.PinkDark;
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
if (action == GlobalAction.Back)
|
||||
{
|
||||
Action?.Invoke();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back;
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
button.MoveToX(0, 400, Easing.OutQuint);
|
||||
button.FadeIn(150, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
button.MoveToX(-TwoLayerButton.SIZE_EXTENDED.X / 2, 400, Easing.OutQuint);
|
||||
button.FadeOut(400, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
@ -15,17 +14,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class OsuCheckbox : Checkbox
|
||||
{
|
||||
private Bindable<bool> bindable;
|
||||
|
||||
public Bindable<bool> Bindable
|
||||
{
|
||||
set
|
||||
{
|
||||
bindable = value;
|
||||
Current.BindTo(bindable);
|
||||
}
|
||||
}
|
||||
|
||||
public Color4 CheckedColor { get; set; } = Color4.Cyan;
|
||||
public Color4 UncheckedColor { get; set; } = Color4.White;
|
||||
public int FadeDuration { get; set; }
|
||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
|
||||
@ -97,6 +98,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableOsuDropdownMenuItem(item) { AccentColour = accentColour };
|
||||
|
||||
protected override ScrollContainer<Drawable> CreateScrollContainer(Direction direction) => new OsuScrollContainer(direction);
|
||||
|
||||
#region DrawableOsuDropdownMenuItem
|
||||
|
||||
public class DrawableOsuDropdownMenuItem : DrawableDropdownMenuItem, IHasAccentColour
|
||||
@ -247,8 +250,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Icon = FontAwesome.Solid.ChevronDown,
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Margin = new MarginPadding { Right = 4 },
|
||||
Size = new Vector2(20),
|
||||
Margin = new MarginPadding { Right = 5 },
|
||||
Size = new Vector2(12),
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
|
||||
@ -46,6 +47,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableOsuMenuItem(item);
|
||||
|
||||
protected override ScrollContainer<Drawable> CreateScrollContainer(Direction direction) => new OsuScrollContainer(direction);
|
||||
|
||||
protected override Menu CreateSubMenu() => new OsuMenu(Direction.Vertical)
|
||||
{
|
||||
Anchor = Direction == Direction.Horizontal ? Anchor.BottomLeft : Anchor.TopRight
|
||||
|
10
osu.Game/Graphics/UserInterface/OsuNumberBox.cs
Normal file
10
osu.Game/Graphics/UserInterface/OsuNumberBox.cs
Normal file
@ -0,0 +1,10 @@
|
||||
// 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.
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class OsuNumberBox : OsuTextBox
|
||||
{
|
||||
protected override bool CanAddCharacter(char character) => char.IsNumber(character);
|
||||
}
|
||||
}
|
@ -165,7 +165,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
this.ResizeTo(SIZE_EXTENDED, transform_time, Easing.OutElastic);
|
||||
IconLayer.FadeColour(HoverColour, transform_time, Easing.OutElastic);
|
||||
|
||||
IconLayer.FadeColour(HoverColour, transform_time / 2f, Easing.OutQuint);
|
||||
|
||||
bouncingIcon.ScaleTo(1.1f, transform_time, Easing.OutElastic);
|
||||
|
||||
@ -174,16 +175,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
this.ResizeTo(SIZE_RETRACTED, transform_time, Easing.OutElastic);
|
||||
IconLayer.FadeColour(TextLayer.Colour, transform_time, Easing.OutElastic);
|
||||
this.ResizeTo(SIZE_RETRACTED, transform_time, Easing.Out);
|
||||
IconLayer.FadeColour(TextLayer.Colour, transform_time, Easing.Out);
|
||||
|
||||
bouncingIcon.ScaleTo(1, transform_time, Easing.OutElastic);
|
||||
bouncingIcon.ScaleTo(1, transform_time, Easing.Out);
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
|
@ -50,6 +50,7 @@ namespace osu.Game.Input.Bindings
|
||||
{
|
||||
new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene),
|
||||
new KeyBinding(InputKey.Tilde, GlobalAction.QuickRetry),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Tilde }, GlobalAction.QuickExit),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed),
|
||||
};
|
||||
@ -111,5 +112,8 @@ namespace osu.Game.Input.Bindings
|
||||
|
||||
[Description("Select")]
|
||||
Select,
|
||||
|
||||
[Description("Quick exit (Hold)")]
|
||||
QuickExit,
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,12 @@ namespace osu.Game.Online.API
|
||||
if (checkAndScheduleFailure())
|
||||
return;
|
||||
|
||||
API.Schedule(delegate { Success?.Invoke(); });
|
||||
API.Schedule(delegate
|
||||
{
|
||||
if (cancelled) return;
|
||||
|
||||
Success?.Invoke();
|
||||
});
|
||||
}
|
||||
|
||||
public void Cancel() => Fail(new OperationCanceledException(@"Request cancelled"));
|
||||
|
@ -29,6 +29,7 @@ using osu.Framework.Threading;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Screens.Play;
|
||||
@ -82,6 +83,7 @@ namespace osu.Game
|
||||
private OsuScreenStack screenStack;
|
||||
private VolumeOverlay volume;
|
||||
private OsuLogo osuLogo;
|
||||
private BackButton backButton;
|
||||
|
||||
private MainMenu menuScreen;
|
||||
private Intro introScreen;
|
||||
@ -181,10 +183,10 @@ namespace osu.Game
|
||||
configSkin.ValueChanged += skinId => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == skinId.NewValue) ?? SkinInfo.Default;
|
||||
configSkin.TriggerChange();
|
||||
|
||||
LocalConfig.BindWith(OsuSetting.VolumeInactive, userInactiveVolume);
|
||||
|
||||
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
|
||||
|
||||
Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade);
|
||||
|
||||
Beatmap.BindValueChanged(beatmapChanged, true);
|
||||
}
|
||||
|
||||
@ -399,6 +401,16 @@ namespace osu.Game
|
||||
Children = new Drawable[]
|
||||
{
|
||||
screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both },
|
||||
backButton = new BackButton
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Action = () =>
|
||||
{
|
||||
if ((screenStack.CurrentScreen as IOsuScreen)?.AllowBackButton == true)
|
||||
screenStack.Exit();
|
||||
}
|
||||
},
|
||||
logoContainer = new Container { RelativeSizeAxes = Axes.Both },
|
||||
}
|
||||
},
|
||||
@ -707,22 +719,14 @@ namespace osu.Game
|
||||
|
||||
#region Inactive audio dimming
|
||||
|
||||
private readonly BindableDouble userInactiveVolume = new BindableDouble();
|
||||
|
||||
private readonly BindableDouble inactiveVolumeFade = new BindableDouble();
|
||||
|
||||
private void updateActiveState(bool isActive)
|
||||
{
|
||||
if (isActive)
|
||||
{
|
||||
this.TransformBindableTo(inactiveVolumeFade, 1, 500, Easing.OutQuint)
|
||||
.Finally(_ => Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolumeFade)); //wait for the transition to finish to remove the inactive audio adjustment
|
||||
}
|
||||
this.TransformBindableTo(inactiveVolumeFade, 1, 400, Easing.OutQuint);
|
||||
else
|
||||
{
|
||||
Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade);
|
||||
this.TransformBindableTo(inactiveVolumeFade, userInactiveVolume.Value, 1500, Easing.OutSine);
|
||||
}
|
||||
this.TransformBindableTo(inactiveVolumeFade, LocalConfig.Get<double>(OsuSetting.VolumeInactive), 4000, Easing.OutQuint);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -803,6 +807,11 @@ namespace osu.Game
|
||||
CloseAllOverlays();
|
||||
else
|
||||
Toolbar.Show();
|
||||
|
||||
if (newOsuScreen.AllowBackButton)
|
||||
backButton.Show();
|
||||
else
|
||||
backButton.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@ using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
@ -41,6 +40,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
private readonly FavouriteButton favouriteButton;
|
||||
|
||||
private readonly FillFlowContainer fadeContent;
|
||||
|
||||
private readonly LoadingAnimation loading;
|
||||
|
||||
public Header()
|
||||
{
|
||||
ExternalLinkButton externalLink;
|
||||
@ -97,8 +100,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Top = 20,
|
||||
@ -106,7 +108,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
Left = BeatmapSetOverlay.X_PADDING,
|
||||
Right = BeatmapSetOverlay.X_PADDING + BeatmapSetOverlay.RIGHT_WIDTH,
|
||||
},
|
||||
Child = new FillFlowContainer
|
||||
Children = new Drawable[]
|
||||
{
|
||||
fadeContent = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
@ -154,7 +158,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
Children = new Drawable[]
|
||||
{
|
||||
favouriteButton = new FavouriteButton(),
|
||||
DownloadButtonsContainer = new FillFlowContainer
|
||||
downloadButtonsContainer = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Left = buttons_height + buttons_spacing },
|
||||
@ -164,6 +168,12 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
},
|
||||
},
|
||||
},
|
||||
loading = new LoadingAnimation
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}
|
||||
}
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
@ -189,8 +199,11 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
},
|
||||
};
|
||||
|
||||
Picker.Beatmap.ValueChanged += b => Details.Beatmap = b.NewValue;
|
||||
Picker.Beatmap.ValueChanged += b => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}";
|
||||
Picker.Beatmap.ValueChanged += b =>
|
||||
{
|
||||
Details.Beatmap = b.NewValue;
|
||||
externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}";
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -203,24 +216,35 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
BeatmapSet.BindValueChanged(setInfo =>
|
||||
{
|
||||
Picker.BeatmapSet = author.BeatmapSet = beatmapNotAvailable.BeatmapSet = Details.BeatmapSet = setInfo.NewValue;
|
||||
|
||||
title.Text = setInfo.NewValue?.Metadata.Title ?? string.Empty;
|
||||
artist.Text = setInfo.NewValue?.Metadata.Artist ?? string.Empty;
|
||||
onlineStatusPill.Status = setInfo.NewValue?.OnlineInfo.Status ?? BeatmapSetOnlineStatus.None;
|
||||
cover.BeatmapSet = setInfo.NewValue;
|
||||
|
||||
if (setInfo.NewValue != null)
|
||||
if (setInfo.NewValue == null)
|
||||
{
|
||||
DownloadButtonsContainer.FadeIn(transition_duration);
|
||||
favouriteButton.FadeIn(transition_duration);
|
||||
onlineStatusPill.FadeTo(0.5f, 500, Easing.OutQuint);
|
||||
fadeContent.Hide();
|
||||
|
||||
loading.Show();
|
||||
|
||||
downloadButtonsContainer.FadeOut(transition_duration);
|
||||
favouriteButton.FadeOut(transition_duration);
|
||||
}
|
||||
else
|
||||
{
|
||||
DownloadButtonsContainer.FadeOut(transition_duration);
|
||||
favouriteButton.FadeOut(transition_duration);
|
||||
}
|
||||
fadeContent.FadeIn(500, Easing.OutQuint);
|
||||
|
||||
loading.Hide();
|
||||
|
||||
title.Text = setInfo.NewValue.Metadata.Title ?? string.Empty;
|
||||
artist.Text = setInfo.NewValue.Metadata.Artist ?? string.Empty;
|
||||
|
||||
onlineStatusPill.FadeIn(500, Easing.OutQuint);
|
||||
onlineStatusPill.Status = setInfo.NewValue.OnlineInfo.Status;
|
||||
|
||||
downloadButtonsContainer.FadeIn(transition_duration);
|
||||
favouriteButton.FadeIn(transition_duration);
|
||||
|
||||
updateDownloadButtons();
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
Size = new Vector2(40),
|
||||
FillMode = FillMode.Fit,
|
||||
},
|
||||
avatar = new UpdateableAvatar
|
||||
avatar = new UpdateableAvatar(hideImmediately: true)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -90,7 +90,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
Origin = Anchor.CentreLeft,
|
||||
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold)
|
||||
},
|
||||
flag = new UpdateableFlag
|
||||
flag = new UpdateableFlag(hideImmediately: true)
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
|
@ -134,9 +134,9 @@ namespace osu.Game.Overlays.Dialog
|
||||
Origin = Anchor.BottomCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Position = new Vector2(0f, -50f),
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0f, 10f),
|
||||
Padding = new MarginPadding { Bottom = 10 },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
@ -144,10 +144,6 @@ namespace osu.Game.Overlays.Dialog
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Size = ringSize,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Bottom = 30,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
ring = new CircularContainer
|
||||
@ -181,15 +177,15 @@ namespace osu.Game.Overlays.Dialog
|
||||
Anchor = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding(15),
|
||||
TextAnchor = Anchor.TopCentre,
|
||||
},
|
||||
body = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 18))
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
TextAnchor = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding(15),
|
||||
TextAnchor = Anchor.TopCentre,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1,153 +1,23 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class OverlayHeaderTabControl : TabControl<string>
|
||||
public class OverlayHeaderTabControl : OverlayTabControl<string>
|
||||
{
|
||||
private readonly Box bar;
|
||||
|
||||
private Color4 accentColour = Color4.White;
|
||||
|
||||
public Color4 AccentColour
|
||||
protected override TabItem<string> CreateTabItem(string value) => new OverlayHeaderTabItem(value)
|
||||
{
|
||||
get => accentColour;
|
||||
set
|
||||
{
|
||||
if (accentColour == value)
|
||||
return;
|
||||
|
||||
accentColour = value;
|
||||
bar.Colour = value;
|
||||
|
||||
foreach (TabItem<string> tabItem in TabContainer)
|
||||
{
|
||||
((HeaderTabItem)tabItem).AccentColour = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public new MarginPadding Padding
|
||||
{
|
||||
get => TabContainer.Padding;
|
||||
set => TabContainer.Padding = value;
|
||||
}
|
||||
|
||||
public OverlayHeaderTabControl()
|
||||
{
|
||||
TabContainer.Masking = false;
|
||||
TabContainer.Spacing = new Vector2(15, 0);
|
||||
|
||||
AddInternal(bar = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 2,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.CentreLeft
|
||||
});
|
||||
}
|
||||
|
||||
protected override Dropdown<string> CreateDropdown() => null;
|
||||
|
||||
protected override TabItem<string> CreateTabItem(string value) => new HeaderTabItem(value)
|
||||
{
|
||||
AccentColour = AccentColour
|
||||
AccentColour = AccentColour,
|
||||
};
|
||||
|
||||
private class HeaderTabItem : TabItem<string>
|
||||
private class OverlayHeaderTabItem : OverlayTabItem<string>
|
||||
{
|
||||
private readonly OsuSpriteText text;
|
||||
private readonly ExpandingBar bar;
|
||||
|
||||
private Color4 accentColour;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get => accentColour;
|
||||
set
|
||||
{
|
||||
if (accentColour == value)
|
||||
return;
|
||||
|
||||
accentColour = value;
|
||||
bar.Colour = value;
|
||||
|
||||
updateState();
|
||||
}
|
||||
}
|
||||
|
||||
public HeaderTabItem(string value)
|
||||
public OverlayHeaderTabItem(string value)
|
||||
: base(value)
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
text = new OsuSpriteText
|
||||
{
|
||||
Margin = new MarginPadding { Bottom = 10 },
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Text = value,
|
||||
Font = OsuFont.GetFont()
|
||||
},
|
||||
bar = new ExpandingBar
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
ExpandedSize = 7.5f,
|
||||
CollapsedSize = 0
|
||||
},
|
||||
new HoverClickSounds()
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
base.OnHover(e);
|
||||
|
||||
updateState();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
base.OnHoverLost(e);
|
||||
|
||||
updateState();
|
||||
}
|
||||
|
||||
protected override void OnActivated() => updateState();
|
||||
|
||||
protected override void OnDeactivated() => updateState();
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
if (Active.Value || IsHovered)
|
||||
{
|
||||
text.FadeColour(Color4.White, 120, Easing.InQuad);
|
||||
bar.Expand();
|
||||
|
||||
if (Active.Value)
|
||||
text.Font = text.Font.With(weight: FontWeight.Bold);
|
||||
}
|
||||
else
|
||||
{
|
||||
text.FadeColour(AccentColour, 120, Easing.InQuad);
|
||||
bar.Collapse();
|
||||
text.Font = text.Font.With(weight: FontWeight.Medium);
|
||||
}
|
||||
Text.Text = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
163
osu.Game/Overlays/OverlayTabControl.cs
Normal file
163
osu.Game/Overlays/OverlayTabControl.cs
Normal file
@ -0,0 +1,163 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public abstract class OverlayTabControl<T> : TabControl<T>
|
||||
{
|
||||
private readonly Box bar;
|
||||
|
||||
private Color4 accentColour = Color4.White;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get => accentColour;
|
||||
set
|
||||
{
|
||||
if (accentColour == value)
|
||||
return;
|
||||
|
||||
accentColour = value;
|
||||
bar.Colour = value;
|
||||
|
||||
foreach (TabItem<T> tabItem in TabContainer)
|
||||
{
|
||||
((OverlayTabItem<T>)tabItem).AccentColour = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public new MarginPadding Padding
|
||||
{
|
||||
get => TabContainer.Padding;
|
||||
set => TabContainer.Padding = value;
|
||||
}
|
||||
|
||||
protected OverlayTabControl()
|
||||
{
|
||||
TabContainer.Masking = false;
|
||||
TabContainer.Spacing = new Vector2(15, 0);
|
||||
|
||||
AddInternal(bar = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 2,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.CentreLeft
|
||||
});
|
||||
}
|
||||
|
||||
protected override Dropdown<T> CreateDropdown() => null;
|
||||
|
||||
protected override TabItem<T> CreateTabItem(T value) => new OverlayTabItem<T>(value);
|
||||
|
||||
protected class OverlayTabItem<U> : TabItem<U>
|
||||
{
|
||||
private readonly ExpandingBar bar;
|
||||
|
||||
protected readonly OsuSpriteText Text;
|
||||
|
||||
private Color4 accentColour;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get => accentColour;
|
||||
set
|
||||
{
|
||||
if (accentColour == value)
|
||||
return;
|
||||
|
||||
accentColour = value;
|
||||
bar.Colour = value;
|
||||
|
||||
updateState();
|
||||
}
|
||||
}
|
||||
|
||||
public OverlayTabItem(U value)
|
||||
: base(value)
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Text = new OsuSpriteText
|
||||
{
|
||||
Margin = new MarginPadding { Bottom = 10 },
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Font = OsuFont.GetFont(),
|
||||
},
|
||||
bar = new ExpandingBar
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
ExpandedSize = 7.5f,
|
||||
CollapsedSize = 0
|
||||
},
|
||||
new HoverClickSounds()
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
base.OnHover(e);
|
||||
|
||||
if (!Active.Value)
|
||||
HoverAction();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
base.OnHoverLost(e);
|
||||
|
||||
if (!Active.Value)
|
||||
UnhoverAction();
|
||||
}
|
||||
|
||||
protected override void OnActivated()
|
||||
{
|
||||
HoverAction();
|
||||
Text.Font = Text.Font.With(weight: FontWeight.Bold);
|
||||
}
|
||||
|
||||
protected override void OnDeactivated()
|
||||
{
|
||||
UnhoverAction();
|
||||
Text.Font = Text.Font.With(weight: FontWeight.Medium);
|
||||
}
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
if (Active.Value)
|
||||
OnActivated();
|
||||
else
|
||||
OnDeactivated();
|
||||
}
|
||||
|
||||
protected virtual void HoverAction()
|
||||
{
|
||||
bar.Expand();
|
||||
Text.FadeColour(Color4.White, 120, Easing.InQuad);
|
||||
}
|
||||
|
||||
protected virtual void UnhoverAction()
|
||||
{
|
||||
bar.Collapse();
|
||||
Text.FadeColour(AccentColour, 120, Easing.InQuad);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +1,29 @@
|
||||
// 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.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Profile
|
||||
{
|
||||
public abstract class ProfileSection : FillFlowContainer
|
||||
public abstract class ProfileSection : Container
|
||||
{
|
||||
public abstract string Title { get; }
|
||||
|
||||
public abstract string Identifier { get; }
|
||||
|
||||
private readonly FillFlowContainer content;
|
||||
private readonly Box background;
|
||||
private readonly Box underscore;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
@ -27,19 +31,51 @@ namespace osu.Game.Overlays.Profile
|
||||
|
||||
protected ProfileSection()
|
||||
{
|
||||
Direction = FillDirection.Vertical;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new SectionTriangles
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Direction = FillDirection.Vertical,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
|
||||
Top = 15,
|
||||
Bottom = 10,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = Title,
|
||||
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular, italics: true),
|
||||
Margin = new MarginPadding
|
||||
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
|
||||
},
|
||||
underscore = new Box
|
||||
{
|
||||
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
|
||||
Vertical = 10
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding { Top = 4 },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 2,
|
||||
}
|
||||
}
|
||||
},
|
||||
content = new FillFlowContainer
|
||||
@ -53,24 +89,51 @@ namespace osu.Game.Overlays.Profile
|
||||
Bottom = 20
|
||||
}
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 1,
|
||||
Colour = OsuColour.Gray(34),
|
||||
EdgeSmoothness = new Vector2(1)
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// placeholder
|
||||
Add(new OsuSpriteText
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Text = @"coming soon!",
|
||||
Colour = Color4.Gray,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Margin = new MarginPadding { Top = 100, Bottom = 100 }
|
||||
});
|
||||
background.Colour = colours.GreySeafoamDarker;
|
||||
underscore.Colour = colours.Seafoam;
|
||||
}
|
||||
|
||||
private class SectionTriangles : Container
|
||||
{
|
||||
private readonly Triangles triangles;
|
||||
private readonly Box foreground;
|
||||
|
||||
public SectionTriangles()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 100;
|
||||
Masking = true;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
triangles = new Triangles
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
TriangleScale = 3,
|
||||
},
|
||||
foreground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
triangles.ColourLight = colours.GreySeafoamDark;
|
||||
triangles.ColourDark = colours.GreySeafoamDarker.Darken(0.2f);
|
||||
foreground.Colour = ColourInfo.GradientVertical(colours.GreySeafoamDarker, colours.GreySeafoamDarker.Opacity(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
||||
|
||||
private class AudioDeviceSettingsDropdown : SettingsDropdown<string>
|
||||
{
|
||||
protected override OsuDropdown<string> CreateDropdown() => new AudioDeviceDropdownControl { Items = Items };
|
||||
protected override OsuDropdown<string> CreateDropdown() => new AudioDeviceDropdownControl();
|
||||
|
||||
private class AudioDeviceDropdownControl : DropdownControl
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
|
||||
private class ResolutionSettingsDropdown : SettingsDropdown<Size>
|
||||
{
|
||||
protected override OsuDropdown<Size> CreateDropdown() => new ResolutionDropdownControl { Items = Items };
|
||||
protected override OsuDropdown<Size> CreateDropdown() => new ResolutionDropdownControl();
|
||||
|
||||
private class ResolutionDropdownControl : DropdownControl
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
|
||||
private class SkinSettingsDropdown : SettingsDropdown<SkinInfo>
|
||||
{
|
||||
protected override OsuDropdown<SkinInfo> CreateDropdown() => new SkinDropdownControl { Items = Items };
|
||||
protected override OsuDropdown<SkinInfo> CreateDropdown() => new SkinDropdownControl();
|
||||
|
||||
private class SkinDropdownControl : DropdownControl
|
||||
{
|
||||
|
@ -13,39 +13,23 @@ namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
protected new OsuDropdown<T> Control => (OsuDropdown<T>)base.Control;
|
||||
|
||||
private IEnumerable<T> items = Enumerable.Empty<T>();
|
||||
|
||||
public IEnumerable<T> Items
|
||||
{
|
||||
get => items;
|
||||
set
|
||||
{
|
||||
items = value;
|
||||
|
||||
if (Control != null)
|
||||
Control.Items = value;
|
||||
get => Control.Items;
|
||||
set => Control.Items = value;
|
||||
}
|
||||
}
|
||||
|
||||
private IBindableList<T> itemSource;
|
||||
|
||||
public IBindableList<T> ItemSource
|
||||
{
|
||||
get => itemSource;
|
||||
set
|
||||
{
|
||||
itemSource = value;
|
||||
|
||||
if (Control != null)
|
||||
Control.ItemSource = value;
|
||||
}
|
||||
get => Control.ItemSource;
|
||||
set => Control.ItemSource = value;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(Control.Items.Select(i => i.ToString()));
|
||||
|
||||
protected sealed override Drawable CreateControl() => CreateDropdown();
|
||||
|
||||
protected virtual OsuDropdown<T> CreateDropdown() => new DropdownControl { Items = Items, ItemSource = ItemSource };
|
||||
protected virtual OsuDropdown<T> CreateDropdown() => new DropdownControl();
|
||||
|
||||
protected class DropdownControl : OsuDropdown<T>
|
||||
{
|
||||
|
17
osu.Game/Overlays/Settings/SettingsNumberBox.cs
Normal file
17
osu.Game/Overlays/Settings/SettingsNumberBox.cs
Normal file
@ -0,0 +1,17 @@
|
||||
// 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.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
public class SettingsNumberBox : SettingsItem<string>
|
||||
{
|
||||
protected override Drawable CreateControl() => new OsuNumberBox
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
};
|
||||
}
|
||||
}
|
@ -4,11 +4,11 @@
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.Profile;
|
||||
using osu.Game.Overlays.Profile.Sections;
|
||||
@ -23,7 +23,7 @@ namespace osu.Game.Overlays
|
||||
private ProfileSection[] sections;
|
||||
private GetUserRequest userReq;
|
||||
protected ProfileHeader Header;
|
||||
private SectionsContainer<ProfileSection> sectionsContainer;
|
||||
private ProfileSectionsContainer sectionsContainer;
|
||||
private ProfileTabControl tabs;
|
||||
|
||||
public const float CONTENT_X_MARGIN = 70;
|
||||
@ -65,12 +65,11 @@ namespace osu.Game.Overlays
|
||||
Add(new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(0.2f)
|
||||
Colour = OsuColour.Gray(0.1f)
|
||||
});
|
||||
|
||||
Add(sectionsContainer = new SectionsContainer<ProfileSection>
|
||||
Add(sectionsContainer = new ProfileSectionsContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ExpandableHeader = Header = new ProfileHeader(),
|
||||
FixedHeader = tabs,
|
||||
HeaderBackground = new Box
|
||||
@ -141,31 +140,28 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
}
|
||||
|
||||
private class ProfileTabControl : PageTabControl<ProfileSection>
|
||||
private class ProfileTabControl : OverlayTabControl<ProfileSection>
|
||||
{
|
||||
private readonly Box bottom;
|
||||
|
||||
public ProfileTabControl()
|
||||
{
|
||||
TabContainer.RelativeSizeAxes &= ~Axes.X;
|
||||
TabContainer.AutoSizeAxes |= Axes.X;
|
||||
TabContainer.Anchor |= Anchor.x1;
|
||||
TabContainer.Origin |= Anchor.x1;
|
||||
AddInternal(bottom = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 1,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
EdgeSmoothness = new Vector2(1)
|
||||
});
|
||||
}
|
||||
|
||||
protected override TabItem<ProfileSection> CreateTabItem(ProfileSection value) => new ProfileTabItem(value);
|
||||
protected override TabItem<ProfileSection> CreateTabItem(ProfileSection value) => new ProfileTabItem(value)
|
||||
{
|
||||
AccentColour = AccentColour
|
||||
};
|
||||
|
||||
protected override Dropdown<ProfileSection> CreateDropdown() => null;
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AccentColour = colours.Seafoam;
|
||||
}
|
||||
|
||||
private class ProfileTabItem : PageTabItem
|
||||
private class ProfileTabItem : OverlayTabItem<ProfileSection>
|
||||
{
|
||||
public ProfileTabItem(ProfileSection value)
|
||||
: base(value)
|
||||
@ -173,12 +169,22 @@ namespace osu.Game.Overlays
|
||||
Text.Text = value.Title;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private class ProfileSectionsContainer : SectionsContainer<ProfileSection>
|
||||
{
|
||||
bottom.Colour = colours.Yellow;
|
||||
}
|
||||
public ProfileSectionsContainer()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
protected override FlowContainer<ProfileSection> CreateScrollContentContainer() => new FillFlowContainer<ProfileSection>
|
||||
{
|
||||
Direction = FillDirection.Vertical,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Spacing = new Vector2(0, 20),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +102,10 @@ namespace osu.Game.Overlays
|
||||
case GlobalAction.DecreaseVolume:
|
||||
if (State.Value == Visibility.Hidden)
|
||||
Show();
|
||||
else if (volumeMeterMusic.IsHovered)
|
||||
volumeMeterMusic.Decrease(amount, isPrecise);
|
||||
else if (volumeMeterEffect.IsHovered)
|
||||
volumeMeterEffect.Decrease(amount, isPrecise);
|
||||
else
|
||||
volumeMeterMaster.Decrease(amount, isPrecise);
|
||||
return true;
|
||||
@ -109,6 +113,10 @@ namespace osu.Game.Overlays
|
||||
case GlobalAction.IncreaseVolume:
|
||||
if (State.Value == Visibility.Hidden)
|
||||
Show();
|
||||
else if (volumeMeterMusic.IsHovered)
|
||||
volumeMeterMusic.Increase(amount, isPrecise);
|
||||
else if (volumeMeterEffect.IsHovered)
|
||||
volumeMeterEffect.Increase(amount, isPrecise);
|
||||
else
|
||||
volumeMeterMaster.Increase(amount, isPrecise);
|
||||
return true;
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
@ -14,6 +15,6 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override IconUsage Icon => OsuIcon.ModPerfect;
|
||||
public override string Description => "SS or quit.";
|
||||
|
||||
protected override bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Accuracy.Value != 1;
|
||||
protected override bool FailCondition(ScoreProcessor scoreProcessor, JudgementResult result) => scoreProcessor.Accuracy.Value != 1;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
@ -27,6 +28,6 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
|
||||
|
||||
protected virtual bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Combo.Value == 0;
|
||||
protected virtual bool FailCondition(ScoreProcessor scoreProcessor, JudgementResult result) => scoreProcessor.Combo.Value == 0 && result.Judgement.AffectsCombo;
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// <summary>
|
||||
/// Additional conditions on top of <see cref="DefaultFailCondition"/> that cause a failing state.
|
||||
/// </summary>
|
||||
public event Func<ScoreProcessor, bool> FailConditions;
|
||||
public event Func<ScoreProcessor, JudgementResult, bool> FailConditions;
|
||||
|
||||
/// <summary>
|
||||
/// The current total score.
|
||||
@ -151,12 +151,12 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// This can only ever notify subscribers once.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
protected void UpdateFailed()
|
||||
protected void UpdateFailed(JudgementResult result)
|
||||
{
|
||||
if (HasFailed)
|
||||
return;
|
||||
|
||||
if (!DefaultFailCondition && FailConditions?.Invoke(this) != true)
|
||||
if (!DefaultFailCondition && FailConditions?.Invoke(this, result) != true)
|
||||
return;
|
||||
|
||||
if (Failed?.Invoke() != false)
|
||||
@ -287,7 +287,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
ApplyResult(result);
|
||||
updateScore();
|
||||
|
||||
UpdateFailed();
|
||||
UpdateFailed(result);
|
||||
NotifyNewJudgement(result);
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,8 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
|
||||
|
||||
public override bool AllowBackButton => false;
|
||||
|
||||
public override bool HideOverlaysOnEnter => true;
|
||||
|
||||
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||
|
@ -17,6 +17,11 @@ namespace osu.Game.Screens
|
||||
/// </summary>
|
||||
bool DisallowExternalBeatmapRulesetChanges { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the user can exit this this <see cref="IOsuScreen"/> by pressing the back button.
|
||||
/// </summary>
|
||||
bool AllowBackButton { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether a top-level component should be allowed to exit the current screen to, for example,
|
||||
/// complete an import. Note that this can be overridden by a user if they specifically request.
|
||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Screens
|
||||
|
||||
public override bool CursorVisible => false;
|
||||
|
||||
protected override bool AllowBackButton => false;
|
||||
public override bool AllowBackButton => false;
|
||||
|
||||
public Loader()
|
||||
{
|
||||
|
@ -31,6 +31,8 @@ namespace osu.Game.Screens.Menu
|
||||
public override bool HideOverlaysOnEnter => true;
|
||||
public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||
|
||||
public override bool AllowBackButton => false;
|
||||
|
||||
public override bool CursorVisible => false;
|
||||
|
||||
private Drawable heart;
|
||||
|
@ -32,6 +32,8 @@ namespace osu.Game.Screens.Menu
|
||||
private SampleChannel welcome;
|
||||
private SampleChannel seeya;
|
||||
|
||||
public override bool AllowBackButton => false;
|
||||
|
||||
public override bool HideOverlaysOnEnter => true;
|
||||
public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
public override bool HideOverlaysOnEnter => buttons == null || buttons.State == ButtonSystemState.Initial;
|
||||
|
||||
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial && host.CanExit;
|
||||
public override bool AllowBackButton => false;
|
||||
|
||||
public override bool AllowExternalScreenChange => true;
|
||||
|
||||
|
@ -212,6 +212,12 @@ namespace osu.Game.Screens.Multi
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
if (!(screenStack.CurrentScreen is LoungeSubScreen))
|
||||
{
|
||||
screenStack.Exit();
|
||||
return true;
|
||||
}
|
||||
|
||||
waves.Hide();
|
||||
|
||||
this.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut();
|
||||
@ -257,7 +263,7 @@ namespace osu.Game.Screens.Multi
|
||||
private void subScreenChanged(IScreen newScreen)
|
||||
{
|
||||
updatePollingRate(isIdle.Value);
|
||||
createButton.FadeTo(newScreen is MatchSubScreen ? 0 : 1, 200);
|
||||
createButton.FadeTo(newScreen is LoungeSubScreen ? 1 : 0, 200);
|
||||
|
||||
updateTrack();
|
||||
}
|
||||
|
@ -8,10 +8,8 @@ using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Overlays;
|
||||
@ -21,7 +19,7 @@ using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Screens
|
||||
{
|
||||
public abstract class OsuScreen : Screen, IOsuScreen, IKeyBindingHandler<GlobalAction>, IHasDescription
|
||||
public abstract class OsuScreen : Screen, IOsuScreen, IHasDescription
|
||||
{
|
||||
/// <summary>
|
||||
/// The amount of negative padding that should be applied to game background content which touches both the left and right sides of the screen.
|
||||
@ -36,7 +34,7 @@ namespace osu.Game.Screens
|
||||
|
||||
public string Description => Title;
|
||||
|
||||
protected virtual bool AllowBackButton => true;
|
||||
public virtual bool AllowBackButton => true;
|
||||
|
||||
public virtual bool AllowExternalScreenChange => false;
|
||||
|
||||
@ -131,21 +129,6 @@ namespace osu.Game.Screens
|
||||
sampleExit = audio.Samples.Get(@"UI/screen-back");
|
||||
}
|
||||
|
||||
public virtual bool OnPressed(GlobalAction action)
|
||||
{
|
||||
if (!this.IsCurrentScreen()) return false;
|
||||
|
||||
if (action == GlobalAction.Back && AllowBackButton)
|
||||
{
|
||||
this.Exit();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back && AllowBackButton;
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
{
|
||||
if (PlayResumeSound)
|
||||
|
28
osu.Game/Screens/Play/HotkeyExitOverlay.cs
Normal file
28
osu.Game/Screens/Play/HotkeyExitOverlay.cs
Normal file
@ -0,0 +1,28 @@
|
||||
// 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.Input.Bindings;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class HotkeyExitOverlay : HoldToConfirmOverlay, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
if (action != GlobalAction.QuickExit) return false;
|
||||
|
||||
BeginConfirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool OnReleased(GlobalAction action)
|
||||
{
|
||||
if (action != GlobalAction.QuickExit) return false;
|
||||
|
||||
AbortConfirm();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class Player : ScreenWithBeatmapBackground
|
||||
{
|
||||
protected override bool AllowBackButton => false; // handled by HoldForMenuButton
|
||||
public override bool AllowBackButton => false; // handled by HoldForMenuButton
|
||||
|
||||
protected override UserActivity InitialActivity => new UserActivity.SoloGame(Beatmap.Value.BeatmapInfo, Ruleset.Value);
|
||||
|
||||
@ -177,6 +177,16 @@ namespace osu.Game.Screens.Play
|
||||
Restart();
|
||||
},
|
||||
},
|
||||
new HotkeyExitOverlay
|
||||
{
|
||||
Action = () =>
|
||||
{
|
||||
if (!this.IsCurrentScreen()) return;
|
||||
|
||||
fadeOut(true);
|
||||
performUserRequestedExit();
|
||||
},
|
||||
},
|
||||
failAnimation = new FailAnimation(DrawableRuleset) { OnComplete = onFailComplete, }
|
||||
};
|
||||
|
||||
@ -245,6 +255,11 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
if (!this.IsCurrentScreen()) return;
|
||||
|
||||
// if a restart has been requested, cancel any pending completion (user has shown intent to restart).
|
||||
onCompletionEvent = null;
|
||||
|
||||
ValidForResume = false;
|
||||
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
|
@ -247,6 +247,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public override void OnSuspending(IScreen next)
|
||||
{
|
||||
BackgroundBrightnessReduction = false;
|
||||
base.OnSuspending(next);
|
||||
cancelLoad();
|
||||
}
|
||||
@ -258,6 +259,7 @@ namespace osu.Game.Screens.Play
|
||||
cancelLoad();
|
||||
|
||||
Background.EnableUserDim.Value = false;
|
||||
BackgroundBrightnessReduction = false;
|
||||
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
@ -273,6 +275,22 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
|
||||
private bool backgroundBrightnessReduction;
|
||||
|
||||
protected bool BackgroundBrightnessReduction
|
||||
{
|
||||
get => backgroundBrightnessReduction;
|
||||
set
|
||||
{
|
||||
if (value == backgroundBrightnessReduction)
|
||||
return;
|
||||
|
||||
backgroundBrightnessReduction = value;
|
||||
|
||||
Background.FadeColour(OsuColour.Gray(backgroundBrightnessReduction ? 0.8f : 1), 200);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
@ -287,12 +305,16 @@ namespace osu.Game.Screens.Play
|
||||
// Preview user-defined background dim and blur when hovered on the visual settings panel.
|
||||
Background.EnableUserDim.Value = true;
|
||||
Background.BlurAmount.Value = 0;
|
||||
|
||||
BackgroundBrightnessReduction = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Returns background dim and blur to the values specified by PlayerLoader.
|
||||
Background.EnableUserDim.Value = false;
|
||||
Background.BlurAmount.Value = BACKGROUND_BLUR;
|
||||
|
||||
BackgroundBrightnessReduction = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
new PlayerCheckbox
|
||||
{
|
||||
LabelText = "Show floating comments",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.FloatingComments)
|
||||
Current = config.GetBindable<bool>(OsuSetting.FloatingComments)
|
||||
},
|
||||
new FocusedTextBox
|
||||
{
|
||||
|
@ -25,6 +25,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config) => mouseButtonsCheckbox.Bindable = config.GetBindable<bool>(OsuSetting.MouseDisableButtons);
|
||||
private void load(OsuConfigManager config) => mouseButtonsCheckbox.Current = config.GetBindable<bool>(OsuSetting.MouseDisableButtons);
|
||||
}
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
dimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
showStoryboardToggle.Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
beatmapSkinsToggle.Bindable = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
|
||||
beatmapHitsoundsToggle.Bindable = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
|
||||
showStoryboardToggle.Current = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
beatmapSkinsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
|
||||
beatmapHitsoundsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ using osu.Game.Screens.Backgrounds;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Scoring;
|
||||
@ -254,13 +253,7 @@ namespace osu.Game.Screens.Ranking
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new BackButton
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Action = this.Exit
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
foreach (var t in CreateResultPages())
|
||||
|
@ -20,8 +20,6 @@ namespace osu.Game.Screens
|
||||
{
|
||||
public class ScreenWhiteBox : OsuScreen
|
||||
{
|
||||
private readonly BackButton popButton;
|
||||
|
||||
private const double transition_time = 1000;
|
||||
|
||||
protected virtual IEnumerable<Type> PossibleChildren => null;
|
||||
@ -35,10 +33,6 @@ namespace osu.Game.Screens
|
||||
{
|
||||
base.OnEntering(last);
|
||||
|
||||
//only show the pop button if we are entered form another screen.
|
||||
if (last != null)
|
||||
popButton.Alpha = 1;
|
||||
|
||||
Alpha = 0;
|
||||
textContainer.Position = new Vector2(DrawSize.X / 16, 0);
|
||||
|
||||
@ -144,13 +138,6 @@ namespace osu.Game.Screens
|
||||
},
|
||||
}
|
||||
},
|
||||
popButton = new BackButton
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Alpha = 0,
|
||||
Action = this.Exit
|
||||
},
|
||||
childModeButtons = new FillFlowContainer
|
||||
{
|
||||
Direction = FillDirection.Vertical,
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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 osuTK;
|
||||
@ -25,8 +24,6 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private const float padding = 80;
|
||||
|
||||
public Action OnBack;
|
||||
|
||||
private readonly FillFlowContainer<FooterButton> buttons;
|
||||
|
||||
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
||||
@ -83,12 +80,6 @@ namespace osu.Game.Screens.Select
|
||||
Height = 3,
|
||||
Position = new Vector2(0, -3),
|
||||
},
|
||||
new BackButton
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Action = () => OnBack?.Invoke()
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
|
@ -34,10 +34,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public abstract class SongSelect : OsuScreen
|
||||
public abstract class SongSelect : OsuScreen, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245);
|
||||
|
||||
@ -186,23 +187,16 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
if (ShowFooter)
|
||||
{
|
||||
AddInternal(FooterPanels = new Container
|
||||
AddRangeInternal(new[]
|
||||
{
|
||||
FooterPanels = new Container
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Bottom = Footer.HEIGHT,
|
||||
},
|
||||
});
|
||||
AddInternal(Footer = new Footer
|
||||
{
|
||||
OnBack = ExitFromBack,
|
||||
});
|
||||
|
||||
FooterPanels.AddRange(new Drawable[]
|
||||
Margin = new MarginPadding { Bottom = Footer.HEIGHT },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
BeatmapOptions = new BeatmapOptionsOverlay(),
|
||||
ModSelect = new ModSelectOverlay
|
||||
@ -211,6 +205,9 @@ namespace osu.Game.Screens.Select
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
}
|
||||
}
|
||||
},
|
||||
Footer = new Footer()
|
||||
});
|
||||
}
|
||||
|
||||
@ -277,17 +274,6 @@ namespace osu.Game.Screens.Select
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
protected virtual void ExitFromBack()
|
||||
{
|
||||
if (ModSelect.State.Value == Visibility.Visible)
|
||||
{
|
||||
ModSelect.Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
public void Edit(BeatmapInfo beatmap = null)
|
||||
{
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce);
|
||||
@ -518,6 +504,12 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
if (ModSelect.State.Value == Visibility.Visible)
|
||||
{
|
||||
ModSelect.Hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (base.OnExiting(next))
|
||||
return true;
|
||||
|
||||
@ -649,7 +641,7 @@ namespace osu.Game.Screens.Select
|
||||
Schedule(() => BeatmapDetails.Leaderboard.RefreshScores())));
|
||||
}
|
||||
|
||||
public override bool OnPressed(GlobalAction action)
|
||||
public virtual bool OnPressed(GlobalAction action)
|
||||
{
|
||||
if (!this.IsCurrentScreen()) return false;
|
||||
|
||||
@ -660,9 +652,11 @@ namespace osu.Game.Screens.Select
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnPressed(action);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(GlobalAction action) => action == GlobalAction.Select;
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
if (e.Repeat) return false;
|
||||
|
@ -15,6 +15,10 @@ namespace osu.Game.Skinning
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A drawable which can be skinned via an <see cref="ISkinSource"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of drawable.</typeparam>
|
||||
public class SkinnableDrawable<T> : SkinReloadableDrawable
|
||||
where T : Drawable
|
||||
{
|
||||
@ -23,48 +27,63 @@ namespace osu.Game.Skinning
|
||||
/// </summary>
|
||||
protected Drawable Drawable { get; private set; }
|
||||
|
||||
private readonly Func<string, T> createDefault;
|
||||
|
||||
private readonly string componentName;
|
||||
|
||||
private readonly bool restrictSize;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Create a new skinnable drawable.
|
||||
/// </summary>
|
||||
/// <param name="name">The namespace-complete resource name for this skinnable element.</param>
|
||||
/// <param name="defaultImplementation">A function to create the default skin implementation of this element.</param>
|
||||
/// <param name="allowFallback">A conditional to decide whether to allow fallback to the default implementation if a skinned element is not present.</param>
|
||||
/// <param name="restrictSize">Whether a user-skin drawable should be limited to the size of our parent.</param>
|
||||
public SkinnableDrawable(string name, Func<string, T> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true)
|
||||
: this(name, allowFallback, restrictSize)
|
||||
{
|
||||
createDefault = defaultImplementation;
|
||||
}
|
||||
|
||||
protected SkinnableDrawable(string name, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true)
|
||||
: base(allowFallback)
|
||||
{
|
||||
componentName = name;
|
||||
createDefault = defaultImplementation;
|
||||
this.restrictSize = restrictSize;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
private readonly Func<string, T> createDefault;
|
||||
|
||||
protected virtual T CreateDefault(string name) => createDefault(name);
|
||||
|
||||
/// <summary>
|
||||
/// Whether to apply size restrictions (specified via <see cref="restrictSize"/>) to the default implementation.
|
||||
/// </summary>
|
||||
protected virtual bool ApplySizeRestrictionsToDefault => false;
|
||||
|
||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||
{
|
||||
Drawable = skin.GetDrawableComponent(componentName);
|
||||
|
||||
bool isDefault = false;
|
||||
|
||||
if (Drawable == null && allowFallback)
|
||||
{
|
||||
Drawable = CreateDefault(componentName);
|
||||
isDefault = true;
|
||||
}
|
||||
|
||||
if (Drawable != null)
|
||||
{
|
||||
if (restrictSize)
|
||||
if (restrictSize && (!isDefault || ApplySizeRestrictionsToDefault))
|
||||
{
|
||||
Drawable.RelativeSizeAxes = Axes.Both;
|
||||
Drawable.Size = Vector2.One;
|
||||
Drawable.Scale = Vector2.One;
|
||||
Drawable.FillMode = FillMode.Fit;
|
||||
}
|
||||
}
|
||||
else if (allowFallback)
|
||||
Drawable = createDefault(componentName);
|
||||
|
||||
if (Drawable != null)
|
||||
{
|
||||
Drawable.Origin = Anchor.Centre;
|
||||
Drawable.Anchor = Anchor.Centre;
|
||||
|
||||
|
28
osu.Game/Skinning/SkinnableSprite.cs
Normal file
28
osu.Game/Skinning/SkinnableSprite.cs
Normal file
@ -0,0 +1,28 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
/// A skinnable element which uses a stable sprite and can therefore share implementation logic.
|
||||
/// </summary>
|
||||
public class SkinnableSprite : SkinnableDrawable<Sprite>
|
||||
{
|
||||
protected override bool ApplySizeRestrictionsToDefault => true;
|
||||
|
||||
[Resolved]
|
||||
private TextureStore textures { get; set; }
|
||||
|
||||
public SkinnableSprite(string name, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true)
|
||||
: base(name, allowFallback, restrictSize)
|
||||
{
|
||||
}
|
||||
|
||||
protected override Sprite CreateDefault(string name) => new Sprite { Texture = textures.Get(name) };
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
|
||||
namespace osu.Game.Users.Drawables
|
||||
{
|
||||
@ -37,6 +38,8 @@ namespace osu.Game.Users.Drawables
|
||||
set => base.EdgeEffect = value;
|
||||
}
|
||||
|
||||
protected override bool TransformImmediately { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show a default guest representation on null user (as opposed to nothing).
|
||||
/// </summary>
|
||||
@ -47,11 +50,14 @@ namespace osu.Game.Users.Drawables
|
||||
/// </summary>
|
||||
public readonly BindableBool OpenOnClick = new BindableBool(true);
|
||||
|
||||
public UpdateableAvatar(User user = null)
|
||||
public UpdateableAvatar(User user = null, bool hideImmediately = false)
|
||||
{
|
||||
TransformImmediately = hideImmediately;
|
||||
User = user;
|
||||
}
|
||||
|
||||
protected override TransformSequence<Drawable> ApplyHideTransforms(Drawable drawable) => TransformImmediately ? drawable?.FadeOut() : base.ApplyHideTransforms(drawable);
|
||||
|
||||
protected override Drawable CreateDrawable(User user)
|
||||
{
|
||||
if (user == null && !ShowGuestOnNull)
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
|
||||
namespace osu.Game.Users.Drawables
|
||||
{
|
||||
@ -14,16 +15,21 @@ namespace osu.Game.Users.Drawables
|
||||
set => Model = value;
|
||||
}
|
||||
|
||||
protected override bool TransformImmediately { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show a place holder on null country.
|
||||
/// </summary>
|
||||
public bool ShowPlaceholderOnNull = true;
|
||||
|
||||
public UpdateableFlag(Country country = null)
|
||||
public UpdateableFlag(Country country = null, bool hideImmediately = false)
|
||||
{
|
||||
TransformImmediately = hideImmediately;
|
||||
Country = country;
|
||||
}
|
||||
|
||||
protected override TransformSequence<Drawable> ApplyHideTransforms(Drawable drawable) => TransformImmediately ? drawable?.FadeOut() : base.ApplyHideTransforms(drawable);
|
||||
|
||||
protected override Drawable CreateDrawable(Country country)
|
||||
{
|
||||
if (country == null && !ShowPlaceholderOnNull)
|
||||
|
@ -15,7 +15,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.618.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.625.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.23.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
@ -105,8 +105,8 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.618.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.618.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.625.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.625.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user