mirror of
https://github.com/ppy/osu
synced 2025-02-20 20:47:09 +00:00
Rename ScoreOverlay -> HUDOverlay, move to osu.Game, make it not overridable by rulesets.
This commit is contained in:
parent
fa9110ce6e
commit
31f6cbd8cf
@ -40,7 +40,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
};
|
};
|
||||||
Add(score);
|
Add(score);
|
||||||
|
|
||||||
ComboCounter standardCombo = new OsuComboCounter
|
BaseComboCounter comboCounter = new ComboCounter
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
@ -48,15 +48,15 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
Count = 0,
|
Count = 0,
|
||||||
TextSize = 40,
|
TextSize = 40,
|
||||||
};
|
};
|
||||||
Add(standardCombo);
|
Add(comboCounter);
|
||||||
|
|
||||||
PercentageCounter accuracyCombo = new PercentageCounter
|
PercentageCounter accuracyCounter = new PercentageCounter
|
||||||
{
|
{
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Position = new Vector2(-20, 60),
|
Position = new Vector2(-20, 60),
|
||||||
};
|
};
|
||||||
Add(accuracyCombo);
|
Add(accuracyCounter);
|
||||||
|
|
||||||
StarCounter stars = new StarCounter
|
StarCounter stars = new StarCounter
|
||||||
{
|
{
|
||||||
@ -79,26 +79,26 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
AddButton(@"Reset all", delegate
|
AddButton(@"Reset all", delegate
|
||||||
{
|
{
|
||||||
score.Count = 0;
|
score.Count = 0;
|
||||||
standardCombo.Count = 0;
|
comboCounter.Count = 0;
|
||||||
numerator = denominator = 0;
|
numerator = denominator = 0;
|
||||||
accuracyCombo.SetFraction(0, 0);
|
accuracyCounter.SetFraction(0, 0);
|
||||||
stars.Count = 0;
|
stars.Count = 0;
|
||||||
starsLabel.Text = stars.Count.ToString("0.00");
|
starsLabel.Text = stars.Count.ToString("0.00");
|
||||||
});
|
});
|
||||||
|
|
||||||
AddButton(@"Hit! :D", delegate
|
AddButton(@"Hit! :D", delegate
|
||||||
{
|
{
|
||||||
score.Count += 300 + (ulong)(300.0 * (standardCombo.Count > 0 ? standardCombo.Count - 1 : 0) / 25.0);
|
score.Count += 300 + (ulong)(300.0 * (comboCounter.Count > 0 ? comboCounter.Count - 1 : 0) / 25.0);
|
||||||
standardCombo.Count++;
|
comboCounter.Count++;
|
||||||
numerator++; denominator++;
|
numerator++; denominator++;
|
||||||
accuracyCombo.SetFraction(numerator, denominator);
|
accuracyCounter.SetFraction(numerator, denominator);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddButton(@"miss...", delegate
|
AddButton(@"miss...", delegate
|
||||||
{
|
{
|
||||||
standardCombo.Roll();
|
comboCounter.Roll();
|
||||||
denominator++;
|
denominator++;
|
||||||
accuracyCombo.SetFraction(numerator, denominator);
|
accuracyCounter.SetFraction(numerator, denominator);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddButton(@"Alter stars", delegate
|
AddButton(@"Alter stars", delegate
|
||||||
@ -110,8 +110,8 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
AddButton(@"Stop counters", delegate
|
AddButton(@"Stop counters", delegate
|
||||||
{
|
{
|
||||||
score.StopRolling();
|
score.StopRolling();
|
||||||
standardCombo.StopRolling();
|
comboCounter.StopRolling();
|
||||||
accuracyCombo.StopRolling();
|
accuracyCounter.StopRolling();
|
||||||
stars.StopAnimation();
|
stars.StopAnimation();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using OpenTK.Input;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Modes.Catch.UI;
|
using osu.Game.Modes.Catch.UI;
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using osu.Game.Modes.Osu.UI;
|
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Screens.Play;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Catch
|
namespace osu.Game.Modes.Catch
|
||||||
{
|
{
|
||||||
public class CatchRuleset : Ruleset
|
public class CatchRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay();
|
|
||||||
|
|
||||||
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new CatchHitRenderer
|
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new CatchHitRenderer
|
||||||
{
|
{
|
||||||
Beatmap = beatmap,
|
Beatmap = beatmap,
|
||||||
@ -81,6 +80,13 @@ namespace osu.Game.Modes.Catch
|
|||||||
|
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o;
|
public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o;
|
||||||
|
|
||||||
|
public override KeyCounter[] GameplayKeys => new KeyCounter[]
|
||||||
|
{
|
||||||
|
new KeyCounterKeyboard(Key.ShiftLeft),
|
||||||
|
new KeyCounterMouse(MouseButton.Left),
|
||||||
|
new KeyCounterMouse(MouseButton.Right)
|
||||||
|
};
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
|
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
|
||||||
|
|
||||||
public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser();
|
public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser();
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// 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.Graphics;
|
||||||
using osu.Game.Modes.Mania.UI;
|
using osu.Game.Modes.Mania.UI;
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using osu.Game.Modes.Osu.UI;
|
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Screens.Play;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Mania
|
namespace osu.Game.Modes.Mania
|
||||||
{
|
{
|
||||||
public class ManiaRuleset : Ruleset
|
public class ManiaRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay();
|
|
||||||
|
|
||||||
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new ManiaHitRenderer
|
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new ManiaHitRenderer
|
||||||
{
|
{
|
||||||
Beatmap = beatmap,
|
Beatmap = beatmap,
|
||||||
@ -102,6 +100,8 @@ namespace osu.Game.Modes.Mania
|
|||||||
|
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mania_o;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mania_o;
|
||||||
|
|
||||||
|
public override KeyCounter[] GameplayKeys => new KeyCounter[] { /* Todo: Should be keymod specific */ };
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
|
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
|
||||||
|
|
||||||
public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser();
|
public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser();
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using OpenTK.Input;
|
||||||
using System.Linq;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using osu.Game.Modes.Osu.Objects;
|
using osu.Game.Modes.Osu.Objects;
|
||||||
using osu.Game.Modes.Osu.UI;
|
using osu.Game.Modes.Osu.UI;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu
|
namespace osu.Game.Modes.Osu
|
||||||
{
|
{
|
||||||
public class OsuRuleset : Ruleset
|
public class OsuRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay();
|
|
||||||
|
|
||||||
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new OsuHitRenderer
|
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new OsuHitRenderer
|
||||||
{
|
{
|
||||||
Beatmap = beatmap,
|
Beatmap = beatmap,
|
||||||
@ -111,5 +111,13 @@ namespace osu.Game.Modes.Osu
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override PlayMode PlayMode => PlayMode.Osu;
|
protected override PlayMode PlayMode => PlayMode.Osu;
|
||||||
|
|
||||||
|
public override KeyCounter[] GameplayKeys => new KeyCounter[]
|
||||||
|
{
|
||||||
|
new KeyCounterKeyboard(Key.Z),
|
||||||
|
new KeyCounterKeyboard(Key.X),
|
||||||
|
new KeyCounterMouse(MouseButton.Left),
|
||||||
|
new KeyCounterMouse(MouseButton.Right)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,141 +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.UI;
|
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.UI
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Uses the 'x' symbol and has a pop-out effect while rolling over. Used in osu! standard.
|
|
||||||
/// </summary>
|
|
||||||
public class OsuComboCounter : ComboCounter
|
|
||||||
{
|
|
||||||
protected uint ScheduledPopOutCurrentId;
|
|
||||||
|
|
||||||
protected virtual float PopOutSmallScale => 1.1f;
|
|
||||||
protected virtual bool CanPopOutWhileRolling => false;
|
|
||||||
|
|
||||||
public new Vector2 PopOutScale = new Vector2(1.6f);
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
PopOutCount.Origin = Origin;
|
|
||||||
PopOutCount.Anchor = Anchor;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string FormatCount(ulong count)
|
|
||||||
{
|
|
||||||
return $@"{count}x";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void TransformPopOut(ulong newValue)
|
|
||||||
{
|
|
||||||
PopOutCount.Text = FormatCount(newValue);
|
|
||||||
|
|
||||||
PopOutCount.ScaleTo(PopOutScale);
|
|
||||||
PopOutCount.FadeTo(PopOutInitialAlpha);
|
|
||||||
PopOutCount.MoveTo(Vector2.Zero);
|
|
||||||
|
|
||||||
PopOutCount.ScaleTo(1, PopOutDuration, PopOutEasing);
|
|
||||||
PopOutCount.FadeOut(PopOutDuration, PopOutEasing);
|
|
||||||
PopOutCount.MoveTo(DisplayedCountSpriteText.Position, PopOutDuration, PopOutEasing);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void TransformPopOutRolling(ulong newValue)
|
|
||||||
{
|
|
||||||
TransformPopOut(newValue);
|
|
||||||
TransformPopOutSmall(newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void TransformNoPopOut(ulong newValue)
|
|
||||||
{
|
|
||||||
DisplayedCountSpriteText.Text = FormatCount(newValue);
|
|
||||||
DisplayedCountSpriteText.ScaleTo(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void TransformPopOutSmall(ulong newValue)
|
|
||||||
{
|
|
||||||
DisplayedCountSpriteText.Text = FormatCount(newValue);
|
|
||||||
DisplayedCountSpriteText.ScaleTo(PopOutSmallScale);
|
|
||||||
DisplayedCountSpriteText.ScaleTo(1, PopOutDuration, PopOutEasing);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void ScheduledPopOutSmall(uint id)
|
|
||||||
{
|
|
||||||
// Too late; scheduled task invalidated
|
|
||||||
if (id != ScheduledPopOutCurrentId)
|
|
||||||
return;
|
|
||||||
|
|
||||||
DisplayedCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnCountRolling(ulong currentValue, ulong newValue)
|
|
||||||
{
|
|
||||||
ScheduledPopOutCurrentId++;
|
|
||||||
|
|
||||||
// Hides displayed count if was increasing from 0 to 1 but didn't finish
|
|
||||||
if (currentValue == 0 && newValue == 0)
|
|
||||||
DisplayedCountSpriteText.FadeOut(FadeOutDuration);
|
|
||||||
|
|
||||||
base.OnCountRolling(currentValue, newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnCountIncrement(ulong currentValue, ulong newValue)
|
|
||||||
{
|
|
||||||
ScheduledPopOutCurrentId++;
|
|
||||||
|
|
||||||
if (DisplayedCount < currentValue)
|
|
||||||
DisplayedCount++;
|
|
||||||
|
|
||||||
DisplayedCountSpriteText.Show();
|
|
||||||
|
|
||||||
TransformPopOut(newValue);
|
|
||||||
|
|
||||||
uint newTaskId = ScheduledPopOutCurrentId;
|
|
||||||
Scheduler.AddDelayed(delegate
|
|
||||||
{
|
|
||||||
ScheduledPopOutSmall(newTaskId);
|
|
||||||
}, PopOutDuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnCountChange(ulong currentValue, ulong newValue)
|
|
||||||
{
|
|
||||||
ScheduledPopOutCurrentId++;
|
|
||||||
|
|
||||||
if (newValue == 0)
|
|
||||||
DisplayedCountSpriteText.FadeOut();
|
|
||||||
|
|
||||||
base.OnCountChange(currentValue, newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnDisplayedCountRolling(ulong currentValue, ulong newValue)
|
|
||||||
{
|
|
||||||
if (newValue == 0)
|
|
||||||
DisplayedCountSpriteText.FadeOut(FadeOutDuration);
|
|
||||||
else
|
|
||||||
DisplayedCountSpriteText.Show();
|
|
||||||
|
|
||||||
if (CanPopOutWhileRolling)
|
|
||||||
TransformPopOutRolling(newValue);
|
|
||||||
else
|
|
||||||
TransformNoPopOut(newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnDisplayedCountChange(ulong newValue)
|
|
||||||
{
|
|
||||||
DisplayedCountSpriteText.FadeTo(newValue == 0 ? 0 : 1);
|
|
||||||
|
|
||||||
TransformNoPopOut(newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnDisplayedCountIncrement(ulong newValue)
|
|
||||||
{
|
|
||||||
DisplayedCountSpriteText.Show();
|
|
||||||
|
|
||||||
TransformPopOutSmall(newValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -74,7 +74,6 @@
|
|||||||
<Compile Include="OsuDifficultyCalculator.cs" />
|
<Compile Include="OsuDifficultyCalculator.cs" />
|
||||||
<Compile Include="OsuScore.cs" />
|
<Compile Include="OsuScore.cs" />
|
||||||
<Compile Include="OsuScoreProcessor.cs" />
|
<Compile Include="OsuScoreProcessor.cs" />
|
||||||
<Compile Include="UI\OsuComboCounter.cs" />
|
|
||||||
<Compile Include="UI\OsuHitRenderer.cs" />
|
<Compile Include="UI\OsuHitRenderer.cs" />
|
||||||
<Compile Include="UI\OsuPlayfield.cs" />
|
<Compile Include="UI\OsuPlayfield.cs" />
|
||||||
<Compile Include="OsuRuleset.cs" />
|
<Compile Include="OsuRuleset.cs" />
|
||||||
@ -85,7 +84,6 @@
|
|||||||
<Compile Include="Objects\Slider.cs" />
|
<Compile Include="Objects\Slider.cs" />
|
||||||
<Compile Include="Objects\Spinner.cs" />
|
<Compile Include="Objects\Spinner.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="UI\OsuScoreOverlay.cs" />
|
|
||||||
<Compile Include="OsuMod.cs" />
|
<Compile Include="OsuMod.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
15
osu.Game.Modes.Taiko/Objects/DrumHit.cs
Normal file
15
osu.Game.Modes.Taiko/Objects/DrumHit.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// 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 System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Taiko.Objects
|
||||||
|
{
|
||||||
|
class DrumHit
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -1,20 +1,19 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK.Input;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using osu.Game.Modes.Osu.UI;
|
|
||||||
using osu.Game.Modes.Taiko.UI;
|
using osu.Game.Modes.Taiko.UI;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Taiko
|
namespace osu.Game.Modes.Taiko
|
||||||
{
|
{
|
||||||
public class TaikoRuleset : Ruleset
|
public class TaikoRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay();
|
|
||||||
|
|
||||||
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new TaikoHitRenderer
|
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new TaikoHitRenderer
|
||||||
{
|
{
|
||||||
Beatmap = beatmap,
|
Beatmap = beatmap,
|
||||||
@ -81,6 +80,14 @@ namespace osu.Game.Modes.Taiko
|
|||||||
|
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o;
|
public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o;
|
||||||
|
|
||||||
|
public override KeyCounter[] GameplayKeys => new KeyCounter[]
|
||||||
|
{
|
||||||
|
new KeyCounterKeyboard(Key.D),
|
||||||
|
new KeyCounterKeyboard(Key.F),
|
||||||
|
new KeyCounterKeyboard(Key.J),
|
||||||
|
new KeyCounterKeyboard(Key.K)
|
||||||
|
};
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
|
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
|
||||||
|
|
||||||
public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser();
|
public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser();
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Objects\DrumHit.cs" />
|
||||||
<Compile Include="TaikoDifficultyCalculator.cs" />
|
<Compile Include="TaikoDifficultyCalculator.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableTaikoHit.cs" />
|
<Compile Include="Objects\Drawable\DrawableTaikoHit.cs" />
|
||||||
<Compile Include="Objects\TaikoBaseHit.cs" />
|
<Compile Include="Objects\TaikoBaseHit.cs" />
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Game.Modes.Objects;
|
|
||||||
using osu.Game.Modes.UI;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Modes.Objects;
|
||||||
|
using osu.Game.Modes.UI;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Modes
|
namespace osu.Game.Modes
|
||||||
{
|
{
|
||||||
@ -20,9 +21,9 @@ namespace osu.Game.Modes
|
|||||||
|
|
||||||
public abstract class Ruleset
|
public abstract class Ruleset
|
||||||
{
|
{
|
||||||
private static ConcurrentDictionary<PlayMode, Type> availableRulesets = new ConcurrentDictionary<PlayMode, Type>();
|
public abstract KeyCounter[] GameplayKeys { get; }
|
||||||
|
|
||||||
public abstract ScoreOverlay CreateScoreOverlay();
|
private static ConcurrentDictionary<PlayMode, Type> availableRulesets = new ConcurrentDictionary<PlayMode, Type>();
|
||||||
|
|
||||||
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
|
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
|
||||||
|
|
||||||
|
267
osu.Game/Modes/UI/BaseComboCounter.cs
Normal file
267
osu.Game/Modes/UI/BaseComboCounter.cs
Normal file
@ -0,0 +1,267 @@
|
|||||||
|
// 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.Containers;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Transforms;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.UI
|
||||||
|
{
|
||||||
|
public abstract class BaseComboCounter : Container
|
||||||
|
{
|
||||||
|
public bool IsRolling
|
||||||
|
{
|
||||||
|
get; protected set;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SpriteText PopOutCount;
|
||||||
|
|
||||||
|
protected virtual double PopOutDuration => 150;
|
||||||
|
protected virtual float PopOutScale => 2.0f;
|
||||||
|
protected virtual EasingTypes PopOutEasing => EasingTypes.None;
|
||||||
|
protected virtual float PopOutInitialAlpha => 0.75f;
|
||||||
|
|
||||||
|
protected virtual double FadeOutDuration => 100;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Duration in milliseconds for the counter roll-up animation for each element.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual double RollingDuration => 20;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Easing for the counter rollover animation.
|
||||||
|
/// </summary>
|
||||||
|
protected EasingTypes RollingEasing => EasingTypes.None;
|
||||||
|
|
||||||
|
private ulong displayedCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Value shown at the current moment.
|
||||||
|
/// </summary>
|
||||||
|
public virtual ulong DisplayedCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return displayedCount;
|
||||||
|
}
|
||||||
|
protected set
|
||||||
|
{
|
||||||
|
if (displayedCount.Equals(value))
|
||||||
|
return;
|
||||||
|
updateDisplayedCount(displayedCount, value, IsRolling);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ulong count;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Actual value of counter.
|
||||||
|
/// </summary>
|
||||||
|
public virtual ulong Count
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
updateCount(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Increment(ulong amount = 1)
|
||||||
|
{
|
||||||
|
Count = Count + amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SpriteText DisplayedCountSpriteText;
|
||||||
|
|
||||||
|
private float textSize;
|
||||||
|
public float TextSize
|
||||||
|
{
|
||||||
|
get { return textSize; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
textSize = value;
|
||||||
|
DisplayedCountSpriteText.TextSize = TextSize;
|
||||||
|
PopOutCount.TextSize = TextSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Base of all combo counters.
|
||||||
|
/// </summary>
|
||||||
|
protected BaseComboCounter()
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
DisplayedCountSpriteText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Alpha = 0,
|
||||||
|
},
|
||||||
|
PopOutCount = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Alpha = 0,
|
||||||
|
Margin = new MarginPadding(0.05f),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TextSize = 80;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
DisplayedCountSpriteText.Text = FormatCount(Count);
|
||||||
|
DisplayedCountSpriteText.Anchor = Anchor;
|
||||||
|
DisplayedCountSpriteText.Origin = Origin;
|
||||||
|
|
||||||
|
StopRolling();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stops rollover animation, forcing the displayed count to be the actual count.
|
||||||
|
/// </summary>
|
||||||
|
public void StopRolling()
|
||||||
|
{
|
||||||
|
updateCount(Count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Animates roll-up/roll-back to an specific value.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newValue">Target value.</param>
|
||||||
|
public virtual void Roll(ulong newValue = 0)
|
||||||
|
{
|
||||||
|
updateCount(newValue, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets count to default value.
|
||||||
|
/// </summary>
|
||||||
|
public virtual void ResetCount()
|
||||||
|
{
|
||||||
|
updateCount(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual string FormatCount(ulong count)
|
||||||
|
{
|
||||||
|
return count.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void OnDisplayedCountRolling(ulong currentValue, ulong newValue);
|
||||||
|
protected abstract void OnDisplayedCountIncrement(ulong newValue);
|
||||||
|
protected abstract void OnDisplayedCountChange(ulong newValue);
|
||||||
|
|
||||||
|
protected virtual void OnCountRolling(ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
transformRoll(new TransformComboRoll(), currentValue, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnCountIncrement(ulong currentValue, ulong newValue) {
|
||||||
|
DisplayedCount = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnCountChange(ulong currentValue, ulong newValue) {
|
||||||
|
DisplayedCount = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double getProportionalDuration(ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
double difference = currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
||||||
|
return difference * RollingDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateDisplayedCount(ulong currentValue, ulong newValue, bool rolling)
|
||||||
|
{
|
||||||
|
displayedCount = newValue;
|
||||||
|
if (rolling)
|
||||||
|
OnDisplayedCountRolling(currentValue, newValue);
|
||||||
|
else if (currentValue + 1 == newValue)
|
||||||
|
OnDisplayedCountIncrement(newValue);
|
||||||
|
else
|
||||||
|
OnDisplayedCountChange(newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCount(ulong value, bool rolling = false)
|
||||||
|
{
|
||||||
|
ulong prevCount = count;
|
||||||
|
count = value;
|
||||||
|
|
||||||
|
if (!IsLoaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!rolling)
|
||||||
|
{
|
||||||
|
Flush(false, typeof(TransformComboRoll));
|
||||||
|
IsRolling = false;
|
||||||
|
DisplayedCount = prevCount;
|
||||||
|
|
||||||
|
if (prevCount + 1 == count)
|
||||||
|
OnCountIncrement(prevCount, count);
|
||||||
|
else
|
||||||
|
OnCountChange(prevCount, count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OnCountRolling(displayedCount, count);
|
||||||
|
IsRolling = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void transformRoll(TransformComboRoll transform, ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
Flush(false, typeof(TransformComboRoll));
|
||||||
|
|
||||||
|
if (RollingDuration < 1)
|
||||||
|
{
|
||||||
|
DisplayedCount = Count;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
transform.StartTime = Time.Current;
|
||||||
|
transform.EndTime = Time.Current + getProportionalDuration(currentValue, newValue);
|
||||||
|
transform.StartValue = currentValue;
|
||||||
|
transform.EndValue = newValue;
|
||||||
|
transform.Easing = RollingEasing;
|
||||||
|
|
||||||
|
Transforms.Add(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class TransformComboRoll : Transform<ulong>
|
||||||
|
{
|
||||||
|
protected override ulong CurrentValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
double time = Time?.Current ?? 0;
|
||||||
|
if (time < StartTime) return StartValue;
|
||||||
|
if (time >= EndTime) return EndValue;
|
||||||
|
|
||||||
|
return (ulong)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Apply(Drawable d)
|
||||||
|
{
|
||||||
|
base.Apply(d);
|
||||||
|
((BaseComboCounter)d).DisplayedCount = CurrentValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Set(ulong value)
|
||||||
|
{
|
||||||
|
if (value == 0)
|
||||||
|
Roll();
|
||||||
|
else
|
||||||
|
Count = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,267 +1,140 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
using OpenTK;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Transforms;
|
|
||||||
using osu.Framework.MathUtils;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
|
|
||||||
namespace osu.Game.Modes.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
public abstract class ComboCounter : Container
|
|
||||||
{
|
|
||||||
public bool IsRolling
|
|
||||||
{
|
|
||||||
get; protected set;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected SpriteText PopOutCount;
|
|
||||||
|
|
||||||
protected virtual double PopOutDuration => 150;
|
|
||||||
protected virtual float PopOutScale => 2.0f;
|
|
||||||
protected virtual EasingTypes PopOutEasing => EasingTypes.None;
|
|
||||||
protected virtual float PopOutInitialAlpha => 0.75f;
|
|
||||||
|
|
||||||
protected virtual double FadeOutDuration => 100;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Duration in milliseconds for the counter roll-up animation for each element.
|
/// Uses the 'x' symbol and has a pop-out effect while rolling over.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual double RollingDuration => 20;
|
public class ComboCounter : BaseComboCounter
|
||||||
|
{
|
||||||
|
protected uint ScheduledPopOutCurrentId;
|
||||||
|
|
||||||
/// <summary>
|
protected virtual float PopOutSmallScale => 1.1f;
|
||||||
/// Easing for the counter rollover animation.
|
protected virtual bool CanPopOutWhileRolling => false;
|
||||||
/// </summary>
|
|
||||||
protected EasingTypes RollingEasing => EasingTypes.None;
|
|
||||||
|
|
||||||
private ulong displayedCount;
|
public new Vector2 PopOutScale = new Vector2(1.6f);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Value shown at the current moment.
|
|
||||||
/// </summary>
|
|
||||||
public virtual ulong DisplayedCount
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return displayedCount;
|
|
||||||
}
|
|
||||||
protected set
|
|
||||||
{
|
|
||||||
if (displayedCount.Equals(value))
|
|
||||||
return;
|
|
||||||
updateDisplayedCount(displayedCount, value, IsRolling);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ulong count;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Actual value of counter.
|
|
||||||
/// </summary>
|
|
||||||
public virtual ulong Count
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
updateCount(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Increment(ulong amount = 1)
|
|
||||||
{
|
|
||||||
Count = Count + amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected SpriteText DisplayedCountSpriteText;
|
|
||||||
|
|
||||||
private float textSize;
|
|
||||||
public float TextSize
|
|
||||||
{
|
|
||||||
get { return textSize; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
textSize = value;
|
|
||||||
DisplayedCountSpriteText.TextSize = TextSize;
|
|
||||||
PopOutCount.TextSize = TextSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Base of all combo counters.
|
|
||||||
/// </summary>
|
|
||||||
protected ComboCounter()
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
DisplayedCountSpriteText = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Alpha = 0,
|
|
||||||
},
|
|
||||||
PopOutCount = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Alpha = 0,
|
|
||||||
Margin = new MarginPadding(0.05f),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
TextSize = 80;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
DisplayedCountSpriteText.Text = FormatCount(Count);
|
PopOutCount.Origin = Origin;
|
||||||
DisplayedCountSpriteText.Anchor = Anchor;
|
PopOutCount.Anchor = Anchor;
|
||||||
DisplayedCountSpriteText.Origin = Origin;
|
|
||||||
|
|
||||||
StopRolling();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override string FormatCount(ulong count)
|
||||||
/// Stops rollover animation, forcing the displayed count to be the actual count.
|
|
||||||
/// </summary>
|
|
||||||
public void StopRolling()
|
|
||||||
{
|
{
|
||||||
updateCount(Count);
|
return $@"{count}x";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected virtual void TransformPopOut(ulong newValue)
|
||||||
/// Animates roll-up/roll-back to an specific value.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="newValue">Target value.</param>
|
|
||||||
public virtual void Roll(ulong newValue = 0)
|
|
||||||
{
|
{
|
||||||
updateCount(newValue, true);
|
PopOutCount.Text = FormatCount(newValue);
|
||||||
|
|
||||||
|
PopOutCount.ScaleTo(PopOutScale);
|
||||||
|
PopOutCount.FadeTo(PopOutInitialAlpha);
|
||||||
|
PopOutCount.MoveTo(Vector2.Zero);
|
||||||
|
|
||||||
|
PopOutCount.ScaleTo(1, PopOutDuration, PopOutEasing);
|
||||||
|
PopOutCount.FadeOut(PopOutDuration, PopOutEasing);
|
||||||
|
PopOutCount.MoveTo(DisplayedCountSpriteText.Position, PopOutDuration, PopOutEasing);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected virtual void TransformPopOutRolling(ulong newValue)
|
||||||
/// Resets count to default value.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void ResetCount()
|
|
||||||
{
|
{
|
||||||
updateCount(0);
|
TransformPopOut(newValue);
|
||||||
|
TransformPopOutSmall(newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual string FormatCount(ulong count)
|
protected virtual void TransformNoPopOut(ulong newValue)
|
||||||
{
|
{
|
||||||
return count.ToString();
|
DisplayedCountSpriteText.Text = FormatCount(newValue);
|
||||||
|
DisplayedCountSpriteText.ScaleTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void OnDisplayedCountRolling(ulong currentValue, ulong newValue);
|
protected virtual void TransformPopOutSmall(ulong newValue)
|
||||||
protected abstract void OnDisplayedCountIncrement(ulong newValue);
|
|
||||||
protected abstract void OnDisplayedCountChange(ulong newValue);
|
|
||||||
|
|
||||||
protected virtual void OnCountRolling(ulong currentValue, ulong newValue)
|
|
||||||
{
|
{
|
||||||
transformRoll(new TransformComboRoll(), currentValue, newValue);
|
DisplayedCountSpriteText.Text = FormatCount(newValue);
|
||||||
|
DisplayedCountSpriteText.ScaleTo(PopOutSmallScale);
|
||||||
|
DisplayedCountSpriteText.ScaleTo(1, PopOutDuration, PopOutEasing);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnCountIncrement(ulong currentValue, ulong newValue) {
|
protected virtual void ScheduledPopOutSmall(uint id)
|
||||||
DisplayedCount = newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnCountChange(ulong currentValue, ulong newValue) {
|
|
||||||
DisplayedCount = newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double getProportionalDuration(ulong currentValue, ulong newValue)
|
|
||||||
{
|
{
|
||||||
double difference = currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
// Too late; scheduled task invalidated
|
||||||
return difference * RollingDuration;
|
if (id != ScheduledPopOutCurrentId)
|
||||||
}
|
|
||||||
|
|
||||||
private void updateDisplayedCount(ulong currentValue, ulong newValue, bool rolling)
|
|
||||||
{
|
|
||||||
displayedCount = newValue;
|
|
||||||
if (rolling)
|
|
||||||
OnDisplayedCountRolling(currentValue, newValue);
|
|
||||||
else if (currentValue + 1 == newValue)
|
|
||||||
OnDisplayedCountIncrement(newValue);
|
|
||||||
else
|
|
||||||
OnDisplayedCountChange(newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateCount(ulong value, bool rolling = false)
|
|
||||||
{
|
|
||||||
ulong prevCount = count;
|
|
||||||
count = value;
|
|
||||||
|
|
||||||
if (!IsLoaded)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!rolling)
|
DisplayedCount++;
|
||||||
{
|
}
|
||||||
Flush(false, typeof(TransformComboRoll));
|
|
||||||
IsRolling = false;
|
|
||||||
DisplayedCount = prevCount;
|
|
||||||
|
|
||||||
if (prevCount + 1 == count)
|
protected override void OnCountRolling(ulong currentValue, ulong newValue)
|
||||||
OnCountIncrement(prevCount, count);
|
{
|
||||||
|
ScheduledPopOutCurrentId++;
|
||||||
|
|
||||||
|
// Hides displayed count if was increasing from 0 to 1 but didn't finish
|
||||||
|
if (currentValue == 0 && newValue == 0)
|
||||||
|
DisplayedCountSpriteText.FadeOut(FadeOutDuration);
|
||||||
|
|
||||||
|
base.OnCountRolling(currentValue, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCountIncrement(ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
ScheduledPopOutCurrentId++;
|
||||||
|
|
||||||
|
if (DisplayedCount < currentValue)
|
||||||
|
DisplayedCount++;
|
||||||
|
|
||||||
|
DisplayedCountSpriteText.Show();
|
||||||
|
|
||||||
|
TransformPopOut(newValue);
|
||||||
|
|
||||||
|
uint newTaskId = ScheduledPopOutCurrentId;
|
||||||
|
Scheduler.AddDelayed(delegate
|
||||||
|
{
|
||||||
|
ScheduledPopOutSmall(newTaskId);
|
||||||
|
}, PopOutDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCountChange(ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
ScheduledPopOutCurrentId++;
|
||||||
|
|
||||||
|
if (newValue == 0)
|
||||||
|
DisplayedCountSpriteText.FadeOut();
|
||||||
|
|
||||||
|
base.OnCountChange(currentValue, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDisplayedCountRolling(ulong currentValue, ulong newValue)
|
||||||
|
{
|
||||||
|
if (newValue == 0)
|
||||||
|
DisplayedCountSpriteText.FadeOut(FadeOutDuration);
|
||||||
else
|
else
|
||||||
OnCountChange(prevCount, count);
|
DisplayedCountSpriteText.Show();
|
||||||
}
|
|
||||||
|
if (CanPopOutWhileRolling)
|
||||||
|
TransformPopOutRolling(newValue);
|
||||||
else
|
else
|
||||||
{
|
TransformNoPopOut(newValue);
|
||||||
OnCountRolling(displayedCount, count);
|
|
||||||
IsRolling = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void transformRoll(TransformComboRoll transform, ulong currentValue, ulong newValue)
|
protected override void OnDisplayedCountChange(ulong newValue)
|
||||||
{
|
{
|
||||||
Flush(false, typeof(TransformComboRoll));
|
DisplayedCountSpriteText.FadeTo(newValue == 0 ? 0 : 1);
|
||||||
|
|
||||||
if (RollingDuration < 1)
|
TransformNoPopOut(newValue);
|
||||||
{
|
|
||||||
DisplayedCount = Count;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
transform.StartTime = Time.Current;
|
protected override void OnDisplayedCountIncrement(ulong newValue)
|
||||||
transform.EndTime = Time.Current + getProportionalDuration(currentValue, newValue);
|
|
||||||
transform.StartValue = currentValue;
|
|
||||||
transform.EndValue = newValue;
|
|
||||||
transform.Easing = RollingEasing;
|
|
||||||
|
|
||||||
Transforms.Add(transform);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected class TransformComboRoll : Transform<ulong>
|
|
||||||
{
|
{
|
||||||
protected override ulong CurrentValue
|
DisplayedCountSpriteText.Show();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
double time = Time?.Current ?? 0;
|
|
||||||
if (time < StartTime) return StartValue;
|
|
||||||
if (time >= EndTime) return EndValue;
|
|
||||||
|
|
||||||
return (ulong)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
|
TransformPopOutSmall(newValue);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Apply(Drawable d)
|
|
||||||
{
|
|
||||||
base.Apply(d);
|
|
||||||
((ComboCounter)d).DisplayedCount = CurrentValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Set(ulong value)
|
|
||||||
{
|
|
||||||
if (value == 0)
|
|
||||||
Roll();
|
|
||||||
else
|
|
||||||
Count = value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using OpenTK;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using OpenTK;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Framework.Allocation;
|
using System;
|
||||||
using osu.Game.Configuration;
|
|
||||||
using osu.Framework.Configuration;
|
|
||||||
|
|
||||||
namespace osu.Game.Modes.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
public abstract class ScoreOverlay : Container
|
internal abstract class HUDOverlay : Container
|
||||||
{
|
{
|
||||||
public KeyCounterCollection KeyCounter;
|
public KeyCounterCollection KeyCounter;
|
||||||
public ComboCounter ComboCounter;
|
public BaseComboCounter ComboCounter;
|
||||||
public ScoreCounter ScoreCounter;
|
public ScoreCounter ScoreCounter;
|
||||||
public PercentageCounter AccuracyCounter;
|
public PercentageCounter AccuracyCounter;
|
||||||
public HealthDisplay HealthDisplay;
|
public HealthDisplay HealthDisplay;
|
||||||
@ -26,8 +26,8 @@ namespace osu.Game.Modes.UI
|
|||||||
|
|
||||||
private Bindable<bool> showKeyCounter;
|
private Bindable<bool> showKeyCounter;
|
||||||
|
|
||||||
protected abstract KeyCounterCollection CreateKeyCounter();
|
protected abstract KeyCounterCollection CreateKeyCounter(KeyCounter[] keyCounters);
|
||||||
protected abstract ComboCounter CreateComboCounter();
|
protected abstract BaseComboCounter CreateComboCounter();
|
||||||
protected abstract PercentageCounter CreateAccuracyCounter();
|
protected abstract PercentageCounter CreateAccuracyCounter();
|
||||||
protected abstract ScoreCounter CreateScoreCounter();
|
protected abstract ScoreCounter CreateScoreCounter();
|
||||||
protected virtual HealthDisplay CreateHealthDisplay() => new HealthDisplay
|
protected virtual HealthDisplay CreateHealthDisplay() => new HealthDisplay
|
||||||
@ -50,12 +50,13 @@ namespace osu.Game.Modes.UI
|
|||||||
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
|
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ScoreOverlay()
|
protected HUDOverlay(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Children = new Drawable[] {
|
Children = new Drawable[]
|
||||||
KeyCounter = CreateKeyCounter(),
|
{
|
||||||
|
KeyCounter = CreateKeyCounter(ruleset.GameplayKeys),
|
||||||
ComboCounter = CreateComboCounter(),
|
ComboCounter = CreateComboCounter(),
|
||||||
ScoreCounter = CreateScoreCounter(),
|
ScoreCounter = CreateScoreCounter(),
|
||||||
AccuracyCounter = CreateAccuracyCounter(),
|
AccuracyCounter = CreateAccuracyCounter(),
|
@ -1,26 +1,21 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osu.Game.Modes.UI;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Input;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Osu.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
public class OsuScoreOverlay : ScoreOverlay
|
internal class StandardHUDOverlay : HUDOverlay
|
||||||
{
|
{
|
||||||
protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
|
public StandardHUDOverlay(Ruleset ruleset)
|
||||||
|
: base(ruleset)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
}
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
TextSize = 40,
|
|
||||||
Position = new Vector2(0, 30),
|
|
||||||
Margin = new MarginPadding { Right = 5 },
|
|
||||||
};
|
|
||||||
|
|
||||||
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter
|
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter
|
||||||
{
|
{
|
||||||
@ -31,26 +26,29 @@ namespace osu.Game.Modes.Osu.UI
|
|||||||
Margin = new MarginPadding { Right = 5 },
|
Margin = new MarginPadding { Right = 5 },
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override ComboCounter CreateComboCounter() => new OsuComboCounter
|
protected override BaseComboCounter CreateComboCounter() => new ComboCounter
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection
|
protected override KeyCounterCollection CreateKeyCounter(KeyCounter[] keyCounters) => new KeyCounterCollection
|
||||||
{
|
{
|
||||||
IsCounting = true,
|
IsCounting = true,
|
||||||
FadeTime = 50,
|
FadeTime = 50,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
Margin = new MarginPadding(10),
|
Margin = new MarginPadding(10),
|
||||||
Children = new KeyCounter[]
|
Children = keyCounters
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
|
||||||
{
|
{
|
||||||
new KeyCounterKeyboard(Key.Z),
|
Anchor = Anchor.TopCentre,
|
||||||
new KeyCounterKeyboard(Key.X),
|
Origin = Anchor.TopCentre,
|
||||||
new KeyCounterMouse(MouseButton.Left),
|
TextSize = 40,
|
||||||
new KeyCounterMouse(MouseButton.Right),
|
Position = new Vector2(0, 30),
|
||||||
}
|
Margin = new MarginPadding { Right = 5 },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,29 +1,29 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Timing;
|
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Game.Modes;
|
|
||||||
using osu.Game.Screens.Backgrounds;
|
|
||||||
using OpenTK;
|
|
||||||
using osu.Framework.Screens;
|
|
||||||
using osu.Game.Modes.UI;
|
|
||||||
using osu.Game.Screens.Ranking;
|
|
||||||
using osu.Game.Configuration;
|
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using OpenTK.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Input.Handlers;
|
using osu.Game.Input.Handlers;
|
||||||
|
using osu.Game.Modes;
|
||||||
|
using osu.Game.Modes.UI;
|
||||||
|
using osu.Game.Screens.Backgrounds;
|
||||||
|
using osu.Game.Screens.Ranking;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ namespace osu.Game.Screens.Play
|
|||||||
private Bindable<int> dimLevel;
|
private Bindable<int> dimLevel;
|
||||||
private SkipButton skipButton;
|
private SkipButton skipButton;
|
||||||
|
|
||||||
private ScoreOverlay scoreOverlay;
|
private HUDOverlay hudOverlay;
|
||||||
private PauseOverlay pauseOverlay;
|
private PauseOverlay pauseOverlay;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -112,8 +112,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
ruleset = Ruleset.GetRuleset(Beatmap.PlayMode);
|
ruleset = Ruleset.GetRuleset(Beatmap.PlayMode);
|
||||||
|
|
||||||
scoreOverlay = ruleset.CreateScoreOverlay();
|
hudOverlay = new StandardHUDOverlay(ruleset);
|
||||||
scoreOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor(beatmap.HitObjects.Count));
|
hudOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor(beatmap.HitObjects.Count));
|
||||||
|
|
||||||
pauseOverlay = new PauseOverlay
|
pauseOverlay = new PauseOverlay
|
||||||
{
|
{
|
||||||
@ -135,7 +135,7 @@ namespace osu.Game.Screens.Play
|
|||||||
hitRenderer.InputManager.ReplayInputHandler = ReplayInputHandler;
|
hitRenderer.InputManager.ReplayInputHandler = ReplayInputHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoreOverlay.BindHitRenderer(hitRenderer);
|
hudOverlay.BindHitRenderer(hitRenderer);
|
||||||
|
|
||||||
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
|
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
|
||||||
hitRenderer.OnJudgement += scoreProcessor.AddJudgement;
|
hitRenderer.OnJudgement += scoreProcessor.AddJudgement;
|
||||||
@ -159,7 +159,7 @@ namespace osu.Game.Screens.Play
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scoreOverlay,
|
hudOverlay,
|
||||||
pauseOverlay
|
pauseOverlay
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -196,7 +196,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (canPause || force)
|
if (canPause || force)
|
||||||
{
|
{
|
||||||
lastPauseActionTime = Time.Current;
|
lastPauseActionTime = Time.Current;
|
||||||
scoreOverlay.KeyCounter.IsCounting = false;
|
hudOverlay.KeyCounter.IsCounting = false;
|
||||||
pauseOverlay.Retries = RestartCount;
|
pauseOverlay.Retries = RestartCount;
|
||||||
pauseOverlay.Show();
|
pauseOverlay.Show();
|
||||||
sourceClock.Stop();
|
sourceClock.Stop();
|
||||||
@ -211,7 +211,7 @@ namespace osu.Game.Screens.Play
|
|||||||
public void Resume()
|
public void Resume()
|
||||||
{
|
{
|
||||||
lastPauseActionTime = Time.Current;
|
lastPauseActionTime = Time.Current;
|
||||||
scoreOverlay.KeyCounter.IsCounting = true;
|
hudOverlay.KeyCounter.IsCounting = true;
|
||||||
pauseOverlay.Hide();
|
pauseOverlay.Hide();
|
||||||
sourceClock.Start();
|
sourceClock.Start();
|
||||||
IsPaused = false;
|
IsPaused = false;
|
||||||
|
@ -167,6 +167,8 @@
|
|||||||
<Compile Include="Screens\Play\PlayerInputManager.cs" />
|
<Compile Include="Screens\Play\PlayerInputManager.cs" />
|
||||||
<Compile Include="Screens\Play\PlayerLoader.cs" />
|
<Compile Include="Screens\Play\PlayerLoader.cs" />
|
||||||
<Compile Include="Screens\Play\SkipButton.cs" />
|
<Compile Include="Screens\Play\SkipButton.cs" />
|
||||||
|
<Compile Include="Modes\UI\ComboCounter.cs" />
|
||||||
|
<Compile Include="Modes\UI\StandardHUDOverlay.cs" />
|
||||||
<Compile Include="Screens\Select\CarouselContainer.cs" />
|
<Compile Include="Screens\Select\CarouselContainer.cs" />
|
||||||
<Compile Include="Screens\Select\MatchSongSelect.cs" />
|
<Compile Include="Screens\Select\MatchSongSelect.cs" />
|
||||||
<Compile Include="Screens\OsuGameScreen.cs" />
|
<Compile Include="Screens\OsuGameScreen.cs" />
|
||||||
@ -181,9 +183,9 @@
|
|||||||
<Compile Include="Screens\Select\PlaySongSelect.cs" />
|
<Compile Include="Screens\Select\PlaySongSelect.cs" />
|
||||||
<Compile Include="Modes\UI\HitRenderer.cs" />
|
<Compile Include="Modes\UI\HitRenderer.cs" />
|
||||||
<Compile Include="Modes\UI\Playfield.cs" />
|
<Compile Include="Modes\UI\Playfield.cs" />
|
||||||
<Compile Include="Modes\UI\ScoreOverlay.cs" />
|
<Compile Include="Modes\UI\HUDOverlay.cs" />
|
||||||
<Compile Include="Screens\Select\EditSongSelect.cs" />
|
<Compile Include="Screens\Select\EditSongSelect.cs" />
|
||||||
<Compile Include="Modes\UI\ComboCounter.cs" />
|
<Compile Include="Modes\UI\BaseComboCounter.cs" />
|
||||||
<Compile Include="Modes\UI\ComboResultCounter.cs" />
|
<Compile Include="Modes\UI\ComboResultCounter.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\RollingCounter.cs" />
|
<Compile Include="Graphics\UserInterface\RollingCounter.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\Volume\VolumeControlReceptor.cs" />
|
<Compile Include="Graphics\UserInterface\Volume\VolumeControlReceptor.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user