1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 07:43:00 +08:00

Remove custom combo counters.

This commit is contained in:
smoogipooo 2017-03-10 11:04:46 +09:00
parent a266add670
commit fa9110ce6e
8 changed files with 7 additions and 272 deletions

View File

@ -1,20 +1,20 @@
// 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.Screens.Testing;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.MathUtils;
using osu.Framework.Screens.Testing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Modes.Catch.UI;
using osu.Game.Modes.Mania.UI;
using osu.Game.Modes.Osu.UI;
using osu.Game.Modes.Taiko.UI;
using osu.Game.Modes.UI;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Primitives;
using System;
namespace osu.Desktop.VisualTests.Tests
{
@ -50,36 +50,6 @@ namespace osu.Desktop.VisualTests.Tests
};
Add(standardCombo);
CatchComboCounter catchCombo = new CatchComboCounter
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Count = 0,
TextSize = 40,
};
Add(catchCombo);
ComboCounter taikoCombo = new TaikoComboCounter
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.Centre,
Position = new Vector2(0, -160),
Count = 0,
TextSize = 40,
};
Add(taikoCombo);
ManiaComboCounter maniaCombo = new ManiaComboCounter
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Position = new Vector2(0, -80),
Count = 0,
TextSize = 40,
};
Add(maniaCombo);
PercentageCounter accuracyCombo = new PercentageCounter
{
Origin = Anchor.TopRight,
@ -110,9 +80,6 @@ namespace osu.Desktop.VisualTests.Tests
{
score.Count = 0;
standardCombo.Count = 0;
taikoCombo.Count = 0;
maniaCombo.Count = 0;
catchCombo.Count = 0;
numerator = denominator = 0;
accuracyCombo.SetFraction(0, 0);
stars.Count = 0;
@ -123,14 +90,6 @@ namespace osu.Desktop.VisualTests.Tests
{
score.Count += 300 + (ulong)(300.0 * (standardCombo.Count > 0 ? standardCombo.Count - 1 : 0) / 25.0);
standardCombo.Count++;
taikoCombo.Count++;
maniaCombo.Count++;
catchCombo.CatchFruit(new Color4(
Math.Max(0.5f, RNG.NextSingle()),
Math.Max(0.5f, RNG.NextSingle()),
Math.Max(0.5f, RNG.NextSingle()),
1)
);
numerator++; denominator++;
accuracyCombo.SetFraction(numerator, denominator);
});
@ -138,22 +97,10 @@ namespace osu.Desktop.VisualTests.Tests
AddButton(@"miss...", delegate
{
standardCombo.Roll();
taikoCombo.Roll();
maniaCombo.Roll();
catchCombo.Roll();
denominator++;
accuracyCombo.SetFraction(numerator, denominator);
});
AddButton(@"mania hold", delegate
{
if (!maniaHold)
maniaCombo.HoldStart();
else
maniaCombo.HoldEnd();
maniaHold = !maniaHold;
});
AddButton(@"Alter stars", delegate
{
stars.Count = RNG.NextSingle() * (stars.StarCount + 1);
@ -164,9 +111,6 @@ namespace osu.Desktop.VisualTests.Tests
{
score.StopRolling();
standardCombo.StopRolling();
catchCombo.StopRolling();
taikoCombo.StopRolling();
maniaCombo.StopRolling();
accuracyCombo.StopRolling();
stars.StopAnimation();
});

View File

@ -1,65 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Modes.Osu.UI;
using OpenTK.Graphics;
namespace osu.Game.Modes.Catch.UI
{
/// <summary>
/// Similar to Standard, but without the 'x' and has tinted pop-ups. Used in osu!catch.
/// </summary>
public class CatchComboCounter : OsuComboCounter
{
protected override bool CanPopOutWhileRolling => true;
protected virtual double FadeOutDelay => 1000;
protected override double FadeOutDuration => 300;
protected override string FormatCount(ulong count)
{
return $@"{count:#,0}";
}
private void animateFade()
{
Show();
Delay(FadeOutDelay);
FadeOut(FadeOutDuration);
DelayReset();
}
protected override void OnCountChange(ulong currentValue, ulong newValue)
{
if (newValue != 0)
animateFade();
base.OnCountChange(currentValue, newValue);
}
protected override void OnCountRolling(ulong currentValue, ulong newValue)
{
if (!IsRolling)
{
PopOutCount.Colour = DisplayedCountSpriteText.Colour;
FadeOut(FadeOutDuration);
}
base.OnCountRolling(currentValue, newValue);
}
protected override void OnCountIncrement(ulong currentValue, ulong newValue)
{
animateFade();
base.OnCountIncrement(currentValue, newValue);
}
/// <summary>
/// Increaces counter and tints pop-out before animation.
/// </summary>
/// <param name="colour">Last grabbed fruit colour.</param>
public void CatchFruit(Color4 colour)
{
PopOutCount.Colour = colour;
Count++;
}
}
}

View File

@ -54,7 +54,6 @@
<Compile Include="Objects\Droplet.cs" />
<Compile Include="Objects\Fruit.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UI\CatchComboCounter.cs" />
<Compile Include="UI\CatchHitRenderer.cs" />
<Compile Include="UI\CatchPlayfield.cs" />
<Compile Include="CatchRuleset.cs" />

View File

@ -1,78 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transforms;
using osu.Game.Modes.Taiko.UI;
using OpenTK.Graphics;
namespace osu.Game.Modes.Mania.UI
{
/// <summary>
/// Similar to osu!taiko, with a pop-out animation when failing (rolling). Used in osu!mania.
/// </summary>
public class ManiaComboCounter : TaikoComboCounter
{
protected ushort KeysHeld;
protected Color4 OriginalColour;
protected Color4 TintColour => Color4.Orange;
protected EasingTypes TintEasing => EasingTypes.None;
protected int TintDuration => 500;
protected Color4 PopOutColor => Color4.Red;
protected override float PopOutInitialAlpha => 1.0f;
protected override double PopOutDuration => 300;
protected override void LoadComplete()
{
base.LoadComplete();
PopOutCount.Anchor = Anchor.BottomCentre;
PopOutCount.Origin = Anchor.Centre;
PopOutCount.FadeColour(PopOutColor);
OriginalColour = DisplayedCountSpriteText.Colour;
}
protected override void OnCountRolling(ulong currentValue, ulong newValue)
{
if (!IsRolling && newValue < currentValue)
{
PopOutCount.Text = FormatCount(currentValue);
PopOutCount.FadeTo(PopOutInitialAlpha);
PopOutCount.ScaleTo(1.0f);
PopOutCount.FadeOut(PopOutDuration, PopOutEasing);
PopOutCount.ScaleTo(PopOutScale, PopOutDuration, PopOutEasing);
}
base.OnCountRolling(currentValue, newValue);
}
/// <summary>
/// Tints text while holding a key.
/// </summary>
/// <remarks>
/// Does not alter combo. This has to be done depending of the scoring system.
/// (i.e. v1 = each period of time; v2 = when starting and ending a key hold)
/// </remarks>
public void HoldStart()
{
if (KeysHeld == 0)
DisplayedCountSpriteText.FadeColour(TintColour, TintDuration, TintEasing);
KeysHeld++;
}
/// <summary>
/// Ends tinting.
/// </summary>
public void HoldEnd()
{
KeysHeld--;
if (KeysHeld == 0)
DisplayedCountSpriteText.FadeColour(OriginalColour, TintDuration, TintEasing);
}
}
}

View File

@ -54,7 +54,6 @@
<Compile Include="Objects\ManiaConverter.cs" />
<Compile Include="Objects\Note.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UI\ManiaComboCounter.cs" />
<Compile Include="UI\ManiaHitRenderer.cs" />
<Compile Include="UI\ManiaPlayfield.cs" />
<Compile Include="ManiaRuleset.cs" />

View File

@ -1,13 +1,13 @@
// 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.Collections.Generic;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Modes.Objects;
using osu.Game.Modes.Osu.UI;
using osu.Game.Modes.Taiko.UI;
using osu.Game.Modes.UI;
using osu.Game.Beatmaps;
using System.Collections.Generic;
namespace osu.Game.Modes.Taiko
{

View File

@ -1,63 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Transforms;
using osu.Game.Modes.UI;
using OpenTK;
namespace osu.Game.Modes.Taiko.UI
{
/// <summary>
/// Allows tint and scaling animations. Used in osu!taiko.
/// </summary>
public class TaikoComboCounter : ComboCounter
{
protected virtual int AnimationDuration => 300;
protected virtual float ScaleFactor => 2;
protected virtual EasingTypes AnimationEasing => EasingTypes.None;
protected virtual bool CanAnimateWhenBackwards => false;
public TaikoComboCounter()
{
DisplayedCountSpriteText.Origin = Framework.Graphics.Anchor.BottomCentre;
DisplayedCountSpriteText.Anchor = Framework.Graphics.Anchor.BottomCentre;
}
protected virtual void TransformAnimate(ulong newValue)
{
DisplayedCountSpriteText.Text = FormatCount(newValue);
DisplayedCountSpriteText.ScaleTo(new Vector2(1, ScaleFactor));
DisplayedCountSpriteText.ScaleTo(new Vector2(1, 1), AnimationDuration, AnimationEasing);
}
protected virtual void TransformNotAnimate(ulong newValue)
{
DisplayedCountSpriteText.Text = FormatCount(newValue);
DisplayedCountSpriteText.ScaleTo(1);
}
protected override void OnDisplayedCountRolling(ulong currentValue, ulong newValue)
{
if (newValue == 0)
DisplayedCountSpriteText.FadeOut(FadeOutDuration);
else
DisplayedCountSpriteText.Show();
TransformNotAnimate(newValue);
}
protected override void OnDisplayedCountChange(ulong newValue)
{
DisplayedCountSpriteText.FadeTo(newValue == 0 ? 0 : 1);
TransformNotAnimate(newValue);
}
protected override void OnDisplayedCountIncrement(ulong newValue)
{
DisplayedCountSpriteText.Show();
TransformAnimate(newValue);
}
}
}

View File

@ -52,7 +52,6 @@
<Compile Include="Objects\TaikoBaseHit.cs" />
<Compile Include="Objects\TaikoConverter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UI\TaikoComboCounter.cs" />
<Compile Include="UI\TaikoHitRenderer.cs" />
<Compile Include="UI\TaikoPlayfield.cs" />
<Compile Include="TaikoRuleset.cs" />