private void updateState(ArmedState newState, bool force = false) { if (State.Value == newState && !force) { return; } if (UseTransformStateManagement) { LifetimeEnd = double.MaxValue; double transformTime = HitObject.StartTime - InitialLifetimeOffset; base.ApplyTransformsAt(transformTime, true); base.ClearTransformsAfter(transformTime, true); using (BeginAbsoluteSequence(transformTime, true)) { UpdateInitialTransforms(); var judgementOffset = Result?.TimeOffset ?? 0; using (BeginDelayedSequence(InitialLifetimeOffset + judgementOffset, true)) { UpdateStateTransforms(newState); state.Value = newState; } } if (state.Value != ArmedState.Idle && LifetimeEnd == double.MaxValue) { Expire(); } } else { state.Value = newState; } UpdateState(newState); // apply any custom state overrides ApplyCustomUpdateState?.Invoke(this, newState); if (newState == ArmedState.Hit) { PlaySamples(); } }
protected override void LoadComplete() { base.LoadComplete(); State.ValueChanged += state => { UpdateState(state); // apply any custom state overrides ApplyCustomUpdateState?.Invoke(this, state); if (State == ArmedState.Hit) { PlaySamples(); } }; State.TriggerChange(); }
private void updateState(ArmedState newState, bool force = false) { if (State.Value == newState && !force) { return; } LifetimeEnd = double.MaxValue; double transformTime = HitObject.StartTime - InitialLifetimeOffset; base.ApplyTransformsAt(double.MinValue, true); base.ClearTransformsAfter(double.MinValue, true); using (BeginAbsoluteSequence(transformTime, true)) UpdateInitialTransforms(); using (BeginAbsoluteSequence(StateUpdateTime, true)) UpdateStartTimeStateTransforms(); #pragma warning disable 618 using (BeginAbsoluteSequence(StateUpdateTime + (Result?.TimeOffset ?? 0), true)) UpdateStateTransforms(newState); #pragma warning restore 618 using (BeginAbsoluteSequence(HitStateUpdateTime, true)) UpdateHitStateTransforms(newState); state.Value = newState; if (LifetimeEnd == double.MaxValue && (state.Value != ArmedState.Idle || HitObject.HitWindows == null)) { Expire(); } // apply any custom state overrides ApplyCustomUpdateState?.Invoke(this, newState); if (!force && newState == ArmedState.Hit) { PlaySamples(); } }
private void updateState(ArmedState newState, bool force = false) { if (State.Value == newState && !force) { return; } // apply any custom state overrides ApplyCustomUpdateState?.Invoke(this, newState); if (newState == ArmedState.Hit) { PlaySamples(); } if (UseTransformStateManagement) { double transformTime = HitObject.StartTime - InitialLifetimeOffset; base.ApplyTransformsAt(transformTime, true); base.ClearTransformsAfter(transformTime, true); using (BeginAbsoluteSequence(transformTime, true)) { UpdateInitialTransforms(); var judgementOffset = Math.Min(HitObject.HitWindows?.HalfWindowFor(HitResult.Miss) ?? double.MaxValue, Result?.TimeOffset ?? 0); using (BeginDelayedSequence(InitialLifetimeOffset + judgementOffset, true)) { UpdateStateTransforms(newState); state.Value = newState; } } } else { state.Value = newState; } UpdateState(newState); }
private void apply(HitObject hitObject) { if (nestedHitObjects.IsValueCreated) { nestedHitObjects.Value.Clear(); ClearNestedHitObjects(); } foreach (var h in hitObject.NestedHitObjects) { var drawableNested = CreateNestedHitObject(h) ?? throw new InvalidOperationException($"{nameof(CreateNestedHitObject)} returned null for {h.GetType().ReadableName()}."); drawableNested.OnNewResult += (d, r) => OnNewResult?.Invoke(d, r); drawableNested.OnRevertResult += (d, r) => OnRevertResult?.Invoke(d, r); drawableNested.ApplyCustomUpdateState += (d, j) => ApplyCustomUpdateState?.Invoke(d, j); nestedHitObjects.Value.Add(drawableNested); AddNestedHitObject(drawableNested); } }
private void updateState(ArmedState newState, bool force = false) { if (State.Value == newState && !force) { return; } LifetimeEnd = double.MaxValue; double transformTime = HitObject.StartTime - InitialLifetimeOffset; clearExistingStateTransforms(); using (BeginAbsoluteSequence(transformTime)) UpdateInitialTransforms(); using (BeginAbsoluteSequence(StateUpdateTime)) UpdateStartTimeStateTransforms(); using (BeginAbsoluteSequence(HitStateUpdateTime)) UpdateHitStateTransforms(newState); state.Value = newState; if (LifetimeEnd == double.MaxValue && (state.Value != ArmedState.Idle || HitObject.HitWindows == null)) { LifetimeEnd = Math.Max(LatestTransformEndTime, HitStateUpdateTime + (Samples?.Length ?? 0)); } // apply any custom state overrides ApplyCustomUpdateState?.Invoke(this, newState); if (!force && newState == ArmedState.Hit) { PlaySamples(); } }
private void onApplyCustomUpdateState(DrawableHitObject drawableHitObject, ArmedState state) => ApplyCustomUpdateState?.Invoke(drawableHitObject, state);