Skip to content

Commit

Permalink
Merge pull request #1106 from shananas/new-panacea-option
Browse files Browse the repository at this point in the history
New Panacea Sound Debug Setting
  • Loading branch information
Delta-473 authored Sep 13, 2024
2 parents 6f4b250 + 350917a commit 65553fc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
10 changes: 10 additions & 0 deletions OpenKh.Tools.ModsManager/Services/ConfigurationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ private class Config
public bool PanaceaInstalled { get; internal set; }
public bool ShowConsole { get; internal set; } = false;
public bool DebugLog { get; internal set; } = false;
public bool SoundDebug { get; internal set; } = false;
public bool EnableCache { get; internal set; } = true;
public bool QuickMenu { get; internal set; } = false;
public bool DevView { get; internal set; } = false;
Expand Down Expand Up @@ -316,6 +317,15 @@ public static bool DebugLog
_config.Save(ConfigPath);
}
}
public static bool SoundDebug
{
get => _config.SoundDebug;
set
{
_config.SoundDebug = value;
_config.Save(ConfigPath);
}
}
public static bool EnableCache
{
get => _config.EnableCache;
Expand Down
22 changes: 20 additions & 2 deletions OpenKh.Tools.ModsManager/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class MainViewModel : BaseNotifyPropertyChanged, IChangeModEnableState
private bool _panaceaInstalled;
private bool _panaceaConsoleEnabled;
private bool _panaceaDebugLogEnabled;
private bool _panaceaSoundDebugEnabled;
private bool _panaceaCacheEnabled;
private bool _panaceaQuickMenuEnabled;
private bool _devView;
Expand Down Expand Up @@ -142,10 +143,24 @@ public bool PanaceaDebugLogEnabled
{
_panaceaDebugLogEnabled = value;
ConfigurationService.DebugLog = _panaceaDebugLogEnabled;
if (_panaceaSoundDebugEnabled)
PanaceaSoundDebugEnabled = false;
OnPropertyChanged(nameof(PanaceaDebugLogEnabled));
UpdatePanaceaSettings();
}
}
public bool PanaceaSoundDebugEnabled
{
get => _panaceaSoundDebugEnabled;
set
{
_panaceaSoundDebugEnabled = value;
ConfigurationService.SoundDebug = _panaceaSoundDebugEnabled;
OnPropertyChanged(nameof(PanaceaSoundDebugEnabled));
UpdatePanaceaSettings();
}

}
public bool PanaceaCacheEnabled
{
get => _panaceaCacheEnabled;
Expand Down Expand Up @@ -299,6 +314,7 @@ public MainViewModel()
DevView = ConfigurationService.DevView;
_panaceaConsoleEnabled = ConfigurationService.ShowConsole;
_panaceaDebugLogEnabled = ConfigurationService.DebugLog;
_panaceaSoundDebugEnabled = ConfigurationService.SoundDebug;
_panaceaCacheEnabled = ConfigurationService.EnableCache;
_panaceaQuickMenuEnabled = ConfigurationService.QuickMenu;
}
Expand Down Expand Up @@ -1274,7 +1290,8 @@ public void UpdatePanaceaSettings()
}
}
textToWrite += $"\r\nshow_console={_panaceaConsoleEnabled}\r\n" +
$"debug_log={_panaceaDebugLogEnabled}\r\nenable_cache={_panaceaCacheEnabled}\r\nquick_menu={_panaceaQuickMenuEnabled}";
$"debug_log={_panaceaDebugLogEnabled}\r\nsound_debug={_panaceaSoundDebugEnabled}\r\n" +
$"enable_cache={_panaceaCacheEnabled}\r\nquick_menu={_panaceaQuickMenuEnabled}";
File.WriteAllText(panaceaSettings, textToWrite);
}
else if (ConfigurationService.PcReleaseLocationKH3D != null)
Expand All @@ -1291,7 +1308,8 @@ public void UpdatePanaceaSettings()
}
}
textToWrite += $"\r\nshow_console={_panaceaConsoleEnabled}\r\n" +
$"debug_log={_panaceaDebugLogEnabled}\r\nenable_cache={_panaceaCacheEnabled}\r\nquick_menu={_panaceaQuickMenuEnabled}";
$"debug_log={_panaceaDebugLogEnabled}\r\nsound_debug={_panaceaSoundDebugEnabled}\r\n" +
$"enable_cache={_panaceaCacheEnabled}\r\nquick_menu={_panaceaQuickMenuEnabled}";
File.WriteAllText(panaceaSettings, textToWrite);
}
}
Expand Down
1 change: 1 addition & 0 deletions OpenKh.Tools.ModsManager/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<MenuItem Header="Panacea Settings" Visibility="{Binding PanaceaSettings}">
<MenuItem Header="Enable Console" IsCheckable="True" IsChecked="{Binding PanaceaConsoleEnabled}" StaysOpenOnClick="True"/>
<MenuItem Header="Enable Debug Log" IsCheckable="True" IsChecked="{Binding PanaceaDebugLogEnabled}" IsEnabled="{Binding PanaceaConsoleEnabled}" StaysOpenOnClick="True"/>
<MenuItem Header="Enable Sound Debug" IsCheckable="True" IsChecked="{Binding PanaceaSoundDebugEnabled}" IsEnabled="{Binding PanaceaDebugLogEnabled}" StaysOpenOnClick="True"/>
<MenuItem Header="Enable Cache" IsCheckable="True" IsChecked="{Binding PanaceaCacheEnabled}" StaysOpenOnClick="True"/>
<MenuItem Header="Enable Quick Menu" IsCheckable="True" IsChecked="{Binding PanaceaQuickMenuEnabled}" StaysOpenOnClick="True"/>
</MenuItem>
Expand Down

0 comments on commit 65553fc

Please sign in to comment.