Merge branch 'master' of git://github.com/ppy/osu into animated-legacy-skins
@ -63,6 +63,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.702.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.702.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.726.2" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.730.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -38,9 +38,9 @@ namespace osu.Desktop
|
|||||||
if (Host is DesktopGameHost desktopHost)
|
if (Host is DesktopGameHost desktopHost)
|
||||||
return new StableStorage(desktopHost);
|
return new StableStorage(desktopHost);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Logger.Error(e, "Error while searching for stable install");
|
Logger.Log("Could not find a stable install", LoggingTarget.Runtime, LogLevel.Important);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -52,11 +52,7 @@ namespace osu.Desktop
|
|||||||
|
|
||||||
if (!noVersionOverlay)
|
if (!noVersionOverlay)
|
||||||
{
|
{
|
||||||
LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, v =>
|
LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, Add);
|
||||||
{
|
|
||||||
Add(v);
|
|
||||||
v.Show();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
|
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
|
||||||
Add(new SquirrelUpdateManager());
|
Add(new SquirrelUpdateManager());
|
||||||
@ -71,7 +67,7 @@ namespace osu.Desktop
|
|||||||
|
|
||||||
switch (newScreen)
|
switch (newScreen)
|
||||||
{
|
{
|
||||||
case Intro _:
|
case IntroScreen _:
|
||||||
case MainMenu _:
|
case MainMenu _:
|
||||||
versionManager?.Show();
|
versionManager?.Show();
|
||||||
break;
|
break;
|
||||||
|
@ -27,6 +27,8 @@ namespace osu.Desktop.Updater
|
|||||||
|
|
||||||
public Task PrepareUpdateAsync() => UpdateManager.RestartAppWhenExited();
|
public Task PrepareUpdateAsync() => UpdateManager.RestartAppWhenExited();
|
||||||
|
|
||||||
|
private static readonly Logger logger = Logger.GetLogger("updater");
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(NotificationOverlay notification, OsuGameBase game)
|
private void load(NotificationOverlay notification, OsuGameBase game)
|
||||||
{
|
{
|
||||||
@ -77,7 +79,7 @@ namespace osu.Desktop.Updater
|
|||||||
{
|
{
|
||||||
if (useDeltaPatching)
|
if (useDeltaPatching)
|
||||||
{
|
{
|
||||||
Logger.Error(e, @"delta patching failed!");
|
logger.Add(@"delta patching failed; will attempt full download!");
|
||||||
|
|
||||||
//could fail if deltas are unavailable for full update path (https://github.com/Squirrel/Squirrel.Windows/issues/959)
|
//could fail if deltas are unavailable for full update path (https://github.com/Squirrel/Squirrel.Windows/issues/959)
|
||||||
//try again without deltas.
|
//try again without deltas.
|
||||||
@ -163,16 +165,11 @@ namespace osu.Desktop.Updater
|
|||||||
{
|
{
|
||||||
public LogLevel Level { get; set; } = LogLevel.Info;
|
public LogLevel Level { get; set; } = LogLevel.Info;
|
||||||
|
|
||||||
private Logger logger;
|
|
||||||
|
|
||||||
public void Write(string message, LogLevel logLevel)
|
public void Write(string message, LogLevel logLevel)
|
||||||
{
|
{
|
||||||
if (logLevel < Level)
|
if (logLevel < Level)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (logger == null)
|
|
||||||
logger = Logger.GetLogger("updater");
|
|
||||||
|
|
||||||
logger.Add(message);
|
logger.Add(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
osu.Game.Rulesets.Osu.Tests/Resources/default-skin/approachcircle@2x.png
Executable file
After Width: | Height: | Size: 18 KiB |
BIN
osu.Game.Rulesets.Osu.Tests/Resources/default-skin/hit300k@2x.png
Executable file
After Width: | Height: | Size: 28 KiB |
BIN
osu.Game.Rulesets.Osu.Tests/Resources/default-skin/hitcircle@2x.png
Executable file
After Width: | Height: | Size: 7.6 KiB |
BIN
osu.Game.Rulesets.Osu.Tests/Resources/default-skin/hitcircleoverlay@2x.png
Executable file
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 37 KiB |
BIN
osu.Game.Rulesets.Osu.Tests/Resources/special-skin/approachcircle@2x.png
Executable file
After Width: | Height: | Size: 26 KiB |
BIN
osu.Game.Rulesets.Osu.Tests/Resources/special-skin/hitcircle@2x.png
Executable file
After Width: | Height: | Size: 240 KiB |
BIN
osu.Game.Rulesets.Osu.Tests/Resources/special-skin/hitcircleoverlay@2x.png
Executable file
After Width: | Height: | Size: 241 KiB |
66
osu.Game.Rulesets.Osu.Tests/SkinnableTestScene.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// 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.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.IO.Stores;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
|
{
|
||||||
|
public abstract class SkinnableTestScene : OsuGridTestScene
|
||||||
|
{
|
||||||
|
private Skin metricsSkin;
|
||||||
|
private Skin defaultSkin;
|
||||||
|
private Skin specialSkin;
|
||||||
|
|
||||||
|
protected SkinnableTestScene()
|
||||||
|
: base(2, 2)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio)
|
||||||
|
{
|
||||||
|
var skins = new SkinManager(LocalStorage, ContextFactory, null, audio);
|
||||||
|
|
||||||
|
metricsSkin = getSkinFromResources(skins, "metrics_skin");
|
||||||
|
defaultSkin = getSkinFromResources(skins, "default_skin");
|
||||||
|
specialSkin = getSkinFromResources(skins, "special_skin");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetContents(Func<Drawable> creationFunction)
|
||||||
|
{
|
||||||
|
Cell(0).Child = new LocalSkinOverrideContainer(null) { RelativeSizeAxes = Axes.Both }.WithChild(creationFunction());
|
||||||
|
Cell(1).Child = new LocalSkinOverrideContainer(metricsSkin) { RelativeSizeAxes = Axes.Both }.WithChild(creationFunction());
|
||||||
|
Cell(2).Child = new LocalSkinOverrideContainer(defaultSkin) { RelativeSizeAxes = Axes.Both }.WithChild(creationFunction());
|
||||||
|
Cell(3).Child = new LocalSkinOverrideContainer(specialSkin) { RelativeSizeAxes = Axes.Both }.WithChild(creationFunction());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Skin getSkinFromResources(SkinManager skins, string name)
|
||||||
|
{
|
||||||
|
using (var storage = new DllResourceStore("osu.Game.Rulesets.Osu.Tests.dll"))
|
||||||
|
{
|
||||||
|
var tempName = Path.GetTempFileName();
|
||||||
|
|
||||||
|
File.Delete(tempName);
|
||||||
|
Directory.CreateDirectory(tempName);
|
||||||
|
|
||||||
|
var files = storage.GetAvailableResources().Where(f => f.StartsWith($"Resources/{name}"));
|
||||||
|
|
||||||
|
foreach (var file in files)
|
||||||
|
using (var stream = storage.GetStream(file))
|
||||||
|
using (var newFile = File.Create(Path.Combine(tempName, Path.GetFileName(file))))
|
||||||
|
stream.CopyTo(newFile);
|
||||||
|
|
||||||
|
return skins.GetSkin(skins.Import(tempName).Result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,6 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System;
|
using System;
|
||||||
@ -19,37 +18,32 @@ using osu.Game.Rulesets.Scoring;
|
|||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneHitCircle : OsuTestScene
|
public class TestSceneHitCircle : SkinnableTestScene
|
||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(DrawableHitCircle)
|
typeof(DrawableHitCircle)
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly Container content;
|
|
||||||
protected override Container<Drawable> Content => content;
|
|
||||||
|
|
||||||
private int depthIndex;
|
private int depthIndex;
|
||||||
|
|
||||||
public TestSceneHitCircle()
|
public TestSceneHitCircle()
|
||||||
{
|
{
|
||||||
base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 }));
|
AddStep("Miss Big Single", () => SetContents(() => testSingle(2)));
|
||||||
|
AddStep("Miss Medium Single", () => SetContents(() => testSingle(5)));
|
||||||
AddStep("Miss Big Single", () => testSingle(2));
|
AddStep("Miss Small Single", () => SetContents(() => testSingle(7)));
|
||||||
AddStep("Miss Medium Single", () => testSingle(5));
|
AddStep("Hit Big Single", () => SetContents(() => testSingle(2, true)));
|
||||||
AddStep("Miss Small Single", () => testSingle(7));
|
AddStep("Hit Medium Single", () => SetContents(() => testSingle(5, true)));
|
||||||
AddStep("Hit Big Single", () => testSingle(2, true));
|
AddStep("Hit Small Single", () => SetContents(() => testSingle(7, true)));
|
||||||
AddStep("Hit Medium Single", () => testSingle(5, true));
|
AddStep("Miss Big Stream", () => SetContents(() => testStream(2)));
|
||||||
AddStep("Hit Small Single", () => testSingle(7, true));
|
AddStep("Miss Medium Stream", () => SetContents(() => testStream(5)));
|
||||||
AddStep("Miss Big Stream", () => testStream(2));
|
AddStep("Miss Small Stream", () => SetContents(() => testStream(7)));
|
||||||
AddStep("Miss Medium Stream", () => testStream(5));
|
AddStep("Hit Big Stream", () => SetContents(() => testStream(2, true)));
|
||||||
AddStep("Miss Small Stream", () => testStream(7));
|
AddStep("Hit Medium Stream", () => SetContents(() => testStream(5, true)));
|
||||||
AddStep("Hit Big Stream", () => testStream(2, true));
|
AddStep("Hit Small Stream", () => SetContents(() => testStream(7, true)));
|
||||||
AddStep("Hit Medium Stream", () => testStream(5, true));
|
|
||||||
AddStep("Hit Small Stream", () => testStream(7, true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testSingle(float circleSize, bool auto = false, double timeOffset = 0, Vector2? positionOffset = null)
|
private Drawable testSingle(float circleSize, bool auto = false, double timeOffset = 0, Vector2? positionOffset = null)
|
||||||
{
|
{
|
||||||
positionOffset = positionOffset ?? Vector2.Zero;
|
positionOffset = positionOffset ?? Vector2.Zero;
|
||||||
|
|
||||||
@ -61,27 +55,33 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize });
|
circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize });
|
||||||
|
|
||||||
var drawable = new TestDrawableHitCircle(circle, auto)
|
var drawable = CreateDrawableHitCircle(circle, auto);
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Depth = depthIndex++
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var mod in Mods.Value.OfType<IApplicableToDrawableHitObjects>())
|
foreach (var mod in Mods.Value.OfType<IApplicableToDrawableHitObjects>())
|
||||||
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
||||||
|
|
||||||
Add(drawable);
|
return drawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testStream(float circleSize, bool auto = false)
|
protected virtual TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto) => new TestDrawableHitCircle(circle, auto)
|
||||||
{
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Depth = depthIndex++
|
||||||
|
};
|
||||||
|
|
||||||
|
private Drawable testStream(float circleSize, bool auto = false)
|
||||||
|
{
|
||||||
|
var container = new Container { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
Vector2 pos = new Vector2(-250, 0);
|
Vector2 pos = new Vector2(-250, 0);
|
||||||
|
|
||||||
for (int i = 0; i <= 1000; i += 100)
|
for (int i = 0; i <= 1000; i += 100)
|
||||||
{
|
{
|
||||||
testSingle(circleSize, auto, i, pos);
|
container.Add(testSingle(circleSize, auto, i, pos));
|
||||||
pos.X += 50;
|
pos.X += 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class TestDrawableHitCircle : DrawableHitCircle
|
protected class TestDrawableHitCircle : DrawableHitCircle
|
||||||
|
@ -1,23 +1,22 @@
|
|||||||
// 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.Graphics;
|
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
{
|
{
|
||||||
public class TestSceneShaking : TestSceneHitCircle
|
public class TestSceneShaking : TestSceneHitCircle
|
||||||
{
|
{
|
||||||
public override void Add(Drawable drawable)
|
protected override TestDrawableHitCircle CreateDrawableHitCircle(HitCircle circle, bool auto)
|
||||||
{
|
{
|
||||||
base.Add(drawable);
|
var drawableHitObject = base.CreateDrawableHitCircle(circle, auto);
|
||||||
|
|
||||||
if (drawable is TestDrawableHitCircle hitObject)
|
Scheduler.AddDelayed(() => drawableHitObject.TriggerJudgement(),
|
||||||
{
|
drawableHitObject.HitObject.StartTime - (drawableHitObject.HitObject.HitWindows.HalfWindowFor(HitResult.Miss) + RNG.Next(0, 300)) - Time.Current);
|
||||||
Scheduler.AddDelayed(() => hitObject.TriggerJudgement(),
|
|
||||||
hitObject.HitObject.StartTime - (hitObject.HitObject.HitWindows.HalfWindowFor(HitResult.Miss) + RNG.Next(0, 300)) - Time.Current);
|
return drawableHitObject;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Alpha = 0.5f,
|
Alpha = 0.5f,
|
||||||
}
|
}
|
||||||
}, restrictSize: false);
|
}, confineMode: ConfineMode.NoScaling);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,13 +97,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
|||||||
Position = pointStartPosition,
|
Position = pointStartPosition,
|
||||||
Rotation = rotation,
|
Rotation = rotation,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Scale = new Vector2(1.5f),
|
Scale = new Vector2(1.5f * currHitObject.Scale),
|
||||||
});
|
});
|
||||||
|
|
||||||
using (fp.BeginAbsoluteSequence(fadeInTime))
|
using (fp.BeginAbsoluteSequence(fadeInTime))
|
||||||
{
|
{
|
||||||
fp.FadeIn(currHitObject.TimeFadeIn);
|
fp.FadeIn(currHitObject.TimeFadeIn);
|
||||||
fp.ScaleTo(1, currHitObject.TimeFadeIn, Easing.Out);
|
fp.ScaleTo(currHitObject.Scale, currHitObject.TimeFadeIn, Easing.Out);
|
||||||
|
|
||||||
fp.MoveTo(pointEndPosition, currHitObject.TimeFadeIn, Easing.Out);
|
fp.MoveTo(pointEndPosition, currHitObject.TimeFadeIn, Easing.Out);
|
||||||
|
|
||||||
|
@ -6,33 +6,29 @@ 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.Input.Bindings;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach
|
public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach
|
||||||
{
|
{
|
||||||
public ApproachCircle ApproachCircle;
|
public ApproachCircle ApproachCircle;
|
||||||
private readonly CirclePiece circle;
|
|
||||||
private readonly RingPiece ring;
|
|
||||||
private readonly FlashPiece flash;
|
|
||||||
private readonly ExplodePiece explode;
|
|
||||||
private readonly NumberPiece number;
|
|
||||||
private readonly GlowPiece glow;
|
|
||||||
|
|
||||||
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
private readonly IBindable<Vector2> positionBindable = new Bindable<Vector2>();
|
||||||
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
|
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
|
||||||
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||||
|
|
||||||
public OsuAction? HitAction => circle.HitAction;
|
public OsuAction? HitAction => hitArea.HitAction;
|
||||||
|
|
||||||
private readonly Container explodeContainer;
|
|
||||||
|
|
||||||
private readonly Container scaleContainer;
|
private readonly Container scaleContainer;
|
||||||
|
|
||||||
|
private readonly HitArea hitArea;
|
||||||
|
|
||||||
public DrawableHitCircle(HitCircle h)
|
public DrawableHitCircle(HitCircle h)
|
||||||
: base(h)
|
: base(h)
|
||||||
{
|
{
|
||||||
@ -47,44 +43,30 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Child = explodeContainer = new Container
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
hitArea = new HitArea
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
glow = new GlowPiece(),
|
Hit = () =>
|
||||||
circle = new CirclePiece
|
|
||||||
{
|
{
|
||||||
Hit = () =>
|
if (AllJudged)
|
||||||
{
|
return false;
|
||||||
if (AllJudged)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
UpdateResult(true);
|
UpdateResult(true);
|
||||||
return true;
|
return true;
|
||||||
},
|
|
||||||
},
|
},
|
||||||
number = new NumberPiece
|
},
|
||||||
{
|
new SkinnableDrawable("Play/osu/hitcircle", _ => new MainCirclePiece(HitObject.IndexInCurrentCombo)),
|
||||||
Text = (HitObject.IndexInCurrentCombo + 1).ToString(),
|
ApproachCircle = new ApproachCircle
|
||||||
},
|
{
|
||||||
ring = new RingPiece(),
|
Alpha = 0,
|
||||||
flash = new FlashPiece(),
|
Scale = new Vector2(4),
|
||||||
explode = new ExplodePiece(),
|
|
||||||
ApproachCircle = new ApproachCircle
|
|
||||||
{
|
|
||||||
Alpha = 0,
|
|
||||||
Scale = new Vector2(4),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
//may not be so correct
|
Size = hitArea.DrawSize;
|
||||||
Size = circle.DrawSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -98,13 +80,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
stackHeightBindable.BindTo(HitObject.StackHeightBindable);
|
stackHeightBindable.BindTo(HitObject.StackHeightBindable);
|
||||||
scaleBindable.BindTo(HitObject.ScaleBindable);
|
scaleBindable.BindTo(HitObject.ScaleBindable);
|
||||||
|
|
||||||
AccentColour.BindValueChanged(colour =>
|
AccentColour.BindValueChanged(accent => ApproachCircle.Colour = accent.NewValue, true);
|
||||||
{
|
|
||||||
explode.Colour = colour.NewValue;
|
|
||||||
glow.Colour = colour.NewValue;
|
|
||||||
circle.Colour = colour.NewValue;
|
|
||||||
ApproachCircle.Colour = colour.NewValue;
|
|
||||||
}, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
@ -133,14 +109,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
base.UpdateInitialTransforms();
|
base.UpdateInitialTransforms();
|
||||||
|
|
||||||
ApproachCircle.FadeIn(Math.Min(HitObject.TimeFadeIn * 2, HitObject.TimePreempt));
|
ApproachCircle.FadeIn(Math.Min(HitObject.TimeFadeIn * 2, HitObject.TimePreempt));
|
||||||
ApproachCircle.ScaleTo(1.1f, HitObject.TimePreempt);
|
ApproachCircle.ScaleTo(1f, HitObject.TimePreempt);
|
||||||
ApproachCircle.Expire(true);
|
ApproachCircle.Expire(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateStateTransforms(ArmedState state)
|
protected override void UpdateStateTransforms(ArmedState state)
|
||||||
{
|
{
|
||||||
glow.FadeOut(400);
|
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Idle:
|
case ArmedState.Idle:
|
||||||
@ -148,7 +122,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
Expire(true);
|
Expire(true);
|
||||||
|
|
||||||
circle.HitAction = null;
|
hitArea.HitAction = null;
|
||||||
|
|
||||||
// override lifetime end as FadeIn may have been changed externally, causing out expiration to be too early.
|
// override lifetime end as FadeIn may have been changed externally, causing out expiration to be too early.
|
||||||
LifetimeEnd = HitObject.StartTime + HitObject.HitWindows.HalfWindowFor(HitResult.Miss);
|
LifetimeEnd = HitObject.StartTime + HitObject.HitWindows.HalfWindowFor(HitResult.Miss);
|
||||||
@ -163,29 +137,50 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
ApproachCircle.FadeOut(50);
|
ApproachCircle.FadeOut(50);
|
||||||
|
|
||||||
const double flash_in = 40;
|
// todo: temporary / arbitrary
|
||||||
flash.FadeTo(0.8f, flash_in)
|
this.Delay(800).Expire();
|
||||||
.Then()
|
|
||||||
.FadeOut(100);
|
|
||||||
|
|
||||||
explode.FadeIn(flash_in);
|
|
||||||
|
|
||||||
using (BeginDelayedSequence(flash_in, true))
|
|
||||||
{
|
|
||||||
//after the flash, we can hide some elements that were behind it
|
|
||||||
ring.FadeOut();
|
|
||||||
circle.FadeOut();
|
|
||||||
number.FadeOut();
|
|
||||||
|
|
||||||
this.FadeOut(800);
|
|
||||||
explodeContainer.ScaleTo(1.5f, 400, Easing.OutQuad);
|
|
||||||
}
|
|
||||||
|
|
||||||
Expire();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable ProxiedLayer => ApproachCircle;
|
public Drawable ProxiedLayer => ApproachCircle;
|
||||||
|
|
||||||
|
private class HitArea : Drawable, IKeyBindingHandler<OsuAction>
|
||||||
|
{
|
||||||
|
// IsHovered is used
|
||||||
|
public override bool HandlePositionalInput => true;
|
||||||
|
|
||||||
|
public Func<bool> Hit;
|
||||||
|
|
||||||
|
public OsuAction? HitAction;
|
||||||
|
|
||||||
|
public HitArea()
|
||||||
|
{
|
||||||
|
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
|
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool OnPressed(OsuAction action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case OsuAction.LeftButton:
|
||||||
|
case OsuAction.RightButton:
|
||||||
|
if (IsHovered && (Hit?.Invoke() ?? false))
|
||||||
|
{
|
||||||
|
HitAction = action;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool OnReleased(OsuAction action) => false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// 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.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
@ -20,27 +22,40 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
private double animDuration;
|
private double animDuration;
|
||||||
|
|
||||||
|
private readonly SkinnableDrawable scaleContainer;
|
||||||
|
|
||||||
public DrawableRepeatPoint(RepeatPoint repeatPoint, DrawableSlider drawableSlider)
|
public DrawableRepeatPoint(RepeatPoint repeatPoint, DrawableSlider drawableSlider)
|
||||||
: base(repeatPoint)
|
: base(repeatPoint)
|
||||||
{
|
{
|
||||||
this.repeatPoint = repeatPoint;
|
this.repeatPoint = repeatPoint;
|
||||||
this.drawableSlider = drawableSlider;
|
this.drawableSlider = drawableSlider;
|
||||||
|
|
||||||
Size = new Vector2(45 * repeatPoint.Scale);
|
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
|
|
||||||
Blending = BlendingMode.Additive;
|
Blending = BlendingMode.Additive;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChild = scaleContainer = new SkinnableDrawable("Play/osu/reversearrow", _ => new SpriteIcon
|
||||||
{
|
{
|
||||||
new SkinnableDrawable("Play/osu/reversearrow", _ => new SpriteIcon
|
RelativeSizeAxes = Axes.Both,
|
||||||
{
|
Icon = FontAwesome.Solid.ChevronRight,
|
||||||
RelativeSizeAxes = Axes.Both,
|
Size = new Vector2(0.35f)
|
||||||
Icon = FontAwesome.Solid.ChevronRight
|
}, confineMode: ConfineMode.NoScaling)
|
||||||
}, restrictSize: false)
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
scaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue), true);
|
||||||
|
scaleBindable.BindTo(HitObject.ScaleBindable);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
{
|
{
|
||||||
if (repeatPoint.StartTime <= Time.Current)
|
if (repeatPoint.StartTime <= Time.Current)
|
||||||
|
@ -48,10 +48,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
Body = new SnakingSliderBody(s)
|
Body = new SnakingSliderBody(s),
|
||||||
{
|
|
||||||
PathRadius = s.Scale * OsuHitObject.OBJECT_RADIUS,
|
|
||||||
},
|
|
||||||
ticks = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },
|
ticks = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },
|
||||||
repeatPoints = new Container<DrawableRepeatPoint> { RelativeSizeAxes = Axes.Both },
|
repeatPoints = new Container<DrawableRepeatPoint> { RelativeSizeAxes = Axes.Both },
|
||||||
Ball = new SliderBall(s, this)
|
Ball = new SliderBall(s, this)
|
||||||
@ -105,7 +102,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
||||||
scaleBindable.BindValueChanged(scale =>
|
scaleBindable.BindValueChanged(scale =>
|
||||||
{
|
{
|
||||||
Body.PathRadius = scale.NewValue * 64;
|
updatePathRadius();
|
||||||
Ball.Scale = new Vector2(scale.NewValue);
|
Ball.Scale = new Vector2(scale.NewValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -118,7 +115,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
AccentColour.BindValueChanged(colour =>
|
AccentColour.BindValueChanged(colour =>
|
||||||
{
|
{
|
||||||
Body.AccentColour = colour.NewValue;
|
Body.AccentColour = colour.NewValue;
|
||||||
Ball.AccentColour = colour.NewValue;
|
|
||||||
|
|
||||||
foreach (var drawableHitObject in NestedHitObjects)
|
foreach (var drawableHitObject in NestedHitObjects)
|
||||||
drawableHitObject.AccentColour.Value = colour.NewValue;
|
drawableHitObject.AccentColour.Value = colour.NewValue;
|
||||||
@ -157,16 +153,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
Body.RecyclePath();
|
Body.RecyclePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float sliderPathRadius;
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||||
{
|
{
|
||||||
base.SkinChanged(skin, allowFallback);
|
base.SkinChanged(skin, allowFallback);
|
||||||
|
|
||||||
Body.BorderSize = skin.GetValue<SkinConfiguration, float?>(s => s.SliderBorderSize) ?? SliderBody.DEFAULT_BORDER_SIZE;
|
Body.BorderSize = skin.GetValue<SkinConfiguration, float?>(s => s.SliderBorderSize) ?? SliderBody.DEFAULT_BORDER_SIZE;
|
||||||
|
sliderPathRadius = skin.GetValue<SkinConfiguration, float?>(s => s.SliderPathRadius) ?? OsuHitObject.OBJECT_RADIUS;
|
||||||
|
updatePathRadius();
|
||||||
|
|
||||||
Body.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? AccentColour.Value;
|
Body.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? AccentColour.Value;
|
||||||
Body.BorderColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Color4.White;
|
Body.BorderColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Color4.White;
|
||||||
Ball.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? AccentColour.Value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updatePathRadius() => Body.PathRadius = slider.Scale * sliderPathRadius;
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
{
|
{
|
||||||
if (userTriggered || Time.Current < slider.EndTime)
|
if (userTriggered || Time.Current < slider.EndTime)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -16,36 +18,49 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
public const double ANIM_DURATION = 150;
|
public const double ANIM_DURATION = 150;
|
||||||
|
|
||||||
|
private const float default_tick_size = 16;
|
||||||
|
|
||||||
public bool Tracking { get; set; }
|
public bool Tracking { get; set; }
|
||||||
|
|
||||||
public override bool DisplayResult => false;
|
public override bool DisplayResult => false;
|
||||||
|
|
||||||
|
private readonly SkinnableDrawable scaleContainer;
|
||||||
|
|
||||||
public DrawableSliderTick(SliderTick sliderTick)
|
public DrawableSliderTick(SliderTick sliderTick)
|
||||||
: base(sliderTick)
|
: base(sliderTick)
|
||||||
{
|
{
|
||||||
Size = new Vector2(16) * sliderTick.Scale;
|
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChild = scaleContainer = new SkinnableDrawable("Play/osu/sliderscorepoint", _ => new CircularContainer
|
||||||
{
|
{
|
||||||
new SkinnableDrawable("Play/osu/sliderscorepoint", _ => new Container
|
Masking = true,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(default_tick_size),
|
||||||
|
BorderThickness = default_tick_size / 4,
|
||||||
|
BorderColour = Color4.White,
|
||||||
|
Child = new Box
|
||||||
{
|
{
|
||||||
Masking = true,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.Centre,
|
Colour = AccentColour.Value,
|
||||||
CornerRadius = Size.X / 2,
|
Alpha = 0.3f,
|
||||||
BorderThickness = 2,
|
}
|
||||||
BorderColour = Color4.White,
|
})
|
||||||
Child = new Box
|
{
|
||||||
{
|
Anchor = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
Origin = Anchor.Centre,
|
||||||
Colour = AccentColour.Value,
|
|
||||||
Alpha = 0.3f,
|
|
||||||
}
|
|
||||||
}, restrictSize: false)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
scaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue), true);
|
||||||
|
scaleBindable.BindTo(HitObject.ScaleBindable);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
{
|
{
|
||||||
if (timeOffset >= 0)
|
if (timeOffset >= 0)
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||||
{
|
{
|
||||||
@ -24,7 +25,26 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
Child = new SkinnableSprite("Play/osu/approachcircle");
|
Child = new SkinnableApproachCircle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SkinnableApproachCircle : SkinnableSprite
|
||||||
|
{
|
||||||
|
public SkinnableApproachCircle()
|
||||||
|
: base("Play/osu/approachcircle")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Drawable CreateDefault(string name)
|
||||||
|
{
|
||||||
|
var drawable = base.CreateDefault(name);
|
||||||
|
|
||||||
|
// account for the sprite being used for the default approach circle being taken from stable,
|
||||||
|
// when hitcircles have 5px padding on each size. this should be removed if we update the sprite.
|
||||||
|
drawable.Scale = new Vector2(128 / 118f);
|
||||||
|
|
||||||
|
return drawable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,17 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Skinning;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||||
{
|
{
|
||||||
public class CirclePiece : Container, IKeyBindingHandler<OsuAction>
|
public class CirclePiece : CompositeDrawable
|
||||||
{
|
{
|
||||||
// IsHovered is used
|
|
||||||
public override bool HandlePositionalInput => true;
|
|
||||||
|
|
||||||
public Func<bool> Hit;
|
|
||||||
|
|
||||||
public OsuAction? HitAction;
|
|
||||||
|
|
||||||
public CirclePiece()
|
public CirclePiece()
|
||||||
{
|
{
|
||||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
@ -27,28 +20,26 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
|
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
InternalChild = new SkinnableDrawable("Play/osu/hitcircle", _ => new DefaultCirclePiece());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnPressed(OsuAction action)
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
switch (action)
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
case OsuAction.LeftButton:
|
new Sprite
|
||||||
case OsuAction.RightButton:
|
{
|
||||||
if (IsHovered && (Hit?.Invoke() ?? false))
|
Anchor = Anchor.Centre,
|
||||||
{
|
Origin = Anchor.Centre,
|
||||||
HitAction = action;
|
Texture = textures.Get(@"Play/osu/disc"),
|
||||||
return true;
|
},
|
||||||
}
|
new TrianglesPiece
|
||||||
|
{
|
||||||
break;
|
RelativeSizeAxes = Axes.Both,
|
||||||
}
|
Blending = BlendingMode.Additive,
|
||||||
|
Alpha = 0.5f,
|
||||||
return false;
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(OsuAction action) => false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|
||||||
{
|
|
||||||
public class DefaultCirclePiece : Container
|
|
||||||
{
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(TextureStore textures)
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Sprite
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Texture = textures.Get(@"Play/osu/disc"),
|
|
||||||
},
|
|
||||||
new TrianglesPiece
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Blending = BlendingMode.Additive,
|
|
||||||
Alpha = 0.5f,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,94 @@
|
|||||||
|
// 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.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||||
|
{
|
||||||
|
public class MainCirclePiece : CompositeDrawable
|
||||||
|
{
|
||||||
|
private readonly CirclePiece circle;
|
||||||
|
private readonly RingPiece ring;
|
||||||
|
private readonly FlashPiece flash;
|
||||||
|
private readonly ExplodePiece explode;
|
||||||
|
private readonly NumberPiece number;
|
||||||
|
private readonly GlowPiece glow;
|
||||||
|
|
||||||
|
public MainCirclePiece(int index)
|
||||||
|
{
|
||||||
|
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
|
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
glow = new GlowPiece(),
|
||||||
|
circle = new CirclePiece(),
|
||||||
|
number = new NumberPiece
|
||||||
|
{
|
||||||
|
Text = (index + 1).ToString(),
|
||||||
|
},
|
||||||
|
ring = new RingPiece(),
|
||||||
|
flash = new FlashPiece(),
|
||||||
|
explode = new ExplodePiece(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly IBindable<ArmedState> state = new Bindable<ArmedState>();
|
||||||
|
|
||||||
|
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(DrawableHitObject drawableObject)
|
||||||
|
{
|
||||||
|
state.BindTo(drawableObject.State);
|
||||||
|
state.BindValueChanged(updateState, true);
|
||||||
|
|
||||||
|
accentColour.BindTo(drawableObject.AccentColour);
|
||||||
|
accentColour.BindValueChanged(colour =>
|
||||||
|
{
|
||||||
|
explode.Colour = colour.NewValue;
|
||||||
|
glow.Colour = colour.NewValue;
|
||||||
|
circle.Colour = colour.NewValue;
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateState(ValueChangedEvent<ArmedState> state)
|
||||||
|
{
|
||||||
|
glow.FadeOut(400);
|
||||||
|
|
||||||
|
switch (state.NewValue)
|
||||||
|
{
|
||||||
|
case ArmedState.Hit:
|
||||||
|
const double flash_in = 40;
|
||||||
|
const double flash_out = 100;
|
||||||
|
|
||||||
|
flash.FadeTo(0.8f, flash_in)
|
||||||
|
.Then()
|
||||||
|
.FadeOut(flash_out);
|
||||||
|
|
||||||
|
explode.FadeIn(flash_in);
|
||||||
|
this.ScaleTo(1.5f, 400, Easing.OutQuad);
|
||||||
|
|
||||||
|
using (BeginDelayedSequence(flash_in, true))
|
||||||
|
{
|
||||||
|
//after the flash, we can hide some elements that were behind it
|
||||||
|
ring.FadeOut();
|
||||||
|
circle.FadeOut();
|
||||||
|
number.FadeOut();
|
||||||
|
|
||||||
|
this.FadeOut(800);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
{
|
{
|
||||||
Font = OsuFont.Numeric.With(size: 40),
|
Font = OsuFont.Numeric.With(size: 40),
|
||||||
UseFullGlyphHeight = false,
|
UseFullGlyphHeight = false,
|
||||||
}, restrictSize: false)
|
}, confineMode: ConfineMode.NoScaling)
|
||||||
{
|
{
|
||||||
Text = @"1"
|
Text = @"1"
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,13 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
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.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -17,88 +19,44 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
{
|
{
|
||||||
public class SliderBall : CircularContainer, ISliderProgress, IRequireHighFrequencyMousePosition
|
public class SliderBall : CircularContainer, ISliderProgress, IRequireHighFrequencyMousePosition
|
||||||
{
|
{
|
||||||
private Color4 accentColour = Color4.Black;
|
|
||||||
|
|
||||||
public Func<OsuAction?> GetInitialHitAction;
|
public Func<OsuAction?> GetInitialHitAction;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The colour that is used for the slider ball.
|
|
||||||
/// </summary>
|
|
||||||
public Color4 AccentColour
|
|
||||||
{
|
|
||||||
get => accentColour;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
accentColour = value;
|
|
||||||
if (drawableBall != null)
|
|
||||||
drawableBall.Colour = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Slider slider;
|
private readonly Slider slider;
|
||||||
public readonly Drawable FollowCircle;
|
public readonly Drawable FollowCircle;
|
||||||
private Drawable drawableBall;
|
|
||||||
private readonly DrawableSlider drawableSlider;
|
private readonly DrawableSlider drawableSlider;
|
||||||
|
|
||||||
public SliderBall(Slider slider, DrawableSlider drawableSlider = null)
|
public SliderBall(Slider slider, DrawableSlider drawableSlider = null)
|
||||||
{
|
{
|
||||||
this.drawableSlider = drawableSlider;
|
this.drawableSlider = drawableSlider;
|
||||||
this.slider = slider;
|
this.slider = slider;
|
||||||
Masking = true;
|
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
Blending = BlendingMode.Additive;
|
Blending = BlendingMode.Additive;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||||
|
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
FollowCircle = new Container
|
FollowCircle = new FollowCircleContainer
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Width = OsuHitObject.OBJECT_RADIUS * 2,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Height = OsuHitObject.OBJECT_RADIUS * 2,
|
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Child = new SkinnableDrawable("Play/osu/sliderfollowcircle", _ => new CircularContainer
|
Child = new SkinnableDrawable("Play/osu/sliderfollowcircle", _ => new DefaultFollowCircle()),
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Masking = true,
|
|
||||||
BorderThickness = 5,
|
|
||||||
BorderColour = Color4.Orange,
|
|
||||||
Blending = BlendingMode.Additive,
|
|
||||||
Child = new Box
|
|
||||||
{
|
|
||||||
Colour = Color4.Orange,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Alpha = 0.2f,
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
new CircularContainer
|
new CircularContainer
|
||||||
{
|
{
|
||||||
Masking = true,
|
Masking = true,
|
||||||
AutoSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Alpha = 1,
|
Alpha = 1,
|
||||||
Child = new Container
|
Child = new Container
|
||||||
{
|
{
|
||||||
Width = OsuHitObject.OBJECT_RADIUS * 2,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Height = OsuHitObject.OBJECT_RADIUS * 2,
|
|
||||||
// TODO: support skin filename animation (sliderb0, sliderb1...)
|
// TODO: support skin filename animation (sliderb0, sliderb1...)
|
||||||
Child = new SkinnableDrawable("Play/osu/sliderb", _ => new CircularContainer
|
Child = new SkinnableDrawable("Play/osu/sliderball", _ => new DefaultSliderBall()),
|
||||||
{
|
|
||||||
Masking = true,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
BorderThickness = 10,
|
|
||||||
BorderColour = Color4.White,
|
|
||||||
Alpha = 1,
|
|
||||||
Child = drawableBall = new Box
|
|
||||||
{
|
|
||||||
Colour = AccentColour,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Alpha = 0.4f,
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -191,7 +149,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
// in valid time range
|
// in valid time range
|
||||||
Time.Current >= slider.StartTime && Time.Current < slider.EndTime &&
|
Time.Current >= slider.StartTime && Time.Current < slider.EndTime &&
|
||||||
// in valid position range
|
// in valid position range
|
||||||
lastScreenSpaceMousePosition.HasValue && base.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
|
lastScreenSpaceMousePosition.HasValue && FollowCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
|
||||||
// valid action
|
// valid action
|
||||||
(actions?.Any(isValidTrackingAction) ?? false);
|
(actions?.Any(isValidTrackingAction) ?? false);
|
||||||
}
|
}
|
||||||
@ -214,5 +172,62 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
{
|
{
|
||||||
Position = slider.CurvePositionAt(completionProgress);
|
Position = slider.CurvePositionAt(completionProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class FollowCircleContainer : Container
|
||||||
|
{
|
||||||
|
public override bool HandlePositionalInput => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DefaultFollowCircle : CompositeDrawable
|
||||||
|
{
|
||||||
|
public DefaultFollowCircle()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
InternalChild = new CircularContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Masking = true,
|
||||||
|
BorderThickness = 5,
|
||||||
|
BorderColour = Color4.Orange,
|
||||||
|
Blending = BlendingMode.Additive,
|
||||||
|
Child = new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.Orange,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Alpha = 0.2f,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DefaultSliderBall : CompositeDrawable
|
||||||
|
{
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(DrawableHitObject drawableObject, ISkinSource skin)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
float radius = skin.GetValue<SkinConfiguration, float?>(s => s.SliderPathRadius) ?? OsuHitObject.OBJECT_RADIUS;
|
||||||
|
|
||||||
|
InternalChild = new CircularContainer
|
||||||
|
{
|
||||||
|
Masking = true,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Scale = new Vector2(radius / OsuHitObject.OBJECT_RADIUS),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
BorderThickness = 10,
|
||||||
|
BorderColour = Color4.White,
|
||||||
|
Alpha = 1,
|
||||||
|
Child = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.White,
|
||||||
|
Alpha = 0.4f,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
|
|
||||||
protected Path Path => path;
|
protected Path Path => path;
|
||||||
|
|
||||||
public float PathRadius
|
public virtual float PathRadius
|
||||||
{
|
{
|
||||||
get => path.PathRadius;
|
get => path.PathRadius;
|
||||||
set => path.PathRadius = value;
|
set => path.PathRadius = value;
|
||||||
|
@ -24,6 +24,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
public double? SnakedStart { get; private set; }
|
public double? SnakedStart { get; private set; }
|
||||||
public double? SnakedEnd { get; private set; }
|
public double? SnakedEnd { get; private set; }
|
||||||
|
|
||||||
|
public override float PathRadius
|
||||||
|
{
|
||||||
|
get => base.PathRadius;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (base.PathRadius == value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
base.PathRadius = value;
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Vector2 PathOffset => snakedPathOffset;
|
public override Vector2 PathOffset => snakedPathOffset;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -18,6 +18,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
{
|
{
|
||||||
public class OsuCursor : SkinReloadableDrawable
|
public class OsuCursor : SkinReloadableDrawable
|
||||||
{
|
{
|
||||||
|
private const float size = 28;
|
||||||
|
|
||||||
private bool cursorExpand;
|
private bool cursorExpand;
|
||||||
|
|
||||||
private Bindable<double> cursorScale;
|
private Bindable<double> cursorScale;
|
||||||
@ -30,7 +32,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
public OsuCursor()
|
public OsuCursor()
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
Size = new Vector2(28);
|
|
||||||
|
Size = new Vector2(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||||
@ -46,66 +49,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Child = scaleTarget = new SkinnableDrawable("cursor", _ => new CircularContainer
|
Child = scaleTarget = new SkinnableDrawable("Play/osu/cursor", _ => new DefaultCursor(), confineMode: ConfineMode.NoScaling)
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Masking = true,
|
|
||||||
BorderThickness = Size.X / 6,
|
|
||||||
BorderColour = Color4.White,
|
|
||||||
EdgeEffect = new EdgeEffectParameters
|
|
||||||
{
|
|
||||||
Type = EdgeEffectType.Shadow,
|
|
||||||
Colour = Color4.Pink.Opacity(0.5f),
|
|
||||||
Radius = 5,
|
|
||||||
},
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Alpha = 0,
|
|
||||||
AlwaysPresent = true,
|
|
||||||
},
|
|
||||||
new CircularContainer
|
|
||||||
{
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Masking = true,
|
|
||||||
BorderThickness = Size.X / 3,
|
|
||||||
BorderColour = Color4.White.Opacity(0.5f),
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Alpha = 0,
|
|
||||||
AlwaysPresent = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new CircularContainer
|
|
||||||
{
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Scale = new Vector2(0.1f),
|
|
||||||
Masking = true,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = Color4.White,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}, restrictSize: false)
|
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -145,5 +92,76 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Contract() => expandTarget.ScaleTo(released_scale, 100, Easing.OutQuad);
|
public void Contract() => expandTarget.ScaleTo(released_scale, 100, Easing.OutQuad);
|
||||||
|
|
||||||
|
private class DefaultCursor : CompositeDrawable
|
||||||
|
{
|
||||||
|
public DefaultCursor()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new CircularContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Masking = true,
|
||||||
|
BorderThickness = size / 6,
|
||||||
|
BorderColour = Color4.White,
|
||||||
|
EdgeEffect = new EdgeEffectParameters
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Shadow,
|
||||||
|
Colour = Color4.Pink.Opacity(0.5f),
|
||||||
|
Radius = 5,
|
||||||
|
},
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Alpha = 0,
|
||||||
|
AlwaysPresent = true,
|
||||||
|
},
|
||||||
|
new CircularContainer
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Masking = true,
|
||||||
|
BorderThickness = size / 3,
|
||||||
|
BorderColour = Color4.White.Opacity(0.5f),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Alpha = 0,
|
||||||
|
AlwaysPresent = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new CircularContainer
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Scale = new Vector2(0.1f),
|
||||||
|
Masking = true,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.White,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,8 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
Size = new Vector2(0.75f);
|
// Calculated from osu!stable as 512 (default gamefield size) / 640 (default window size)
|
||||||
|
Size = new Vector2(0.8f);
|
||||||
|
|
||||||
InternalChild = new Container
|
InternalChild = new Container
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,6 @@ using osu.Framework.Platform;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -51,26 +50,14 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
private DummySongSelect songSelect;
|
private DummySongSelect songSelect;
|
||||||
private TestPlayerLoader playerLoader;
|
private TestPlayerLoader playerLoader;
|
||||||
private TestPlayer player;
|
private TestPlayer player;
|
||||||
private DatabaseContextFactory factory;
|
|
||||||
private BeatmapManager manager;
|
private BeatmapManager manager;
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, AudioManager audio)
|
private void load(GameHost host, AudioManager audio)
|
||||||
{
|
{
|
||||||
factory = new DatabaseContextFactory(LocalStorage);
|
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
||||||
factory.ResetDatabase();
|
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default));
|
||||||
|
|
||||||
using (var usage = factory.Get())
|
|
||||||
usage.Migrate();
|
|
||||||
|
|
||||||
factory.ResetDatabase();
|
|
||||||
|
|
||||||
using (var usage = factory.Get())
|
|
||||||
usage.Migrate();
|
|
||||||
|
|
||||||
Dependencies.Cache(rulesets = new RulesetStore(factory));
|
|
||||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, audio, host, Beatmap.Default));
|
|
||||||
Dependencies.Cache(new OsuConfigManager(LocalStorage));
|
Dependencies.Cache(new OsuConfigManager(LocalStorage));
|
||||||
|
|
||||||
manager.Import(TestResources.GetTestBeatmapForImport()).Wait();
|
manager.Import(TestResources.GetTestBeatmapForImport()).Wait();
|
||||||
|
@ -1,145 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using osu.Framework.Audio.Sample;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Skinning;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
|
||||||
{
|
|
||||||
public class TestSceneSkinReloadable : OsuTestScene
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void TestInitialLoad()
|
|
||||||
{
|
|
||||||
var secondarySource = new SecondarySource();
|
|
||||||
SkinConsumer consumer = null;
|
|
||||||
|
|
||||||
AddStep("setup layout", () =>
|
|
||||||
{
|
|
||||||
Child = new SkinSourceContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Child = new LocalSkinOverrideContainer(secondarySource)
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Child = consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"), source => true)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox);
|
|
||||||
AddAssert("skinchanged only called once", () => consumer.SkinChangedCount == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestOverride()
|
|
||||||
{
|
|
||||||
var secondarySource = new SecondarySource();
|
|
||||||
|
|
||||||
SkinConsumer consumer = null;
|
|
||||||
Container target = null;
|
|
||||||
|
|
||||||
AddStep("setup layout", () =>
|
|
||||||
{
|
|
||||||
Child = new SkinSourceContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Child = target = new LocalSkinOverrideContainer(secondarySource)
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"), source => true)));
|
|
||||||
AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox);
|
|
||||||
AddAssert("skinchanged only called once", () => consumer.SkinChangedCount == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class NamedBox : Container
|
|
||||||
{
|
|
||||||
public NamedBox(string name)
|
|
||||||
{
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
Colour = Color4.Black,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
},
|
|
||||||
new OsuSpriteText
|
|
||||||
{
|
|
||||||
Font = OsuFont.Default.With(size: 40),
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Text = name
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class SkinConsumer : SkinnableDrawable
|
|
||||||
{
|
|
||||||
public new Drawable Drawable => base.Drawable;
|
|
||||||
public int SkinChangedCount { get; private set; }
|
|
||||||
|
|
||||||
public SkinConsumer(string name, Func<string, Drawable> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true)
|
|
||||||
: base(name, defaultImplementation, allowFallback, restrictSize)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
|
||||||
{
|
|
||||||
base.SkinChanged(skin, allowFallback);
|
|
||||||
SkinChangedCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class BaseSourceBox : NamedBox
|
|
||||||
{
|
|
||||||
public BaseSourceBox()
|
|
||||||
: base("Base Source")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class SecondarySourceBox : NamedBox
|
|
||||||
{
|
|
||||||
public SecondarySourceBox()
|
|
||||||
: base("Secondary Source")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class SecondarySource : ISkin
|
|
||||||
{
|
|
||||||
public Drawable GetDrawableComponent(string componentName) => new SecondarySourceBox();
|
|
||||||
|
|
||||||
public Texture GetTexture(string componentName) => throw new NotImplementedException();
|
|
||||||
|
|
||||||
public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
|
|
||||||
|
|
||||||
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private class SkinSourceContainer : Container, ISkin
|
|
||||||
{
|
|
||||||
public Drawable GetDrawableComponent(string componentName) => new BaseSourceBox();
|
|
||||||
|
|
||||||
public Texture GetTexture(string componentName) => throw new NotImplementedException();
|
|
||||||
|
|
||||||
public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
|
|
||||||
|
|
||||||
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
283
osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableDrawable.cs
Normal file
@ -0,0 +1,283 @@
|
|||||||
|
// 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.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneSkinnableDrawable : OsuTestScene
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestConfineScaleDown()
|
||||||
|
{
|
||||||
|
FillFlowContainer<ExposedSkinnableDrawable> fill = null;
|
||||||
|
|
||||||
|
AddStep("setup layout larger source", () =>
|
||||||
|
{
|
||||||
|
Child = new LocalSkinOverrideContainer(new SizedSource(50))
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = fill = new FillFlowContainer<ExposedSkinnableDrawable>
|
||||||
|
{
|
||||||
|
Size = new Vector2(30),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Spacing = new Vector2(10),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new ExposedSkinnableDrawable("default", _ => new DefaultBox(), _ => true),
|
||||||
|
new ExposedSkinnableDrawable("available", _ => new DefaultBox(), _ => true),
|
||||||
|
new ExposedSkinnableDrawable("available", _ => new DefaultBox(), _ => true, ConfineMode.ScaleToFit),
|
||||||
|
new ExposedSkinnableDrawable("available", _ => new DefaultBox(), _ => true, ConfineMode.NoScaling)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("check sizes", () => fill.Children.Select(c => c.Drawable.DrawWidth).SequenceEqual(new float[] { 30, 30, 30, 50 }));
|
||||||
|
AddStep("adjust scale", () => fill.Scale = new Vector2(2));
|
||||||
|
AddAssert("check sizes unchanged by scale", () => fill.Children.Select(c => c.Drawable.DrawWidth).SequenceEqual(new float[] { 30, 30, 30, 50 }));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestConfineScaleUp()
|
||||||
|
{
|
||||||
|
FillFlowContainer<ExposedSkinnableDrawable> fill = null;
|
||||||
|
|
||||||
|
AddStep("setup layout larger source", () =>
|
||||||
|
{
|
||||||
|
Child = new LocalSkinOverrideContainer(new SizedSource(30))
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = fill = new FillFlowContainer<ExposedSkinnableDrawable>
|
||||||
|
{
|
||||||
|
Size = new Vector2(50),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Spacing = new Vector2(10),
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new ExposedSkinnableDrawable("default", _ => new DefaultBox(), _ => true),
|
||||||
|
new ExposedSkinnableDrawable("available", _ => new DefaultBox(), _ => true),
|
||||||
|
new ExposedSkinnableDrawable("available", _ => new DefaultBox(), _ => true, ConfineMode.ScaleToFit),
|
||||||
|
new ExposedSkinnableDrawable("available", _ => new DefaultBox(), _ => true, ConfineMode.NoScaling)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("check sizes", () => fill.Children.Select(c => c.Drawable.DrawWidth).SequenceEqual(new float[] { 50, 30, 50, 30 }));
|
||||||
|
AddStep("adjust scale", () => fill.Scale = new Vector2(2));
|
||||||
|
AddAssert("check sizes unchanged by scale", () => fill.Children.Select(c => c.Drawable.DrawWidth).SequenceEqual(new float[] { 50, 30, 50, 30 }));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestInitialLoad()
|
||||||
|
{
|
||||||
|
var secondarySource = new SecondarySource();
|
||||||
|
SkinConsumer consumer = null;
|
||||||
|
|
||||||
|
AddStep("setup layout", () =>
|
||||||
|
{
|
||||||
|
Child = new SkinSourceContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = new LocalSkinOverrideContainer(secondarySource)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"), source => true)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox);
|
||||||
|
AddAssert("skinchanged only called once", () => consumer.SkinChangedCount == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOverride()
|
||||||
|
{
|
||||||
|
var secondarySource = new SecondarySource();
|
||||||
|
|
||||||
|
SkinConsumer consumer = null;
|
||||||
|
Container target = null;
|
||||||
|
|
||||||
|
AddStep("setup layout", () =>
|
||||||
|
{
|
||||||
|
Child = new SkinSourceContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = target = new LocalSkinOverrideContainer(secondarySource)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"), source => true)));
|
||||||
|
AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox);
|
||||||
|
AddAssert("skinchanged only called once", () => consumer.SkinChangedCount == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ExposedSkinnableDrawable : SkinnableDrawable
|
||||||
|
{
|
||||||
|
public new Drawable Drawable => base.Drawable;
|
||||||
|
|
||||||
|
public ExposedSkinnableDrawable(string name, Func<string, Drawable> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, ConfineMode confineMode = ConfineMode.ScaleDownToFit)
|
||||||
|
: base(name, defaultImplementation, allowFallback, confineMode)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DefaultBox : DrawWidthBox
|
||||||
|
{
|
||||||
|
public DefaultBox()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DrawWidthBox : Container
|
||||||
|
{
|
||||||
|
private readonly OsuSpriteText text;
|
||||||
|
|
||||||
|
public DrawWidthBox()
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.Gray,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
text = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateAfterChildren()
|
||||||
|
{
|
||||||
|
base.UpdateAfterChildren();
|
||||||
|
text.Text = DrawWidth.ToString(CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class NamedBox : Container
|
||||||
|
{
|
||||||
|
public NamedBox(string name)
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.Black,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.Default.With(size: 40),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Text = name
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SkinConsumer : SkinnableDrawable
|
||||||
|
{
|
||||||
|
public new Drawable Drawable => base.Drawable;
|
||||||
|
public int SkinChangedCount { get; private set; }
|
||||||
|
|
||||||
|
public SkinConsumer(string name, Func<string, Drawable> defaultImplementation, Func<ISkinSource, bool> allowFallback = null)
|
||||||
|
: base(name, defaultImplementation, allowFallback)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||||
|
{
|
||||||
|
base.SkinChanged(skin, allowFallback);
|
||||||
|
SkinChangedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class BaseSourceBox : NamedBox
|
||||||
|
{
|
||||||
|
public BaseSourceBox()
|
||||||
|
: base("Base Source")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SecondarySourceBox : NamedBox
|
||||||
|
{
|
||||||
|
public SecondarySourceBox()
|
||||||
|
: base("Secondary Source")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SizedSource : ISkin
|
||||||
|
{
|
||||||
|
private readonly float size;
|
||||||
|
|
||||||
|
public SizedSource(float size)
|
||||||
|
{
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Drawable GetDrawableComponent(string componentName) =>
|
||||||
|
componentName == "available"
|
||||||
|
? new DrawWidthBox
|
||||||
|
{
|
||||||
|
Colour = Color4.Yellow,
|
||||||
|
Size = new Vector2(size)
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
|
||||||
|
public Texture GetTexture(string componentName) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SecondarySource : ISkin
|
||||||
|
{
|
||||||
|
public Drawable GetDrawableComponent(string componentName) => new SecondarySourceBox();
|
||||||
|
|
||||||
|
public Texture GetTexture(string componentName) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SkinSourceContainer : Container, ISkin
|
||||||
|
{
|
||||||
|
public Drawable GetDrawableComponent(string componentName) => new BaseSourceBox();
|
||||||
|
|
||||||
|
public Texture GetTexture(string componentName) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
69
osu.Game.Tests/Visual/Menus/IntroTestScene.cs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// 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.Shapes;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Screens;
|
||||||
|
using osu.Game.Screens.Menu;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Menus
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public abstract class IntroTestScene : OsuTestScene
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(StartupScreen),
|
||||||
|
typeof(IntroScreen),
|
||||||
|
typeof(OsuScreen),
|
||||||
|
typeof(IntroTestScene),
|
||||||
|
};
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private OsuLogo logo;
|
||||||
|
|
||||||
|
protected IntroTestScene()
|
||||||
|
{
|
||||||
|
Drawable introStack = null;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Depth = float.MaxValue,
|
||||||
|
Colour = Color4.Black,
|
||||||
|
},
|
||||||
|
logo = new OsuLogo
|
||||||
|
{
|
||||||
|
Alpha = 0,
|
||||||
|
RelativePositionAxes = Axes.Both,
|
||||||
|
Depth = float.MinValue,
|
||||||
|
Position = new Vector2(0.5f),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
AddStep("restart sequence", () =>
|
||||||
|
{
|
||||||
|
logo.FinishTransforms();
|
||||||
|
logo.IsTracking = false;
|
||||||
|
|
||||||
|
introStack?.Expire();
|
||||||
|
|
||||||
|
Add(introStack = new OsuScreenStack(CreateScreen())
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract IScreen CreateScreen();
|
||||||
|
}
|
||||||
|
}
|
15
osu.Game.Tests/Visual/Menus/TestSceneIntroCircles.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// 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.Screens;
|
||||||
|
using osu.Game.Screens.Menu;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Menus
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestSceneIntroCircles : IntroTestScene
|
||||||
|
{
|
||||||
|
protected override IScreen CreateScreen() => new IntroCircles();
|
||||||
|
}
|
||||||
|
}
|
@ -1,54 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Timing;
|
|
||||||
using osu.Game.Screens.Menu;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Menus
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class TestSceneIntroSequence : OsuTestScene
|
|
||||||
{
|
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
||||||
{
|
|
||||||
typeof(OsuLogo),
|
|
||||||
};
|
|
||||||
|
|
||||||
public TestSceneIntroSequence()
|
|
||||||
{
|
|
||||||
OsuLogo logo;
|
|
||||||
|
|
||||||
var rateAdjustClock = new StopwatchClock(true);
|
|
||||||
var framedClock = new FramedClock(rateAdjustClock);
|
|
||||||
framedClock.ProcessFrame();
|
|
||||||
|
|
||||||
Add(new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Clock = framedClock,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = Color4.Black,
|
|
||||||
},
|
|
||||||
logo = new OsuLogo
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStep(@"Restart", logo.PlayIntro);
|
|
||||||
AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -35,7 +35,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
private TestChatOverlay chatOverlay;
|
private TestChatOverlay chatOverlay;
|
||||||
private ChannelManager channelManager;
|
private ChannelManager channelManager;
|
||||||
|
|
||||||
private readonly Channel channel1 = new Channel(new User()) { Name = "test1" };
|
private readonly Channel channel1 = new Channel(new User()) { Name = "test really long username" };
|
||||||
private readonly Channel channel2 = new Channel(new User()) { Name = "test2" };
|
private readonly Channel channel2 = new Channel(new User()) { Name = "test2" };
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
|
@ -15,7 +15,6 @@ using osu.Framework.MathUtils;
|
|||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
@ -35,7 +34,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
private WorkingBeatmap defaultBeatmap;
|
private WorkingBeatmap defaultBeatmap;
|
||||||
private DatabaseContextFactory factory;
|
|
||||||
|
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
@ -74,28 +72,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
private TestSongSelect songSelect;
|
private TestSongSelect songSelect;
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
factory.ResetDatabase();
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, AudioManager audio)
|
private void load(GameHost host, AudioManager audio)
|
||||||
{
|
{
|
||||||
factory = new DatabaseContextFactory(LocalStorage);
|
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
||||||
factory.ResetDatabase();
|
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default));
|
||||||
|
|
||||||
using (var usage = factory.Get())
|
|
||||||
usage.Migrate();
|
|
||||||
|
|
||||||
factory.ResetDatabase();
|
|
||||||
|
|
||||||
using (var usage = factory.Get())
|
|
||||||
usage.Migrate();
|
|
||||||
|
|
||||||
Dependencies.Cache(rulesets = new RulesetStore(factory));
|
|
||||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default));
|
|
||||||
|
|
||||||
Beatmap.SetDefault();
|
Beatmap.SetDefault();
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,13 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osu.Game.Tournament.Components;
|
using osu.Game.Tournament.Components;
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
using osu.Game.Tournament.Screens.Ladder.Components;
|
using osu.Game.Tournament.Screens.Ladder.Components;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests.Components
|
namespace osu.Game.Tournament.Tests.Components
|
||||||
{
|
{
|
||||||
public class TestSceneDrawableTournamentMatch : OsuTestScene
|
public class TestSceneDrawableTournamentMatch : TournamentTestScene
|
||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
// 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 NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests
|
namespace osu.Game.Tournament.Tests
|
||||||
{
|
{
|
||||||
public abstract class LadderTestScene : OsuTestScene
|
[TestFixture]
|
||||||
|
public abstract class LadderTestScene : TournamentTestScene
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
||||||
protected LadderInfo Ladder { get; private set; }
|
protected LadderInfo Ladder { get; private set; }
|
||||||
|
@ -2,13 +2,12 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osu.Game.Tournament.Components;
|
using osu.Game.Tournament.Components;
|
||||||
using osu.Game.Tournament.Screens.Gameplay;
|
using osu.Game.Tournament.Screens.Gameplay;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests.Screens
|
namespace osu.Game.Tournament.Tests.Screens
|
||||||
{
|
{
|
||||||
public class TestSceneGameplayScreen : OsuTestScene
|
public class TestSceneGameplayScreen : TournamentTestScene
|
||||||
{
|
{
|
||||||
[Cached]
|
[Cached]
|
||||||
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay();
|
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay();
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osu.Game.Tournament.Screens.Schedule;
|
using osu.Game.Tournament.Screens.Schedule;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests.Screens
|
namespace osu.Game.Tournament.Tests.Screens
|
||||||
{
|
{
|
||||||
public class TestSceneScheduleScreen : OsuTestScene
|
public class TestSceneScheduleScreen : TournamentTestScene
|
||||||
{
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osu.Game.Tournament.Screens.Showcase;
|
using osu.Game.Tournament.Screens.Showcase;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests.Screens
|
namespace osu.Game.Tournament.Tests.Screens
|
||||||
{
|
{
|
||||||
public class TestSceneShowcaseScreen : OsuTestScene
|
public class TestSceneShowcaseScreen : TournamentTestScene
|
||||||
{
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests
|
namespace osu.Game.Tournament.Tests
|
||||||
{
|
{
|
||||||
public class TestSceneTournamentSceneManager : OsuTestScene
|
public class TestSceneTournamentSceneManager : TournamentTestScene
|
||||||
{
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(Storage storage)
|
private void load(Storage storage)
|
||||||
|
28
osu.Game.Tournament.Tests/TournamentTestScene.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.Testing;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Tournament.Tests
|
||||||
|
{
|
||||||
|
public abstract class TournamentTestScene : OsuTestScene
|
||||||
|
{
|
||||||
|
protected override ITestSceneTestRunner CreateRunner() => new TournamentTestSceneTestRunner();
|
||||||
|
|
||||||
|
public class TournamentTestSceneTestRunner : TournamentGameBase, ITestSceneTestRunner
|
||||||
|
{
|
||||||
|
private TestSceneTestRunner.TestRunner runner;
|
||||||
|
|
||||||
|
protected override void LoadAsyncComplete()
|
||||||
|
{
|
||||||
|
// this has to be run here rather than LoadComplete because
|
||||||
|
// TestScene.cs is checking the IsLoaded state (on another thread) and expects
|
||||||
|
// the runner to be loaded at that point.
|
||||||
|
Add(runner = new TestSceneTestRunner.TestRunner());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RunTestBlocking(TestScene test) => runner.RunTestBlocking(test);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,15 +9,20 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Tournament.IPC;
|
using osu.Game.Tournament.IPC;
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
|
using osuTK.Graphics;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tournament
|
namespace osu.Game.Tournament
|
||||||
@ -35,6 +40,8 @@ namespace osu.Game.Tournament
|
|||||||
private Bindable<Size> windowSize;
|
private Bindable<Size> windowSize;
|
||||||
private FileBasedIPC ipc;
|
private FileBasedIPC ipc;
|
||||||
|
|
||||||
|
private Drawable heightWarning;
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
{
|
{
|
||||||
return dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
return dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
@ -53,6 +60,12 @@ namespace osu.Game.Tournament
|
|||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
|
|
||||||
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
|
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
|
||||||
|
windowSize.BindValueChanged(size => ScheduleAfterChildren(() =>
|
||||||
|
{
|
||||||
|
var minWidth = (int)(size.NewValue.Height / 9f * 16 + 400);
|
||||||
|
|
||||||
|
heightWarning.Alpha = size.NewValue.Width < minWidth ? 1 : 0;
|
||||||
|
}), true);
|
||||||
|
|
||||||
readBracket();
|
readBracket();
|
||||||
|
|
||||||
@ -61,16 +74,43 @@ namespace osu.Game.Tournament
|
|||||||
dependencies.CacheAs<MatchIPCInfo>(ipc = new FileBasedIPC());
|
dependencies.CacheAs<MatchIPCInfo>(ipc = new FileBasedIPC());
|
||||||
Add(ipc);
|
Add(ipc);
|
||||||
|
|
||||||
Add(new OsuButton
|
AddRange(new[]
|
||||||
{
|
{
|
||||||
Text = "Save Changes",
|
new OsuButton
|
||||||
Width = 140,
|
{
|
||||||
Height = 50,
|
Text = "Save Changes",
|
||||||
Depth = float.MinValue,
|
Width = 140,
|
||||||
Anchor = Anchor.BottomRight,
|
Height = 50,
|
||||||
Origin = Anchor.BottomRight,
|
Depth = float.MinValue,
|
||||||
Padding = new MarginPadding(10),
|
Anchor = Anchor.BottomRight,
|
||||||
Action = SaveChanges,
|
Origin = Anchor.BottomRight,
|
||||||
|
Padding = new MarginPadding(10),
|
||||||
|
Action = SaveChanges,
|
||||||
|
},
|
||||||
|
heightWarning = new Container
|
||||||
|
{
|
||||||
|
Masking = true,
|
||||||
|
CornerRadius = 5,
|
||||||
|
Depth = float.MinValue,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.Red,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new SpriteText
|
||||||
|
{
|
||||||
|
Text = "Please make the window wider",
|
||||||
|
Font = OsuFont.Default.With(weight: "bold"),
|
||||||
|
Colour = Color4.White,
|
||||||
|
Padding = new MarginPadding(20)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,18 +235,6 @@ namespace osu.Game.Tournament
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
var minWidth = (int)(windowSize.Value.Height / 9f * 16 + 400);
|
|
||||||
|
|
||||||
if (windowSize.Value.Width < minWidth)
|
|
||||||
{
|
|
||||||
// todo: can be removed after ppy/osu-framework#1975
|
|
||||||
windowSize.Value = Host.Window.ClientSize = new Size(minWidth, windowSize.Value.Height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void SaveChanges()
|
protected virtual void SaveChanges()
|
||||||
{
|
{
|
||||||
foreach (var r in ladder.Rounds)
|
foreach (var r in ladder.Rounds)
|
||||||
|
@ -253,7 +253,7 @@ namespace osu.Game.Database
|
|||||||
using (Stream s = reader.GetStream(file))
|
using (Stream s = reader.GetStream(file))
|
||||||
s.CopyTo(hashable);
|
s.CopyTo(hashable);
|
||||||
|
|
||||||
return hashable.ComputeSHA2Hash();
|
return hashable.Length > 0 ? hashable.ComputeSHA2Hash() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -27,11 +27,12 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
private bool shouldPerformRightMouseScroll(MouseButtonEvent e) => RightMouseScrollbar && e.Button == MouseButton.Right;
|
private bool shouldPerformRightMouseScroll(MouseButtonEvent e) => RightMouseScrollbar && e.Button == MouseButton.Right;
|
||||||
|
|
||||||
private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar);
|
private void scrollFromMouseEvent(MouseEvent e) =>
|
||||||
|
ScrollTo(Clamp(ToLocalSpace(e.ScreenSpaceMousePosition)[ScrollDim] / DrawSize[ScrollDim]) * Content.DrawSize[ScrollDim], true, DistanceDecayOnRightMouseScrollbar);
|
||||||
|
|
||||||
private bool mouseScrollBarDragging;
|
private bool rightMouseDragging;
|
||||||
|
|
||||||
protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging;
|
protected override bool IsDragging => base.IsDragging || rightMouseDragging;
|
||||||
|
|
||||||
public OsuScrollContainer(Direction scrollDirection = Direction.Vertical)
|
public OsuScrollContainer(Direction scrollDirection = Direction.Vertical)
|
||||||
: base(scrollDirection)
|
: base(scrollDirection)
|
||||||
@ -42,7 +43,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
if (shouldPerformRightMouseScroll(e))
|
if (shouldPerformRightMouseScroll(e))
|
||||||
{
|
{
|
||||||
scrollToRelative(e.MousePosition[ScrollDim]);
|
scrollFromMouseEvent(e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,9 +52,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override bool OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
if (mouseScrollBarDragging)
|
if (rightMouseDragging)
|
||||||
{
|
{
|
||||||
scrollToRelative(e.MousePosition[ScrollDim]);
|
scrollFromMouseEvent(e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
if (shouldPerformRightMouseScroll(e))
|
if (shouldPerformRightMouseScroll(e))
|
||||||
{
|
{
|
||||||
mouseScrollBarDragging = true;
|
rightMouseDragging = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,9 +74,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override bool OnDragEnd(DragEndEvent e)
|
protected override bool OnDragEnd(DragEndEvent e)
|
||||||
{
|
{
|
||||||
if (mouseScrollBarDragging)
|
if (rightMouseDragging)
|
||||||
{
|
{
|
||||||
mouseScrollBarDragging = false;
|
rightMouseDragging = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,8 @@ namespace osu.Game
|
|||||||
private BackButton backButton;
|
private BackButton backButton;
|
||||||
|
|
||||||
private MainMenu menuScreen;
|
private MainMenu menuScreen;
|
||||||
private Intro introScreen;
|
|
||||||
|
private IntroScreen introScreen;
|
||||||
|
|
||||||
private Bindable<int> configRuleset;
|
private Bindable<int> configRuleset;
|
||||||
|
|
||||||
@ -264,7 +265,16 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
// The given ScoreInfo may have missing properties if it was retrieved from online data. Re-retrieve it from the database
|
// The given ScoreInfo may have missing properties if it was retrieved from online data. Re-retrieve it from the database
|
||||||
// to ensure all the required data for presenting a replay are present.
|
// to ensure all the required data for presenting a replay are present.
|
||||||
var databasedScoreInfo = ScoreManager.Query(s => s.OnlineScoreID == score.OnlineScoreID);
|
var databasedScoreInfo = score.OnlineScoreID != null
|
||||||
|
? ScoreManager.Query(s => s.OnlineScoreID == score.OnlineScoreID)
|
||||||
|
: ScoreManager.Query(s => s.Hash == score.Hash);
|
||||||
|
|
||||||
|
if (databasedScoreInfo == null)
|
||||||
|
{
|
||||||
|
Logger.Log("The requested score could not be found locally.", LoggingTarget.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var databasedScore = ScoreManager.GetScore(databasedScoreInfo);
|
var databasedScore = ScoreManager.GetScore(databasedScoreInfo);
|
||||||
|
|
||||||
if (databasedScore.Replay == null)
|
if (databasedScore.Replay == null)
|
||||||
@ -761,7 +771,7 @@ namespace osu.Game
|
|||||||
if (introScreen == null)
|
if (introScreen == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!introScreen.DidLoadMenu || !(screenStack.CurrentScreen is Intro))
|
if (!introScreen.DidLoadMenu || !(screenStack.CurrentScreen is IntroScreen))
|
||||||
{
|
{
|
||||||
Scheduler.Add(introScreen.MakeCurrent);
|
Scheduler.Add(introScreen.MakeCurrent);
|
||||||
return true;
|
return true;
|
||||||
@ -796,7 +806,7 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
switch (newScreen)
|
switch (newScreen)
|
||||||
{
|
{
|
||||||
case Intro intro:
|
case IntroScreen intro:
|
||||||
introScreen = intro;
|
introScreen = intro;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
|
|
||||||
public override bool IsSwitchable => false;
|
public override bool IsSwitchable => false;
|
||||||
|
|
||||||
|
protected override bool IsBoldWhenActive => false;
|
||||||
|
|
||||||
public ChannelSelectorTabItem()
|
public ChannelSelectorTabItem()
|
||||||
: base(new ChannelSelectorTabChannel())
|
: base(new ChannelSelectorTabChannel())
|
||||||
{
|
{
|
||||||
@ -22,7 +24,7 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
Icon.Alpha = 0;
|
Icon.Alpha = 0;
|
||||||
|
|
||||||
Text.Font = Text.Font.With(size: 45);
|
Text.Font = Text.Font.With(size: 45);
|
||||||
TextBold.Font = Text.Font.With(size: 45);
|
Text.Truncate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -29,7 +29,6 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
public override bool IsRemovable => !Pinned;
|
public override bool IsRemovable => !Pinned;
|
||||||
|
|
||||||
protected readonly SpriteText Text;
|
protected readonly SpriteText Text;
|
||||||
protected readonly SpriteText TextBold;
|
|
||||||
protected readonly ClickableContainer CloseButton;
|
protected readonly ClickableContainer CloseButton;
|
||||||
private readonly Box box;
|
private readonly Box box;
|
||||||
private readonly Box highlightBox;
|
private readonly Box highlightBox;
|
||||||
@ -88,20 +87,17 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
},
|
},
|
||||||
Text = new OsuSpriteText
|
Text = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding(5),
|
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Text = value.ToString(),
|
Text = value.ToString(),
|
||||||
Font = OsuFont.GetFont(size: 18)
|
Font = OsuFont.GetFont(size: 18),
|
||||||
},
|
Padding = new MarginPadding(5)
|
||||||
TextBold = new OsuSpriteText
|
{
|
||||||
{
|
Left = LeftTextPadding,
|
||||||
Alpha = 0,
|
Right = RightTextPadding,
|
||||||
Margin = new MarginPadding(5),
|
},
|
||||||
Origin = Anchor.CentreLeft,
|
RelativeSizeAxes = Axes.X,
|
||||||
Anchor = Anchor.CentreLeft,
|
Truncate = true,
|
||||||
Text = value.ToString(),
|
|
||||||
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold)
|
|
||||||
},
|
},
|
||||||
CloseButton = new TabCloseButton
|
CloseButton = new TabCloseButton
|
||||||
{
|
{
|
||||||
@ -119,10 +115,16 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual float LeftTextPadding => 5;
|
||||||
|
|
||||||
|
protected virtual float RightTextPadding => IsRemovable ? 40 : 5;
|
||||||
|
|
||||||
protected virtual IconUsage DisplayIcon => FontAwesome.Solid.Hashtag;
|
protected virtual IconUsage DisplayIcon => FontAwesome.Solid.Hashtag;
|
||||||
|
|
||||||
protected virtual bool ShowCloseOnHover => true;
|
protected virtual bool ShowCloseOnHover => true;
|
||||||
|
|
||||||
|
protected virtual bool IsBoldWhenActive => true;
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
if (IsRemovable && ShowCloseOnHover)
|
if (IsRemovable && ShowCloseOnHover)
|
||||||
@ -203,8 +205,7 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
box.FadeColour(BackgroundActive, TRANSITION_LENGTH, Easing.OutQuint);
|
box.FadeColour(BackgroundActive, TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
highlightBox.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
|
highlightBox.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
|
|
||||||
Text.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
|
if (IsBoldWhenActive) Text.Font = Text.Font.With(weight: FontWeight.Bold);
|
||||||
TextBold.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void FadeInactive()
|
protected virtual void FadeInactive()
|
||||||
@ -216,8 +217,7 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
box.FadeColour(BackgroundInactive, TRANSITION_LENGTH, Easing.OutQuint);
|
box.FadeColour(BackgroundInactive, TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
highlightBox.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
|
highlightBox.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
|
|
||||||
Text.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
|
Text.Font = Text.Font.With(weight: FontWeight.Medium);
|
||||||
TextBold.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnActivated() => updateState();
|
protected override void OnActivated() => updateState();
|
||||||
|
@ -62,11 +62,10 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
});
|
});
|
||||||
|
|
||||||
avatar.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint);
|
avatar.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint);
|
||||||
|
|
||||||
Text.X = ChatOverlay.TAB_AREA_HEIGHT;
|
|
||||||
TextBold.X = ChatOverlay.TAB_AREA_HEIGHT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override float LeftTextPadding => base.LeftTextPadding + ChatOverlay.TAB_AREA_HEIGHT;
|
||||||
|
|
||||||
protected override bool ShowCloseOnHover => false;
|
protected override bool ShowCloseOnHover => false;
|
||||||
|
|
||||||
protected override void FadeActive()
|
protected override void FadeActive()
|
||||||
|
@ -53,6 +53,6 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
User.BindValueChanged(user => updateFollowers(user.NewValue), true);
|
User.BindValueChanged(user => updateFollowers(user.NewValue), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFollowers(User user) => followerText.Text = user?.FollowerCount?.Length > 0 ? user.FollowerCount[0].ToString("#,##0") : "0";
|
private void updateFollowers(User user) => followerText.Text = user?.FollowerCount.ToString("#,##0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,6 @@ namespace osu.Game.Overlays.Settings.Sections.Debug
|
|||||||
Bindable = frameworkConfig.GetBindable<bool>(FrameworkSetting.PerformanceLogging)
|
Bindable = frameworkConfig.GetBindable<bool>(FrameworkSetting.PerformanceLogging)
|
||||||
},
|
},
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
|
||||||
LabelText = "Bypass caching (slow)",
|
|
||||||
Bindable = config.GetBindable<bool>(DebugSetting.BypassCaching)
|
|
||||||
},
|
|
||||||
new SettingsCheckbox
|
|
||||||
{
|
{
|
||||||
LabelText = "Bypass front-to-back render pass",
|
LabelText = "Bypass front-to-back render pass",
|
||||||
Bindable = config.GetBindable<bool>(DebugSetting.BypassFrontToBackPass)
|
Bindable = config.GetBindable<bool>(DebugSetting.BypassFrontToBackPass)
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Platform;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections.Debug
|
namespace osu.Game.Overlays.Settings.Sections.Debug
|
||||||
{
|
{
|
||||||
public class GCSettings : SettingsSubsection
|
public class MemorySettings : SettingsSubsection
|
||||||
{
|
{
|
||||||
protected override string Header => "Garbage Collector";
|
protected override string Header => "Memory";
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(FrameworkDebugConfigManager config)
|
private void load(FrameworkDebugConfigManager config, GameHost host)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SettingsButton
|
new SettingsButton
|
||||||
{
|
{
|
||||||
Text = "Force garbage collection",
|
Text = "Clear all caches",
|
||||||
Action = GC.Collect
|
Action = host.Collect
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new GeneralSettings(),
|
new GeneralSettings(),
|
||||||
new GCSettings(),
|
new MemorySettings(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,8 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
private class SkinDropdownControl : DropdownControl
|
private class SkinDropdownControl : DropdownControl
|
||||||
{
|
{
|
||||||
protected override string GenerateItemText(SkinInfo item) => item.ToString();
|
protected override string GenerateItemText(SkinInfo item) => item.ToString();
|
||||||
|
|
||||||
|
protected override DropdownMenu CreateMenu() => base.CreateMenu().With(m => m.MaxHeight = 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Judgements
|
|||||||
Font = OsuFont.Numeric.With(size: 12),
|
Font = OsuFont.Numeric.With(size: 12),
|
||||||
Colour = judgementColour(Result.Type),
|
Colour = judgementColour(Result.Type),
|
||||||
Scale = new Vector2(0.85f, 1),
|
Scale = new Vector2(0.85f, 1),
|
||||||
}, restrictSize: false)
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Drawables
|
namespace osu.Game.Rulesets.Objects.Drawables
|
||||||
{
|
{
|
||||||
|
[Cached(typeof(DrawableHitObject))]
|
||||||
public abstract class DrawableHitObject : SkinReloadableDrawable
|
public abstract class DrawableHitObject : SkinReloadableDrawable
|
||||||
{
|
{
|
||||||
public readonly HitObject HitObject;
|
public readonly HitObject HitObject;
|
||||||
|
@ -80,6 +80,9 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
else if (version >= 20121008)
|
else if (version >= 20121008)
|
||||||
scoreInfo.OnlineScoreID = sr.ReadInt32();
|
scoreInfo.OnlineScoreID = sr.ReadInt32();
|
||||||
|
|
||||||
|
if (scoreInfo.OnlineScoreID <= 0)
|
||||||
|
scoreInfo.OnlineScoreID = null;
|
||||||
|
|
||||||
if (compressedReplay?.Length > 0)
|
if (compressedReplay?.Length > 0)
|
||||||
{
|
{
|
||||||
using (var replayInStream = new MemoryStream(compressedReplay))
|
using (var replayInStream = new MemoryStream(compressedReplay))
|
||||||
|
@ -45,7 +45,15 @@ namespace osu.Game.Screens
|
|||||||
private OsuScreen loadableScreen;
|
private OsuScreen loadableScreen;
|
||||||
private ShaderPrecompiler precompiler;
|
private ShaderPrecompiler precompiler;
|
||||||
|
|
||||||
protected virtual OsuScreen CreateLoadableScreen() => showDisclaimer ? (OsuScreen)new Disclaimer() : new Intro();
|
protected virtual OsuScreen CreateLoadableScreen()
|
||||||
|
{
|
||||||
|
if (showDisclaimer)
|
||||||
|
return new Disclaimer(getIntroSequence());
|
||||||
|
|
||||||
|
return getIntroSequence();
|
||||||
|
}
|
||||||
|
|
||||||
|
private IntroScreen getIntroSequence() => new IntroCircles();
|
||||||
|
|
||||||
protected virtual ShaderPrecompiler CreateShaderPrecompiler() => new ShaderPrecompiler();
|
protected virtual ShaderPrecompiler CreateShaderPrecompiler() => new ShaderPrecompiler();
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
public class Disclaimer : StartupScreen
|
public class Disclaimer : StartupScreen
|
||||||
{
|
{
|
||||||
private Intro intro;
|
|
||||||
private SpriteIcon icon;
|
private SpriteIcon icon;
|
||||||
private Color4 iconColour;
|
private Color4 iconColour;
|
||||||
private LinkFlowContainer textFlow;
|
private LinkFlowContainer textFlow;
|
||||||
@ -32,10 +31,13 @@ namespace osu.Game.Screens.Menu
|
|||||||
private const float icon_y = -85;
|
private const float icon_y = -85;
|
||||||
private const float icon_size = 30;
|
private const float icon_size = 30;
|
||||||
|
|
||||||
|
private readonly OsuScreen nextScreen;
|
||||||
|
|
||||||
private readonly Bindable<User> currentUser = new Bindable<User>();
|
private readonly Bindable<User> currentUser = new Bindable<User>();
|
||||||
|
|
||||||
public Disclaimer()
|
public Disclaimer(OsuScreen nextScreen = null)
|
||||||
{
|
{
|
||||||
|
this.nextScreen = nextScreen;
|
||||||
ValidForResume = false;
|
ValidForResume = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +148,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
LoadComponentAsync(intro = new Intro());
|
if (nextScreen != null)
|
||||||
|
LoadComponentAsync(nextScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEntering(IScreen last)
|
public override void OnEntering(IScreen last)
|
||||||
@ -170,7 +173,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
.Then(5500)
|
.Then(5500)
|
||||||
.FadeOut(250)
|
.FadeOut(250)
|
||||||
.ScaleTo(0.9f, 250, Easing.InQuint)
|
.ScaleTo(0.9f, 250, Easing.InQuint)
|
||||||
.Finally(d => this.Push(intro));
|
.Finally(d => this.Push(nextScreen));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -12,41 +11,24 @@ using osu.Framework.MathUtils;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.IO.Archives;
|
using osu.Game.IO.Archives;
|
||||||
using osu.Game.Screens.Backgrounds;
|
|
||||||
using osuTK;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Menu
|
namespace osu.Game.Screens.Menu
|
||||||
{
|
{
|
||||||
public class Intro : StartupScreen
|
public class IntroCircles : IntroScreen
|
||||||
{
|
{
|
||||||
private const string menu_music_beatmap_hash = "3c8b1fcc9434dbb29e2fb613d3b9eada9d7bb6c125ceb32396c3b53437280c83";
|
private const string menu_music_beatmap_hash = "3c8b1fcc9434dbb29e2fb613d3b9eada9d7bb6c125ceb32396c3b53437280c83";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether we have loaded the menu previously.
|
|
||||||
/// </summary>
|
|
||||||
public bool DidLoadMenu;
|
|
||||||
|
|
||||||
private MainMenu mainMenu;
|
|
||||||
private SampleChannel welcome;
|
private SampleChannel welcome;
|
||||||
private SampleChannel seeya;
|
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
|
|
||||||
|
|
||||||
private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
|
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private AudioManager audio { get; set; }
|
|
||||||
|
|
||||||
private Bindable<bool> menuVoice;
|
|
||||||
private Bindable<bool> menuMusic;
|
private Bindable<bool> menuMusic;
|
||||||
|
|
||||||
private Track track;
|
private Track track;
|
||||||
|
|
||||||
private WorkingBeatmap introBeatmap;
|
private WorkingBeatmap introBeatmap;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
|
private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, ISampleStore samples)
|
||||||
{
|
{
|
||||||
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
|
||||||
menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
||||||
|
|
||||||
BeatmapSetInfo setInfo = null;
|
BeatmapSetInfo setInfo = null;
|
||||||
@ -75,15 +57,13 @@ namespace osu.Game.Screens.Menu
|
|||||||
introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
||||||
track = introBeatmap.Track;
|
track = introBeatmap.Track;
|
||||||
|
|
||||||
welcome = audio.Samples.Get(@"welcome");
|
if (config.Get<bool>(OsuSetting.MenuVoice))
|
||||||
seeya = audio.Samples.Get(@"seeya");
|
welcome = samples.Get(@"welcome");
|
||||||
}
|
}
|
||||||
|
|
||||||
private const double delay_step_one = 2300;
|
private const double delay_step_one = 2300;
|
||||||
private const double delay_step_two = 600;
|
private const double delay_step_two = 600;
|
||||||
|
|
||||||
public const int EXIT_DELAY = 3000;
|
|
||||||
|
|
||||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
{
|
{
|
||||||
base.LogoArriving(logo, resuming);
|
base.LogoArriving(logo, resuming);
|
||||||
@ -93,86 +73,34 @@ namespace osu.Game.Screens.Menu
|
|||||||
Beatmap.Value = introBeatmap;
|
Beatmap.Value = introBeatmap;
|
||||||
introBeatmap = null;
|
introBeatmap = null;
|
||||||
|
|
||||||
if (menuVoice.Value)
|
welcome?.Play();
|
||||||
welcome.Play();
|
|
||||||
|
|
||||||
Scheduler.AddDelayed(delegate
|
Scheduler.AddDelayed(delegate
|
||||||
{
|
{
|
||||||
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Manu.
|
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Manu.
|
||||||
if (menuMusic.Value)
|
if (menuMusic.Value)
|
||||||
{
|
{
|
||||||
track.Start();
|
track.Restart();
|
||||||
track = null;
|
track = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadComponentAsync(mainMenu = new MainMenu());
|
PrepareMenuLoad();
|
||||||
|
|
||||||
Scheduler.AddDelayed(delegate
|
Scheduler.AddDelayed(LoadMenu, delay_step_one);
|
||||||
{
|
|
||||||
DidLoadMenu = true;
|
|
||||||
this.Push(mainMenu);
|
|
||||||
}, delay_step_one);
|
|
||||||
}, delay_step_two);
|
}, delay_step_two);
|
||||||
}
|
|
||||||
|
|
||||||
logo.Colour = Color4.White;
|
|
||||||
logo.Ripple = false;
|
|
||||||
|
|
||||||
const int quick_appear = 350;
|
|
||||||
|
|
||||||
int initialMovementTime = logo.Alpha > 0.2f ? quick_appear : 0;
|
|
||||||
|
|
||||||
logo.MoveTo(new Vector2(0.5f), initialMovementTime, Easing.OutQuint);
|
|
||||||
|
|
||||||
if (!resuming)
|
|
||||||
{
|
|
||||||
logo.ScaleTo(1);
|
logo.ScaleTo(1);
|
||||||
logo.FadeIn();
|
logo.FadeIn();
|
||||||
logo.PlayIntro();
|
logo.PlayIntro();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
logo.Triangles = false;
|
|
||||||
|
|
||||||
logo
|
|
||||||
.ScaleTo(1, initialMovementTime, Easing.OutQuint)
|
|
||||||
.FadeIn(quick_appear, Easing.OutQuint)
|
|
||||||
.Then()
|
|
||||||
.RotateTo(20, EXIT_DELAY * 1.5f)
|
|
||||||
.FadeOut(EXIT_DELAY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSuspending(IScreen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
|
track = null;
|
||||||
|
|
||||||
this.FadeOut(300);
|
this.FadeOut(300);
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
|
||||||
{
|
|
||||||
//cancel exiting if we haven't loaded the menu yet.
|
|
||||||
return !DidLoadMenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnResuming(IScreen last)
|
|
||||||
{
|
|
||||||
this.FadeIn(300);
|
|
||||||
|
|
||||||
double fadeOutTime = EXIT_DELAY;
|
|
||||||
//we also handle the exit transition.
|
|
||||||
if (menuVoice.Value)
|
|
||||||
seeya.Play();
|
|
||||||
else
|
|
||||||
fadeOutTime = 500;
|
|
||||||
|
|
||||||
audio.AddAdjustment(AdjustableProperty.Volume, exitingVolumeFade);
|
|
||||||
this.TransformBindableTo(exitingVolumeFade, 0, fadeOutTime).OnComplete(_ => this.Exit());
|
|
||||||
|
|
||||||
//don't want to fade out completely else we will stop running updates.
|
|
||||||
Game.FadeTo(0.01f, fadeOutTime);
|
|
||||||
|
|
||||||
base.OnResuming(last);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
114
osu.Game/Screens/Menu/IntroScreen.cs
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
// 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.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Screens.Backgrounds;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Menu
|
||||||
|
{
|
||||||
|
public abstract class IntroScreen : StartupScreen
|
||||||
|
{
|
||||||
|
private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
|
||||||
|
|
||||||
|
public const int EXIT_DELAY = 3000;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private AudioManager audio { get; set; }
|
||||||
|
|
||||||
|
private SampleChannel seeya;
|
||||||
|
|
||||||
|
private Bindable<bool> menuVoice;
|
||||||
|
|
||||||
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
|
||||||
|
{
|
||||||
|
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
||||||
|
seeya = audio.Samples.Get(@"seeya");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether we have loaded the menu previously.
|
||||||
|
/// </summary>
|
||||||
|
public bool DidLoadMenu { get; private set; }
|
||||||
|
|
||||||
|
public override bool OnExiting(IScreen next)
|
||||||
|
{
|
||||||
|
//cancel exiting if we haven't loaded the menu yet.
|
||||||
|
return !DidLoadMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnResuming(IScreen last)
|
||||||
|
{
|
||||||
|
this.FadeIn(300);
|
||||||
|
|
||||||
|
double fadeOutTime = EXIT_DELAY;
|
||||||
|
//we also handle the exit transition.
|
||||||
|
if (menuVoice.Value)
|
||||||
|
seeya.Play();
|
||||||
|
else
|
||||||
|
fadeOutTime = 500;
|
||||||
|
|
||||||
|
audio.AddAdjustment(AdjustableProperty.Volume, exitingVolumeFade);
|
||||||
|
this.TransformBindableTo(exitingVolumeFade, 0, fadeOutTime).OnComplete(_ => this.Exit());
|
||||||
|
|
||||||
|
//don't want to fade out completely else we will stop running updates.
|
||||||
|
Game.FadeTo(0.01f, fadeOutTime);
|
||||||
|
|
||||||
|
base.OnResuming(last);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
|
{
|
||||||
|
base.LogoArriving(logo, resuming);
|
||||||
|
|
||||||
|
logo.Colour = Color4.White;
|
||||||
|
logo.Triangles = false;
|
||||||
|
logo.Ripple = false;
|
||||||
|
|
||||||
|
if (!resuming)
|
||||||
|
{
|
||||||
|
logo.MoveTo(new Vector2(0.5f));
|
||||||
|
logo.ScaleTo(Vector2.One);
|
||||||
|
logo.Hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const int quick_appear = 350;
|
||||||
|
int initialMovementTime = logo.Alpha > 0.2f ? quick_appear : 0;
|
||||||
|
|
||||||
|
logo.MoveTo(new Vector2(0.5f), initialMovementTime, Easing.OutQuint);
|
||||||
|
|
||||||
|
logo
|
||||||
|
.ScaleTo(1, initialMovementTime, Easing.OutQuint)
|
||||||
|
.FadeIn(quick_appear, Easing.OutQuint)
|
||||||
|
.Then()
|
||||||
|
.RotateTo(20, EXIT_DELAY * 1.5f)
|
||||||
|
.FadeOut(EXIT_DELAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private MainMenu mainMenu;
|
||||||
|
|
||||||
|
protected void PrepareMenuLoad()
|
||||||
|
{
|
||||||
|
LoadComponentAsync(mainMenu = new MainMenu());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void LoadMenu()
|
||||||
|
{
|
||||||
|
DidLoadMenu = true;
|
||||||
|
this.Push(mainMenu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -123,7 +123,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
var track = Beatmap.Value.Track;
|
var track = Beatmap.Value.Track;
|
||||||
var metadata = Beatmap.Value.Metadata;
|
var metadata = Beatmap.Value.Metadata;
|
||||||
|
|
||||||
if (last is Intro && track != null)
|
if (last is IntroScreen && track != null)
|
||||||
{
|
{
|
||||||
if (!track.IsRunning)
|
if (!track.IsRunning)
|
||||||
{
|
{
|
||||||
|
@ -212,7 +212,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
if (!(screenStack.CurrentScreen is LoungeSubScreen))
|
if (screenStack.CurrentScreen != null && !(screenStack.CurrentScreen is LoungeSubScreen))
|
||||||
{
|
{
|
||||||
screenStack.Exit();
|
screenStack.Exit();
|
||||||
return true;
|
return true;
|
||||||
|
@ -141,6 +141,7 @@ namespace osu.Game.Screens.Select
|
|||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
|
|
||||||
public BufferedWedgeInfo(WorkingBeatmap beatmap, RulesetInfo userRuleset)
|
public BufferedWedgeInfo(WorkingBeatmap beatmap, RulesetInfo userRuleset)
|
||||||
|
: base(pixelSnapping: true)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
ruleset = userRuleset ?? beatmap.BeatmapInfo.Ruleset;
|
ruleset = userRuleset ?? beatmap.BeatmapInfo.Ruleset;
|
||||||
@ -152,7 +153,6 @@ namespace osu.Game.Screens.Select
|
|||||||
var beatmapInfo = beatmap.BeatmapInfo;
|
var beatmapInfo = beatmap.BeatmapInfo;
|
||||||
var metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
var metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
||||||
|
|
||||||
PixelSnapping = true;
|
|
||||||
CacheDrawnFrameBuffer = true;
|
CacheDrawnFrameBuffer = true;
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
@ -6,16 +6,23 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
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.Animations;
|
using osu.Framework.Graphics.Animations;
|
||||||
|
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 osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
@ -25,11 +32,20 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
protected IResourceStore<SampleChannel> Samples;
|
protected IResourceStore<SampleChannel> Samples;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// On osu-stable, hitcircles have 5 pixels of transparent padding on each side to allow for shadows etc.
|
||||||
|
/// Their hittable area is 128px, but the actual circle portion is 118px.
|
||||||
|
/// We must account for some gameplay elements such as slider bodies, where this padding is not present.
|
||||||
|
/// </summary>
|
||||||
|
private const float legacy_circle_radius = 64 - 5;
|
||||||
|
|
||||||
public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager)
|
public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager)
|
||||||
: this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini")
|
: this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly bool hasHitCircle;
|
||||||
|
|
||||||
protected LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager, string filename)
|
protected LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager, string filename)
|
||||||
: base(skin)
|
: base(skin)
|
||||||
{
|
{
|
||||||
@ -42,6 +58,14 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
Samples = audioManager.GetSampleStore(storage);
|
Samples = audioManager.GetSampleStore(storage);
|
||||||
Textures = new TextureStore(new TextureLoaderStore(storage));
|
Textures = new TextureStore(new TextureLoaderStore(storage));
|
||||||
|
|
||||||
|
using (var testStream = storage.GetStream("hitcircle"))
|
||||||
|
hasHitCircle |= testStream != null;
|
||||||
|
|
||||||
|
if (hasHitCircle)
|
||||||
|
{
|
||||||
|
Configuration.SliderPathRadius = legacy_circle_radius;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
@ -59,6 +83,24 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
switch (componentName)
|
switch (componentName)
|
||||||
{
|
{
|
||||||
|
case "Play/osu/cursor":
|
||||||
|
if (GetTexture("cursor") != null)
|
||||||
|
return new LegacyCursor();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
case "Play/osu/sliderball":
|
||||||
|
if (GetTexture("sliderb") != null)
|
||||||
|
return new LegacySliderBall();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
case "Play/osu/hitcircle":
|
||||||
|
if (hasHitCircle)
|
||||||
|
return new LegacyMainCirclePiece();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
case "Play/Miss":
|
case "Play/Miss":
|
||||||
componentName = "hit0";
|
componentName = "hit0";
|
||||||
animatable = true;
|
animatable = true;
|
||||||
@ -120,10 +162,19 @@ namespace osu.Game.Skinning
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class LegacySliderBall : Sprite
|
||||||
|
{
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(ISkinSource skin)
|
||||||
|
{
|
||||||
|
Texture = skin.GetTexture("sliderb");
|
||||||
|
Colour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? Color4.White;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Texture GetTexture(string componentName)
|
public override Texture GetTexture(string componentName)
|
||||||
{
|
{
|
||||||
float ratio = 2;
|
float ratio = 2;
|
||||||
|
|
||||||
var texture = Textures.Get($"{componentName}@2x");
|
var texture = Textures.Get($"{componentName}@2x");
|
||||||
|
|
||||||
if (texture == null)
|
if (texture == null)
|
||||||
@ -133,7 +184,7 @@ namespace osu.Game.Skinning
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (texture != null)
|
if (texture != null)
|
||||||
texture.ScaleAdjust = ratio / 0.72f; // brings sizing roughly in-line with stable
|
texture.ScaleAdjust = ratio;
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
@ -243,5 +294,112 @@ namespace osu.Game.Skinning
|
|||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class LegacyCursor : CompositeDrawable
|
||||||
|
{
|
||||||
|
public LegacyCursor()
|
||||||
|
{
|
||||||
|
Size = new Vector2(50);
|
||||||
|
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(ISkinSource skin)
|
||||||
|
{
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new NonPlayfieldSprite
|
||||||
|
{
|
||||||
|
Texture = skin.GetTexture("cursormiddle"),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
new NonPlayfieldSprite
|
||||||
|
{
|
||||||
|
Texture = skin.GetTexture("cursor"),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LegacyMainCirclePiece : CompositeDrawable
|
||||||
|
{
|
||||||
|
public LegacyMainCirclePiece()
|
||||||
|
{
|
||||||
|
Size = new Vector2(128);
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly IBindable<ArmedState> state = new Bindable<ArmedState>();
|
||||||
|
|
||||||
|
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(DrawableHitObject drawableObject, ISkinSource skin)
|
||||||
|
{
|
||||||
|
Sprite hitCircleSprite;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
hitCircleSprite = new Sprite
|
||||||
|
{
|
||||||
|
Texture = skin.GetTexture("hitcircle"),
|
||||||
|
Colour = drawableObject.AccentColour.Value,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
new SkinnableSpriteText("Play/osu/number-text", _ => new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.Numeric.With(size: 40),
|
||||||
|
UseFullGlyphHeight = false,
|
||||||
|
}, confineMode: ConfineMode.NoScaling)
|
||||||
|
{
|
||||||
|
Text = (((IHasComboInformation)drawableObject.HitObject).IndexInCurrentCombo + 1).ToString()
|
||||||
|
},
|
||||||
|
new Sprite
|
||||||
|
{
|
||||||
|
Texture = skin.GetTexture("hitcircleoverlay"),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
state.BindTo(drawableObject.State);
|
||||||
|
state.BindValueChanged(updateState, true);
|
||||||
|
|
||||||
|
accentColour.BindTo(drawableObject.AccentColour);
|
||||||
|
accentColour.BindValueChanged(colour => hitCircleSprite.Colour = colour.NewValue, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateState(ValueChangedEvent<ArmedState> state)
|
||||||
|
{
|
||||||
|
const double legacy_fade_duration = 240;
|
||||||
|
|
||||||
|
switch (state.NewValue)
|
||||||
|
{
|
||||||
|
case ArmedState.Hit:
|
||||||
|
this.FadeOut(legacy_fade_duration, Easing.Out);
|
||||||
|
this.ScaleTo(1.4f, legacy_fade_duration, Easing.Out);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class NonPlayfieldSprite : Sprite
|
||||||
|
{
|
||||||
|
public override Texture Texture
|
||||||
|
{
|
||||||
|
get => base.Texture;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != null)
|
||||||
|
value.ScaleAdjust *= 2f;
|
||||||
|
base.Texture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public float? SliderBorderSize { get; set; }
|
public float? SliderBorderSize { get; set; }
|
||||||
|
|
||||||
|
public float? SliderPathRadius { get; set; }
|
||||||
|
|
||||||
public bool? CursorExpand { get; set; } = true;
|
public bool? CursorExpand { get; set; } = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Skinning
|
|||||||
CurrentSkinInfo.Value = SkinInfo.Default;
|
CurrentSkinInfo.Value = SkinInfo.Default;
|
||||||
};
|
};
|
||||||
|
|
||||||
CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = getSkin(skin.NewValue);
|
CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = GetSkin(skin.NewValue);
|
||||||
CurrentSkin.ValueChanged += skin =>
|
CurrentSkin.ValueChanged += skin =>
|
||||||
{
|
{
|
||||||
if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value)
|
if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value)
|
||||||
@ -80,7 +80,7 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
await base.Populate(model, archive, cancellationToken);
|
await base.Populate(model, archive, cancellationToken);
|
||||||
|
|
||||||
Skin reference = getSkin(model);
|
Skin reference = GetSkin(model);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(reference.Configuration.SkinInfo.Name))
|
if (!string.IsNullOrEmpty(reference.Configuration.SkinInfo.Name))
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ namespace osu.Game.Skinning
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="skinInfo">The skin to lookup.</param>
|
/// <param name="skinInfo">The skin to lookup.</param>
|
||||||
/// <returns>A <see cref="Skin"/> instance correlating to the provided <see cref="SkinInfo"/>.</returns>
|
/// <returns>A <see cref="Skin"/> instance correlating to the provided <see cref="SkinInfo"/>.</returns>
|
||||||
private Skin getSkin(SkinInfo skinInfo)
|
public Skin GetSkin(SkinInfo skinInfo)
|
||||||
{
|
{
|
||||||
if (skinInfo == SkinInfo.Default)
|
if (skinInfo == SkinInfo.Default)
|
||||||
return new DefaultSkin();
|
return new DefaultSkin();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -36,12 +36,15 @@ namespace osu.Game.Skinning
|
|||||||
skin.SourceChanged += onChange;
|
skin.SourceChanged += onChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onChange() => SkinChanged(skin, allowDefaultFallback);
|
private void onChange() =>
|
||||||
|
// schedule required to avoid calls after disposed.
|
||||||
|
// note that this has the side-effect of components only performing a skin change when they are alive.
|
||||||
|
Scheduler.AddOnce(() => SkinChanged(skin, allowDefaultFallback));
|
||||||
|
|
||||||
protected override void LoadAsyncComplete()
|
protected override void LoadAsyncComplete()
|
||||||
{
|
{
|
||||||
base.LoadAsyncComplete();
|
base.LoadAsyncComplete();
|
||||||
onChange();
|
SkinChanged(skin, allowDefaultFallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,35 +1,26 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Caching;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
public class SkinnableDrawable : SkinnableDrawable<Drawable>
|
|
||||||
{
|
|
||||||
public SkinnableDrawable(string name, Func<string, Drawable> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true)
|
|
||||||
: base(name, defaultImplementation, allowFallback, restrictSize)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A drawable which can be skinned via an <see cref="ISkinSource"/>.
|
/// A drawable which can be skinned via an <see cref="ISkinSource"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The type of drawable.</typeparam>
|
public class SkinnableDrawable : SkinReloadableDrawable
|
||||||
public class SkinnableDrawable<T> : SkinReloadableDrawable
|
|
||||||
where T : Drawable
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The displayed component. May or may not be a type-<typeparamref name="T"/> member.
|
/// The displayed component.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Drawable Drawable { get; private set; }
|
protected Drawable Drawable { get; private set; }
|
||||||
|
|
||||||
private readonly string componentName;
|
private readonly string componentName;
|
||||||
|
|
||||||
private readonly bool restrictSize;
|
private readonly ConfineMode confineMode;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new skinnable drawable.
|
/// Create a new skinnable drawable.
|
||||||
@ -37,28 +28,32 @@ namespace osu.Game.Skinning
|
|||||||
/// <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="confineMode">How (if at all) the <see cref="Drawable"/> should be resize to fit within our own bounds.</param>
|
||||||
public SkinnableDrawable(string name, Func<string, T> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true)
|
public SkinnableDrawable(string name, Func<string, Drawable> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, ConfineMode confineMode = ConfineMode.ScaleDownToFit)
|
||||||
: this(name, allowFallback, restrictSize)
|
: this(name, allowFallback, confineMode)
|
||||||
{
|
{
|
||||||
createDefault = defaultImplementation;
|
createDefault = defaultImplementation;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SkinnableDrawable(string name, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true)
|
protected SkinnableDrawable(string name, Func<ISkinSource, bool> allowFallback = null, ConfineMode confineMode = ConfineMode.ScaleDownToFit)
|
||||||
: base(allowFallback)
|
: base(allowFallback)
|
||||||
{
|
{
|
||||||
componentName = name;
|
componentName = name;
|
||||||
this.restrictSize = restrictSize;
|
this.confineMode = confineMode;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Func<string, T> createDefault;
|
private readonly Func<string, Drawable> createDefault;
|
||||||
|
|
||||||
protected virtual T CreateDefault(string name) => createDefault(name);
|
private readonly Cached scaling = new Cached();
|
||||||
|
|
||||||
|
private bool isDefault;
|
||||||
|
|
||||||
|
protected virtual Drawable CreateDefault(string name) => createDefault(name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to apply size restrictions (specified via <see cref="restrictSize"/>) to the default implementation.
|
/// Whether to apply size restrictions (specified via <see cref="confineMode"/>) to the default implementation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual bool ApplySizeRestrictionsToDefault => false;
|
protected virtual bool ApplySizeRestrictionsToDefault => false;
|
||||||
|
|
||||||
@ -66,7 +61,7 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
Drawable = skin.GetDrawableComponent(componentName);
|
Drawable = skin.GetDrawableComponent(componentName);
|
||||||
|
|
||||||
bool isDefault = false;
|
isDefault = false;
|
||||||
|
|
||||||
if (Drawable == null && allowFallback)
|
if (Drawable == null && allowFallback)
|
||||||
{
|
{
|
||||||
@ -76,21 +71,57 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
if (Drawable != null)
|
if (Drawable != null)
|
||||||
{
|
{
|
||||||
if (restrictSize && (!isDefault || ApplySizeRestrictionsToDefault))
|
scaling.Invalidate();
|
||||||
{
|
|
||||||
Drawable.RelativeSizeAxes = Axes.Both;
|
|
||||||
Drawable.Size = Vector2.One;
|
|
||||||
Drawable.Scale = Vector2.One;
|
|
||||||
Drawable.FillMode = FillMode.Fit;
|
|
||||||
}
|
|
||||||
|
|
||||||
Drawable.Origin = Anchor.Centre;
|
Drawable.Origin = Anchor.Centre;
|
||||||
Drawable.Anchor = Anchor.Centre;
|
Drawable.Anchor = Anchor.Centre;
|
||||||
|
|
||||||
InternalChild = Drawable;
|
InternalChild = Drawable;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ClearInternal();
|
ClearInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
if (!scaling.IsValid)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Drawable == null || (isDefault && !ApplySizeRestrictionsToDefault)) return;
|
||||||
|
|
||||||
|
switch (confineMode)
|
||||||
|
{
|
||||||
|
case ConfineMode.NoScaling:
|
||||||
|
return;
|
||||||
|
|
||||||
|
case ConfineMode.ScaleDownToFit:
|
||||||
|
if (Drawable.DrawSize.X <= DrawSize.X && Drawable.DrawSize.Y <= DrawSize.Y)
|
||||||
|
return;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Drawable.RelativeSizeAxes = Axes.Both;
|
||||||
|
Drawable.Size = Vector2.One;
|
||||||
|
Drawable.Scale = Vector2.One;
|
||||||
|
Drawable.FillMode = FillMode.Fit;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
scaling.Validate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ConfineMode
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Don't apply any scaling. This allows the user element to be of any size, exceeding specified bounds.
|
||||||
|
/// </summary>
|
||||||
|
NoScaling,
|
||||||
|
ScaleDownToFit,
|
||||||
|
ScaleToFit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
|
||||||
@ -11,18 +12,18 @@ namespace osu.Game.Skinning
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A skinnable element which uses a stable sprite and can therefore share implementation logic.
|
/// A skinnable element which uses a stable sprite and can therefore share implementation logic.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SkinnableSprite : SkinnableDrawable<Sprite>
|
public class SkinnableSprite : SkinnableDrawable
|
||||||
{
|
{
|
||||||
protected override bool ApplySizeRestrictionsToDefault => true;
|
protected override bool ApplySizeRestrictionsToDefault => true;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private TextureStore textures { get; set; }
|
private TextureStore textures { get; set; }
|
||||||
|
|
||||||
public SkinnableSprite(string name, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true)
|
public SkinnableSprite(string name, Func<ISkinSource, bool> allowFallback = null, ConfineMode confineMode = ConfineMode.ScaleDownToFit)
|
||||||
: base(name, allowFallback, restrictSize)
|
: base(name, allowFallback, confineMode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Sprite CreateDefault(string name) => new Sprite { Texture = textures.Get(name) };
|
protected override Drawable CreateDefault(string name) => new Sprite { Texture = textures.Get(name) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,10 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
public class SkinnableSpriteText : SkinnableDrawable<SpriteText>, IHasText
|
public class SkinnableSpriteText : SkinnableDrawable, IHasText
|
||||||
{
|
{
|
||||||
public SkinnableSpriteText(string name, Func<string, SpriteText> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, bool restrictSize = true)
|
public SkinnableSpriteText(string name, Func<string, SpriteText> defaultImplementation, Func<ISkinSource, bool> allowFallback = null, ConfineMode confineMode = ConfineMode.ScaleDownToFit)
|
||||||
: base(name, defaultImplementation, allowFallback, restrictSize)
|
: base(name, defaultImplementation, allowFallback, confineMode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ using osu.Framework.Extensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.UserInterface
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An abstract test case which exposes small cells arranged in a grid.
|
/// An abstract test case which exposes small cells arranged in a grid.
|
@ -15,6 +15,7 @@ using osu.Framework.Platform;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
@ -43,6 +44,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
private readonly Lazy<Storage> localStorage;
|
private readonly Lazy<Storage> localStorage;
|
||||||
protected Storage LocalStorage => localStorage.Value;
|
protected Storage LocalStorage => localStorage.Value;
|
||||||
|
|
||||||
|
private readonly Lazy<DatabaseContextFactory> contextFactory;
|
||||||
|
protected DatabaseContextFactory ContextFactory => contextFactory.Value;
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
{
|
{
|
||||||
// This is the earliest we can get OsuGameBase, which is used by the dummy working beatmap to find textures
|
// This is the earliest we can get OsuGameBase, which is used by the dummy working beatmap to find textures
|
||||||
@ -59,6 +63,14 @@ namespace osu.Game.Tests.Visual
|
|||||||
protected OsuTestScene()
|
protected OsuTestScene()
|
||||||
{
|
{
|
||||||
localStorage = new Lazy<Storage>(() => new NativeStorage($"{GetType().Name}-{Guid.NewGuid()}"));
|
localStorage = new Lazy<Storage>(() => new NativeStorage($"{GetType().Name}-{Guid.NewGuid()}"));
|
||||||
|
contextFactory = new Lazy<DatabaseContextFactory>(() =>
|
||||||
|
{
|
||||||
|
var factory = new DatabaseContextFactory(LocalStorage);
|
||||||
|
factory.ResetDatabase();
|
||||||
|
using (var usage = factory.Get())
|
||||||
|
usage.Migrate();
|
||||||
|
return factory;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
@ -85,6 +97,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
if (beatmap?.Value.TrackLoaded == true)
|
if (beatmap?.Value.TrackLoaded == true)
|
||||||
beatmap.Value.Track.Stop();
|
beatmap.Value.Track.Stop();
|
||||||
|
|
||||||
|
if (contextFactory.IsValueCreated)
|
||||||
|
contextFactory.Value.ResetDatabase();
|
||||||
|
|
||||||
if (localStorage.IsValueCreated)
|
if (localStorage.IsValueCreated)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -118,7 +118,7 @@ namespace osu.Game.Users
|
|||||||
public int PostCount;
|
public int PostCount;
|
||||||
|
|
||||||
[JsonProperty(@"follower_count")]
|
[JsonProperty(@"follower_count")]
|
||||||
public int[] FollowerCount;
|
public int FollowerCount;
|
||||||
|
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
private string[] playstyle
|
private string[] playstyle
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using SharpRaven;
|
using SharpRaven;
|
||||||
@ -36,31 +37,50 @@ namespace osu.Game.Utils
|
|||||||
|
|
||||||
if (exception != null)
|
if (exception != null)
|
||||||
{
|
{
|
||||||
if (exception is IOException ioe)
|
if (!shouldSubmitException(exception))
|
||||||
{
|
return;
|
||||||
// disk full exceptions, see https://stackoverflow.com/a/9294382
|
|
||||||
const int hr_error_handle_disk_full = unchecked((int)0x80070027);
|
|
||||||
const int hr_error_disk_full = unchecked((int)0x80070070);
|
|
||||||
|
|
||||||
if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports.
|
// since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports.
|
||||||
if (lastException != null &&
|
if (lastException != null &&
|
||||||
lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace))
|
lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace))
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
lastException = exception;
|
lastException = exception;
|
||||||
queuePendingTask(raven.CaptureAsync(new SentryEvent(exception)));
|
queuePendingTask(raven.CaptureAsync(new SentryEvent(exception) { Message = entry.Message }));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
raven.AddTrail(new Breadcrumb(entry.Target.ToString(), BreadcrumbType.Navigation) { Message = entry.Message });
|
raven.AddTrail(new Breadcrumb(entry.Target.ToString(), BreadcrumbType.Navigation) { Message = entry.Message });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool shouldSubmitException(Exception exception)
|
||||||
|
{
|
||||||
|
switch (exception)
|
||||||
|
{
|
||||||
|
case IOException ioe:
|
||||||
|
// disk full exceptions, see https://stackoverflow.com/a/9294382
|
||||||
|
const int hr_error_handle_disk_full = unchecked((int)0x80070027);
|
||||||
|
const int hr_error_disk_full = unchecked((int)0x80070070);
|
||||||
|
|
||||||
|
if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WebException we:
|
||||||
|
switch (we.Status)
|
||||||
|
{
|
||||||
|
// more statuses may need to be blocked as we come across them.
|
||||||
|
case WebExceptionStatus.Timeout:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void queuePendingTask(Task<string> task)
|
private void queuePendingTask(Task<string> task)
|
||||||
{
|
{
|
||||||
lock (tasks) tasks.Add(task);
|
lock (tasks) tasks.Add(task);
|
||||||
|
@ -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.702.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.702.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.726.2" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.730.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.702.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.702.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.726.2" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.730.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.726.2" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.730.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" />
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
<string>0.1.0</string>
|
<string>0.1.0</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>LSSupportsOpeningDocumentsInPlace</key>
|
||||||
|
<true/>
|
||||||
<key>MinimumOSVersion</key>
|
<key>MinimumOSVersion</key>
|
||||||
<string>10.0</string>
|
<string>10.0</string>
|
||||||
<key>UIDeviceFamily</key>
|
<key>UIDeviceFamily</key>
|
||||||
|