mirror of
https://github.com/osukey/osukey.git
synced 2025-05-31 10:27:26 +09:00
wip
This commit is contained in:
parent
4aadd3a8f8
commit
c615762da6
@ -5,6 +5,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -30,6 +31,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Current.Value = DisplayedCount = 1.0f;
|
Current.Value = DisplayedCount = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
DisplayedCountSpriteText.Colour = colours.BlueLighter;
|
||||||
|
}
|
||||||
|
|
||||||
protected override string FormatCount(double count)
|
protected override string FormatCount(double count)
|
||||||
{
|
{
|
||||||
return $@"{count:P2}";
|
return $@"{count:P2}";
|
||||||
|
@ -111,8 +111,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Flush(false, TransformType);
|
Flush(false, TransformType);
|
||||||
|
|
||||||
DisplayedCountSpriteText.Text = FormatCount(Current);
|
DisplayedCountSpriteText.Text = FormatCount(Current);
|
||||||
DisplayedCountSpriteText.Anchor = Anchor;
|
|
||||||
DisplayedCountSpriteText.Origin = Origin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -5,6 +5,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -34,6 +35,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
LeadingZeroes = leading;
|
LeadingZeroes = leading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
DisplayedCountSpriteText.Colour = colours.BlueLighter;
|
||||||
|
}
|
||||||
|
|
||||||
protected override double GetProportionalDuration(double currentValue, double newValue)
|
protected override double GetProportionalDuration(double currentValue, double newValue)
|
||||||
{
|
{
|
||||||
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
||||||
|
68
osu.Game/Graphics/UserInterface/SimpleComboCounter.cs
Normal file
68
osu.Game/Graphics/UserInterface/SimpleComboCounter.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Transforms;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Used as an accuracy counter. Represented visually as a percentage.
|
||||||
|
/// </summary>
|
||||||
|
public class SimpleComboCounter : RollingCounter<int>
|
||||||
|
{
|
||||||
|
protected override Type TransformType => typeof(TransformCount);
|
||||||
|
|
||||||
|
protected override double RollingDuration => 750;
|
||||||
|
|
||||||
|
public SimpleComboCounter()
|
||||||
|
{
|
||||||
|
Current.Value = DisplayedCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string FormatCount(int count)
|
||||||
|
{
|
||||||
|
return $@"{count}x";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override double GetProportionalDuration(int currentValue, int newValue)
|
||||||
|
{
|
||||||
|
return Math.Abs(currentValue - newValue) * RollingDuration * 100.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Increment(int amount)
|
||||||
|
{
|
||||||
|
Current.Value = Current + amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
DisplayedCountSpriteText.Colour = colours.BlueLighter;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class TransformCount : Transform<int>
|
||||||
|
{
|
||||||
|
public override int CurrentValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
double time = Time?.Current ?? 0;
|
||||||
|
if (time < StartTime) return StartValue;
|
||||||
|
if (time >= EndTime) return EndValue;
|
||||||
|
|
||||||
|
return (int)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Apply(Drawable d)
|
||||||
|
{
|
||||||
|
base.Apply(d);
|
||||||
|
((SimpleComboCounter)d).DisplayedCount = CurrentValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -22,9 +22,9 @@ namespace osu.Game.Modes.UI
|
|||||||
|
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
public readonly KeyCounterCollection KeyCounter;
|
public readonly KeyCounterCollection KeyCounter;
|
||||||
public readonly ComboCounter ComboCounter;
|
public readonly RollingCounter<int> ComboCounter;
|
||||||
public readonly ScoreCounter ScoreCounter;
|
public readonly ScoreCounter ScoreCounter;
|
||||||
public readonly PercentageCounter AccuracyCounter;
|
public readonly RollingCounter<double> AccuracyCounter;
|
||||||
public readonly HealthDisplay HealthDisplay;
|
public readonly HealthDisplay HealthDisplay;
|
||||||
|
|
||||||
private Bindable<bool> showKeyCounter;
|
private Bindable<bool> showKeyCounter;
|
||||||
@ -33,8 +33,8 @@ namespace osu.Game.Modes.UI
|
|||||||
private static bool hasShownNotificationOnce;
|
private static bool hasShownNotificationOnce;
|
||||||
|
|
||||||
protected abstract KeyCounterCollection CreateKeyCounter();
|
protected abstract KeyCounterCollection CreateKeyCounter();
|
||||||
protected abstract ComboCounter CreateComboCounter();
|
protected abstract RollingCounter<int> CreateComboCounter();
|
||||||
protected abstract PercentageCounter CreateAccuracyCounter();
|
protected abstract RollingCounter<double> CreateAccuracyCounter();
|
||||||
protected abstract ScoreCounter CreateScoreCounter();
|
protected abstract ScoreCounter CreateScoreCounter();
|
||||||
protected abstract HealthDisplay CreateHealthDisplay();
|
protected abstract HealthDisplay CreateHealthDisplay();
|
||||||
|
|
||||||
|
@ -11,19 +11,22 @@ namespace osu.Game.Modes.UI
|
|||||||
{
|
{
|
||||||
public class StandardHudOverlay : HudOverlay
|
public class StandardHudOverlay : HudOverlay
|
||||||
{
|
{
|
||||||
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter
|
protected override RollingCounter<double> CreateAccuracyCounter() => new PercentageCounter
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopRight,
|
||||||
Position = new Vector2(0, 65),
|
Position = new Vector2(0, 35),
|
||||||
TextSize = 20,
|
TextSize = 20,
|
||||||
Margin = new MarginPadding { Right = 5 },
|
Margin = new MarginPadding { Right = 140 },
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override ComboCounter CreateComboCounter() => new StandardComboCounter
|
protected override RollingCounter<int> CreateComboCounter() => new SimpleComboCounter
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.TopLeft,
|
||||||
|
Position = new Vector2(0, 35),
|
||||||
|
Margin = new MarginPadding { Left = 140 },
|
||||||
|
TextSize = 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay
|
protected override HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay
|
||||||
@ -49,7 +52,6 @@ namespace osu.Game.Modes.UI
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
TextSize = 40,
|
TextSize = 40,
|
||||||
Position = new Vector2(0, 30),
|
Position = new Vector2(0, 30),
|
||||||
Margin = new MarginPadding { Right = 5 },
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
<Compile Include="Graphics\UserInterface\OsuPasswordTextBox.cs" />
|
<Compile Include="Graphics\UserInterface\OsuPasswordTextBox.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\OsuSliderBar.cs" />
|
<Compile Include="Graphics\UserInterface\OsuSliderBar.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\OsuTextBox.cs" />
|
<Compile Include="Graphics\UserInterface\OsuTextBox.cs" />
|
||||||
|
<Compile Include="Graphics\UserInterface\SimpleComboCounter.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\TwoLayerButton.cs" />
|
<Compile Include="Graphics\UserInterface\TwoLayerButton.cs" />
|
||||||
<Compile Include="Input\Handlers\ReplayInputHandler.cs" />
|
<Compile Include="Input\Handlers\ReplayInputHandler.cs" />
|
||||||
<Compile Include="IO\Legacy\ILegacySerializable.cs" />
|
<Compile Include="IO\Legacy\ILegacySerializable.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user