mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 09:43:10 +08:00
Start to structure flow of information in Player.
- Allow basic clicking of hitobjects. - Break non-osu! game modes temporarily. - Fix some issues with RollingCounters. - Add the ability to increment counters.
This commit is contained in:
parent
e78e0d37b4
commit
43f0409893
@ -12,6 +12,7 @@ using osu.Framework.Timing;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps.Objects.Osu;
|
using osu.Game.Beatmaps.Objects.Osu;
|
||||||
using osu.Game.Beatmaps.Objects.Osu.Drawable;
|
using osu.Game.Beatmaps.Objects.Osu.Drawable;
|
||||||
|
using osu.Game.Beatmaps.Objects;
|
||||||
|
|
||||||
namespace osu.Desktop.Tests
|
namespace osu.Desktop.Tests
|
||||||
{
|
{
|
||||||
@ -50,7 +51,7 @@ namespace osu.Desktop.Tests
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Depth = -i,
|
Depth = -i,
|
||||||
State = HitState.Armed,
|
State = ArmedState.Armed,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,7 +60,6 @@ namespace osu.Desktop.Tests
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
ourClock.ProcessFrame();
|
ourClock.ProcessFrame();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,13 +32,13 @@ namespace osu.Desktop.Tests
|
|||||||
|
|
||||||
var objects = new List<HitObject>();
|
var objects = new List<HitObject>();
|
||||||
|
|
||||||
int time = 500;
|
int time = 1500;
|
||||||
for (int i = 0; i < 1; i++)
|
for (int i = 0; i < 50; i++)
|
||||||
{
|
{
|
||||||
objects.Add(new Circle()
|
objects.Add(new Circle()
|
||||||
{
|
{
|
||||||
StartTime = time,
|
StartTime = time,
|
||||||
Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384))
|
Position = new Vector2(RNG.Next(100, 400), RNG.Next(100, 200))
|
||||||
});
|
});
|
||||||
|
|
||||||
time += 500;
|
time += 500;
|
||||||
|
71
osu.Game/Beatmaps/Objects/DrawableHitObject.cs
Normal file
71
osu.Game/Beatmaps/Objects/DrawableHitObject.cs
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
//Copyright (c) 2007-2016 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;
|
||||||
|
using osu.Framework;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Beatmaps.Objects.Osu.Drawable;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps.Objects
|
||||||
|
{
|
||||||
|
public abstract class DrawableHitObject : Container, IStateful<ArmedState>
|
||||||
|
{
|
||||||
|
public Action<DrawableHitObject> OnHit;
|
||||||
|
public Action<DrawableHitObject> OnMiss;
|
||||||
|
|
||||||
|
public HitObject HitObject;
|
||||||
|
|
||||||
|
public DrawableHitObject(HitObject hitObject)
|
||||||
|
{
|
||||||
|
HitObject = hitObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArmedState state;
|
||||||
|
public ArmedState State
|
||||||
|
{
|
||||||
|
get { return state; }
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
state = value;
|
||||||
|
|
||||||
|
UpdateState(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Load(BaseGame game)
|
||||||
|
{
|
||||||
|
base.Load(game);
|
||||||
|
|
||||||
|
UpdateState(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool counted;
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
if (Time >= HitObject.EndTime && !counted)
|
||||||
|
{
|
||||||
|
counted = true;
|
||||||
|
if (state == ArmedState.Armed)
|
||||||
|
OnHit?.Invoke(this);
|
||||||
|
else
|
||||||
|
OnMiss?.Invoke(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void UpdateState(ArmedState state);
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ArmedState
|
||||||
|
{
|
||||||
|
Disarmed,
|
||||||
|
Armed
|
||||||
|
}
|
||||||
|
}
|
@ -13,9 +13,9 @@ namespace osu.Game.Beatmaps.Objects
|
|||||||
public abstract class HitObject
|
public abstract class HitObject
|
||||||
{
|
{
|
||||||
public double StartTime;
|
public double StartTime;
|
||||||
public double? EndTime;
|
public virtual double EndTime => StartTime;
|
||||||
|
|
||||||
public double Duration => (EndTime ?? StartTime) - StartTime;
|
public double Duration => EndTime - StartTime;
|
||||||
|
|
||||||
public HitSampleInfo Sample;
|
public HitSampleInfo Sample;
|
||||||
|
|
||||||
|
@ -15,13 +15,7 @@ using osu.Framework.MathUtils;
|
|||||||
|
|
||||||
namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
||||||
{
|
{
|
||||||
public enum HitState
|
public class DrawableCircle : DrawableHitObject
|
||||||
{
|
|
||||||
Disarmed,
|
|
||||||
Armed
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DrawableCircle : Container, IStateful<HitState>
|
|
||||||
{
|
{
|
||||||
private Sprite approachCircle;
|
private Sprite approachCircle;
|
||||||
private CirclePart circle;
|
private CirclePart circle;
|
||||||
@ -32,7 +26,7 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
private GlowPart glow;
|
private GlowPart glow;
|
||||||
private OsuBaseHit h;
|
private OsuBaseHit h;
|
||||||
|
|
||||||
public DrawableCircle(Circle h)
|
public DrawableCircle(Circle h) : base(h)
|
||||||
{
|
{
|
||||||
this.h = h;
|
this.h = h;
|
||||||
|
|
||||||
@ -50,7 +44,7 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
circle = new CirclePart()
|
circle = new CirclePart()
|
||||||
{
|
{
|
||||||
Colour = h.Colour,
|
Colour = h.Colour,
|
||||||
Hit = delegate { State = HitState.Armed; }
|
Hit = delegate { State = ArmedState.Armed; }
|
||||||
},
|
},
|
||||||
number = new NumberPart(),
|
number = new NumberPart(),
|
||||||
ring = new RingPart(),
|
ring = new RingPart(),
|
||||||
@ -68,8 +62,6 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
};
|
};
|
||||||
|
|
||||||
Size = new Vector2(100);
|
Size = new Vector2(100);
|
||||||
|
|
||||||
State = HitState.Armed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load(BaseGame game)
|
public override void Load(BaseGame game)
|
||||||
@ -77,6 +69,13 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
base.Load(game);
|
base.Load(game);
|
||||||
|
|
||||||
approachCircle.Texture = game.Textures.Get(@"Play/osu/approachcircle@2x");
|
approachCircle.Texture = game.Textures.Get(@"Play/osu/approachcircle@2x");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateState(ArmedState state)
|
||||||
|
{
|
||||||
|
if (!IsLoaded) return;
|
||||||
|
|
||||||
|
Flush(); //move to DrawableHitObject
|
||||||
|
|
||||||
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime - 1000, EndTime = h.StartTime - 800, StartValue = 0, EndValue = 1 });
|
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime - 1000, EndTime = h.StartTime - 800, StartValue = 0, EndValue = 1 });
|
||||||
|
|
||||||
@ -85,35 +84,12 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
|
|
||||||
glow.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime, EndTime = h.StartTime + 400, StartValue = glow.Alpha, EndValue = 0 });
|
glow.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime, EndTime = h.StartTime + 400, StartValue = glow.Alpha, EndValue = 0 });
|
||||||
|
|
||||||
updateState();
|
|
||||||
|
|
||||||
Transforms.Add(new TransformScale(Clock) { StartTime = h.StartTime + h.Duration, EndTime = h.StartTime + h.Duration + 400, StartValue = Scale, EndValue = Scale * 1.5f, Easing = EasingTypes.OutQuad });
|
|
||||||
Expire(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private HitState state;
|
|
||||||
public HitState State
|
|
||||||
{
|
|
||||||
get { return state; }
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
state = value;
|
|
||||||
|
|
||||||
updateState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateState()
|
|
||||||
{
|
|
||||||
if (!IsLoaded) return;
|
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case HitState.Disarmed:
|
case ArmedState.Disarmed:
|
||||||
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
|
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
|
||||||
break;
|
break;
|
||||||
case HitState.Armed:
|
case ArmedState.Armed:
|
||||||
const float flashIn = 30;
|
const float flashIn = 30;
|
||||||
const float fadeOut = 800;
|
const float fadeOut = 800;
|
||||||
|
|
||||||
@ -130,6 +106,7 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
|
|
||||||
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn + fadeOut, StartValue = 1, EndValue = 0 });
|
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn + fadeOut, StartValue = 1, EndValue = 0 });
|
||||||
|
|
||||||
|
Transforms.Add(new TransformScale(Clock) { StartTime = h.StartTime + h.Duration, EndTime = h.StartTime + h.Duration + 400, StartValue = Scale, EndValue = Scale * 1.5f, Easing = EasingTypes.OutQuad });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,6 @@ namespace osu.Game.GameModes.Play.Catch
|
|||||||
|
|
||||||
protected override Playfield CreatePlayfield() => new CatchPlayfield();
|
protected override Playfield CreatePlayfield() => new CatchPlayfield();
|
||||||
|
|
||||||
protected override Drawable GetVisualRepresentation(CatchBaseHit h) => new DrawableFruit(h);
|
protected override DrawableHitObject GetVisualRepresentation(CatchBaseHit h) => null;// new DrawableFruit(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
public abstract class ComboCounter : Container
|
public abstract class ComboCounter : AutoSizeContainer
|
||||||
{
|
{
|
||||||
public bool IsRolling
|
public bool IsRolling
|
||||||
{
|
{
|
||||||
@ -78,9 +78,14 @@ namespace osu.Game.GameModes.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Increment(ulong amount = 1)
|
||||||
|
{
|
||||||
|
Count = Count + amount;
|
||||||
|
}
|
||||||
|
|
||||||
protected SpriteText DisplayedCountSpriteText;
|
protected SpriteText DisplayedCountSpriteText;
|
||||||
|
|
||||||
private float textSize = 20.0f;
|
private float textSize;
|
||||||
public float TextSize
|
public float TextSize
|
||||||
{
|
{
|
||||||
get { return textSize; }
|
get { return textSize; }
|
||||||
@ -108,6 +113,8 @@ namespace osu.Game.GameModes.Play
|
|||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TextSize = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load(BaseGame game)
|
public override void Load(BaseGame game)
|
||||||
|
@ -34,6 +34,11 @@ namespace osu.Game.GameModes.Play
|
|||||||
return $@"{count}x";
|
return $@"{count}x";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Increment(ulong amount)
|
||||||
|
{
|
||||||
|
Count = Count + amount;
|
||||||
|
}
|
||||||
|
|
||||||
protected class TransformComboResult : Transform<ulong>
|
protected class TransformComboResult : Transform<ulong>
|
||||||
{
|
{
|
||||||
public override ulong CurrentValue
|
public override ulong CurrentValue
|
||||||
|
@ -6,10 +6,17 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Beatmaps.Objects;
|
using osu.Game.Beatmaps.Objects;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
public abstract class HitRenderer<T> : Container
|
public abstract class HitRenderer : Container
|
||||||
|
{
|
||||||
|
public Action<HitObject> OnHit;
|
||||||
|
public Action<HitObject> OnMiss;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class HitRenderer<T> : HitRenderer
|
||||||
where T : HitObject
|
where T : HitObject
|
||||||
{
|
{
|
||||||
private List<T> objects;
|
private List<T> objects;
|
||||||
@ -50,9 +57,28 @@ namespace osu.Game.GameModes.Play
|
|||||||
{
|
{
|
||||||
if (objects == null) return;
|
if (objects == null) return;
|
||||||
foreach (T h in objects)
|
foreach (T h in objects)
|
||||||
playfield.Add(GetVisualRepresentation(h));
|
{
|
||||||
|
var drawableObject = GetVisualRepresentation(h);
|
||||||
|
|
||||||
|
if (drawableObject == null) continue;
|
||||||
|
|
||||||
|
drawableObject.OnHit = onHit;
|
||||||
|
drawableObject.OnMiss = onMiss;
|
||||||
|
|
||||||
|
playfield.Add(drawableObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Drawable GetVisualRepresentation(T h);
|
private void onMiss(DrawableHitObject obj)
|
||||||
|
{
|
||||||
|
OnMiss?.Invoke(obj.HitObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onHit(DrawableHitObject obj)
|
||||||
|
{
|
||||||
|
OnHit?.Invoke(obj.HitObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract DrawableHitObject GetVisualRepresentation(T h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,13 +22,14 @@ namespace osu.Game.GameModes.Play.Mania
|
|||||||
|
|
||||||
protected override Playfield CreatePlayfield() => new ManiaPlayfield(columns);
|
protected override Playfield CreatePlayfield() => new ManiaPlayfield(columns);
|
||||||
|
|
||||||
protected override Drawable GetVisualRepresentation(ManiaBaseHit h)
|
protected override DrawableHitObject GetVisualRepresentation(ManiaBaseHit h)
|
||||||
{
|
{
|
||||||
return new DrawableNote(h)
|
return null;
|
||||||
{
|
//return new DrawableNote(h)
|
||||||
Position = new Vector2((float)(h.Column + 0.5) / columns, -0.1f),
|
//{
|
||||||
RelativePositionAxes = Axes.Both
|
// Position = new Vector2((float)(h.Column + 0.5) / columns, -0.1f),
|
||||||
};
|
// RelativePositionAxes = Axes.Both
|
||||||
|
//};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,6 @@ namespace osu.Game.GameModes.Play.Osu
|
|||||||
|
|
||||||
protected override Playfield CreatePlayfield() => new OsuPlayfield();
|
protected override Playfield CreatePlayfield() => new OsuPlayfield();
|
||||||
|
|
||||||
protected override Drawable GetVisualRepresentation(OsuBaseHit h) => new DrawableCircle(h as Circle);
|
protected override DrawableHitObject GetVisualRepresentation(OsuBaseHit h) => new DrawableCircle(h as Circle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
55
osu.Game/GameModes/Play/Osu/ScoreOverlayOsu.cs
Normal file
55
osu.Game/GameModes/Play/Osu/ScoreOverlayOsu.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
//Copyright (c) 2007-2016 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;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Input;
|
||||||
|
using osu.Game.Beatmaps.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.GameModes.Play.Osu
|
||||||
|
{
|
||||||
|
class ScoreOverlayOsu : ScoreOverlay
|
||||||
|
{
|
||||||
|
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
Position = new Vector2(0, 45)
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override ScoreCounter CreateScoreCounter() => new ScoreCounter()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
TextSize = 60
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override ComboCounter CreateComboCounter() => new OsuComboCounter()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection
|
||||||
|
{
|
||||||
|
IsCounting = true,
|
||||||
|
FadeTime = 50,
|
||||||
|
Anchor = Anchor.BottomRight,
|
||||||
|
Origin = Anchor.BottomRight,
|
||||||
|
Position = new Vector2(10),
|
||||||
|
Counters = new KeyCounter[]
|
||||||
|
{
|
||||||
|
new KeyCounterKeyboard(@"Z", Key.Z),
|
||||||
|
new KeyCounterKeyboard(@"X", Key.X),
|
||||||
|
new KeyCounterMouse(@"M1", MouseButton.Left),
|
||||||
|
new KeyCounterMouse(@"M2", MouseButton.Right),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -1,25 +1,15 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 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 System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.MathUtils;
|
|
||||||
using osu.Framework.Timing;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Objects;
|
using osu.Game.Beatmaps.Objects;
|
||||||
using osu.Game.Beatmaps.Objects.Osu;
|
|
||||||
using osu.Game.GameModes.Backgrounds;
|
using osu.Game.GameModes.Backgrounds;
|
||||||
using osu.Game.GameModes.Play.Catch;
|
using osu.Game.GameModes.Play.Catch;
|
||||||
using osu.Game.GameModes.Play.Mania;
|
using osu.Game.GameModes.Play.Mania;
|
||||||
using osu.Game.GameModes.Play.Osu;
|
using osu.Game.GameModes.Play.Osu;
|
||||||
using osu.Game.GameModes.Play.Taiko;
|
using osu.Game.GameModes.Play.Taiko;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Input;
|
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
@ -41,57 +31,61 @@ namespace osu.Game.GameModes.Play
|
|||||||
HitObjects = Beatmap?.HitObjects ?? new List<HitObject>()
|
HitObjects = Beatmap?.HitObjects ?? new List<HitObject>()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HitRenderer hitRenderer;
|
||||||
|
ScoreOverlay scoreOverlay;
|
||||||
|
|
||||||
switch (PlayMode)
|
switch (PlayMode)
|
||||||
{
|
{
|
||||||
case PlayMode.Osu:
|
default:
|
||||||
Add(new OsuHitRenderer
|
scoreOverlay = new ScoreOverlayOsu();
|
||||||
|
|
||||||
|
hitRenderer = new OsuHitRenderer
|
||||||
{
|
{
|
||||||
Objects = beatmap.HitObjects,
|
Objects = beatmap.HitObjects,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
});
|
};
|
||||||
break;
|
break;
|
||||||
case PlayMode.Taiko:
|
case PlayMode.Taiko:
|
||||||
Add(new TaikoHitRenderer
|
scoreOverlay = null;
|
||||||
|
|
||||||
|
hitRenderer = new TaikoHitRenderer
|
||||||
{
|
{
|
||||||
Objects = beatmap.HitObjects,
|
Objects = beatmap.HitObjects,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
});
|
};
|
||||||
break;
|
break;
|
||||||
case PlayMode.Catch:
|
case PlayMode.Catch:
|
||||||
Add(new CatchHitRenderer
|
scoreOverlay = null;
|
||||||
|
|
||||||
|
hitRenderer = new CatchHitRenderer
|
||||||
{
|
{
|
||||||
Objects = beatmap.HitObjects,
|
Objects = beatmap.HitObjects,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
});
|
};
|
||||||
break;
|
break;
|
||||||
case PlayMode.Mania:
|
case PlayMode.Mania:
|
||||||
Add(new ManiaHitRenderer
|
scoreOverlay = null;
|
||||||
|
|
||||||
|
hitRenderer = new ManiaHitRenderer
|
||||||
{
|
{
|
||||||
Objects = beatmap.HitObjects,
|
Objects = beatmap.HitObjects,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
});
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Add(new KeyCounterCollection
|
hitRenderer.OnHit += delegate (HitObject h) { scoreOverlay.OnHit(h); };
|
||||||
|
hitRenderer.OnMiss += delegate (HitObject h) { scoreOverlay.OnMiss(h); };
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
IsCounting = true,
|
hitRenderer,
|
||||||
FadeTime = 50,
|
scoreOverlay,
|
||||||
Anchor = Anchor.BottomRight,
|
};
|
||||||
Origin = Anchor.BottomRight,
|
|
||||||
Position = new Vector2(10, 50),
|
|
||||||
Counters = new KeyCounter[]
|
|
||||||
{
|
|
||||||
new KeyCounterKeyboard(@"Z", Key.Z),
|
|
||||||
new KeyCounterKeyboard(@"X", Key.X),
|
|
||||||
new KeyCounterMouse(@"M1", MouseButton.Left),
|
|
||||||
new KeyCounterMouse(@"M2", MouseButton.Right),
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
53
osu.Game/GameModes/Play/ScoreOverlay.cs
Normal file
53
osu.Game/GameModes/Play/ScoreOverlay.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
//Copyright (c) 2007-2016 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;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Beatmaps.Objects;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
|
namespace osu.Game.GameModes.Play
|
||||||
|
{
|
||||||
|
public abstract class ScoreOverlay : Container
|
||||||
|
{
|
||||||
|
public KeyCounterCollection KeyCounter;
|
||||||
|
public ComboCounter ComboCounter;
|
||||||
|
public ScoreCounter ScoreCounter;
|
||||||
|
public PercentageCounter AccuracyCounter;
|
||||||
|
|
||||||
|
protected abstract KeyCounterCollection CreateKeyCounter();
|
||||||
|
protected abstract ComboCounter CreateComboCounter();
|
||||||
|
protected abstract PercentageCounter CreateAccuracyCounter();
|
||||||
|
protected abstract ScoreCounter CreateScoreCounter();
|
||||||
|
|
||||||
|
public virtual void OnHit(HitObject h)
|
||||||
|
{
|
||||||
|
ComboCounter?.Increment();
|
||||||
|
ScoreCounter?.Increment(300);
|
||||||
|
AccuracyCounter?.Set(Math.Min(1, AccuracyCounter.Count + 0.01f));
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnMiss(HitObject h)
|
||||||
|
{
|
||||||
|
ComboCounter?.Roll();
|
||||||
|
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScoreOverlay()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Children = new Drawable[] {
|
||||||
|
KeyCounter = CreateKeyCounter(),
|
||||||
|
ComboCounter = CreateComboCounter(),
|
||||||
|
ScoreCounter = CreateScoreCounter(),
|
||||||
|
AccuracyCounter = CreateAccuracyCounter(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,6 +14,6 @@ namespace osu.Game.GameModes.Play.Taiko
|
|||||||
|
|
||||||
protected override Playfield CreatePlayfield() => new TaikoPlayfield();
|
protected override Playfield CreatePlayfield() => new TaikoPlayfield();
|
||||||
|
|
||||||
protected override Drawable GetVisualRepresentation(TaikoBaseHit h) => new DrawableTaikoHit(h);
|
protected override DrawableHitObject GetVisualRepresentation(TaikoBaseHit h) => null;// new DrawableTaikoHit(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return Math.Abs(currentValue - newValue) * RollingDuration * 100.0f;
|
return Math.Abs(currentValue - newValue) * RollingDuration * 100.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Increment(float amount)
|
||||||
|
{
|
||||||
|
Count = Count + amount;
|
||||||
|
}
|
||||||
|
|
||||||
protected class TransformAccuracy : TransformFloat
|
protected class TransformAccuracy : TransformFloat
|
||||||
{
|
{
|
||||||
public override void Apply(Drawable d)
|
public override void Apply(Drawable d)
|
||||||
|
@ -86,7 +86,14 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float textSize = 20.0f;
|
public void Set(T value)
|
||||||
|
{
|
||||||
|
Count = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void Increment(T amount);
|
||||||
|
|
||||||
|
protected float textSize;
|
||||||
|
|
||||||
public float TextSize
|
public float TextSize
|
||||||
{
|
{
|
||||||
@ -107,6 +114,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
DisplayedCountSpriteText = new SpriteText(),
|
DisplayedCountSpriteText = new SpriteText(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TextSize = 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load(BaseGame game)
|
public override void Load(BaseGame game)
|
||||||
|
@ -49,6 +49,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
return count.ToString("D" + LeadingZeroes);
|
return count.ToString("D" + LeadingZeroes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Increment(ulong amount)
|
||||||
|
{
|
||||||
|
Count = Count + amount;
|
||||||
|
}
|
||||||
|
|
||||||
protected class TransformScore : Transform<ulong>
|
protected class TransformScore : Transform<ulong>
|
||||||
{
|
{
|
||||||
public override ulong CurrentValue
|
public override ulong CurrentValue
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
<Compile Include="Beatmaps\Beatmap.cs" />
|
<Compile Include="Beatmaps\Beatmap.cs" />
|
||||||
<Compile Include="Beatmaps\Objects\Catch\CatchConverter.cs" />
|
<Compile Include="Beatmaps\Objects\Catch\CatchConverter.cs" />
|
||||||
<Compile Include="Beatmaps\Objects\Catch\Drawable\DrawableFruit.cs" />
|
<Compile Include="Beatmaps\Objects\Catch\Drawable\DrawableFruit.cs" />
|
||||||
|
<Compile Include="Beatmaps\Objects\DrawableHitObject.cs" />
|
||||||
<Compile Include="Beatmaps\Objects\HitObject.cs" />
|
<Compile Include="Beatmaps\Objects\HitObject.cs" />
|
||||||
<Compile Include="Beatmaps\Objects\Catch\CatchBaseHit.cs" />
|
<Compile Include="Beatmaps\Objects\Catch\CatchBaseHit.cs" />
|
||||||
<Compile Include="Beatmaps\Objects\Catch\Droplet.cs" />
|
<Compile Include="Beatmaps\Objects\Catch\Droplet.cs" />
|
||||||
@ -111,6 +112,7 @@
|
|||||||
<Compile Include="GameModes\Multiplayer\MatchSongSelect.cs" />
|
<Compile Include="GameModes\Multiplayer\MatchSongSelect.cs" />
|
||||||
<Compile Include="GameModes\OsuGameMode.cs" />
|
<Compile Include="GameModes\OsuGameMode.cs" />
|
||||||
<Compile Include="GameModes\Play\ModSelect.cs" />
|
<Compile Include="GameModes\Play\ModSelect.cs" />
|
||||||
|
<Compile Include="GameModes\Play\Osu\ScoreOverlayOsu.cs" />
|
||||||
<Compile Include="GameModes\Play\Player.cs" />
|
<Compile Include="GameModes\Play\Player.cs" />
|
||||||
<Compile Include="GameModes\Charts\ChartListing.cs" />
|
<Compile Include="GameModes\Charts\ChartListing.cs" />
|
||||||
<Compile Include="GameModes\Play\PlayMode.cs" />
|
<Compile Include="GameModes\Play\PlayMode.cs" />
|
||||||
@ -125,6 +127,7 @@
|
|||||||
<Compile Include="GameModes\Play\Osu\OsuHitRenderer.cs" />
|
<Compile Include="GameModes\Play\Osu\OsuHitRenderer.cs" />
|
||||||
<Compile Include="GameModes\Play\Osu\OsuPlayfield.cs" />
|
<Compile Include="GameModes\Play\Osu\OsuPlayfield.cs" />
|
||||||
<Compile Include="GameModes\Play\Playfield.cs" />
|
<Compile Include="GameModes\Play\Playfield.cs" />
|
||||||
|
<Compile Include="GameModes\Play\ScoreOverlay.cs" />
|
||||||
<Compile Include="GameModes\Play\Taiko\TaikoHitRenderer.cs" />
|
<Compile Include="GameModes\Play\Taiko\TaikoHitRenderer.cs" />
|
||||||
<Compile Include="GameModes\Play\Taiko\TaikoPlayfield.cs" />
|
<Compile Include="GameModes\Play\Taiko\TaikoPlayfield.cs" />
|
||||||
<Compile Include="GameModes\Edit\EditSongSelect.cs" />
|
<Compile Include="GameModes\Edit\EditSongSelect.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user