1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Change state variables

This commit is contained in:
Craftplacer 2020-04-27 23:19:18 +02:00
parent 96660b2cca
commit 74d36cad78
2 changed files with 17 additions and 12 deletions

View File

@ -4,7 +4,6 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps.ControlPoints;
@ -16,8 +15,7 @@ namespace osu.Game.Rulesets.Taiko.UI
{
private TaikoMascotTextureAnimation idleDrawable, clearDrawable, kiaiDrawable, failDrawable;
private EffectControlPoint lastEffectControlPoint;
public Bindable<TaikoMascotAnimationState> PlayfieldState;
private TaikoMascotAnimationState playfieldState;
public TaikoMascotAnimationState State { get; private set; }
@ -25,13 +23,6 @@ namespace osu.Game.Rulesets.Taiko.UI
{
RelativeSizeAxes = Axes.Both;
PlayfieldState = new Bindable<TaikoMascotAnimationState>();
PlayfieldState.BindValueChanged(b =>
{
if (lastEffectControlPoint != null)
ShowState(GetFinalAnimationState(lastEffectControlPoint, b.NewValue));
});
State = startingState;
}
@ -60,6 +51,20 @@ namespace osu.Game.Rulesets.Taiko.UI
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)
{
switch (state)
@ -93,7 +98,7 @@ namespace osu.Game.Rulesets.Taiko.UI
{
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
var state = GetFinalAnimationState(lastEffectControlPoint = effectPoint, PlayfieldState.Value);
var state = GetFinalAnimationState(lastEffectControlPoint = effectPoint, playfieldState);
ShowState(state);
if (state == TaikoMascotAnimationState.Clear)

View File

@ -220,7 +220,7 @@ namespace osu.Game.Rulesets.Taiko.UI
if (miss && judgedObject.HitObject is StrongHitObject)
miss = result.Judgement.AffectsCombo;
mascot.PlayfieldState.Value = miss ? TaikoMascotAnimationState.Fail : TaikoMascotAnimationState.Idle;
mascot.SetPlayfieldState(miss ? TaikoMascotAnimationState.Fail : TaikoMascotAnimationState.Idle);
}
}