From 9769b90a2ed760546562ad1d4b794641c57c3ff7 Mon Sep 17 00:00:00 2001 From: pongo1231 Date: Thu, 15 Feb 2024 01:48:11 +0000 Subject: [PATCH] ConfigApp: Don't accidentally mark custom timed type setting for effects with default timed type settings --- ConfigApp/EffectConfig.xaml.cs | 8 ++++---- ConfigApp/Utils.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ConfigApp/EffectConfig.xaml.cs b/ConfigApp/EffectConfig.xaml.cs index 01616d962..4faed211f 100644 --- a/ConfigApp/EffectConfig.xaml.cs +++ b/ConfigApp/EffectConfig.xaml.cs @@ -34,7 +34,7 @@ public EffectConfig(string? effectId, EffectData? effectData, EffectInfo effectI if (m_IsTimedEffect) { - effectconf_timer_type_enable.IsChecked = m_EffectData.TimedType != null; + effectconf_timer_type_enable.IsChecked = m_EffectData.TimedType.HasValue; effectconf_timer_type.ItemsSource = new string[] { "Normal", @@ -211,8 +211,8 @@ private void CheckEnableConfigurables() effectconf_timer_time_enable.IsEnabled = false; } - effectconf_timer_type.IsEnabled = effectconf_timer_type_enable.IsChecked.GetValueOrDefault(false); - effectconf_timer_time.IsEnabled = effectconf_timer_time_enable.IsChecked.GetValueOrDefault(false); + effectconf_timer_type.IsEnabled = effectconf_timer_type_enable.IsEnabled && effectconf_timer_type_enable.IsChecked.GetValueOrDefault(false); + effectconf_timer_time.IsEnabled = effectconf_timer_time_enable.IsEnabled && effectconf_timer_time_enable.IsChecked.GetValueOrDefault(false); } private void OnClicked(object sender, RoutedEventArgs e) @@ -258,7 +258,7 @@ private void NoCopyPastePreviewExecuted(object sender, ExecutedRoutedEventArgs e public EffectData GetNewData() { - if (effectconf_timer_type_enable.IsChecked.HasValue && effectconf_timer_type_enable.IsChecked.Value) + if (effectconf_timer_type_enable.IsChecked.GetValueOrDefault(false)) { m_EffectData.TimedType = (object)effectconf_timer_type.SelectedIndex switch { diff --git a/ConfigApp/Utils.cs b/ConfigApp/Utils.cs index c01139f6b..c6f894fad 100644 --- a/ConfigApp/Utils.cs +++ b/ConfigApp/Utils.cs @@ -30,7 +30,7 @@ public static EffectData ValueStringToEffectData(string? value) if (Enum.TryParse(values[1], out Effects.EffectTimedType timedType)) { - effectData.TimedType = timedType; + effectData.TimedType = timedType != Effects.EffectTimedType.NotTimed ? timedType : null; } if (int.TryParse(values[2], out int customTime)) {