private void OnBuildupChange(object source, MonsterAilmentEventArgs args) { if (args.MaxBuildup <= 0) { return; } System.Windows.Visibility visibility; if (UserSettings.PlayerConfig.Overlay.MonstersComponent.EnableMonsterAilments) { visibility = System.Windows.Visibility.Visible; } else { visibility = System.Windows.Visibility.Collapsed; } Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() => { AilmentBar.MaxHealth = Math.Max(1, args.MaxBuildup); // Get the min between them so the buildup doesnt overflow AilmentBar.Health = Math.Min(args.Buildup, args.MaxBuildup); AilmentText.Text = $"{AilmentBar.Health:0}/{AilmentBar.MaxHealth:0}"; Visibility = visibility; StartVisibilityTimer(); })); }
private void OnDurationChange(object source, MonsterAilmentEventArgs args) { if (args.MaxDuration <= 0) { return; } System.Windows.Visibility visibility; if (UserSettings.PlayerConfig.Overlay.MonstersComponent.EnableMonsterAilments) { visibility = System.Windows.Visibility.Visible; } else { visibility = System.Windows.Visibility.Collapsed; } if (args.Duration > 0) { Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() => { AilmentBar.MaxHealth = args.MaxDuration; AilmentBar.Health = Math.Max(0, args.MaxDuration - args.Duration); AilmentText.Text = $"{AilmentBar.Health:0}/{AilmentBar.MaxHealth:0}"; Visibility = visibility; StartVisibilityTimer(); })); } else { OnBuildupChange(source, args); } //ensures we switch back to showing buildup }
private void OnDurationChange(object source, MonsterAilmentEventArgs args) { if (args.MaxDuration <= 0) { return; } bool enabled = Component.EnableMonsterAilments; bool visible = enabled && IsGroupEnabled; if (args.Duration > 0) { Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() => { AilmentBar.MaxValue = args.MaxDuration; AilmentBar.Value = Math.Max(0, args.MaxDuration - args.Duration); AilmentText.Text = FormatAilmentString(Component.AilmentTimerTextFormat, AilmentBar.Value, AilmentBar.MaxValue);; Visibility = visible ? Visibility.Visible : Visibility.Collapsed; StartVisibilityTimer(); })); } else { OnBuildupChange(source, args); } //ensures we switch back to showing buildup }
private void OnCounterChange(object source, MonsterAilmentEventArgs args) { bool visible = Component.EnableMonsterAilments; Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() => { AilmentCounter.Text = args.Counter.ToString(); Visibility = visible ? Visibility.Visible : Visibility.Collapsed; StartVisibilityTimer(); })); }
private void OnCounterChange(object source, MonsterAilmentEventArgs args) { System.Windows.Visibility visibility; if (UserSettings.PlayerConfig.Overlay.MonstersComponent.EnableMonsterAilments) { visibility = System.Windows.Visibility.Visible; } else { visibility = System.Windows.Visibility.Collapsed; } Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() => { this.AilmentCounter.Text = args.Counter.ToString(); this.Visibility = visibility; StartVisibilityTimer(); })); }
private void OnBuildupChange(object source, MonsterAilmentEventArgs args) { if (args.MaxBuildup <= 0) { return; } bool enabled = Component.EnableMonsterAilments; bool visible = enabled && IsGroupEnabled; Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() => { AilmentBar.MaxValue = Math.Max(1, args.MaxBuildup); // Get the min between them so the buildup doesnt overflow AilmentBar.Value = Math.Min(args.Buildup, args.MaxBuildup); AilmentText.Text = FormatAilmentString(Component.AilmentBuildupTextFormat, AilmentBar.Value, AilmentBar.MaxValue); Visibility = visible ? Visibility.Visible : Visibility.Collapsed; StartVisibilityTimer(); })); }