private void OnRedHealthUpdate(object source, PlayerHealthEventArgs args) { Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { HealthBar.RedHealth = args.RedHealth; })); }
private void OnHealthUpdate(object source, PlayerHealthEventArgs args) { Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { PlayerCurrentHealth = (int)args.Health; PlayerMaxHealth = (int)args.MaxHealth; HealthBar.MaxHealth = args.MaxHealth; HealthBar.Health = args.Health; if (args.RedHealth > 0) { HealthBar.RedHealth = args.RedHealth; } })); }
private void OnHealHealth(object source, PlayerHealthEventArgs args) { Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { double healValue = args.HealingData.Stage == 1 ? args.HealingData.MaxHeal * 2.5 : args.HealingData.MaxHeal; if (args.HealingData.Stage == 0) { HealthBar.HealHealth = 0; } else { HealthBar.HealHealth = Math.Min(args.Health + (healValue - args.HealingData.CurrentHeal), args.MaxHealth); } })); }
private void OnHealthExtStateUpdate(object source, PlayerHealthEventArgs args) { Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { if (args.IsHealthExtVisible && args.MaxPossibleHealth != args.MaxHealth) { HealthExt.Visibility = Visibility.Visible; float maxHealth = Math.Min(args.MaxHealth + HealthComponent.CanIncreaseMaxHealth[args.SelectedItemId], args.MaxPossibleHealth); double extWidth = HealthBar.ConstantWidth * ((maxHealth - args.MaxHealth) / HealthBar.CHealth); HealthExt.Width = Math.Max(0, extWidth); } else { HealthExt.Width = 0; HealthExt.Visibility = Visibility.Collapsed; } })); }
private void OnMaxHealthUpdate(object source, PlayerHealthEventArgs args) { bool hasMoxie = Context?.FoodData.Skills?.Contains(FoodSkills.FelyneMoxie) ?? false; Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { MoxieVisibility = hasMoxie ? Visibility.Visible : Visibility.Hidden; double calculatedLeft = 60 * (HealthBar.ConstantWidth / HealthBar.CHealth); MoxieMargin = new Thickness(HealthBarPanel.Margin.Left + calculatedLeft, HealthBarPanel.Margin.Top, 0, 0); PlayerCurrentHealth = (int)args.Health; PlayerMaxHealth = (int)args.MaxHealth; HealthBar.MaxHealth = args.MaxHealth; HealthBar.Health = args.Health; OnHealthExtStateUpdate(source, args); })); }