private void BossGage_HPUpdated(ulong id, object hp) { Dispatcher.Invoke(() => { if (id == EntityId) { CurrentHP = Convert.ToInt32(hp); if (CurrentHP > MaxHP) { MaxHP = CurrentHP; } DoubleAnimation.To = ValueToLength(CurrentHP, MaxHP); HPrect.BeginAnimation(WidthProperty, DoubleAnimation); Perc.Text = String.Format("{0:0.0}%", CurrentPercentage); Perc2.Text = String.Format("{0} / {1}", CurrentHP.ToString("n", nfi), MaxHP.ToString("n", nfi)); if (Enraged) { SlideNextEnrage(CurrentPercentage); //SetEnragePercTB(CurrentPercentage); } } }); }
private void BossGage_HPUpdated(ulong id, object hp) { Dispatcher.Invoke(() => { if (id == EntityId) { CurrentHP = Convert.ToInt32(hp); if (CurrentHP > MaxHP) { MaxHP = CurrentHP; } DoubleAnimation.To = ValueToLength(CurrentHP, MaxHP); HPrect.BeginAnimation(WidthProperty, DoubleAnimation); dragonHPpercTB.Text = String.Format("{0:0.0}%", CurrentPercentage); if (Enraged) { SlideNextEnrage(CurrentPercentage); //SetEnragePercTB(CurrentPercentage); } //Console.WriteLine("{0} HP updated.", DragonName); } }); }
void AnimateHP(double val) { Dispatcher.Invoke(() => { HPrect.BeginAnimation(WidthProperty, GetDoubleAnimation(ValueToLength(val, MaxHP))); Perc.Text = String.Format("{1} / {2} - {0:0.0}%", 100 * val / MaxHP, val.ToString("n", nfi), MaxHP.ToString("n", nfi)); }); }
private void BossGage_HPUpdated(ulong id, float hp) { Dispatcher.Invoke(() => { if (id == EntityId) { CurrentHP = hp; if (CurrentHP > MaxHP) { MaxHP = CurrentHP; } DoubleAnimation.To = ValueToLength(CurrentHP, MaxHP); HPrect.BeginAnimation(WidthProperty, DoubleAnimation); dragonHPpercTB.Text = String.Format("{0:0.0}%", CurrentPercentage); if (Enraged) { SlideNextEnrage(CurrentPercentage); //SetEnragePercTB(CurrentPercentage); } } }); }