private void Dc_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(_dc.Shield)) { if (_dc.Shield == ShieldStatus.On) { _shieldArcAn = new DoubleAnimation(0, 359.99, TimeSpan.FromSeconds(BossGageWindowViewModel.Ph1ShieldDuration)); ShieldArc.BeginAnimation(Arc.EndAngleProperty, _shieldArcAn); } else { _shieldArcAn.BeginTime = null; ShieldArc.BeginAnimation(Arc.EndAngleProperty, _shieldArcAn); } } else if (e.PropertyName == nameof(_dc.Enraged)) { if (_dc.Enraged) { EnrageArc.BeginAnimation(Arc.EndAngleProperty, new DoubleAnimation(359.99, 0, TimeSpan.FromSeconds(_dc.EnragePattern.Duration))); } else { EnrageLine.LayoutTransform = _dc.CurrentPercentage > _dc.EnragePattern.Percentage ? new RotateTransform((_dc.CurrentPercentage - _dc.EnragePattern.Percentage) * 3.6) : new RotateTransform(0); } } else if (e.PropertyName == nameof(_dc.CurrentHP)) { if (_dc.Enraged) { EnrageLine.LayoutTransform = new RotateTransform(_dc.HPFactor * 359.9); } } }
void DeployEnrageGrid() { Dispatcher.Invoke(() => { DoubleAnimation.To = 1; EnrageGrid.RenderTransform.BeginAnimation(ScaleTransform.ScaleXProperty, DoubleAnimation); EnrageArc.BeginAnimation(Arc.EndAngleProperty, new DoubleAnimation(359.9, 0, TimeSpan.FromMilliseconds(EnrageDuration))); }); }
private void Dc_PropertyChanged(object?sender, PropertyChangedEventArgs e) { if (_dc == null) { return; } switch (e.PropertyName) { case nameof(_dc.Shield) when _dc.Shield == ShieldStatus.On: ShieldArc.BeginAnimation(Arc.EndAngleProperty, _shieldArcAn); break; case nameof(_dc.Shield): _shieldArcAn.BeginTime = null; ShieldArc.BeginAnimation(Arc.EndAngleProperty, _shieldArcAn); break; case nameof(_dc.Enraged) when _dc.Enraged: if (_dc.EnragePattern != null) { _enrageEndAnim.Duration = TimeSpan.FromMilliseconds(_dc.EnragePattern.Duration); } EnrageArc.BeginAnimation(Arc.EndAngleProperty, _enrageEndAnim); break; case nameof(_dc.Enraged): EnrageLine.LayoutTransform = _dc.EnragePattern != null && _dc.CurrentPercentage > _dc.EnragePattern.Percentage ? new RotateTransform((_dc.CurrentPercentage - _dc.EnragePattern.Percentage) * 3.6) : new RotateTransform(0); break; case nameof(_dc.CurrentHP): { if (_dc.Enraged) { EnrageLine.LayoutTransform = new RotateTransform(_dc.HPFactor * 359.9); } break; } } }
private void BossGageWindow_EnragedChanged(bool enraged) { Dispatcher.Invoke(() => { if (enraged) { number.Text = CurrentEnrageTime.ToString(); NextEnrage.BeginAnimation(MarginProperty, SlideNextEnrageIndicatorDirectAnimation(HPrect.ActualWidth - 2)); HPrect.Effect.BeginAnimation(DropShadowEffect.OpacityProperty, GetDoubleAnimation(1)); HPrect.Fill.BeginAnimation(SolidColorBrush.ColorProperty, GetColorAnimation(Colors.Red)); EnrageArc.BeginAnimation(Arc.EndAngleProperty, new DoubleAnimation(359.9, 0, TimeSpan.FromMilliseconds(EnrageDuration))); EnrageGrid.BeginAnimation(WidthProperty, GetDoubleAnimation(60)); NumberTimer = new Timer(1000); NumberTimer.Elapsed += (s, ev) => { Dispatcher.Invoke(() => { number.Text = CurrentEnrageTime.ToString(); CurrentEnrageTime--; }); }; NumberTimer.Enabled = true; } else { if (NumberTimer != null) { NumberTimer.Stop(); } NextEnrage.BeginAnimation(MarginProperty, SlideNextEnrageIndicatorAnimation(LastEnragePercent - 10)); HPrect.Effect.BeginAnimation(DropShadowEffect.OpacityProperty, GetDoubleAnimation(0)); HPrect.Fill.BeginAnimation(SolidColorBrush.ColorProperty, GetColorAnimation(Colors.OrangeRed)); EnrageGrid.BeginAnimation(WidthProperty, GetDoubleAnimation(0)); CurrentEnrageTime = 36; } }); }