Merge pull request #10528 from peppy/skinnable-health-display
Add legacy skinning support for health display
@ -51,7 +51,7 @@
|
||||
<Reference Include="Java.Interop" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.904.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.1009.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
BIN
osu.Game.Tests/Resources/old-skin/score-0.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-1.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-2.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-3.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-4.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-5.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-6.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-7.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-8.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-9.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-comma.png
Normal file
After Width: | Height: | Size: 865 B |
BIN
osu.Game.Tests/Resources/old-skin/score-dot.png
Normal file
After Width: | Height: | Size: 771 B |
BIN
osu.Game.Tests/Resources/old-skin/score-percent.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
osu.Game.Tests/Resources/old-skin/score-x.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-bg.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-colour-0.png
Normal file
After Width: | Height: | Size: 465 B |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-colour-1.png
Normal file
After Width: | Height: | Size: 475 B |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-colour-2.png
Normal file
After Width: | Height: | Size: 466 B |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-colour-3.png
Normal file
After Width: | Height: | Size: 464 B |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-ki.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-kidanger.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
osu.Game.Tests/Resources/old-skin/scorebar-kidanger2.png
Normal file
After Width: | Height: | Size: 9.1 KiB |
2
osu.Game.Tests/Resources/old-skin/skin.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[General]
|
||||
Version: 1.0
|
@ -0,0 +1,61 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public class TestSceneSkinnableHealthDisplay : SkinnableTestScene
|
||||
{
|
||||
private IEnumerable<SkinnableHealthDisplay> healthDisplays => CreatedDrawables.OfType<SkinnableHealthDisplay>();
|
||||
|
||||
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
AddStep("Create health displays", () =>
|
||||
{
|
||||
SetContents(() => new SkinnableHealthDisplay());
|
||||
});
|
||||
AddStep(@"Reset all", delegate
|
||||
{
|
||||
foreach (var s in healthDisplays)
|
||||
s.Current.Value = 1;
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHealthDisplayIncrementing()
|
||||
{
|
||||
AddRepeatStep(@"decrease hp", delegate
|
||||
{
|
||||
foreach (var healthDisplay in healthDisplays)
|
||||
healthDisplay.Current.Value -= 0.08f;
|
||||
}, 10);
|
||||
|
||||
AddRepeatStep(@"increase hp without flash", delegate
|
||||
{
|
||||
foreach (var healthDisplay in healthDisplays)
|
||||
healthDisplay.Current.Value += 0.1f;
|
||||
}, 3);
|
||||
|
||||
AddRepeatStep(@"increase hp with flash", delegate
|
||||
{
|
||||
foreach (var healthDisplay in healthDisplays)
|
||||
{
|
||||
healthDisplay.Current.Value += 0.1f;
|
||||
healthDisplay.Flash(new JudgementResult(null, new OsuJudgement()));
|
||||
}
|
||||
}, 3);
|
||||
}
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@ using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Lists;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.IO;
|
||||
@ -36,6 +37,7 @@ namespace osu.Game.Beatmaps
|
||||
/// <summary>
|
||||
/// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps.
|
||||
/// </summary>
|
||||
[ExcludeFromDynamicCompile]
|
||||
public partial class BeatmapManager : DownloadableArchiveModelManager<BeatmapSetInfo, BeatmapSetFileInfo>, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -13,6 +13,7 @@ using osu.Framework.Development;
|
||||
using osu.Framework.IO.Network;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
@ -23,6 +24,7 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
public partial class BeatmapManager
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
private class BeatmapOnlineLookupQueue : IDisposable
|
||||
{
|
||||
private readonly IAPIProvider api;
|
||||
|
@ -8,6 +8,7 @@ using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Skinning;
|
||||
@ -17,6 +18,7 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
public partial class BeatmapManager
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
private class BeatmapManagerWorkingBeatmap : WorkingBeatmap
|
||||
{
|
||||
private readonly IResourceStore<byte[]> store;
|
||||
|
@ -16,7 +16,7 @@ using osu.Framework.Utils;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class StandardHealthDisplay : HealthDisplay, IHasAccentColour
|
||||
public class DefaultHealthDisplay : HealthDisplay, IHasAccentColour
|
||||
{
|
||||
/// <summary>
|
||||
/// The base opacity of the glow.
|
||||
@ -71,8 +71,12 @@ namespace osu.Game.Screens.Play.HUD
|
||||
}
|
||||
}
|
||||
|
||||
public StandardHealthDisplay()
|
||||
public DefaultHealthDisplay()
|
||||
{
|
||||
Size = new Vector2(1, 5);
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Margin = new MarginPadding { Top = 20 };
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
@ -103,13 +107,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
GlowColour = colours.BlueDarker;
|
||||
}
|
||||
|
||||
public void Flash(JudgementResult result)
|
||||
{
|
||||
if (!result.IsHit)
|
||||
return;
|
||||
|
||||
Scheduler.AddOnce(flash);
|
||||
}
|
||||
public override void Flash(JudgementResult result) => Scheduler.AddOnce(flash);
|
||||
|
||||
private void flash()
|
||||
{
|
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
|
||||
@ -12,14 +13,18 @@ namespace osu.Game.Screens.Play.HUD
|
||||
/// A container for components displaying the current player health.
|
||||
/// Gets bound automatically to the <see cref="HealthProcessor"/> when inserted to <see cref="DrawableRuleset.Overlays"/> hierarchy.
|
||||
/// </summary>
|
||||
public abstract class HealthDisplay : Container
|
||||
public abstract class HealthDisplay : Container, IHealthDisplay
|
||||
{
|
||||
public readonly BindableDouble Current = new BindableDouble(1)
|
||||
public Bindable<double> Current { get; } = new BindableDouble(1)
|
||||
{
|
||||
MinValue = 0,
|
||||
MaxValue = 1
|
||||
};
|
||||
|
||||
public virtual void Flash(JudgementResult result)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bind the tracked fields of <see cref="HealthProcessor"/> to this health display.
|
||||
/// </summary>
|
||||
|
26
osu.Game/Screens/Play/HUD/IHealthDisplay.cs
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
/// <summary>
|
||||
/// An interface providing a set of methods to update a health display.
|
||||
/// </summary>
|
||||
public interface IHealthDisplay : IDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// The current health to be displayed.
|
||||
/// </summary>
|
||||
Bindable<double> Current { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Flash the display for a specified result type.
|
||||
/// </summary>
|
||||
/// <param name="result">The result type.</param>
|
||||
void Flash(JudgementResult result);
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ namespace osu.Game.Screens.Play
|
||||
public readonly SkinnableComboCounter ComboCounter;
|
||||
public readonly SkinnableScoreCounter ScoreCounter;
|
||||
public readonly SkinnableAccuracyCounter AccuracyCounter;
|
||||
public readonly HealthDisplay HealthDisplay;
|
||||
public readonly SkinnableHealthDisplay HealthDisplay;
|
||||
public readonly SongProgress Progress;
|
||||
public readonly ModDisplay ModDisplay;
|
||||
public readonly HitErrorDisplay HitErrorDisplay;
|
||||
@ -272,12 +272,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected virtual SkinnableComboCounter CreateComboCounter() => new SkinnableComboCounter();
|
||||
|
||||
protected virtual HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay
|
||||
{
|
||||
Size = new Vector2(1, 5),
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Margin = new MarginPadding { Top = 20 }
|
||||
};
|
||||
protected virtual SkinnableHealthDisplay CreateHealthDisplay() => new SkinnableHealthDisplay();
|
||||
|
||||
protected virtual FailingLayer CreateFailingLayer() => new FailingLayer
|
||||
{
|
||||
@ -320,8 +315,14 @@ namespace osu.Game.Screens.Play
|
||||
AccuracyCounter?.Current.BindTo(processor.Accuracy);
|
||||
ComboCounter?.Current.BindTo(processor.Combo);
|
||||
|
||||
if (HealthDisplay is StandardHealthDisplay shd)
|
||||
processor.NewJudgement += shd.Flash;
|
||||
if (HealthDisplay is IHealthDisplay shd)
|
||||
{
|
||||
processor.NewJudgement += judgement =>
|
||||
{
|
||||
if (judgement.IsHit && judgement.Type != HitResult.IgnoreHit)
|
||||
shd.Flash(judgement);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void BindHealthProcessor(HealthProcessor processor)
|
||||
|
51
osu.Game/Screens/Play/SkinnableHealthDisplay.cs
Normal file
@ -0,0 +1,51 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class SkinnableHealthDisplay : SkinnableDrawable, IHealthDisplay
|
||||
{
|
||||
public Bindable<double> Current { get; } = new BindableDouble(1)
|
||||
{
|
||||
MinValue = 0,
|
||||
MaxValue = 1
|
||||
};
|
||||
|
||||
public void Flash(JudgementResult result) => skinnedCounter?.Flash(result);
|
||||
|
||||
private HealthProcessor processor;
|
||||
|
||||
public void BindHealthProcessor(HealthProcessor processor)
|
||||
{
|
||||
if (this.processor != null)
|
||||
throw new InvalidOperationException("Can't bind to a processor more than once");
|
||||
|
||||
this.processor = processor;
|
||||
|
||||
Current.BindTo(processor.Health);
|
||||
}
|
||||
|
||||
public SkinnableHealthDisplay()
|
||||
: base(new HUDSkinComponent(HUDSkinComponents.HealthDisplay), _ => new DefaultHealthDisplay())
|
||||
{
|
||||
CentreComponent = false;
|
||||
}
|
||||
|
||||
private IHealthDisplay skinnedCounter;
|
||||
|
||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||
{
|
||||
base.SkinChanged(skin, allowFallback);
|
||||
|
||||
skinnedCounter = Drawable as IHealthDisplay;
|
||||
skinnedCounter?.Current.BindTo(Current);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,8 +7,9 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
ComboCounter,
|
||||
ScoreCounter,
|
||||
AccuracyCounter,
|
||||
HealthDisplay,
|
||||
ScoreText,
|
||||
ComboText,
|
||||
AccuracyCounter,
|
||||
}
|
||||
}
|
||||
|
266
osu.Game/Skinning/LegacyHealthDisplay.cs
Normal file
@ -0,0 +1,266 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public class LegacyHealthDisplay : CompositeDrawable, IHealthDisplay
|
||||
{
|
||||
private const double epic_cutoff = 0.5;
|
||||
|
||||
private readonly Skin skin;
|
||||
private LegacyHealthPiece fill;
|
||||
private LegacyHealthPiece marker;
|
||||
|
||||
private float maxFillWidth;
|
||||
|
||||
private bool isNewStyle;
|
||||
|
||||
public Bindable<double> Current { get; } = new BindableDouble(1)
|
||||
{
|
||||
MinValue = 0,
|
||||
MaxValue = 1
|
||||
};
|
||||
|
||||
public LegacyHealthDisplay(Skin skin)
|
||||
{
|
||||
this.skin = skin;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
isNewStyle = getTexture(skin, "marker") != null;
|
||||
|
||||
// background implementation is the same for both versions.
|
||||
AddInternal(new Sprite { Texture = getTexture(skin, "bg") });
|
||||
|
||||
if (isNewStyle)
|
||||
{
|
||||
AddRangeInternal(new[]
|
||||
{
|
||||
fill = new LegacyNewStyleFill(skin),
|
||||
marker = new LegacyNewStyleMarker(skin),
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
AddRangeInternal(new[]
|
||||
{
|
||||
fill = new LegacyOldStyleFill(skin),
|
||||
marker = new LegacyOldStyleMarker(skin),
|
||||
});
|
||||
}
|
||||
|
||||
fill.Current.BindTo(Current);
|
||||
marker.Current.BindTo(Current);
|
||||
|
||||
maxFillWidth = fill.Width;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
fill.Width = Interpolation.ValueAt(
|
||||
Math.Clamp(Clock.ElapsedFrameTime, 0, 200),
|
||||
fill.Width, (float)Current.Value * maxFillWidth, 0, 200, Easing.OutQuint);
|
||||
|
||||
marker.Position = fill.Position + new Vector2(fill.DrawWidth, fill.DrawHeight / 2);
|
||||
}
|
||||
|
||||
public void Flash(JudgementResult result) => marker.Flash(result);
|
||||
|
||||
private static Texture getTexture(Skin skin, string name) => skin.GetTexture($"scorebar-{name}");
|
||||
|
||||
private static Color4 getFillColour(double hp)
|
||||
{
|
||||
if (hp < 0.2)
|
||||
return Interpolation.ValueAt(0.2 - hp, Color4.Black, Color4.Red, 0, 0.2);
|
||||
|
||||
if (hp < epic_cutoff)
|
||||
return Interpolation.ValueAt(0.5 - hp, Color4.White, Color4.Black, 0, 0.5);
|
||||
|
||||
return Color4.White;
|
||||
}
|
||||
|
||||
public class LegacyOldStyleMarker : LegacyMarker
|
||||
{
|
||||
private readonly Texture normalTexture;
|
||||
private readonly Texture dangerTexture;
|
||||
private readonly Texture superDangerTexture;
|
||||
|
||||
public LegacyOldStyleMarker(Skin skin)
|
||||
{
|
||||
normalTexture = getTexture(skin, "ki");
|
||||
dangerTexture = getTexture(skin, "kidanger");
|
||||
superDangerTexture = getTexture(skin, "kidanger2");
|
||||
}
|
||||
|
||||
public override Sprite CreateSprite() => new Sprite
|
||||
{
|
||||
Texture = normalTexture,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Current.BindValueChanged(hp =>
|
||||
{
|
||||
if (hp.NewValue < 0.2f)
|
||||
Main.Texture = superDangerTexture;
|
||||
else if (hp.NewValue < epic_cutoff)
|
||||
Main.Texture = dangerTexture;
|
||||
else
|
||||
Main.Texture = normalTexture;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class LegacyNewStyleMarker : LegacyMarker
|
||||
{
|
||||
private readonly Skin skin;
|
||||
|
||||
public LegacyNewStyleMarker(Skin skin)
|
||||
{
|
||||
this.skin = skin;
|
||||
}
|
||||
|
||||
public override Sprite CreateSprite() => new Sprite
|
||||
{
|
||||
Texture = getTexture(skin, "marker"),
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
Main.Colour = getFillColour(Current.Value);
|
||||
Main.Blending = Current.Value < epic_cutoff ? BlendingParameters.Inherit : BlendingParameters.Additive;
|
||||
}
|
||||
}
|
||||
|
||||
internal class LegacyOldStyleFill : LegacyHealthPiece
|
||||
{
|
||||
public LegacyOldStyleFill(Skin skin)
|
||||
{
|
||||
// required for sizing correctly..
|
||||
var firstFrame = getTexture(skin, "colour-0");
|
||||
|
||||
if (firstFrame == null)
|
||||
{
|
||||
InternalChild = new Sprite { Texture = getTexture(skin, "colour") };
|
||||
Size = InternalChild.Size;
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalChild = skin.GetAnimation("scorebar-colour", true, true, startAtCurrentTime: false, applyConfigFrameRate: true) ?? Drawable.Empty();
|
||||
Size = new Vector2(firstFrame.DisplayWidth, firstFrame.DisplayHeight);
|
||||
}
|
||||
|
||||
Position = new Vector2(3, 10) * 1.6f;
|
||||
Masking = true;
|
||||
}
|
||||
}
|
||||
|
||||
internal class LegacyNewStyleFill : LegacyHealthPiece
|
||||
{
|
||||
public LegacyNewStyleFill(Skin skin)
|
||||
{
|
||||
InternalChild = new Sprite
|
||||
{
|
||||
Texture = getTexture(skin, "colour"),
|
||||
};
|
||||
|
||||
Size = InternalChild.Size;
|
||||
Position = new Vector2(7.5f, 7.8f) * 1.6f;
|
||||
Masking = true;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
Colour = getFillColour(Current.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class LegacyMarker : LegacyHealthPiece
|
||||
{
|
||||
protected Sprite Main;
|
||||
|
||||
private Sprite explode;
|
||||
|
||||
protected LegacyMarker()
|
||||
{
|
||||
Origin = Anchor.Centre;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
Main = CreateSprite(),
|
||||
explode = CreateSprite().With(s =>
|
||||
{
|
||||
s.Alpha = 0;
|
||||
s.Blending = BlendingParameters.Additive;
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
public abstract Sprite CreateSprite();
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Current.BindValueChanged(val =>
|
||||
{
|
||||
if (val.NewValue > val.OldValue)
|
||||
bulgeMain();
|
||||
});
|
||||
}
|
||||
|
||||
public override void Flash(JudgementResult result)
|
||||
{
|
||||
bulgeMain();
|
||||
|
||||
bool isEpic = Current.Value >= epic_cutoff;
|
||||
|
||||
explode.Blending = isEpic ? BlendingParameters.Additive : BlendingParameters.Inherit;
|
||||
explode.ScaleTo(1).Then().ScaleTo(isEpic ? 2 : 1.6f, 120);
|
||||
explode.FadeOutFromOne(120);
|
||||
}
|
||||
|
||||
private void bulgeMain() =>
|
||||
Main.ScaleTo(1.4f).Then().ScaleTo(1, 200, Easing.Out);
|
||||
}
|
||||
|
||||
public class LegacyHealthPiece : CompositeDrawable, IHealthDisplay
|
||||
{
|
||||
public Bindable<double> Current { get; } = new Bindable<double>();
|
||||
|
||||
public virtual void Flash(JudgementResult result)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -351,6 +351,9 @@ namespace osu.Game.Skinning
|
||||
case HUDSkinComponents.AccuracyCounter:
|
||||
return new LegacyAccuracyCounter(this);
|
||||
|
||||
case HUDSkinComponents.HealthDisplay:
|
||||
return new LegacyHealthDisplay(this);
|
||||
|
||||
case HUDSkinComponents.ComboText:
|
||||
return new LegacySpriteText(this, comboPrefix)
|
||||
{
|
||||
|
@ -18,12 +18,14 @@ using osu.Framework.Graphics.OpenGL.Textures;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.IO.Archives;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
public class SkinManager : ArchiveModelManager<SkinInfo, SkinFileInfo>, ISkinSource
|
||||
{
|
||||
private readonly AudioManager audio;
|
||||
|
@ -35,12 +35,12 @@ namespace osu.Game.Tests.Visual
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, SkinManager skinManager)
|
||||
private void load(AudioManager audio, SkinManager skinManager, OsuGameBase game)
|
||||
{
|
||||
var dllStore = new DllResourceStore(DynamicCompilationOriginal.GetType().Assembly);
|
||||
|
||||
metricsSkin = new TestLegacySkin(new SkinInfo { Name = "metrics-skin" }, new NamespacedResourceStore<byte[]>(dllStore, "Resources/metrics_skin"), audio, true);
|
||||
defaultSkin = skinManager.GetSkin(DefaultLegacySkin.Info);
|
||||
defaultSkin = new DefaultLegacySkin(new NamespacedResourceStore<byte[]>(game.Resources, "Skins/Legacy"), audio);
|
||||
specialSkin = new TestLegacySkin(new SkinInfo { Name = "special-skin" }, new NamespacedResourceStore<byte[]>(dllStore, "Resources/special_skin"), audio, true);
|
||||
oldSkin = new TestLegacySkin(new SkinInfo { Name = "old-skin" }, new NamespacedResourceStore<byte[]>(dllStore, "Resources/old_skin"), audio, true);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.1009.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.904.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
|
||||
<PackageReference Include="Sentry" Version="2.1.6" />
|
||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
|
@ -71,7 +71,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.1009.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.904.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
|
||||
</ItemGroup>
|
||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||
<ItemGroup Label="Transitive Dependencies">
|
||||
|