mirror of
https://github.com/osukey/osukey.git
synced 2025-06-10 05:48:05 +09:00
Change state variables
This commit is contained in:
parent
96660b2cca
commit
74d36cad78
@ -4,7 +4,6 @@
|
|||||||
using System;
|
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.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
@ -16,8 +15,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
private TaikoMascotTextureAnimation idleDrawable, clearDrawable, kiaiDrawable, failDrawable;
|
private TaikoMascotTextureAnimation idleDrawable, clearDrawable, kiaiDrawable, failDrawable;
|
||||||
private EffectControlPoint lastEffectControlPoint;
|
private EffectControlPoint lastEffectControlPoint;
|
||||||
|
private TaikoMascotAnimationState playfieldState;
|
||||||
public Bindable<TaikoMascotAnimationState> PlayfieldState;
|
|
||||||
|
|
||||||
public TaikoMascotAnimationState State { get; private set; }
|
public TaikoMascotAnimationState State { get; private set; }
|
||||||
|
|
||||||
@ -25,13 +23,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
PlayfieldState = new Bindable<TaikoMascotAnimationState>();
|
|
||||||
PlayfieldState.BindValueChanged(b =>
|
|
||||||
{
|
|
||||||
if (lastEffectControlPoint != null)
|
|
||||||
ShowState(GetFinalAnimationState(lastEffectControlPoint, b.NewValue));
|
|
||||||
});
|
|
||||||
|
|
||||||
State = startingState;
|
State = startingState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +51,20 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
drawable.Show();
|
drawable.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the playfield state used for determining the final state.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// If you're looking to change the state manually, please look at <see cref="ShowState"/>.
|
||||||
|
/// </remarks>
|
||||||
|
public void SetPlayfieldState(TaikoMascotAnimationState state)
|
||||||
|
{
|
||||||
|
playfieldState = state;
|
||||||
|
|
||||||
|
if (lastEffectControlPoint != null)
|
||||||
|
ShowState(GetFinalAnimationState(lastEffectControlPoint, playfieldState));
|
||||||
|
}
|
||||||
|
|
||||||
private TaikoMascotTextureAnimation getStateDrawable(TaikoMascotAnimationState state)
|
private TaikoMascotTextureAnimation getStateDrawable(TaikoMascotAnimationState state)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
@ -93,7 +98,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
||||||
|
|
||||||
var state = GetFinalAnimationState(lastEffectControlPoint = effectPoint, PlayfieldState.Value);
|
var state = GetFinalAnimationState(lastEffectControlPoint = effectPoint, playfieldState);
|
||||||
ShowState(state);
|
ShowState(state);
|
||||||
|
|
||||||
if (state == TaikoMascotAnimationState.Clear)
|
if (state == TaikoMascotAnimationState.Clear)
|
||||||
|
@ -220,7 +220,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
if (miss && judgedObject.HitObject is StrongHitObject)
|
if (miss && judgedObject.HitObject is StrongHitObject)
|
||||||
miss = result.Judgement.AffectsCombo;
|
miss = result.Judgement.AffectsCombo;
|
||||||
|
|
||||||
mascot.PlayfieldState.Value = miss ? TaikoMascotAnimationState.Fail : TaikoMascotAnimationState.Idle;
|
mascot.SetPlayfieldState(miss ? TaikoMascotAnimationState.Fail : TaikoMascotAnimationState.Idle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user