mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 19:22:54 +08:00
Merge branch 'general_hud' into counter_bindables
Conflicts: osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs osu.Game/Modes/UI/HUDOverlay.cs
This commit is contained in:
commit
aed89b7c0f
@ -38,7 +38,6 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Margin = new MarginPadding(10),
|
||||
Count = 0,
|
||||
TextSize = 40,
|
||||
};
|
||||
Add(comboCounter);
|
||||
@ -72,7 +71,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
AddButton(@"Reset all", delegate
|
||||
{
|
||||
score.Current.Value = 0;
|
||||
comboCounter.Count = 0;
|
||||
comboCounter.Current.Value = 0;
|
||||
numerator = denominator = 0;
|
||||
accuracyCounter.SetFraction(0, 0);
|
||||
stars.Count = 0;
|
||||
@ -82,14 +81,14 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
AddButton(@"Hit! :D", delegate
|
||||
{
|
||||
score.Current.Value += 300 + (ulong)(300.0 * (comboCounter.Count > 0 ? comboCounter.Count - 1 : 0) / 25.0);
|
||||
comboCounter.Count++;
|
||||
comboCounter.Increment();
|
||||
numerator++; denominator++;
|
||||
accuracyCounter.SetFraction(numerator, denominator);
|
||||
});
|
||||
|
||||
AddButton(@"miss...", delegate
|
||||
{
|
||||
comboCounter.Roll();
|
||||
comboCounter.Current.Value = 0;
|
||||
denominator++;
|
||||
accuracyCounter.SetFraction(numerator, denominator);
|
||||
});
|
||||
|
@ -82,13 +82,15 @@ namespace osu.Game.Modes.Catch
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o;
|
||||
|
||||
|
||||
public override KeyCounter[] CreateGameplayKeys => new KeyCounter[]
|
||||
public override IEnumerable<KeyCounter> CreateGameplayKeys()
|
||||
{
|
||||
new KeyCounterKeyboard(Key.ShiftLeft),
|
||||
new KeyCounterMouse(MouseButton.Left),
|
||||
new KeyCounterMouse(MouseButton.Right)
|
||||
};
|
||||
return new KeyCounter[]
|
||||
{
|
||||
new KeyCounterKeyboard(Key.ShiftLeft),
|
||||
new KeyCounterMouse(MouseButton.Left),
|
||||
new KeyCounterMouse(MouseButton.Right)
|
||||
};
|
||||
}
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
|
||||
|
||||
|
@ -102,7 +102,10 @@ namespace osu.Game.Modes.Mania
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mania_o;
|
||||
|
||||
public override KeyCounter[] CreateGameplayKeys => new KeyCounter[] { /* Todo: Should be keymod specific */ };
|
||||
public override IEnumerable<KeyCounter> CreateGameplayKeys()
|
||||
{
|
||||
return new KeyCounter[] { /* Todo: Should be keymod specific */ };
|
||||
}
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;
|
||||
|
||||
|
@ -113,12 +113,16 @@ namespace osu.Game.Modes.Osu
|
||||
protected override PlayMode PlayMode => PlayMode.Osu;
|
||||
|
||||
public override string Description => "osu!";
|
||||
public override KeyCounter[] CreateGameplayKeys => new KeyCounter[]
|
||||
|
||||
public override IEnumerable<KeyCounter> CreateGameplayKeys()
|
||||
{
|
||||
new KeyCounterKeyboard(Key.Z),
|
||||
new KeyCounterKeyboard(Key.X),
|
||||
new KeyCounterMouse(MouseButton.Left),
|
||||
new KeyCounterMouse(MouseButton.Right)
|
||||
};
|
||||
return new KeyCounter[]
|
||||
{
|
||||
new KeyCounterKeyboard(Key.Z),
|
||||
new KeyCounterKeyboard(Key.X),
|
||||
new KeyCounterMouse(MouseButton.Left),
|
||||
new KeyCounterMouse(MouseButton.Right)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
128
osu.Game.Modes.Osu/OsuRuleset.cs.orig
Normal file
128
osu.Game.Modes.Osu/OsuRuleset.cs.orig
Normal file
@ -0,0 +1,128 @@
|
||||
// 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;
|
||||
|
||||
namespace osu.Game.Modes.Osu
|
||||
{
|
||||
public class OsuRuleset : Ruleset
|
||||
{
|
||||
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new OsuHitRenderer
|
||||
{
|
||||
Beatmap = beatmap,
|
||||
};
|
||||
|
||||
public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new[]
|
||||
{
|
||||
new BeatmapStatistic
|
||||
{
|
||||
Name = @"Circle count",
|
||||
Content = beatmap.Beatmap.HitObjects.Count(h => h is HitCircle).ToString(),
|
||||
Icon = FontAwesome.fa_dot_circle_o
|
||||
},
|
||||
new BeatmapStatistic
|
||||
{
|
||||
Name = @"Slider count",
|
||||
Content = beatmap.Beatmap.HitObjects.Count(h => h is Slider).ToString(),
|
||||
Icon = FontAwesome.fa_circle_o
|
||||
}
|
||||
};
|
||||
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ModType.DifficultyReduction:
|
||||
return new Mod[]
|
||||
{
|
||||
new OsuModEasy(),
|
||||
new OsuModNoFail(),
|
||||
new OsuModHalfTime(),
|
||||
};
|
||||
|
||||
case ModType.DifficultyIncrease:
|
||||
return new Mod[]
|
||||
{
|
||||
new OsuModHardRock(),
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new OsuModSuddenDeath(),
|
||||
new OsuModPerfect(),
|
||||
},
|
||||
},
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new OsuModDoubleTime(),
|
||||
new OsuModNightcore(),
|
||||
},
|
||||
},
|
||||
new OsuModHidden(),
|
||||
new OsuModFlashlight(),
|
||||
};
|
||||
|
||||
case ModType.Special:
|
||||
return new Mod[]
|
||||
{
|
||||
new OsuModRelax(),
|
||||
new OsuModAutopilot(),
|
||||
new OsuModSpunOut(),
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new OsuModAutoplay(),
|
||||
new ModCinema(),
|
||||
},
|
||||
},
|
||||
new OsuModTarget(),
|
||||
};
|
||||
|
||||
default:
|
||||
return new Mod[] { };
|
||||
}
|
||||
}
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_osu_o;
|
||||
|
||||
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => new OsuScoreProcessor(hitObjectCount);
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new OsuDifficultyCalculator(beatmap);
|
||||
|
||||
public override Score CreateAutoplayScore(Beatmap beatmap)
|
||||
{
|
||||
var score = CreateScoreProcessor().GetScore();
|
||||
score.Replay = new OsuAutoReplay(beatmap);
|
||||
return score;
|
||||
}
|
||||
|
||||
protected override PlayMode PlayMode => PlayMode.Osu;
|
||||
|
||||
public override string Description => "osu!";
|
||||
<<<<<<< HEAD
|
||||
public override KeyCounter[] CreateGameplayKeys => new KeyCounter[]
|
||||
=======
|
||||
public override KeyCounter[] GameplayKeys => new KeyCounter[]
|
||||
>>>>>>> combocounter_bindable
|
||||
{
|
||||
new KeyCounterKeyboard(Key.Z),
|
||||
new KeyCounterKeyboard(Key.X),
|
||||
new KeyCounterMouse(MouseButton.Left),
|
||||
new KeyCounterMouse(MouseButton.Right)
|
||||
};
|
||||
}
|
||||
}
|
@ -1,15 +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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects
|
||||
{
|
||||
class DrumHit
|
||||
{
|
||||
}
|
||||
}
|
@ -82,13 +82,16 @@ namespace osu.Game.Modes.Taiko
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o;
|
||||
|
||||
public override KeyCounter[] CreateGameplayKeys => new KeyCounter[]
|
||||
public override IEnumerable<KeyCounter> CreateGameplayKeys()
|
||||
{
|
||||
new KeyCounterKeyboard(Key.D),
|
||||
new KeyCounterKeyboard(Key.F),
|
||||
new KeyCounterKeyboard(Key.J),
|
||||
new KeyCounterKeyboard(Key.K)
|
||||
};
|
||||
return 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;
|
||||
|
||||
|
@ -21,8 +21,6 @@ namespace osu.Game.Modes
|
||||
|
||||
public abstract class Ruleset
|
||||
{
|
||||
public abstract KeyCounter[] CreateGameplayKeys { get; }
|
||||
|
||||
private static ConcurrentDictionary<PlayMode, Type> availableRulesets = new ConcurrentDictionary<PlayMode, Type>();
|
||||
|
||||
public static IEnumerable<PlayMode> PlayModes => availableRulesets.Keys;
|
||||
@ -47,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)
|
||||
|
69
osu.Game/Modes/Ruleset.cs.orig
Normal file
69
osu.Game/Modes/Ruleset.cs.orig
Normal file
@ -0,0 +1,69 @@
|
||||
// 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.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
|
||||
{
|
||||
public class BeatmapStatistic
|
||||
{
|
||||
public FontAwesome Icon;
|
||||
public string Content;
|
||||
public string Name;
|
||||
}
|
||||
|
||||
public abstract class Ruleset
|
||||
{
|
||||
public abstract KeyCounter[] CreateGameplayKeys { get; }
|
||||
|
||||
private static ConcurrentDictionary<PlayMode, Type> availableRulesets = new ConcurrentDictionary<PlayMode, Type>();
|
||||
<<<<<<< HEAD
|
||||
|
||||
public static IEnumerable<PlayMode> PlayModes => availableRulesets.Keys;
|
||||
=======
|
||||
|
||||
public static IEnumerable<PlayMode> PlayModes => availableRulesets.Keys;
|
||||
|
||||
>>>>>>> combocounter_bindable
|
||||
|
||||
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
|
||||
|
||||
public abstract IEnumerable<Mod> GetModsFor(ModType type);
|
||||
|
||||
public abstract ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0);
|
||||
|
||||
public abstract HitRenderer CreateHitRendererWith(Beatmap beatmap);
|
||||
|
||||
public abstract HitObjectParser CreateHitObjectParser();
|
||||
|
||||
public abstract DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap);
|
||||
|
||||
public static void Register(Ruleset ruleset) => availableRulesets.TryAdd(ruleset.PlayMode, ruleset.GetType());
|
||||
|
||||
protected abstract PlayMode PlayMode { get; }
|
||||
|
||||
public virtual FontAwesome Icon => FontAwesome.fa_question_circle;
|
||||
|
||||
public abstract string Description { get; }
|
||||
|
||||
public virtual Score CreateAutoplayScore(Beatmap beatmap) => null;
|
||||
|
||||
public static Ruleset GetRuleset(PlayMode mode)
|
||||
{
|
||||
Type type;
|
||||
|
||||
if (!availableRulesets.TryGetValue(mode, out type))
|
||||
return null;
|
||||
|
||||
return Activator.CreateInstance(type) as Ruleset;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -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 long Combo { get; set; }
|
||||
public long MaxCombo { get; set; }
|
||||
|
||||
public Replay Replay;
|
||||
public BeatmapInfo Beatmap;
|
||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Modes
|
||||
|
||||
public readonly BindableDouble Health = new BindableDouble { MinValue = 0, MaxValue = 1 };
|
||||
|
||||
public readonly BindableInt Combo = new BindableInt();
|
||||
public readonly BindableLong Combo = new BindableLong();
|
||||
|
||||
/// <summary>
|
||||
/// Are we allowed to fail?
|
||||
@ -43,7 +43,7 @@ namespace osu.Game.Modes
|
||||
/// Keeps track of the highest combo ever achieved in this play.
|
||||
/// This is handled automatically by ScoreProcessor.
|
||||
/// </summary>
|
||||
public readonly BindableInt HighestCombo = new BindableInt();
|
||||
public readonly BindableLong HighestCombo = new BindableLong();
|
||||
|
||||
public readonly List<JudgementInfo> Judgements;
|
||||
|
||||
|
@ -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 BindableLong Current = new BindableLong
|
||||
{
|
||||
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 long previousValue;
|
||||
|
||||
/// <summary>
|
||||
/// Base of all combo counters.
|
||||
@ -113,75 +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 long displayedCount;
|
||||
/// <summary>
|
||||
/// Value shown at the current moment.
|
||||
/// </summary>
|
||||
public virtual long 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(long 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(long 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(long currentValue, long newValue)
|
||||
{
|
||||
transformRoll(new TransformComboRoll(), currentValue, newValue);
|
||||
}
|
||||
|
||||
protected virtual void OnCountIncrement(ulong currentValue, ulong newValue)
|
||||
protected virtual void OnCountIncrement(long currentValue, long newValue)
|
||||
{
|
||||
DisplayedCount = newValue;
|
||||
}
|
||||
|
||||
protected virtual void OnCountChange(ulong currentValue, ulong newValue)
|
||||
protected virtual void OnCountChange(long currentValue, long newValue)
|
||||
{
|
||||
DisplayedCount = newValue;
|
||||
}
|
||||
|
||||
private double getProportionalDuration(ulong currentValue, ulong newValue)
|
||||
private double getProportionalDuration(long currentValue, long newValue)
|
||||
{
|
||||
double difference = currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
||||
return difference * RollingDuration;
|
||||
}
|
||||
|
||||
private void updateDisplayedCount(ulong currentValue, ulong newValue, bool rolling)
|
||||
private void updateDisplayedCount(long currentValue, long newValue, bool rolling)
|
||||
{
|
||||
displayedCount = newValue;
|
||||
if (rolling)
|
||||
@ -192,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;
|
||||
long prev = previousValue;
|
||||
previousValue = Current;
|
||||
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
@ -204,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, long currentValue, long newValue)
|
||||
{
|
||||
Flush(false, typeof(TransformComboRoll));
|
||||
|
||||
if (RollingDuration < 1)
|
||||
{
|
||||
DisplayedCount = Count;
|
||||
DisplayedCount = Current;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -237,9 +211,9 @@ namespace osu.Game.Modes.UI
|
||||
Transforms.Add(transform);
|
||||
}
|
||||
|
||||
protected class TransformComboRoll : Transform<ulong>
|
||||
protected class TransformComboRoll : Transform<long>
|
||||
{
|
||||
protected override ulong CurrentValue
|
||||
protected override long CurrentValue
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -247,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 (long)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,12 +232,8 @@ namespace osu.Game.Modes.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void Set(ulong value)
|
||||
{
|
||||
if (value == 0)
|
||||
Roll();
|
||||
else
|
||||
Count = value;
|
||||
}
|
||||
protected abstract void OnDisplayedCountRolling(long currentValue, long newValue);
|
||||
protected abstract void OnDisplayedCountIncrement(long newValue);
|
||||
protected abstract void OnDisplayedCountChange(long newValue);
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Modes.UI
|
||||
{
|
||||
internal abstract class HudOverlay : Container
|
||||
public abstract class HudOverlay : Container
|
||||
{
|
||||
public readonly KeyCounterCollection KeyCounter;
|
||||
public readonly ComboCounter ComboCounter;
|
||||
@ -35,7 +35,7 @@ namespace osu.Game.Modes.UI
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
KeyCounter = CreateKeyCounter(ruleset.CreateGameplayKeys),
|
||||
KeyCounter = CreateKeyCounter(ruleset.CreateGameplayKeys()),
|
||||
ComboCounter = CreateComboCounter(),
|
||||
ScoreCounter = CreateScoreCounter(),
|
||||
AccuracyCounter = CreateAccuracyCounter(),
|
||||
@ -65,7 +65,7 @@ namespace osu.Game.Modes.UI
|
||||
//TODO: these should be bindable binds, not events!
|
||||
ScoreCounter?.Current.BindTo(processor.TotalScore);
|
||||
AccuracyCounter?.Current.BindTo(processor.Accuracy);
|
||||
processor.Combo.ValueChanged += delegate { ComboCounter?.Set((ulong)processor.Combo.Value); };
|
||||
ComboCounter?.Current.BindTo(processor.Combo);
|
||||
HealthDisplay?.Current.BindTo(processor.Health);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Modes.UI
|
||||
{
|
||||
internal abstract class HealthDisplay : Container
|
||||
public abstract class HealthDisplay : Container
|
||||
{
|
||||
public readonly BindableDouble Current = new BindableDouble
|
||||
{
|
||||
@ -16,9 +16,9 @@ namespace osu.Game.Modes.UI
|
||||
|
||||
protected HealthDisplay()
|
||||
{
|
||||
Current.ValueChanged += (s, e) => SetHP((float)Current);
|
||||
Current.ValueChanged += (s, e) => SetHealth((float)Current);
|
||||
}
|
||||
|
||||
protected abstract void SetHP(float value);
|
||||
protected abstract void SetHealth(float value);
|
||||
}
|
||||
}
|
||||
|
@ -25,12 +25,12 @@ namespace osu.Game.Modes.UI
|
||||
PopOutCount.Anchor = Anchor;
|
||||
}
|
||||
|
||||
protected override string FormatCount(ulong count)
|
||||
protected override string FormatCount(long count)
|
||||
{
|
||||
return $@"{count}x";
|
||||
}
|
||||
|
||||
protected virtual void TransformPopOut(ulong newValue)
|
||||
protected virtual void TransformPopOut(long newValue)
|
||||
{
|
||||
PopOutCount.Text = FormatCount(newValue);
|
||||
|
||||
@ -43,19 +43,19 @@ namespace osu.Game.Modes.UI
|
||||
PopOutCount.MoveTo(DisplayedCountSpriteText.Position, PopOutDuration, PopOutEasing);
|
||||
}
|
||||
|
||||
protected virtual void TransformPopOutRolling(ulong newValue)
|
||||
protected virtual void TransformPopOutRolling(long newValue)
|
||||
{
|
||||
TransformPopOut(newValue);
|
||||
TransformPopOutSmall(newValue);
|
||||
}
|
||||
|
||||
protected virtual void TransformNoPopOut(ulong newValue)
|
||||
protected virtual void TransformNoPopOut(long newValue)
|
||||
{
|
||||
DisplayedCountSpriteText.Text = FormatCount(newValue);
|
||||
DisplayedCountSpriteText.ScaleTo(1);
|
||||
}
|
||||
|
||||
protected virtual void TransformPopOutSmall(ulong newValue)
|
||||
protected virtual void TransformPopOutSmall(long newValue)
|
||||
{
|
||||
DisplayedCountSpriteText.Text = FormatCount(newValue);
|
||||
DisplayedCountSpriteText.ScaleTo(PopOutSmallScale);
|
||||
@ -71,7 +71,7 @@ namespace osu.Game.Modes.UI
|
||||
DisplayedCount++;
|
||||
}
|
||||
|
||||
protected override void OnCountRolling(ulong currentValue, ulong newValue)
|
||||
protected override void OnCountRolling(long currentValue, long newValue)
|
||||
{
|
||||
ScheduledPopOutCurrentId++;
|
||||
|
||||
@ -82,7 +82,7 @@ namespace osu.Game.Modes.UI
|
||||
base.OnCountRolling(currentValue, newValue);
|
||||
}
|
||||
|
||||
protected override void OnCountIncrement(ulong currentValue, ulong newValue)
|
||||
protected override void OnCountIncrement(long currentValue, long newValue)
|
||||
{
|
||||
ScheduledPopOutCurrentId++;
|
||||
|
||||
@ -100,7 +100,7 @@ namespace osu.Game.Modes.UI
|
||||
}, PopOutDuration);
|
||||
}
|
||||
|
||||
protected override void OnCountChange(ulong currentValue, ulong newValue)
|
||||
protected override void OnCountChange(long currentValue, long newValue)
|
||||
{
|
||||
ScheduledPopOutCurrentId++;
|
||||
|
||||
@ -110,7 +110,7 @@ namespace osu.Game.Modes.UI
|
||||
base.OnCountChange(currentValue, newValue);
|
||||
}
|
||||
|
||||
protected override void OnDisplayedCountRolling(ulong currentValue, ulong newValue)
|
||||
protected override void OnDisplayedCountRolling(long currentValue, long newValue)
|
||||
{
|
||||
if (newValue == 0)
|
||||
DisplayedCountSpriteText.FadeOut(FadeOutDuration);
|
||||
@ -123,14 +123,14 @@ namespace osu.Game.Modes.UI
|
||||
TransformNoPopOut(newValue);
|
||||
}
|
||||
|
||||
protected override void OnDisplayedCountChange(ulong newValue)
|
||||
protected override void OnDisplayedCountChange(long newValue)
|
||||
{
|
||||
DisplayedCountSpriteText.FadeTo(newValue == 0 ? 0 : 1);
|
||||
|
||||
TransformNoPopOut(newValue);
|
||||
}
|
||||
|
||||
protected override void OnDisplayedCountIncrement(ulong newValue)
|
||||
protected override void OnDisplayedCountIncrement(long newValue)
|
||||
{
|
||||
DisplayedCountSpriteText.Show();
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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 osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
@ -11,7 +10,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Modes.UI
|
||||
{
|
||||
internal class StandardHudOverlay : HudOverlay
|
||||
public class StandardHudOverlay : HudOverlay
|
||||
{
|
||||
public StandardHudOverlay(Ruleset ruleset)
|
||||
: base(ruleset)
|
||||
|
@ -14,7 +14,7 @@ using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.UI
|
||||
{
|
||||
internal class StandardHealthDisplay : HealthDisplay
|
||||
public class StandardHealthDisplay : HealthDisplay
|
||||
{
|
||||
private Container fill;
|
||||
|
||||
@ -44,7 +44,7 @@ namespace osu.Game.Modes.UI
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void laod(OsuColour colours)
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
fill.Colour = colours.BlueLighter;
|
||||
fill.EdgeEffect = new EdgeEffect
|
||||
@ -55,6 +55,6 @@ namespace osu.Game.Modes.UI
|
||||
};
|
||||
}
|
||||
|
||||
protected override void SetHP(float value) => fill.ScaleTo(new Vector2(value, 1), 200, EasingTypes.OutQuint);
|
||||
protected override void SetHealth(float value) => fill.ScaleTo(new Vector2(value, 1), 200, EasingTypes.OutQuint);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user