1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Merge remote-tracking branch 'origin/master' into refactor_hitrenderer

Conflicts:
	osu.Game.Modes.Catch/CatchRuleset.cs
	osu.Game.Modes.Mania/ManiaRuleset.cs
	osu.Game.Modes.Osu/OsuRuleset.cs
	osu.Game.Modes.Taiko/TaikoRuleset.cs
This commit is contained in:
smoogipooo 2017-03-11 14:22:59 +09:00
commit 75ed7406e4
17 changed files with 275 additions and 279 deletions

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.MathUtils;
using osu.Framework.Screens.Testing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Modes.Osu.UI;
using osu.Game.Modes.UI;
namespace osu.Desktop.VisualTests.Tests
@ -35,23 +34,22 @@ namespace osu.Desktop.VisualTests.Tests
};
Add(score);
ComboCounter standardCombo = new OsuComboCounter
ComboCounter comboCounter = new StandardComboCounter
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Margin = new MarginPadding(10),
Count = 0,
TextSize = 40,
};
Add(standardCombo);
Add(comboCounter);
PercentageCounter accuracyCombo = new PercentageCounter
PercentageCounter accuracyCounter = new PercentageCounter
{
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
Position = new Vector2(-20, 60),
};
Add(accuracyCombo);
Add(accuracyCounter);
StarCounter stars = new StarCounter
{
@ -74,26 +72,26 @@ namespace osu.Desktop.VisualTests.Tests
AddButton(@"Reset all", delegate
{
score.Count = 0;
standardCombo.Count = 0;
comboCounter.Current.Value = 0;
numerator = denominator = 0;
accuracyCombo.SetFraction(0, 0);
accuracyCounter.SetFraction(0, 0);
stars.Count = 0;
starsLabel.Text = stars.Count.ToString("0.00");
});
AddButton(@"Hit! :D", delegate
{
score.Count += 300 + (ulong)(300.0 * (standardCombo.Count > 0 ? standardCombo.Count - 1 : 0) / 25.0);
standardCombo.Count++;
score.Count += 300 + (ulong)(300.0 * (comboCounter.Current > 0 ? comboCounter.Current - 1 : 0) / 25.0);
comboCounter.Increment();
numerator++; denominator++;
accuracyCombo.SetFraction(numerator, denominator);
accuracyCounter.SetFraction(numerator, denominator);
});
AddButton(@"miss...", delegate
{
standardCombo.Roll();
comboCounter.Current.Value = 0;
denominator++;
accuracyCombo.SetFraction(numerator, denominator);
accuracyCounter.SetFraction(numerator, denominator);
});
AddButton(@"Alter stars", delegate
@ -105,8 +103,8 @@ namespace osu.Desktop.VisualTests.Tests
AddButton(@"Stop counters", delegate
{
score.StopRolling();
standardCombo.StopRolling();
accuracyCombo.StopRolling();
comboCounter.StopRolling();
accuracyCounter.StopRolling();
stars.StopAnimation();
});
}

View File

@ -1,20 +1,19 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Modes.Catch.UI;
using osu.Game.Modes.Objects;
using osu.Game.Modes.Osu.UI;
using osu.Game.Modes.UI;
using osu.Game.Screens.Play;
using System.Collections.Generic;
namespace osu.Game.Modes.Catch
{
public class CatchRuleset : Ruleset
{
public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay();
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new CatchHitRenderer(beatmap);
public override IEnumerable<Mod> GetModsFor(ModType type)
@ -80,6 +79,13 @@ namespace osu.Game.Modes.Catch
public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o;
public override IEnumerable<KeyCounter> CreateGameplayKeys() => new KeyCounter[]
{
new KeyCounterKeyboard(Key.ShiftLeft),
new KeyCounterMouse(MouseButton.Left),
new KeyCounterMouse(MouseButton.Right)
};
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser();

View File

@ -5,16 +5,14 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Modes.Mania.UI;
using osu.Game.Modes.Objects;
using osu.Game.Modes.Osu.UI;
using osu.Game.Modes.UI;
using osu.Game.Screens.Play;
using System.Collections.Generic;
namespace osu.Game.Modes.Mania
{
public class ManiaRuleset : Ruleset
{
public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay();
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new ManiaHitRenderer(beatmap);
public override IEnumerable<Mod> GetModsFor(ModType type)
@ -101,6 +99,8 @@ namespace osu.Game.Modes.Mania
public override FontAwesome Icon => FontAwesome.fa_osu_mania_o;
public override IEnumerable<KeyCounter> CreateGameplayKeys() => new KeyCounter[] { /* Todo: Should be keymod specific */ };
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser();

View File

@ -1,12 +1,14 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Modes.Objects;
using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.Osu.UI;
using osu.Game.Modes.UI;
using osu.Game.Screens.Play;
using System.Collections.Generic;
using System.Linq;
@ -14,8 +16,6 @@ namespace osu.Game.Modes.Osu
{
public class OsuRuleset : Ruleset
{
public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay();
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new OsuHitRenderer(beatmap);
public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new[]
@ -110,5 +110,13 @@ namespace osu.Game.Modes.Osu
protected override PlayMode PlayMode => PlayMode.Osu;
public override string Description => "osu!";
public override IEnumerable<KeyCounter> CreateGameplayKeys() => new KeyCounter[]
{
new KeyCounterKeyboard(Key.Z),
new KeyCounterKeyboard(Key.X),
new KeyCounterMouse(MouseButton.Left),
new KeyCounterMouse(MouseButton.Right)
};
}
}

View File

@ -74,7 +74,6 @@
<Compile Include="OsuDifficultyCalculator.cs" />
<Compile Include="OsuScore.cs" />
<Compile Include="OsuScoreProcessor.cs" />
<Compile Include="UI\OsuComboCounter.cs" />
<Compile Include="UI\OsuHitRenderer.cs" />
<Compile Include="UI\OsuPlayfield.cs" />
<Compile Include="OsuRuleset.cs" />
@ -85,7 +84,6 @@
<Compile Include="Objects\Slider.cs" />
<Compile Include="Objects\Spinner.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UI\OsuScoreOverlay.cs" />
<Compile Include="OsuMod.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -1,20 +1,19 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
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.Screens.Play;
using System.Collections.Generic;
namespace osu.Game.Modes.Taiko
{
public class TaikoRuleset : Ruleset
{
public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay();
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new TaikoHitRenderer(beatmap);
public override IEnumerable<Mod> GetModsFor(ModType type)
@ -80,6 +79,14 @@ namespace osu.Game.Modes.Taiko
public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o;
public override IEnumerable<KeyCounter> CreateGameplayKeys() => 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 HitObjectParser CreateHitObjectParser() => new NullHitObjectParser();

View File

@ -1,13 +1,14 @@
// 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.Modes.Objects;
using osu.Game.Modes.UI;
using System;
using System.Collections.Concurrent;
using osu.Game.Beatmaps;
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
{
@ -24,8 +25,6 @@ namespace osu.Game.Modes
public static IEnumerable<PlayMode> PlayModes => availableRulesets.Keys;
public abstract ScoreOverlay CreateScoreOverlay();
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
public abstract IEnumerable<Mod> GetModsFor(ModType type);
@ -46,6 +45,8 @@ namespace osu.Game.Modes
public abstract string Description { get; }
public abstract IEnumerable<KeyCounter> CreateGameplayKeys();
public virtual Score CreateAutoplayScore(Beatmap beatmap) => null;
public static Ruleset GetRuleset(PlayMode mode)

View File

@ -9,9 +9,9 @@ namespace osu.Game.Modes
{
public double TotalScore { get; set; }
public double Accuracy { get; set; }
public double Combo { get; set; }
public double MaxCombo { get; set; }
public double Health { get; set; }
public int MaxCombo { get; set; }
public int Combo { get; set; }
public Replay Replay;
public BeatmapInfo Beatmap;

View File

@ -1,10 +1,10 @@
// 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 osu.Framework.Configuration;
using osu.Game.Modes.Objects.Drawables;
using System;
using System.Collections.Generic;
namespace osu.Game.Modes
{

View File

@ -1,6 +1,7 @@
// 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.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
@ -13,10 +14,12 @@ namespace osu.Game.Modes.UI
{
public abstract class ComboCounter : Container
{
public bool IsRolling
public BindableInt Current = new BindableInt
{
get; protected set;
}
MinValue = 0,
};
public bool IsRolling { get; protected set; }
protected SpriteText PopOutCount;
@ -37,60 +40,9 @@ namespace osu.Game.Modes.UI
/// </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;
}
}
private int previousValue;
/// <summary>
/// Base of all combo counters.
@ -113,73 +65,97 @@ namespace osu.Game.Modes.UI
};
TextSize = 80;
Current.ValueChanged += comboChanged;
}
private void comboChanged(object sender, System.EventArgs e)
{
updateCount(Current.Value == 0);
}
protected override void LoadComplete()
{
base.LoadComplete();
DisplayedCountSpriteText.Text = FormatCount(Count);
DisplayedCountSpriteText.Text = FormatCount(Current);
DisplayedCountSpriteText.Anchor = Anchor;
DisplayedCountSpriteText.Origin = Origin;
StopRolling();
}
private int displayedCount;
/// <summary>
/// Value shown at the current moment.
/// </summary>
public virtual int DisplayedCount
{
get { return displayedCount; }
protected set
{
if (displayedCount.Equals(value))
return;
updateDisplayedCount(displayedCount, value, IsRolling);
}
}
private float textSize;
public float TextSize
{
get { return textSize; }
set
{
textSize = value;
DisplayedCountSpriteText.TextSize = TextSize;
PopOutCount.TextSize = TextSize;
}
}
/// <summary>
/// Increments the combo by an amount.
/// </summary>
/// <param name="amount"></param>
public void Increment(int amount = 1)
{
Current.Value = Current + amount;
}
/// <summary>
/// Stops rollover animation, forcing the displayed count to be the actual count.
/// </summary>
public void StopRolling()
{
updateCount(Count);
updateCount(false);
}
/// <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)
protected virtual string FormatCount(int 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)
protected virtual void OnCountRolling(int currentValue, int newValue)
{
transformRoll(new TransformComboRoll(), currentValue, newValue);
}
protected virtual void OnCountIncrement(ulong currentValue, ulong newValue) {
protected virtual void OnCountIncrement(int currentValue, int newValue)
{
DisplayedCount = newValue;
}
protected virtual void OnCountChange(ulong currentValue, ulong newValue) {
protected virtual void OnCountChange(int currentValue, int newValue)
{
DisplayedCount = newValue;
}
private double getProportionalDuration(ulong currentValue, ulong newValue)
private double getProportionalDuration(int currentValue, int newValue)
{
double difference = currentValue > newValue ? currentValue - newValue : newValue - currentValue;
return difference * RollingDuration;
}
private void updateDisplayedCount(ulong currentValue, ulong newValue, bool rolling)
private void updateDisplayedCount(int currentValue, int newValue, bool rolling)
{
displayedCount = newValue;
if (rolling)
@ -190,10 +166,10 @@ namespace osu.Game.Modes.UI
OnDisplayedCountChange(newValue);
}
private void updateCount(ulong value, bool rolling = false)
private void updateCount(bool rolling)
{
ulong prevCount = count;
count = value;
int prev = previousValue;
previousValue = Current;
if (!IsLoaded)
return;
@ -202,27 +178,27 @@ namespace osu.Game.Modes.UI
{
Flush(false, typeof(TransformComboRoll));
IsRolling = false;
DisplayedCount = prevCount;
DisplayedCount = prev;
if (prevCount + 1 == count)
OnCountIncrement(prevCount, count);
if (prev + 1 == Current)
OnCountIncrement(prev, Current);
else
OnCountChange(prevCount, count);
OnCountChange(prev, Current);
}
else
{
OnCountRolling(displayedCount, count);
OnCountRolling(displayedCount, Current);
IsRolling = true;
}
}
private void transformRoll(TransformComboRoll transform, ulong currentValue, ulong newValue)
private void transformRoll(TransformComboRoll transform, int currentValue, int newValue)
{
Flush(false, typeof(TransformComboRoll));
if (RollingDuration < 1)
{
DisplayedCount = Count;
DisplayedCount = Current;
return;
}
@ -235,9 +211,9 @@ namespace osu.Game.Modes.UI
Transforms.Add(transform);
}
protected class TransformComboRoll : Transform<ulong>
protected class TransformComboRoll : Transform<int>
{
protected override ulong CurrentValue
protected override int CurrentValue
{
get
{
@ -245,7 +221,7 @@ namespace osu.Game.Modes.UI
if (time < StartTime) return StartValue;
if (time >= EndTime) return EndValue;
return (ulong)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
return (int)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
}
}
@ -256,12 +232,8 @@ namespace osu.Game.Modes.UI
}
}
public void Set(ulong value)
{
if (value == 0)
Roll();
else
Count = value;
}
protected abstract void OnDisplayedCountRolling(int currentValue, int newValue);
protected abstract void OnDisplayedCountIncrement(int newValue);
protected abstract void OnDisplayedCountChange(int newValue);
}
}

View File

@ -1,72 +1,24 @@
// 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.Configuration;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;
using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Modes.UI
{
public class HealthDisplay : Container
public abstract class HealthDisplay : Container
{
private Container fill;
public BindableDouble Current = new BindableDouble
public readonly BindableDouble Current = new BindableDouble
{
MinValue = 0,
MaxValue = 1
};
public HealthDisplay()
protected HealthDisplay()
{
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
fill = new Container
{
RelativeSizeAxes = Axes.Both,
Scale = new Vector2(0, 1),
Masking = true,
Children = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
}
}
},
};
Current.ValueChanged += current_ValueChanged;
Current.ValueChanged += (s, e) => SetHealth((float)Current);
}
[BackgroundDependencyLoader]
private void laod(OsuColour colours)
{
fill.Colour = colours.BlueLighter;
fill.EdgeEffect = new EdgeEffect
{
Colour = colours.BlueDarker.Opacity(0.6f),
Radius = 8,
Type= EdgeEffectType.Glow
};
}
private void current_ValueChanged(object sender, EventArgs e)
{
fill.ScaleTo(new Vector2((float)Current, 1), 200, EasingTypes.OutQuint);
}
protected abstract void SetHealth(float value);
}
}

View File

@ -1,28 +1,25 @@
// 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.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Modes.Objects;
using OpenTK;
using osu.Framework.Graphics.Primitives;
using osu.Game.Screens.Play;
using osu.Framework.Allocation;
using osu.Game.Configuration;
using osu.Framework.Configuration;
using System;
namespace osu.Game.Modes.UI
{
public abstract class ScoreOverlay : Container
public abstract class HudOverlay : Container
{
public KeyCounterCollection KeyCounter;
public ComboCounter ComboCounter;
public ScoreCounter ScoreCounter;
public PercentageCounter AccuracyCounter;
public HealthDisplay HealthDisplay;
public Score Score { get; set; }
public readonly KeyCounterCollection KeyCounter;
public readonly ComboCounter ComboCounter;
public readonly ScoreCounter ScoreCounter;
public readonly PercentageCounter AccuracyCounter;
public readonly HealthDisplay HealthDisplay;
private Bindable<bool> showKeyCounter;
@ -30,12 +27,7 @@ namespace osu.Game.Modes.UI
protected abstract ComboCounter CreateComboCounter();
protected abstract PercentageCounter CreateAccuracyCounter();
protected abstract ScoreCounter CreateScoreCounter();
protected virtual HealthDisplay CreateHealthDisplay() => new HealthDisplay
{
Size = new Vector2(1, 5),
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding { Top = 20 }
};
protected abstract HealthDisplay CreateHealthDisplay();
public virtual void OnHit(HitObject h)
{
@ -46,15 +38,16 @@ namespace osu.Game.Modes.UI
public virtual void OnMiss(HitObject h)
{
ComboCounter?.Roll();
ComboCounter.Current.Value = 0;
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
}
protected ScoreOverlay()
protected HudOverlay()
{
RelativeSizeAxes = Axes.Both;
Children = new Drawable[] {
Children = new Drawable[]
{
KeyCounter = CreateKeyCounter(),
ComboCounter = CreateComboCounter(),
ScoreCounter = CreateScoreCounter(),
@ -85,7 +78,7 @@ namespace osu.Game.Modes.UI
//TODO: these should be bindable binds, not events!
processor.TotalScore.ValueChanged += delegate { ScoreCounter?.Set((ulong)processor.TotalScore.Value); };
processor.Accuracy.ValueChanged += delegate { AccuracyCounter?.Set((float)processor.Accuracy.Value); };
processor.Combo.ValueChanged += delegate { ComboCounter?.Set((ulong)processor.Combo.Value); };
ComboCounter?.Current.BindTo(processor.Combo);
HealthDisplay?.Current.BindTo(processor.Health);
}

View File

@ -1,15 +1,14 @@
// 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
namespace osu.Game.Modes.UI
{
/// <summary>
/// Uses the 'x' symbol and has a pop-out effect while rolling over. Used in osu! standard.
/// Uses the 'x' symbol and has a pop-out effect while rolling over.
/// </summary>
public class OsuComboCounter : ComboCounter
public class StandardComboCounter : ComboCounter
{
protected uint ScheduledPopOutCurrentId;
@ -26,12 +25,12 @@ namespace osu.Game.Modes.Osu.UI
PopOutCount.Anchor = Anchor;
}
protected override string FormatCount(ulong count)
protected override string FormatCount(int count)
{
return $@"{count}x";
}
protected virtual void TransformPopOut(ulong newValue)
protected virtual void TransformPopOut(int newValue)
{
PopOutCount.Text = FormatCount(newValue);
@ -44,19 +43,19 @@ namespace osu.Game.Modes.Osu.UI
PopOutCount.MoveTo(DisplayedCountSpriteText.Position, PopOutDuration, PopOutEasing);
}
protected virtual void TransformPopOutRolling(ulong newValue)
protected virtual void TransformPopOutRolling(int newValue)
{
TransformPopOut(newValue);
TransformPopOutSmall(newValue);
}
protected virtual void TransformNoPopOut(ulong newValue)
protected virtual void TransformNoPopOut(int newValue)
{
DisplayedCountSpriteText.Text = FormatCount(newValue);
DisplayedCountSpriteText.ScaleTo(1);
}
protected virtual void TransformPopOutSmall(ulong newValue)
protected virtual void TransformPopOutSmall(int newValue)
{
DisplayedCountSpriteText.Text = FormatCount(newValue);
DisplayedCountSpriteText.ScaleTo(PopOutSmallScale);
@ -72,7 +71,7 @@ namespace osu.Game.Modes.Osu.UI
DisplayedCount++;
}
protected override void OnCountRolling(ulong currentValue, ulong newValue)
protected override void OnCountRolling(int currentValue, int newValue)
{
ScheduledPopOutCurrentId++;
@ -83,7 +82,7 @@ namespace osu.Game.Modes.Osu.UI
base.OnCountRolling(currentValue, newValue);
}
protected override void OnCountIncrement(ulong currentValue, ulong newValue)
protected override void OnCountIncrement(int currentValue, int newValue)
{
ScheduledPopOutCurrentId++;
@ -93,7 +92,7 @@ namespace osu.Game.Modes.Osu.UI
DisplayedCountSpriteText.Show();
TransformPopOut(newValue);
uint newTaskId = ScheduledPopOutCurrentId;
Scheduler.AddDelayed(delegate
{
@ -101,7 +100,7 @@ namespace osu.Game.Modes.Osu.UI
}, PopOutDuration);
}
protected override void OnCountChange(ulong currentValue, ulong newValue)
protected override void OnCountChange(int currentValue, int newValue)
{
ScheduledPopOutCurrentId++;
@ -111,7 +110,7 @@ namespace osu.Game.Modes.Osu.UI
base.OnCountChange(currentValue, newValue);
}
protected override void OnDisplayedCountRolling(ulong currentValue, ulong newValue)
protected override void OnDisplayedCountRolling(int currentValue, int newValue)
{
if (newValue == 0)
DisplayedCountSpriteText.FadeOut(FadeOutDuration);
@ -124,14 +123,14 @@ namespace osu.Game.Modes.Osu.UI
TransformNoPopOut(newValue);
}
protected override void OnDisplayedCountChange(ulong newValue)
protected override void OnDisplayedCountChange(int newValue)
{
DisplayedCountSpriteText.FadeTo(newValue == 0 ? 0 : 1);
TransformNoPopOut(newValue);
}
protected override void OnDisplayedCountIncrement(ulong newValue)
protected override void OnDisplayedCountIncrement(int newValue)
{
DisplayedCountSpriteText.Show();

View File

@ -0,0 +1,60 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;
using osu.Game.Graphics;
namespace osu.Game.Modes.UI
{
public class StandardHealthDisplay : HealthDisplay
{
private Container fill;
public StandardHealthDisplay()
{
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
fill = new Container
{
RelativeSizeAxes = Axes.Both,
Scale = new Vector2(0, 1),
Masking = true,
Children = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
}
}
},
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
fill.Colour = colours.BlueLighter;
fill.EdgeEffect = new EdgeEffect
{
Colour = colours.BlueDarker.Opacity(0.6f),
Radius = 8,
Type = EdgeEffectType.Glow
};
}
protected override void SetHealth(float value) => fill.ScaleTo(new Vector2(value, 1), 200, EasingTypes.OutQuint);
}
}

View File

@ -1,27 +1,16 @@
// 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.Game.Graphics.UserInterface;
using osu.Game.Modes.UI;
using OpenTK;
using OpenTK.Input;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Play;
namespace osu.Game.Modes.Osu.UI
namespace osu.Game.Modes.UI
{
public class OsuScoreOverlay : ScoreOverlay
public class StandardHudOverlay : HudOverlay
{
protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextSize = 40,
Position = new Vector2(0, 30),
Margin = new MarginPadding { Right = 5 },
};
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter
{
Anchor = Anchor.TopCentre,
@ -31,12 +20,19 @@ namespace osu.Game.Modes.Osu.UI
Margin = new MarginPadding { Right = 5 },
};
protected override ComboCounter CreateComboCounter() => new OsuComboCounter
protected override ComboCounter CreateComboCounter() => new StandardComboCounter
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
};
protected override HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay
{
Size = new Vector2(1, 5),
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding { Top = 20 }
};
protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection
{
IsCounting = true,
@ -44,13 +40,15 @@ namespace osu.Game.Modes.Osu.UI
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding(10),
Children = new KeyCounter[]
{
new KeyCounterKeyboard(Key.Z),
new KeyCounterKeyboard(Key.X),
new KeyCounterMouse(MouseButton.Left),
new KeyCounterMouse(MouseButton.Right),
}
};
protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
TextSize = 40,
Position = new Vector2(0, 30),
Margin = new MarginPadding { Right = 5 },
};
}
}

View File

@ -1,29 +1,29 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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.Audio;
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 System;
using System.Linq;
using osu.Framework.Extensions.IEnumerableExtensions;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Input;
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.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
{
@ -54,7 +54,7 @@ namespace osu.Game.Screens.Play
private Bindable<int> dimLevel;
private SkipButton skipButton;
private ScoreOverlay scoreOverlay;
private HudOverlay hudOverlay;
private PauseOverlay pauseOverlay;
[BackgroundDependencyLoader]
@ -112,8 +112,9 @@ namespace osu.Game.Screens.Play
ruleset = Ruleset.GetRuleset(Beatmap.PlayMode);
scoreOverlay = ruleset.CreateScoreOverlay();
scoreOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor(beatmap.HitObjects.Count));
hudOverlay = new StandardHudOverlay();
hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys());
hudOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor(beatmap.HitObjects.Count));
pauseOverlay = new PauseOverlay
{
@ -135,7 +136,7 @@ namespace osu.Game.Screens.Play
hitRenderer.InputManager.ReplayInputHandler = ReplayInputHandler;
}
scoreOverlay.BindHitRenderer(hitRenderer);
hudOverlay.BindHitRenderer(hitRenderer);
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
hitRenderer.OnJudgement += scoreProcessor.AddJudgement;
@ -159,7 +160,7 @@ namespace osu.Game.Screens.Play
},
}
},
scoreOverlay,
hudOverlay,
pauseOverlay
};
}
@ -196,7 +197,7 @@ namespace osu.Game.Screens.Play
if (canPause || force)
{
lastPauseActionTime = Time.Current;
scoreOverlay.KeyCounter.IsCounting = false;
hudOverlay.KeyCounter.IsCounting = false;
pauseOverlay.Retries = RestartCount;
pauseOverlay.Show();
sourceClock.Stop();
@ -211,7 +212,7 @@ namespace osu.Game.Screens.Play
public void Resume()
{
lastPauseActionTime = Time.Current;
scoreOverlay.KeyCounter.IsCounting = true;
hudOverlay.KeyCounter.IsCounting = true;
pauseOverlay.Hide();
sourceClock.Start();
IsPaused = false;

View File

@ -97,6 +97,9 @@
<Compile Include="Modes\Score.cs" />
<Compile Include="Modes\ScoreProcesssor.cs" />
<Compile Include="Modes\UI\HealthDisplay.cs" />
<Compile Include="Modes\UI\HudOverlay.cs" />
<Compile Include="Modes\UI\StandardHealthDisplay.cs" />
<Compile Include="Modes\UI\StandardHudOverlay.cs" />
<Compile Include="Online\API\IOnlineComponent.cs" />
<Compile Include="Online\API\Requests\GetUserRequest.cs" />
<Compile Include="Overlays\DragBar.cs" />
@ -167,6 +170,7 @@
<Compile Include="Screens\Play\PlayerInputManager.cs" />
<Compile Include="Screens\Play\PlayerLoader.cs" />
<Compile Include="Screens\Play\SkipButton.cs" />
<Compile Include="Modes\UI\StandardComboCounter.cs" />
<Compile Include="Screens\Select\CarouselContainer.cs" />
<Compile Include="Screens\Select\MatchSongSelect.cs" />
<Compile Include="Screens\OsuGameScreen.cs" />
@ -181,7 +185,6 @@
<Compile Include="Screens\Select\PlaySongSelect.cs" />
<Compile Include="Modes\UI\HitRenderer.cs" />
<Compile Include="Modes\UI\Playfield.cs" />
<Compile Include="Modes\UI\ScoreOverlay.cs" />
<Compile Include="Screens\Select\EditSongSelect.cs" />
<Compile Include="Modes\UI\ComboCounter.cs" />
<Compile Include="Modes\UI\ComboResultCounter.cs" />