-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ConfigApp: Split Misc tab into subtabs & rename to Settings (#3701)
- Loading branch information
Showing
7 changed files
with
440 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Media; | ||
using Xceed.Wpf.Toolkit; | ||
|
||
namespace ConfigApp.Tabs.Settings | ||
{ | ||
public class ColorsTab : Tab | ||
{ | ||
private ColorPicker? m_TimerBarColor = null; | ||
private ColorPicker? m_EffectTextColor = null; | ||
private ColorPicker? m_EffectTimerBarColor = null; | ||
|
||
private static ColorPicker GenerateCommonColorPicker(Color defaultColor) | ||
{ | ||
return new ColorPicker() | ||
{ | ||
Width = 60f, | ||
Height = 25f, | ||
SelectedColor = defaultColor, | ||
ShowStandardColors = false, | ||
UsingAlphaChannel = false | ||
}; | ||
} | ||
|
||
protected override void InitContent() | ||
{ | ||
PushNewColumn(new GridLength(1f, GridUnitType.Star)); | ||
SetRowHeight(new GridLength(1f, GridUnitType.Star)); | ||
|
||
var scrollViewer = new ScrollViewer(); | ||
|
||
var grid = new ChaosGrid(); | ||
grid.PushNewColumn(new GridLength(310f)); | ||
grid.PushNewColumn(new GridLength(10f)); | ||
grid.PushNewColumn(new GridLength(100f)); | ||
grid.PushNewColumn(new GridLength(450f)); | ||
grid.PushNewColumn(new GridLength(10f)); | ||
grid.PushNewColumn(new GridLength()); | ||
|
||
grid.PushRowSpacedPair("Timer bar color", m_TimerBarColor = GenerateCommonColorPicker(Color.FromRgb(0x40, 0x40, 0xFF))); | ||
grid.PopRow(); | ||
|
||
grid.PushRowSpacedPair("Effect text color", m_EffectTextColor = GenerateCommonColorPicker(Color.FromRgb(0xFF, 0xFF, 0xFF))); | ||
grid.PushRowSpacedPair("Effect timer bar color", m_EffectTimerBarColor = GenerateCommonColorPicker(Color.FromRgb(0xB4, 0xB4, 0xB4))); | ||
grid.PopRow(); | ||
|
||
scrollViewer.Content = grid.Grid; | ||
|
||
PushRowElement(scrollViewer); | ||
} | ||
|
||
public override void OnLoadValues() | ||
{ | ||
if (OptionsManager.ConfigFile.HasKey("EffectTimerColor") && m_TimerBarColor is not null) | ||
m_TimerBarColor.SelectedColor = (Color)ColorConverter.ConvertFromString(OptionsManager.ConfigFile.ReadValue("EffectTimerColor")); | ||
if (OptionsManager.ConfigFile.HasKey("EffectTextColor") && m_EffectTextColor is not null) | ||
m_EffectTextColor.SelectedColor = (Color)ColorConverter.ConvertFromString(OptionsManager.ConfigFile.ReadValue("EffectTextColor")); | ||
if (OptionsManager.ConfigFile.HasKey("EffectTimedTimerColor") && m_EffectTimerBarColor is not null) | ||
m_EffectTimerBarColor.SelectedColor = (Color)ColorConverter.ConvertFromString(OptionsManager.ConfigFile.ReadValue("EffectTimedTimerColor")); | ||
} | ||
|
||
public override void OnSaveValues() | ||
{ | ||
OptionsManager.ConfigFile.WriteValue("EffectTimerColor", m_TimerBarColor?.SelectedColor.ToString()); | ||
OptionsManager.ConfigFile.WriteValue("EffectTextColor", m_EffectTextColor?.SelectedColor.ToString()); | ||
OptionsManager.ConfigFile.WriteValue("EffectTimedTimerColor", m_EffectTimerBarColor?.SelectedColor.ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace ConfigApp.Tabs.Settings | ||
{ | ||
public class GeneralTab : Tab | ||
{ | ||
private CheckBox? m_DisableModOnStartup = null; | ||
private TextBox? m_MaxRunningEffects = null; | ||
private CheckBox? m_DisableDrawTimer = null; | ||
private CheckBox? m_DisableDrawEffectText = null; | ||
private TextBox? m_RandomSeed = null; | ||
private CheckBox? m_EnableEffectGroupWeighting = null; | ||
private CheckBox? m_EnableModSplashTexts = null; | ||
private CheckBox? m_EnableFailsafe = null; | ||
|
||
protected override void InitContent() | ||
{ | ||
PushNewColumn(new GridLength(1f, GridUnitType.Star)); | ||
SetRowHeight(new GridLength(1f, GridUnitType.Star)); | ||
|
||
var scrollViewer = new ScrollViewer(); | ||
|
||
var grid = new ChaosGrid(); | ||
grid.PushNewColumn(new GridLength(310f)); | ||
grid.PushNewColumn(new GridLength(10f)); | ||
grid.PushNewColumn(new GridLength(100f)); | ||
grid.PushNewColumn(new GridLength(450f)); | ||
grid.PushNewColumn(new GridLength(10f)); | ||
grid.PushNewColumn(new GridLength()); | ||
|
||
grid.PushRowSpacedPair("Disable mod on startup by default", m_DisableModOnStartup = Utils.GenerateCommonCheckBox()); | ||
grid.PushRowSpacedPair("Max amount of simultaneously running effects", m_MaxRunningEffects = Utils.GenerateCommonNumericOnlyTextBox(2)); | ||
grid.PopRow(); | ||
|
||
grid.PushRowSpacedPair("Don't draw timer bar", m_DisableDrawTimer = Utils.GenerateCommonCheckBox()); | ||
grid.PushRowSpacedPair("Don't draw effect text", m_DisableDrawEffectText = Utils.GenerateCommonCheckBox()); | ||
grid.PopRow(); | ||
|
||
grid.PushRowSpacedPair("Random Seed (Leave empty for random seed every time)", m_RandomSeed = Utils.GenerateCommonNumericOnlyTextBox()); | ||
grid.PushRowSpacedPair("Enable effect group weighting", m_EnableEffectGroupWeighting = Utils.GenerateCommonCheckBox()); | ||
grid.PopRow(); | ||
|
||
grid.PushRowSpacedPair("Show mod splash texts", m_EnableModSplashTexts = Utils.GenerateCommonCheckBox()); | ||
grid.PushRowSpacedPair("Allow prevention of repetitive mission fails (Failsafe)", m_EnableFailsafe = Utils.GenerateCommonCheckBox()); | ||
grid.PopRow(); | ||
|
||
scrollViewer.Content = grid.Grid; | ||
|
||
PushRowElement(scrollViewer); | ||
} | ||
|
||
public override void OnLoadValues() | ||
{ | ||
if (m_DisableDrawTimer is not null) | ||
m_DisableDrawTimer.IsChecked = OptionsManager.ConfigFile.ReadValueBool("DisableTimerBarDraw", false); | ||
if (m_DisableDrawEffectText is not null) | ||
m_DisableDrawEffectText.IsChecked = OptionsManager.ConfigFile.ReadValueBool("DisableEffectTextDraw", false); | ||
if (m_RandomSeed is not null) | ||
m_RandomSeed.Text = OptionsManager.ConfigFile.ReadValue("Seed"); | ||
if (m_MaxRunningEffects is not null) | ||
m_MaxRunningEffects.Text = OptionsManager.ConfigFile.ReadValue("MaxParallelRunningEffects", "99"); | ||
if (m_EnableEffectGroupWeighting is not null) | ||
m_EnableEffectGroupWeighting.IsChecked = OptionsManager.ConfigFile.ReadValueBool("EnableGroupWeightingAdjustments", true); | ||
if (m_DisableModOnStartup is not null) | ||
m_DisableModOnStartup.IsChecked = OptionsManager.ConfigFile.ReadValueBool("DisableStartup", false); | ||
if (m_EnableFailsafe is not null) | ||
m_EnableFailsafe.IsChecked = OptionsManager.ConfigFile.ReadValueBool("EnableFailsafe", true); | ||
if (m_EnableModSplashTexts is not null) | ||
m_EnableModSplashTexts.IsChecked = OptionsManager.ConfigFile.ReadValueBool("EnableModSplashTexts", true); | ||
} | ||
|
||
public override void OnSaveValues() | ||
{ | ||
OptionsManager.ConfigFile.WriteValue("DisableTimerBarDraw", m_DisableDrawTimer?.IsChecked); | ||
OptionsManager.ConfigFile.WriteValue("DisableEffectTextDraw", m_DisableDrawEffectText?.IsChecked); | ||
OptionsManager.ConfigFile.WriteValue("Seed", m_RandomSeed?.Text); | ||
OptionsManager.ConfigFile.WriteValue("MaxParallelRunningEffects", m_MaxRunningEffects?.Text); | ||
OptionsManager.ConfigFile.WriteValue("EnableGroupWeightingAdjustments", m_EnableEffectGroupWeighting?.IsChecked); | ||
OptionsManager.ConfigFile.WriteValue("DisableStartup", m_DisableModOnStartup?.IsChecked); | ||
OptionsManager.ConfigFile.WriteValue("EnableFailsafe", m_EnableFailsafe?.IsChecked); | ||
OptionsManager.ConfigFile.WriteValue("EnableModSplashTexts", m_EnableModSplashTexts?.IsChecked); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace ConfigApp.Tabs.Settings | ||
{ | ||
public class ModesTab : Tab | ||
{ | ||
private enum DispatchModeType | ||
{ | ||
Time, | ||
Distance | ||
}; | ||
private static readonly Dictionary<DispatchModeType, string> DispatchModes = new() | ||
{ | ||
{ DispatchModeType.Time, "Time"}, | ||
{ DispatchModeType.Distance, "Distance" } | ||
}; | ||
|
||
private ComboBox? m_DispatchMode = null; | ||
|
||
private ChaosGrid? m_TimeGrid = null; | ||
private TextBox? m_EffectDispatchTimer = null; | ||
private TextBox? m_TimedEffectDuration = null; | ||
private TextBox? m_ShortTimedEffectDuration = null; | ||
|
||
private ChaosGrid? m_DistanceGrid = null; | ||
private TextBox? m_DistanceBasedDispatchDistance = null; | ||
private ComboBox? m_DistanceBasedDispatchType = null; | ||
|
||
private CheckBox? m_EnableCrossingChallenge = null; | ||
|
||
private void UpdateDispatchModeGridVisibility() | ||
{ | ||
if (m_DispatchMode is null || m_TimeGrid is null || m_DistanceGrid is null) | ||
return; | ||
|
||
switch ((DispatchModeType)m_DispatchMode.SelectedIndex) | ||
{ | ||
case DispatchModeType.Time: | ||
m_TimeGrid.Grid.Visibility = Visibility.Visible; | ||
m_DistanceGrid.Grid.Visibility = Visibility.Collapsed; | ||
break; | ||
case DispatchModeType.Distance: | ||
m_TimeGrid.Grid.Visibility = Visibility.Collapsed; | ||
m_DistanceGrid.Grid.Visibility = Visibility.Visible; | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
protected override void InitContent() | ||
{ | ||
static ChaosGrid createCommonGrid() | ||
{ | ||
var grid = new ChaosGrid(); | ||
grid.PushNewColumn(new GridLength(310f)); | ||
grid.PushNewColumn(new GridLength(10f)); | ||
grid.PushNewColumn(new GridLength(100f)); | ||
grid.PushNewColumn(new GridLength(450f)); | ||
grid.PushNewColumn(new GridLength(10f)); | ||
grid.PushNewColumn(new GridLength()); | ||
return grid; | ||
} | ||
|
||
PushNewColumn(new GridLength(1f, GridUnitType.Star)); | ||
SetRowHeight(new GridLength(1f, GridUnitType.Star)); | ||
|
||
var scrollViewer = new ScrollViewer(); | ||
|
||
var grid = new ChaosGrid(); | ||
grid.PushNewColumn(new GridLength()); | ||
|
||
var headerGrid = createCommonGrid(); | ||
headerGrid.PushRowSpacedPair("Effect dispatch mode", m_DispatchMode = new ComboBox() | ||
{ | ||
Width = 80f, | ||
Height = 25f, | ||
ItemsSource = DispatchModes.Values | ||
}); | ||
m_DispatchMode.SelectionChanged += (sender, args) => UpdateDispatchModeGridVisibility(); | ||
grid.PushRowElement(headerGrid.Grid); | ||
grid.PopRow(); | ||
|
||
var body = new StackPanel(); | ||
grid.SetRowHeight(new GridLength(100f)); | ||
grid.PushRowElement(body); | ||
grid.PopRow(); | ||
|
||
m_TimeGrid = createCommonGrid(); | ||
m_TimeGrid.PushRowSpacedPair("New effect timer (in seconds)", m_EffectDispatchTimer = Utils.GenerateCommonNumericOnlyTextBox()); | ||
m_TimeGrid.PushRowSpacedPair("Timed effect duration (in seconds)", m_TimedEffectDuration = Utils.GenerateCommonNumericOnlyTextBox()); | ||
m_TimeGrid.PopRow(); | ||
m_TimeGrid.PushRowSpacedPair("Short timed effect duration (in seconds)", m_ShortTimedEffectDuration = Utils.GenerateCommonNumericOnlyTextBox()); | ||
body.Children.Add(m_TimeGrid.Grid); | ||
|
||
m_DistanceGrid = createCommonGrid(); | ||
m_DistanceGrid.PushRowSpacedPair("Distance to activate effect (in meters)", m_DistanceBasedDispatchDistance = Utils.GenerateCommonNumericOnlyTextBox()); | ||
m_DistanceGrid.PushRowSpacedPair("Type of travel distance", m_DistanceBasedDispatchType = new ComboBox() | ||
{ | ||
Width = 120f, | ||
Height = 25f, | ||
ItemsSource = new string[] | ||
{ | ||
"Distance", | ||
"Displacement" | ||
} | ||
}); | ||
body.Children.Add(m_DistanceGrid.Grid); | ||
|
||
var footerGrid = createCommonGrid(); | ||
footerGrid.PushRowSpacedPair("Enable Crossing Challenge™", m_EnableCrossingChallenge = Utils.GenerateCommonCheckBox()); | ||
grid.PushRowElement(footerGrid.Grid); | ||
|
||
scrollViewer.Content = grid.Grid; | ||
|
||
PushRowElement(scrollViewer); | ||
} | ||
|
||
public override void OnLoadValues() | ||
{ | ||
if (m_DispatchMode is not null) | ||
{ | ||
m_DispatchMode.SelectedIndex = !OptionsManager.ConfigFile.ReadValueBool("EnableDistanceBasedEffectDispatch", false) ? 0 : 1; | ||
UpdateDispatchModeGridVisibility(); | ||
} | ||
if (m_EffectDispatchTimer is not null) | ||
m_EffectDispatchTimer.Text = OptionsManager.ConfigFile.ReadValue("NewEffectSpawnTime", "30"); | ||
if (m_TimedEffectDuration is not null) | ||
m_TimedEffectDuration.Text = OptionsManager.ConfigFile.ReadValue("EffectTimedDur", "90"); | ||
if (m_ShortTimedEffectDuration is not null) | ||
m_ShortTimedEffectDuration.Text = OptionsManager.ConfigFile.ReadValue("EffectTimedShortDur", "30"); | ||
if (m_DistanceBasedDispatchDistance is not null) | ||
m_DistanceBasedDispatchDistance.Text = OptionsManager.ConfigFile.ReadValue("DistanceToActivateEffect", "250"); | ||
if (m_DistanceBasedDispatchType is not null) | ||
m_DistanceBasedDispatchType.SelectedIndex = OptionsManager.ConfigFile.ReadValueInt("DistanceType", 0); | ||
if (m_EnableCrossingChallenge is not null) | ||
m_EnableCrossingChallenge.IsChecked = OptionsManager.ConfigFile.ReadValueBool("EnableCrossingChallenge", false); | ||
} | ||
|
||
public override void OnSaveValues() | ||
{ | ||
OptionsManager.ConfigFile.WriteValue("NewEffectSpawnTime", m_EffectDispatchTimer?.Text); | ||
OptionsManager.ConfigFile.WriteValue("EffectTimedDur", m_TimedEffectDuration?.Text); | ||
OptionsManager.ConfigFile.WriteValue("EffectTimedShortDur", m_ShortTimedEffectDuration?.Text); | ||
OptionsManager.ConfigFile.WriteValue("EnableDistanceBasedEffectDispatch", m_DispatchMode?.SelectedIndex); | ||
OptionsManager.ConfigFile.WriteValue("DistanceToActivateEffect", m_DistanceBasedDispatchDistance?.Text); | ||
OptionsManager.ConfigFile.WriteValue("DistanceType", m_DistanceBasedDispatchType?.SelectedIndex); | ||
OptionsManager.ConfigFile.WriteValue("EnableCrossingChallenge", m_EnableCrossingChallenge?.IsChecked); | ||
} | ||
} | ||
} |
Oops, something went wrong.