Skip to content

Commit

Permalink
ConfigApp: Don't accidentally mark custom timed type setting for effe…
Browse files Browse the repository at this point in the history
…cts with default timed type settings
  • Loading branch information
pongo1231 committed Feb 15, 2024
1 parent dabb3bd commit 9769b90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions ConfigApp/EffectConfig.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion ConfigApp/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down

0 comments on commit 9769b90

Please sign in to comment.