mirror of
https://github.com/ppy/osu.git
synced 2025-02-01 01:53:21 +08:00
Merge branch 'master' into useroverlay-tabs
This commit is contained in:
commit
6e2138491b
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
Child = new SkinnableDrawable("Play/osu/approachcircle", name => new Sprite { Texture = textures.Get(name) });
|
Child = new SkinnableSprite("Play/osu/approachcircle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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]
|
[TestFixture]
|
||||||
public class TestSceneIdleTracker : ManualInputManagerTestScene
|
public class TestSceneIdleTracker : ManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
private readonly IdleTrackingBox box1;
|
private IdleTrackingBox box1;
|
||||||
private readonly IdleTrackingBox box2;
|
private IdleTrackingBox box2;
|
||||||
private readonly IdleTrackingBox box3;
|
private IdleTrackingBox box3;
|
||||||
private readonly IdleTrackingBox box4;
|
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,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Red,
|
Colour = Color4.Red,
|
||||||
Anchor = Anchor.TopLeft,
|
Anchor = Anchor.TopLeft,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
},
|
},
|
||||||
box2 = new IdleTrackingBox(2000)
|
box2 = new IdleTrackingBox(4000)
|
||||||
{
|
{
|
||||||
|
Name = "TopRight",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Green,
|
Colour = Color4.Green,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
},
|
},
|
||||||
box3 = new IdleTrackingBox(3000)
|
box3 = new IdleTrackingBox(6000)
|
||||||
{
|
{
|
||||||
|
Name = "BottomLeft",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Blue,
|
Colour = Color4.Blue,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
},
|
},
|
||||||
box4 = new IdleTrackingBox(4000)
|
box4 = new IdleTrackingBox(8000)
|
||||||
{
|
{
|
||||||
|
Name = "BottomRight",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Orange,
|
Colour = Color4.Orange,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestNudge()
|
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)));
|
AddStep("nudge mouse", () => InputManager.MoveMouseTo(box1.ScreenSpaceDrawQuad.Centre + new Vector2(1)));
|
||||||
|
|
||||||
AddAssert("check not idle", () => !box1.IsIdle);
|
checkIdleStatus(1, false);
|
||||||
AddAssert("check idle", () => box2.IsIdle);
|
checkIdleStatus(2, true);
|
||||||
AddAssert("check idle", () => box3.IsIdle);
|
checkIdleStatus(3, true);
|
||||||
AddAssert("check idle", () => box4.IsIdle);
|
checkIdleStatus(4, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestMovement()
|
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);
|
checkIdleStatus(1, true);
|
||||||
AddAssert("check not idle", () => !box2.IsIdle);
|
checkIdleStatus(2, false);
|
||||||
AddAssert("check idle", () => box3.IsIdle);
|
checkIdleStatus(3, true);
|
||||||
AddAssert("check idle", () => box4.IsIdle);
|
checkIdleStatus(4, true);
|
||||||
|
|
||||||
AddStep("move mouse", () => InputManager.MoveMouseTo(box3.ScreenSpaceDrawQuad.Centre));
|
AddStep("move to bottom left", () => InputManager.MoveMouseTo(box3));
|
||||||
AddStep("move mouse", () => InputManager.MoveMouseTo(box4.ScreenSpaceDrawQuad.Centre));
|
AddStep("move to bottom right", () => InputManager.MoveMouseTo(box4));
|
||||||
|
|
||||||
AddAssert("check not idle", () => box1.IsIdle);
|
checkIdleStatus(1, true);
|
||||||
AddAssert("check not idle", () => !box2.IsIdle);
|
checkIdleStatus(2, false);
|
||||||
AddAssert("check idle", () => !box3.IsIdle);
|
checkIdleStatus(3, false);
|
||||||
AddAssert("check idle", () => !box4.IsIdle);
|
checkIdleStatus(4, false);
|
||||||
|
|
||||||
AddUntilStep("Wait for all idle", () => box1.IsIdle && box2.IsIdle && box3.IsIdle && box4.IsIdle);
|
waitForAllIdle();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestTimings()
|
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);
|
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);
|
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);
|
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);
|
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()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
ScoreProcessor.FailConditions += _ => true;
|
ScoreProcessor.FailConditions += (_, __) => true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
public void TestOsuMods()
|
public void TestOsuMods()
|
||||||
{
|
{
|
||||||
var ruleset = rulesets.AvailableRulesets.First(r => r.ID == 0);
|
var ruleset = rulesets.AvailableRulesets.First(r => r.ID == 0);
|
||||||
AddStep("change ruleset", () => { Ruleset.Value = ruleset; });
|
changeRuleset(ruleset);
|
||||||
|
|
||||||
var instance = ruleset.CreateInstance();
|
var instance = ruleset.CreateInstance();
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
public void TestManiaMods()
|
public void TestManiaMods()
|
||||||
{
|
{
|
||||||
var ruleset = rulesets.AvailableRulesets.First(r => r.ID == 3);
|
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));
|
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 rulesetOsu = rulesets.AvailableRulesets.First(r => r.ID == 0);
|
||||||
var rulesetMania = rulesets.AvailableRulesets.First(r => r.ID == 3);
|
var rulesetMania = rulesets.AvailableRulesets.First(r => r.ID == 3);
|
||||||
|
|
||||||
AddStep("change ruleset to null", () => { Ruleset.Value = null; });
|
changeRuleset(null);
|
||||||
|
|
||||||
var instance = rulesetOsu.CreateInstance();
|
var instance = rulesetOsu.CreateInstance();
|
||||||
var easierMods = instance.GetModsFor(ModType.DifficultyReduction);
|
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("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);
|
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));
|
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());
|
AddAssert("ensure mods not selected", () => !modDisplay.Current.Value.Any());
|
||||||
}
|
}
|
||||||
@ -216,14 +216,11 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private void testRankedText(Mod mod)
|
private void testRankedText(Mod mod)
|
||||||
{
|
{
|
||||||
waitForLoad();
|
AddUntilStep("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
||||||
AddAssert("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
|
||||||
selectNext(mod);
|
selectNext(mod);
|
||||||
waitForLoad();
|
AddUntilStep("check for unranked", () => modSelect.UnrankedLabel.Alpha != 0);
|
||||||
AddAssert("check for unranked", () => modSelect.UnrankedLabel.Alpha != 0);
|
|
||||||
selectPrevious(mod);
|
selectPrevious(mod);
|
||||||
waitForLoad();
|
AddUntilStep("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
||||||
AddAssert("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectNext(Mod mod) => AddStep($"left click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectNext(1));
|
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)
|
private void checkSelected(Mod mod)
|
||||||
{
|
{
|
||||||
waitForLoad();
|
|
||||||
AddAssert($"check {mod.Name} is selected", () =>
|
AddAssert($"check {mod.Name} is selected", () =>
|
||||||
{
|
{
|
||||||
var button = modSelect.GetModButton(mod);
|
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)
|
private void checkNotSelected(Mod mod)
|
||||||
{
|
{
|
||||||
waitForLoad();
|
|
||||||
AddAssert($"check {mod.Name} is not selected", () =>
|
AddAssert($"check {mod.Name} is not selected", () =>
|
||||||
{
|
{
|
||||||
var button = modSelect.GetModButton(mod);
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -183,7 +183,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SettingsTextBox
|
new SettingsNumberBox
|
||||||
{
|
{
|
||||||
LabelText = "Beatmap ID",
|
LabelText = "Beatmap ID",
|
||||||
RelativeSizeAxes = Axes.None,
|
RelativeSizeAxes = Axes.None,
|
||||||
|
@ -231,7 +231,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SettingsTextBox
|
new SettingsNumberBox
|
||||||
{
|
{
|
||||||
LabelText = "User ID",
|
LabelText = "User ID",
|
||||||
RelativeSizeAxes = Axes.None,
|
RelativeSizeAxes = Axes.None,
|
||||||
|
@ -5,7 +5,6 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -191,8 +190,6 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
|||||||
|
|
||||||
public RoundDisplay()
|
public RoundDisplay()
|
||||||
{
|
{
|
||||||
CornerRadius = 10;
|
|
||||||
Masking = true;
|
|
||||||
Width = 200;
|
Width = 200;
|
||||||
Height = 20;
|
Height = 20;
|
||||||
}
|
}
|
||||||
@ -208,11 +205,6 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
|||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
|
||||||
{
|
|
||||||
Colour = new Color4(47, 71, 67, 255),
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
},
|
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
|
@ -51,8 +51,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
|||||||
name = round.Name.GetBoundCopy();
|
name = round.Name.GetBoundCopy();
|
||||||
name.BindValueChanged(n => textName.Text = ((losers ? "Losers " : "") + round.Name).ToUpper(), true);
|
name.BindValueChanged(n => textName.Text = ((losers ? "Losers " : "") + round.Name).ToUpper(), true);
|
||||||
|
|
||||||
description = round.Name.GetBoundCopy();
|
description = round.Description.GetBoundCopy();
|
||||||
description.BindValueChanged(n => textDescription.Text = round.Description.Value.ToUpper(), true);
|
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.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Showcase
|
namespace osu.Game.Tournament.Screens.Showcase
|
||||||
{
|
{
|
||||||
public class TournamentLogo : CompositeDrawable
|
public class TournamentLogo : CompositeDrawable
|
||||||
{
|
{
|
||||||
public TournamentLogo()
|
public TournamentLogo(bool includeRoundBackground = true)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = 95;
|
|
||||||
Margin = new MarginPadding { Vertical = 5 };
|
Margin = new MarginPadding { Vertical = 5 };
|
||||||
|
|
||||||
|
if (includeRoundBackground)
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Masking = true;
|
||||||
|
Height = 100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -27,9 +35,6 @@ namespace osu.Game.Tournament.Screens.Showcase
|
|||||||
Texture = textures.Get("game-screen-logo"),
|
Texture = textures.Get("game-screen-logo"),
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = 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,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Loop = true,
|
Loop = true,
|
||||||
},
|
},
|
||||||
new TournamentLogo(),
|
new TournamentLogo(false),
|
||||||
mainContainer = new Container
|
mainContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
@ -222,6 +222,7 @@ namespace osu.Game.Tournament
|
|||||||
sw.Write(JsonConvert.SerializeObject(ladder,
|
sw.Write(JsonConvert.SerializeObject(ladder,
|
||||||
new JsonSerializerSettings
|
new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
|
Formatting = Formatting.Indented,
|
||||||
NullValueHandling = NullValueHandling.Ignore,
|
NullValueHandling = NullValueHandling.Ignore,
|
||||||
DefaultValueHandling = DefaultValueHandling.Ignore,
|
DefaultValueHandling = DefaultValueHandling.Ignore,
|
||||||
}));
|
}));
|
||||||
|
@ -9,7 +9,6 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -26,7 +25,7 @@ namespace osu.Game.Audio
|
|||||||
private TrackManagerPreviewTrack current;
|
private TrackManagerPreviewTrack current;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, FrameworkConfigManager config)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
// this is a temporary solution to get around muting ourselves.
|
// this is a temporary solution to get around muting ourselves.
|
||||||
// todo: update this once we have a BackgroundTrackManager or similar.
|
// todo: update this once we have a BackgroundTrackManager or similar.
|
||||||
@ -36,8 +35,6 @@ namespace osu.Game.Audio
|
|||||||
trackStore.AddAdjustment(AdjustableProperty.Volume, audio.VolumeTrack);
|
trackStore.AddAdjustment(AdjustableProperty.Volume, audio.VolumeTrack);
|
||||||
|
|
||||||
this.audio = audio;
|
this.audio = audio;
|
||||||
|
|
||||||
config.BindWith(FrameworkSetting.VolumeMusic, trackStore.Volume);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
@ -15,17 +14,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public class OsuCheckbox : Checkbox
|
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 CheckedColor { get; set; } = Color4.Cyan;
|
||||||
public Color4 UncheckedColor { get; set; } = Color4.White;
|
public Color4 UncheckedColor { get; set; } = Color4.White;
|
||||||
public int FadeDuration { get; set; }
|
public int FadeDuration { get; set; }
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -181,10 +181,10 @@ namespace osu.Game
|
|||||||
configSkin.ValueChanged += skinId => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == skinId.NewValue) ?? SkinInfo.Default;
|
configSkin.ValueChanged += skinId => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == skinId.NewValue) ?? SkinInfo.Default;
|
||||||
configSkin.TriggerChange();
|
configSkin.TriggerChange();
|
||||||
|
|
||||||
LocalConfig.BindWith(OsuSetting.VolumeInactive, userInactiveVolume);
|
|
||||||
|
|
||||||
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
|
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
|
||||||
|
|
||||||
|
Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade);
|
||||||
|
|
||||||
Beatmap.BindValueChanged(beatmapChanged, true);
|
Beatmap.BindValueChanged(beatmapChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,22 +707,14 @@ namespace osu.Game
|
|||||||
|
|
||||||
#region Inactive audio dimming
|
#region Inactive audio dimming
|
||||||
|
|
||||||
private readonly BindableDouble userInactiveVolume = new BindableDouble();
|
|
||||||
|
|
||||||
private readonly BindableDouble inactiveVolumeFade = new BindableDouble();
|
private readonly BindableDouble inactiveVolumeFade = new BindableDouble();
|
||||||
|
|
||||||
private void updateActiveState(bool isActive)
|
private void updateActiveState(bool isActive)
|
||||||
{
|
{
|
||||||
if (isActive)
|
if (isActive)
|
||||||
{
|
this.TransformBindableTo(inactiveVolumeFade, 1, 400, Easing.OutQuint);
|
||||||
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
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
this.TransformBindableTo(inactiveVolumeFade, LocalConfig.Get<double>(OsuSetting.VolumeInactive), 4000, Easing.OutQuint);
|
||||||
Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade);
|
|
||||||
this.TransformBindableTo(inactiveVolumeFade, userInactiveVolume.Value, 1500, Easing.OutSine);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -134,9 +134,9 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Position = new Vector2(0f, -50f),
|
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Spacing = new Vector2(0f, 10f),
|
Spacing = new Vector2(0f, 10f),
|
||||||
|
Padding = new MarginPadding { Bottom = 10 },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -144,10 +144,6 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Size = ringSize,
|
Size = ringSize,
|
||||||
Margin = new MarginPadding
|
|
||||||
{
|
|
||||||
Bottom = 30,
|
|
||||||
},
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
ring = new CircularContainer
|
ring = new CircularContainer
|
||||||
@ -181,15 +177,15 @@ namespace osu.Game.Overlays.Dialog
|
|||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Padding = new MarginPadding(15),
|
|
||||||
TextAnchor = Anchor.TopCentre,
|
TextAnchor = Anchor.TopCentre,
|
||||||
},
|
},
|
||||||
body = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 18))
|
body = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 18))
|
||||||
{
|
{
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
TextAnchor = Anchor.TopCentre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Padding = new MarginPadding(15),
|
|
||||||
TextAnchor = Anchor.TopCentre,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -56,16 +56,12 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new NotificationSection
|
new NotificationSection(@"Notifications", @"Clear All")
|
||||||
{
|
{
|
||||||
Title = @"Notifications",
|
|
||||||
ClearText = @"Clear All",
|
|
||||||
AcceptTypes = new[] { typeof(SimpleNotification) }
|
AcceptTypes = new[] { typeof(SimpleNotification) }
|
||||||
},
|
},
|
||||||
new NotificationSection
|
new NotificationSection(@"Running Tasks", @"Cancel All")
|
||||||
{
|
{
|
||||||
Title = @"Running Tasks",
|
|
||||||
ClearText = @"Cancel All",
|
|
||||||
AcceptTypes = new[] { typeof(ProgressNotification) }
|
AcceptTypes = new[] { typeof(ProgressNotification) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
{
|
{
|
||||||
public class NotificationSection : AlwaysUpdateFillFlowContainer<Drawable>
|
public class NotificationSection : AlwaysUpdateFillFlowContainer<Drawable>
|
||||||
{
|
{
|
||||||
private OsuSpriteText titleText;
|
private OsuSpriteText countDrawable;
|
||||||
private OsuSpriteText countText;
|
|
||||||
|
|
||||||
private ClearAllButton clearButton;
|
|
||||||
|
|
||||||
private FlowContainer<Notification> notifications;
|
private FlowContainer<Notification> notifications;
|
||||||
|
|
||||||
@ -35,28 +32,14 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
|
|
||||||
public IEnumerable<Type> AcceptTypes;
|
public IEnumerable<Type> AcceptTypes;
|
||||||
|
|
||||||
private string clearText;
|
private readonly string clearButtonText;
|
||||||
|
|
||||||
public string ClearText
|
private readonly string titleText;
|
||||||
{
|
|
||||||
get => clearText;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
clearText = value;
|
|
||||||
if (clearButton != null) clearButton.Text = clearText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string title;
|
public NotificationSection(string title, string clearButtonText)
|
||||||
|
|
||||||
public string Title
|
|
||||||
{
|
{
|
||||||
get => title;
|
this.clearButtonText = clearButtonText;
|
||||||
set
|
titleText = title;
|
||||||
{
|
|
||||||
title = value;
|
|
||||||
if (titleText != null) titleText.Text = title.ToUpperInvariant();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -82,9 +65,9 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
clearButton = new ClearAllButton
|
new ClearAllButton
|
||||||
{
|
{
|
||||||
Text = clearText,
|
Text = clearButtonText,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Action = clearAll
|
Action = clearAll
|
||||||
@ -99,12 +82,12 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
titleText = new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = title.ToUpperInvariant(),
|
Text = titleText.ToUpperInvariant(),
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Black)
|
Font = OsuFont.GetFont(weight: FontWeight.Black)
|
||||||
},
|
},
|
||||||
countText = new OsuSpriteText
|
countDrawable = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = "3",
|
Text = "3",
|
||||||
Colour = colours.Yellow,
|
Colour = colours.Yellow,
|
||||||
@ -134,7 +117,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
countText.Text = notifications.Children.Count(c => c.Alpha > 0.99f).ToString();
|
countDrawable.Text = notifications.Children.Count(c => c.Alpha > 0.99f).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ClearAllButton : OsuClickableContainer
|
private class ClearAllButton : OsuClickableContainer
|
||||||
|
@ -1,25 +1,29 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Backgrounds;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile
|
namespace osu.Game.Overlays.Profile
|
||||||
{
|
{
|
||||||
public abstract class ProfileSection : FillFlowContainer
|
public abstract class ProfileSection : Container
|
||||||
{
|
{
|
||||||
public abstract string Title { get; }
|
public abstract string Title { get; }
|
||||||
|
|
||||||
public abstract string Identifier { get; }
|
public abstract string Identifier { get; }
|
||||||
|
|
||||||
private readonly FillFlowContainer content;
|
private readonly FillFlowContainer content;
|
||||||
|
private readonly Box background;
|
||||||
|
private readonly Box underscore;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
@ -27,19 +31,51 @@ namespace osu.Game.Overlays.Profile
|
|||||||
|
|
||||||
protected ProfileSection()
|
protected ProfileSection()
|
||||||
{
|
{
|
||||||
Direction = FillDirection.Vertical;
|
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
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
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = Title,
|
Text = Title,
|
||||||
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular, italics: true),
|
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
|
||||||
Margin = new MarginPadding
|
},
|
||||||
|
underscore = new Box
|
||||||
{
|
{
|
||||||
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
|
Anchor = Anchor.BottomCentre,
|
||||||
Vertical = 10
|
Origin = Anchor.TopCentre,
|
||||||
|
Margin = new MarginPadding { Top = 4 },
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 2,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
content = new FillFlowContainer
|
content = new FillFlowContainer
|
||||||
@ -53,24 +89,51 @@ namespace osu.Game.Overlays.Profile
|
|||||||
Bottom = 20
|
Bottom = 20
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Box
|
},
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = 1,
|
|
||||||
Colour = OsuColour.Gray(34),
|
|
||||||
EdgeSmoothness = new Vector2(1)
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// placeholder
|
[BackgroundDependencyLoader]
|
||||||
Add(new OsuSpriteText
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Text = @"coming soon!",
|
background.Colour = colours.GreySeafoamDarker;
|
||||||
Colour = Color4.Gray,
|
underscore.Colour = colours.Seafoam;
|
||||||
Anchor = Anchor.Centre,
|
}
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Margin = new MarginPadding { Top = 100, Bottom = 100 }
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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,6 +4,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -21,7 +22,7 @@ namespace osu.Game.Overlays
|
|||||||
private ProfileSection[] sections;
|
private ProfileSection[] sections;
|
||||||
private GetUserRequest userReq;
|
private GetUserRequest userReq;
|
||||||
protected ProfileHeader Header;
|
protected ProfileHeader Header;
|
||||||
private SectionsContainer<ProfileSection> sectionsContainer;
|
private ProfileSectionsContainer sectionsContainer;
|
||||||
private ProfileTabControl tabs;
|
private ProfileTabControl tabs;
|
||||||
|
|
||||||
public const float CONTENT_X_MARGIN = 70;
|
public const float CONTENT_X_MARGIN = 70;
|
||||||
@ -63,12 +64,11 @@ namespace osu.Game.Overlays
|
|||||||
Add(new Box
|
Add(new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
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(),
|
ExpandableHeader = Header = new ProfileHeader(),
|
||||||
FixedHeader = tabs,
|
FixedHeader = tabs,
|
||||||
HeaderBackground = new Box
|
HeaderBackground = new Box
|
||||||
@ -169,5 +169,21 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ProfileSectionsContainer : SectionsContainer<ProfileSection>
|
||||||
|
{
|
||||||
|
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),
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
@ -14,6 +15,6 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override IconUsage Icon => OsuIcon.ModPerfect;
|
public override IconUsage Icon => OsuIcon.ModPerfect;
|
||||||
public override string Description => "SS or quit.";
|
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 System;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
@ -27,6 +28,6 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
|
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>
|
/// <summary>
|
||||||
/// Additional conditions on top of <see cref="DefaultFailCondition"/> that cause a failing state.
|
/// Additional conditions on top of <see cref="DefaultFailCondition"/> that cause a failing state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Func<ScoreProcessor, bool> FailConditions;
|
public event Func<ScoreProcessor, JudgementResult, bool> FailConditions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current total score.
|
/// The current total score.
|
||||||
@ -151,12 +151,12 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
/// This can only ever notify subscribers once.
|
/// This can only ever notify subscribers once.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected void UpdateFailed()
|
protected void UpdateFailed(JudgementResult result)
|
||||||
{
|
{
|
||||||
if (HasFailed)
|
if (HasFailed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!DefaultFailCondition && FailConditions?.Invoke(this) != true)
|
if (!DefaultFailCondition && FailConditions?.Invoke(this, result) != true)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Failed?.Invoke() != false)
|
if (Failed?.Invoke() != false)
|
||||||
@ -287,7 +287,7 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
ApplyResult(result);
|
ApplyResult(result);
|
||||||
updateScore();
|
updateScore();
|
||||||
|
|
||||||
UpdateFailed();
|
UpdateFailed(result);
|
||||||
NotifyNewJudgement(result);
|
NotifyNewJudgement(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
private void subScreenChanged(IScreen newScreen)
|
private void subScreenChanged(IScreen newScreen)
|
||||||
{
|
{
|
||||||
updatePollingRate(isIdle.Value);
|
updatePollingRate(isIdle.Value);
|
||||||
createButton.FadeTo(newScreen is MatchSubScreen ? 0 : 1, 200);
|
createButton.FadeTo(newScreen is LoungeSubScreen ? 1 : 0, 200);
|
||||||
|
|
||||||
updateTrack();
|
updateTrack();
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
new PlayerCheckbox
|
new PlayerCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Show floating comments",
|
LabelText = "Show floating comments",
|
||||||
Bindable = config.GetBindable<bool>(OsuSetting.FloatingComments)
|
Current = config.GetBindable<bool>(OsuSetting.FloatingComments)
|
||||||
},
|
},
|
||||||
new FocusedTextBox
|
new FocusedTextBox
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[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);
|
dimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||||
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
|
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||||
showStoryboardToggle.Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
showStoryboardToggle.Current = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
beatmapSkinsToggle.Bindable = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
|
beatmapSkinsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
|
||||||
beatmapHitsoundsToggle.Bindable = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
|
beatmapHitsoundsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
public class SkinnableDrawable<T> : SkinReloadableDrawable
|
||||||
where T : Drawable
|
where T : Drawable
|
||||||
{
|
{
|
||||||
@ -23,48 +27,63 @@ namespace osu.Game.Skinning
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected Drawable Drawable { get; private set; }
|
protected Drawable Drawable { get; private set; }
|
||||||
|
|
||||||
private readonly Func<string, T> createDefault;
|
|
||||||
|
|
||||||
private readonly string componentName;
|
private readonly string componentName;
|
||||||
|
|
||||||
private readonly bool restrictSize;
|
private readonly bool restrictSize;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Create a new skinnable drawable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The namespace-complete resource name for this skinnable element.</param>
|
/// <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="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="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>
|
/// <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)
|
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)
|
: base(allowFallback)
|
||||||
{
|
{
|
||||||
componentName = name;
|
componentName = name;
|
||||||
createDefault = defaultImplementation;
|
|
||||||
this.restrictSize = restrictSize;
|
this.restrictSize = restrictSize;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
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)
|
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||||
{
|
{
|
||||||
Drawable = skin.GetDrawableComponent(componentName);
|
Drawable = skin.GetDrawableComponent(componentName);
|
||||||
|
|
||||||
|
bool isDefault = false;
|
||||||
|
|
||||||
|
if (Drawable == null && allowFallback)
|
||||||
|
{
|
||||||
|
Drawable = CreateDefault(componentName);
|
||||||
|
isDefault = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (Drawable != null)
|
if (Drawable != null)
|
||||||
{
|
{
|
||||||
if (restrictSize)
|
if (restrictSize && (!isDefault || ApplySizeRestrictionsToDefault))
|
||||||
{
|
{
|
||||||
Drawable.RelativeSizeAxes = Axes.Both;
|
Drawable.RelativeSizeAxes = Axes.Both;
|
||||||
Drawable.Size = Vector2.One;
|
Drawable.Size = Vector2.One;
|
||||||
Drawable.Scale = Vector2.One;
|
Drawable.Scale = Vector2.One;
|
||||||
Drawable.FillMode = FillMode.Fit;
|
Drawable.FillMode = FillMode.Fit;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (allowFallback)
|
|
||||||
Drawable = createDefault(componentName);
|
|
||||||
|
|
||||||
if (Drawable != null)
|
|
||||||
{
|
|
||||||
Drawable.Origin = Anchor.Centre;
|
Drawable.Origin = Anchor.Centre;
|
||||||
Drawable.Anchor = 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) };
|
||||||
|
}
|
||||||
|
}
|
@ -15,7 +15,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
<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.621.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.23.0" />
|
<PackageReference Include="SharpCompress" Version="0.23.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
@ -105,8 +105,8 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
<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.621.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.618.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.621.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user