Various code changes, fixes
After Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 74 KiB |
@ -6,9 +6,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -18,7 +18,6 @@ using osu.Game.Rulesets.Taiko.Objects;
|
|||||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Taiko.UI;
|
using osu.Game.Rulesets.Taiko.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Skinning;
|
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||||
@ -38,35 +37,28 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
TimeRange = { Value = 5000 },
|
TimeRange = { Value = 5000 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Cached(typeof(IBindable<WorkingBeatmap>))]
|
||||||
|
private Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
private readonly List<DrawableTaikoMascot> mascots = new List<DrawableTaikoMascot>();
|
private readonly List<DrawableTaikoMascot> mascots = new List<DrawableTaikoMascot>();
|
||||||
private readonly List<SkinnableDrawable> skinnables = new List<SkinnableDrawable>();
|
|
||||||
private readonly List<TaikoPlayfield> playfields = new List<TaikoPlayfield>();
|
private readonly List<TaikoPlayfield> playfields = new List<TaikoPlayfield>();
|
||||||
|
private readonly List<DrawableTaikoRuleset> rulesets = new List<DrawableTaikoRuleset>();
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestStateTextures()
|
public void TestStateTextures()
|
||||||
{
|
{
|
||||||
|
AddStep("Set beatmap", () => setBeatmap());
|
||||||
|
|
||||||
AddStep("Create mascot (idle)", () =>
|
AddStep("Create mascot (idle)", () =>
|
||||||
{
|
|
||||||
skinnables.Clear();
|
|
||||||
SetContents(() =>
|
|
||||||
{
|
|
||||||
var skinnable = getMascot();
|
|
||||||
skinnables.Add(skinnable);
|
|
||||||
return skinnable;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
AddUntilStep("Wait for SkinnableDrawable", () => skinnables.Any(d => d.Drawable is DrawableTaikoMascot));
|
|
||||||
|
|
||||||
AddStep("Collect mascots", () =>
|
|
||||||
{
|
{
|
||||||
mascots.Clear();
|
mascots.Clear();
|
||||||
|
|
||||||
foreach (var skinnable in skinnables)
|
SetContents(() =>
|
||||||
{
|
{
|
||||||
if (skinnable.Drawable is DrawableTaikoMascot mascot)
|
var mascot = new TestDrawableTaikoMascot();
|
||||||
mascots.Add(mascot);
|
mascots.Add(mascot);
|
||||||
}
|
return mascot;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("Clear state", () => setState(TaikoMascotAnimationState.Clear));
|
AddStep("Clear state", () => setState(TaikoMascotAnimationState.Clear));
|
||||||
@ -76,59 +68,25 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
AddStep("Fail state", () => setState(TaikoMascotAnimationState.Fail));
|
AddStep("Fail state", () => setState(TaikoMascotAnimationState.Fail));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setState(TaikoMascotAnimationState state)
|
|
||||||
{
|
|
||||||
foreach (var mascot in mascots)
|
|
||||||
{
|
|
||||||
if (mascot == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
mascot.Dumb = true;
|
|
||||||
mascot.State = state;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private SkinnableDrawable getMascot() =>
|
|
||||||
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.TaikoDon), _ => new Container(), confineMode: ConfineMode.ScaleToFit)
|
|
||||||
{
|
|
||||||
RelativePositionAxes = Axes.Both
|
|
||||||
};
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestPlayfield()
|
public void TestPlayfield()
|
||||||
{
|
{
|
||||||
AddStep("Create playfield", () =>
|
AddStep("Set beatmap", () => setBeatmap());
|
||||||
|
|
||||||
|
AddStep("Create ruleset", () =>
|
||||||
{
|
{
|
||||||
playfields.Clear();
|
rulesets.Clear();
|
||||||
SetContents(() =>
|
SetContents(() =>
|
||||||
{
|
{
|
||||||
var playfield = new TaikoPlayfield(new ControlPointInfo())
|
var ruleset = new TaikoRuleset();
|
||||||
{
|
var drawableRuleset = new DrawableTaikoRuleset(ruleset, beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo));
|
||||||
Height = 0.4f,
|
rulesets.Add(drawableRuleset);
|
||||||
Anchor = Anchor.BottomLeft,
|
return drawableRuleset;
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
};
|
|
||||||
|
|
||||||
playfields.Add(playfield);
|
|
||||||
|
|
||||||
return playfield;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("Wait for SkinnableDrawable", () => playfields.Any(p => p.ChildrenOfType<DrawableTaikoMascot>().Any()));
|
AddStep("Collect playfields", collectPlayfields);
|
||||||
|
AddStep("Collect mascots", collectMascots);
|
||||||
AddStep("Collect mascots", () =>
|
|
||||||
{
|
|
||||||
mascots.Clear();
|
|
||||||
|
|
||||||
foreach (var playfield in playfields)
|
|
||||||
{
|
|
||||||
var mascot = playfield.ChildrenOfType<DrawableTaikoMascot>().SingleOrDefault();
|
|
||||||
|
|
||||||
if (mascot != null)
|
|
||||||
mascots.Add(mascot);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStep("Create hit (miss)", () =>
|
AddStep("Create hit (miss)", () =>
|
||||||
{
|
{
|
||||||
@ -136,7 +94,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
addJudgement(playfield, HitResult.Miss);
|
addJudgement(playfield, HitResult.Miss);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("Check if state is fail", () => mascots.Where(d => d != null).All(d => d.PlayfieldState.Value == TaikoMascotAnimationState.Fail));
|
AddUntilStep("Wait for fail state", () => mascots.Where(d => d != null).All(d => d.State == TaikoMascotAnimationState.Fail));
|
||||||
|
|
||||||
AddStep("Create hit (great)", () =>
|
AddStep("Create hit (great)", () =>
|
||||||
{
|
{
|
||||||
@ -144,12 +102,111 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
|||||||
addJudgement(playfield, HitResult.Great);
|
addJudgement(playfield, HitResult.Great);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("Check if state is idle", () => mascots.Where(d => d != null).All(d => d.PlayfieldState.Value == TaikoMascotAnimationState.Idle));
|
AddUntilStep("Wait for idle state", () => mascots.Where(d => d != null).All(d => d.State == TaikoMascotAnimationState.Idle));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestKiai()
|
||||||
|
{
|
||||||
|
AddStep("Set beatmap", () => setBeatmap(true));
|
||||||
|
|
||||||
|
AddUntilStep("Wait for beatmap to be loaded", () => beatmap.Value.Track.IsLoaded);
|
||||||
|
|
||||||
|
AddStep("Create kiai ruleset", () =>
|
||||||
|
{
|
||||||
|
beatmap.Value.Track.Start();
|
||||||
|
|
||||||
|
rulesets.Clear();
|
||||||
|
SetContents(() =>
|
||||||
|
{
|
||||||
|
var ruleset = new TaikoRuleset();
|
||||||
|
var drawableRuleset = new DrawableTaikoRuleset(ruleset, beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo));
|
||||||
|
rulesets.Add(drawableRuleset);
|
||||||
|
return drawableRuleset;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("Collect playfields", collectPlayfields);
|
||||||
|
AddStep("Collect mascots", collectMascots);
|
||||||
|
|
||||||
|
AddUntilStep("Wait for fail state", () => mascots.Where(d => d != null).All(d => d.State == TaikoMascotAnimationState.Fail));
|
||||||
|
|
||||||
|
AddStep("Create hit (great)", () =>
|
||||||
|
{
|
||||||
|
foreach (var playfield in playfields)
|
||||||
|
addJudgement(playfield, HitResult.Great);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("Wait for kiai state", () => mascots.Where(d => d != null).All(d => d.State == TaikoMascotAnimationState.Kiai));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setBeatmap(bool kiai = false)
|
||||||
|
{
|
||||||
|
var controlPointInfo = new ControlPointInfo();
|
||||||
|
controlPointInfo.Add(0, new TimingControlPoint { BeatLength = 90 });
|
||||||
|
|
||||||
|
if (kiai)
|
||||||
|
controlPointInfo.Add(0, new EffectControlPoint { KiaiMode = true });
|
||||||
|
|
||||||
|
beatmap.Value = CreateWorkingBeatmap(new Beatmap
|
||||||
|
{
|
||||||
|
HitObjects = new List<HitObject> { new Hit { Type = HitType.Centre } },
|
||||||
|
BeatmapInfo = new BeatmapInfo
|
||||||
|
{
|
||||||
|
BaseDifficulty = new BeatmapDifficulty(),
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Artist = @"Unknown",
|
||||||
|
Title = @"Sample Beatmap",
|
||||||
|
AuthorString = @"Craftplacer",
|
||||||
|
},
|
||||||
|
Ruleset = new TaikoRuleset().RulesetInfo
|
||||||
|
},
|
||||||
|
ControlPointInfo = controlPointInfo
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setState(TaikoMascotAnimationState state)
|
||||||
|
{
|
||||||
|
foreach (var mascot in mascots)
|
||||||
|
mascot?.ShowState(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void collectPlayfields()
|
||||||
|
{
|
||||||
|
playfields.Clear();
|
||||||
|
foreach (var ruleset in rulesets) playfields.Add(ruleset.ChildrenOfType<TaikoPlayfield>().Single());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void collectMascots()
|
||||||
|
{
|
||||||
|
mascots.Clear();
|
||||||
|
|
||||||
|
foreach (var playfield in playfields)
|
||||||
|
{
|
||||||
|
var mascot = playfield.ChildrenOfType<DrawableTaikoMascot>()
|
||||||
|
.SingleOrDefault();
|
||||||
|
|
||||||
|
if (mascot != null) mascots.Add(mascot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addJudgement(TaikoPlayfield playfield, HitResult result)
|
private void addJudgement(TaikoPlayfield playfield, HitResult result)
|
||||||
{
|
{
|
||||||
playfield.OnNewResult(new DrawableRimHit(new Hit()), new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = result });
|
playfield.OnNewResult(new DrawableRimHit(new Hit()), new JudgementResult(new HitObject(), new TaikoJudgement()) { Type = result });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestDrawableTaikoMascot : DrawableTaikoMascot
|
||||||
|
{
|
||||||
|
public TestDrawableTaikoMascot(TaikoMascotAnimationState startingState = TaikoMascotAnimationState.Idle)
|
||||||
|
: base(startingState)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override TaikoMascotAnimationState GetFinalAnimationState(EffectControlPoint effectPoint, TaikoMascotAnimationState playfieldState)
|
||||||
|
{
|
||||||
|
return State;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -11,68 +12,29 @@ using osu.Game.Graphics.Containers;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.UI
|
namespace osu.Game.Rulesets.Taiko.UI
|
||||||
{
|
{
|
||||||
public sealed class DrawableTaikoMascot : BeatSyncedContainer
|
public class DrawableTaikoMascot : BeatSyncedContainer
|
||||||
{
|
{
|
||||||
private static TaikoMascotTextureAnimation idleDrawable, clearDrawable, kiaiDrawable, failDrawable;
|
private TaikoMascotTextureAnimation idleDrawable, clearDrawable, kiaiDrawable, failDrawable;
|
||||||
private EffectControlPoint lastEffectControlPoint;
|
private EffectControlPoint lastEffectControlPoint;
|
||||||
private TaikoMascotAnimationState state;
|
|
||||||
|
|
||||||
public Bindable<TaikoMascotAnimationState> PlayfieldState;
|
public Bindable<TaikoMascotAnimationState> PlayfieldState;
|
||||||
|
|
||||||
/// <summary>
|
public TaikoMascotAnimationState State { get; private set; }
|
||||||
/// Determines if there should be no "state logic", intended for testing.
|
|
||||||
/// </summary>
|
|
||||||
public bool Dumb { get; set; }
|
|
||||||
|
|
||||||
public TaikoMascotAnimationState State
|
|
||||||
{
|
|
||||||
get => state;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
state = value;
|
|
||||||
|
|
||||||
foreach (var child in InternalChildren)
|
|
||||||
child.Hide();
|
|
||||||
|
|
||||||
var drawable = getStateDrawable(State);
|
|
||||||
|
|
||||||
drawable?.Show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DrawableTaikoMascot(TaikoMascotAnimationState startingState = TaikoMascotAnimationState.Idle)
|
public DrawableTaikoMascot(TaikoMascotAnimationState startingState = TaikoMascotAnimationState.Idle)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
PlayfieldState = new Bindable<TaikoMascotAnimationState>();
|
PlayfieldState = new Bindable<TaikoMascotAnimationState>();
|
||||||
PlayfieldState.BindValueChanged(b =>
|
PlayfieldState.BindValueChanged(b =>
|
||||||
{
|
{
|
||||||
if (lastEffectControlPoint != null)
|
if (lastEffectControlPoint != null)
|
||||||
State = getFinalAnimationState(lastEffectControlPoint, b.NewValue);
|
ShowState(GetFinalAnimationState(lastEffectControlPoint, b.NewValue));
|
||||||
});
|
});
|
||||||
|
|
||||||
State = startingState;
|
State = startingState;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TaikoMascotTextureAnimation getStateDrawable(TaikoMascotAnimationState state)
|
|
||||||
{
|
|
||||||
return state switch
|
|
||||||
{
|
|
||||||
TaikoMascotAnimationState.Idle => idleDrawable,
|
|
||||||
TaikoMascotAnimationState.Clear => clearDrawable,
|
|
||||||
TaikoMascotAnimationState.Kiai => kiaiDrawable,
|
|
||||||
TaikoMascotAnimationState.Fail => failDrawable,
|
|
||||||
_ => null
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private TaikoMascotAnimationState getFinalAnimationState(EffectControlPoint effectPoint, TaikoMascotAnimationState playfieldState)
|
|
||||||
{
|
|
||||||
if (playfieldState == TaikoMascotAnimationState.Fail)
|
|
||||||
return playfieldState;
|
|
||||||
|
|
||||||
return effectPoint.KiaiMode ? TaikoMascotAnimationState.Kiai : TaikoMascotAnimationState.Idle;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
@ -84,21 +46,60 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
failDrawable = new TaikoMascotTextureAnimation(TaikoMascotAnimationState.Fail),
|
failDrawable = new TaikoMascotTextureAnimation(TaikoMascotAnimationState.Fail),
|
||||||
};
|
};
|
||||||
|
|
||||||
// making sure we have the correct sprite set
|
ShowState(State);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowState(TaikoMascotAnimationState state)
|
||||||
|
{
|
||||||
|
foreach (var child in InternalChildren)
|
||||||
|
child.Hide();
|
||||||
|
|
||||||
State = state;
|
State = state;
|
||||||
|
|
||||||
|
var drawable = getStateDrawable(State);
|
||||||
|
drawable.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private TaikoMascotTextureAnimation getStateDrawable(TaikoMascotAnimationState state)
|
||||||
|
{
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case TaikoMascotAnimationState.Idle:
|
||||||
|
return idleDrawable;
|
||||||
|
|
||||||
|
case TaikoMascotAnimationState.Clear:
|
||||||
|
return clearDrawable;
|
||||||
|
|
||||||
|
case TaikoMascotAnimationState.Kiai:
|
||||||
|
return kiaiDrawable;
|
||||||
|
|
||||||
|
case TaikoMascotAnimationState.Fail:
|
||||||
|
return failDrawable;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentException($"There's no case for animation state ${state} available", nameof(state));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual TaikoMascotAnimationState GetFinalAnimationState(EffectControlPoint effectPoint, TaikoMascotAnimationState playfieldState)
|
||||||
|
{
|
||||||
|
if (playfieldState == TaikoMascotAnimationState.Fail)
|
||||||
|
return playfieldState;
|
||||||
|
|
||||||
|
return effectPoint.KiaiMode ? TaikoMascotAnimationState.Kiai : TaikoMascotAnimationState.Idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
||||||
{
|
{
|
||||||
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
||||||
|
|
||||||
if (!Dumb)
|
var state = GetFinalAnimationState(lastEffectControlPoint = effectPoint, PlayfieldState.Value);
|
||||||
State = getFinalAnimationState(lastEffectControlPoint = effectPoint, PlayfieldState.Value);
|
ShowState(state);
|
||||||
|
|
||||||
if (State == TaikoMascotAnimationState.Clear)
|
if (state == TaikoMascotAnimationState.Clear)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var drawable = getStateDrawable(State);
|
var drawable = getStateDrawable(state);
|
||||||
drawable.Move();
|
drawable.Move();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Animations;
|
using osu.Framework.Graphics.Animations;
|
||||||
@ -39,7 +40,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
foreach (var textureIndex in clear_animation_sequence)
|
foreach (var textureIndex in clear_animation_sequence)
|
||||||
{
|
{
|
||||||
var textureName = _getStateTextureName(textureIndex);
|
var textureName = getStateTextureName(textureIndex);
|
||||||
Texture texture = skin.GetTexture(textureName);
|
Texture texture = skin.GetTexture(textureName);
|
||||||
|
|
||||||
if (texture == null)
|
if (texture == null)
|
||||||
@ -52,7 +53,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
for (int i = 0; true; i++)
|
for (int i = 0; true; i++)
|
||||||
{
|
{
|
||||||
var textureName = _getStateTextureName(i);
|
var textureName = getStateTextureName(i);
|
||||||
Texture texture = skin.GetTexture(textureName);
|
Texture texture = skin.GetTexture(textureName);
|
||||||
|
|
||||||
if (texture == null)
|
if (texture == null)
|
||||||
@ -63,10 +64,13 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Advances the current frame by one.</summary>
|
/// <summary>
|
||||||
|
/// Advances the current frame by one.
|
||||||
|
/// </summary>
|
||||||
public void Move()
|
public void Move()
|
||||||
{
|
{
|
||||||
if (FrameCount == 0) // Frames are apparently broken
|
// Check whether there are frames before causing a crash.
|
||||||
|
if (FrameCount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (FrameCount <= currentFrame)
|
if (FrameCount <= currentFrame)
|
||||||
@ -77,18 +81,27 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
currentFrame += 1;
|
currentFrame += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _getStateTextureName(int i) => $"pippidon{_getStateString(State)}{i}";
|
private string getStateTextureName(int i) => $"pippidon{getStateString(State)}{i}";
|
||||||
|
|
||||||
private string _getStateString(TaikoMascotAnimationState state)
|
private string getStateString(TaikoMascotAnimationState state)
|
||||||
{
|
{
|
||||||
return state switch
|
switch (state)
|
||||||
{
|
{
|
||||||
TaikoMascotAnimationState.Clear => "clear",
|
case TaikoMascotAnimationState.Clear:
|
||||||
TaikoMascotAnimationState.Fail => "fail",
|
return "clear";
|
||||||
TaikoMascotAnimationState.Idle => "idle",
|
|
||||||
TaikoMascotAnimationState.Kiai => "kiai",
|
case TaikoMascotAnimationState.Fail:
|
||||||
_ => null
|
return "fail";
|
||||||
};
|
|
||||||
|
case TaikoMascotAnimationState.Idle:
|
||||||
|
return "idle";
|
||||||
|
|
||||||
|
case TaikoMascotAnimationState.Kiai:
|
||||||
|
return "kiai";
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentException($"There's no case for animation state ${state} available", nameof(state));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,9 +282,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
mascot.PlayfieldState.Value = isFailing ? TaikoMascotAnimationState.Fail : TaikoMascotAnimationState.Idle;
|
mascot.PlayfieldState.Value = isFailing ? TaikoMascotAnimationState.Fail : TaikoMascotAnimationState.Idle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
internal class ProxyContainer : LifetimeManagementContainer
|
private class ProxyContainer : LifetimeManagementContainer
|
||||||
{
|
{
|
||||||
public new MarginPadding Padding
|
public new MarginPadding Padding
|
||||||
{
|
{
|
||||||
@ -294,3 +293,4 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
public void Add(Drawable proxy) => AddInternal(proxy);
|
public void Add(Drawable proxy) => AddInternal(proxy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|