private void OnAbnormalityEnd(object source, AbnormalityEventArgs args) => Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() => { args.Abnormality.OnAbnormalityUpdate -= OnAbnormalityUpdate; args.Abnormality.OnAbnormalityEnd -= OnAbnormalityEnd; args.Abnormality.OnStackChange -= OnAbnormalityStackChange; Context = null; }));
private void OnPlayerAbnormalityEnd(object source, AbnormalityEventArgs args) { Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Loaded, new Action(() => { this.ActiveAbnormalities.Remove(args.Abnormality.InternalID); this.RedrawComponent(); })); }
private void OnAbnormalityUpdate(object source, AbnormalityEventArgs args) { float angle; if (args.Abnormality.IsInfinite || args.Abnormality.MaxDuration == 0) { angle = 90; } else { angle = ConvertPercentageIntoAngle(args.Abnormality.Duration / (args.Abnormality.IsPercentageBuff ? args.Abnormality.MaxTimer : args.Abnormality.MaxDuration)); } Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() => { AbnormalityExpireWarning.Visibility = args.Abnormality.DurationPercentage <= 0.1 ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden; AbnormalityDurationArc.EndAngle = angle; if (args.Abnormality.IsInfinite || !ShowAbnormalityTimerText) { TimeLeftText.Visibility = System.Windows.Visibility.Collapsed; Height = 36; } else { TimeLeftText.Text = args.Abnormality.IsPercentageBuff ? $"{args.Abnormality.Duration / args.Abnormality.MaxTimer:P0}" : FormatToMinutes(args.Abnormality.Duration); } })); }
private void RemoveObsoleteAbnormality(object source, AbnormalityEventArgs args) { // Unhook event to release references args.Abnormality.OnAbnormalityEnd -= RemoveObsoleteAbnormality; // Remove abnormality Remove(args.Abnormality.InternalID); //Logger.Debugger.Log($"REMOVED ABNORMALITY: {args.Abnormality.Name}"); }
private void OnPlayerNewAbnormality(object source, AbnormalityEventArgs args) { Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Loaded, new Action(() => { Parts.AbnormalityControl AbnormalityBox = new Parts.AbnormalityControl(args.Abnormality); this.ActiveAbnormalities.Add(args.Abnormality.InternalID, AbnormalityBox); this.RedrawComponent(); })); }
private void OnAbnormalityStackChange(object source, AbnormalityEventArgs args) => Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, new Action(() => { ImageSource NewIcon = TryFindResource($"{args.Abnormality.Icon}" + string.Concat(Enumerable.Repeat("+", args.Abnormality.Stack))) as ImageSource; if (NewIcon == null) { NewIcon = FindResource($"{args.Abnormality.Icon}") as ImageSource; } AbnormalityIcon.Source = NewIcon; }));
private void OnAbnormalityEnd(object source, AbnormalityEventArgs args) { HashSet <string> poison = new HashSet <string>() { "ICON_POISON", "ICON_VENOM" }; Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { string abnormIcon = args.Abnormality.Icon; if (args.Abnormality.IsDebuff) { if (abnormIcon == "ELEMENT_FIRE") { HealthBar.IsOnFire = false; } else if (abnormIcon == "ICON_BLEED") { HealthBar.IsBleeding = false; } else if (abnormIcon == "ICON_EFFLUVIA") { HealthBar.HasEffluvia = false; } else if (abnormIcon == "ELEMENT_WATER") { IsWet = false; } else if (abnormIcon == "ELEMENT_ICE") { IsIcy = false; } else if (poison.Contains(abnormIcon)) { HealthBar.IsPoisoned = false; } HealthBar.IsNormal = (!HealthBar.IsOnFire && !HealthBar.IsPoisoned && !HealthBar.IsBleeding && !HealthBar.HasEffluvia); IsStaminaNormal = (!IsWet && !IsIcy); } else { if (abnormIcon == "ICON_NATURALHEALING") { HealthBar.IsHealing = false; } } })); }
private void OnAbnormalityUpdate(object source, AbnormalityEventArgs args) { float angle; if (args.Abnormality.IsInfinite || args.Abnormality.MaxDuration == 0) { angle = 90; } else { angle = ConvertPercentageIntoAngle(args.Abnormality.Duration / args.Abnormality.MaxDuration); } Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() => { this.AbnormalityDurationArc.EndAngle = angle; })); }
private void OnPlayerNewAbnormality(object source, AbnormalityEventArgs args) { // Ignore abnormalities that aren't enabled for this tray if (!UserSettings.PlayerConfig.Overlay.AbnormalitiesWidget.BarPresets[AbnormalityTrayIndex].AcceptedAbnormalities.Contains(args.Abnormality.InternalID)) { return; } Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Loaded, new Action(() => { this.WidgetHasContent = true; Parts.AbnormalityControl AbnormalityBox = new Parts.AbnormalityControl() { ShowAbnormalityTimerText = UserSettings.PlayerConfig.Overlay.AbnormalitiesWidget.BarPresets[AbnormalityTrayIndex].ShowTimeLeftText, AbnormalityTimerTextFormat = UserSettings.PlayerConfig.Overlay.AbnormalitiesWidget.BarPresets[AbnormalityTrayIndex].TimeLeftTextFormat }; AbnormalityBox.Initialize(args.Abnormality); this.ActiveAbnormalities.Add(args.Abnormality.InternalID, AbnormalityBox); this.RedrawComponent(); })); }
private void OnAbnormalityStackChange(object source, AbnormalityEventArgs args) => Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, new Action(() =>