(153cbd717) Fix reset button not refreshing the settings frame. Fix a text tag.
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Barotrauma
|
||||
{
|
||||
public partial class GameSettings
|
||||
{
|
||||
private enum Tab
|
||||
public enum Tab
|
||||
{
|
||||
Graphics,
|
||||
Audio,
|
||||
@@ -70,7 +70,7 @@ namespace Barotrauma
|
||||
settingsFrame = null;
|
||||
}
|
||||
|
||||
private void CreateSettingsFrame()
|
||||
public void CreateSettingsFrame(Tab selectedTab = Tab.Graphics)
|
||||
{
|
||||
settingsFrame = new GUIFrame(new RectTransform(new Vector2(0.8f, 0.8f), GUI.Canvas, Anchor.Center));
|
||||
|
||||
@@ -437,10 +437,6 @@ namespace Barotrauma
|
||||
{
|
||||
DebugConsole.NewMessage(name + " " + name.Length.ToString(), Color.Lime);
|
||||
}
|
||||
deviceList.OnSelected = (GUIComponent selected, object obj) =>
|
||||
{
|
||||
string name = obj as string;
|
||||
if (VoiceCaptureDevice == name) return true;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice)) VoiceCaptureDevice = deviceNames[0];
|
||||
#if (!OSX)
|
||||
@@ -801,6 +797,34 @@ namespace Barotrauma
|
||||
//spacing
|
||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
||||
|
||||
var resetControlsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.07f), controlsLayoutGroup.RectTransform), isHorizontal: true)
|
||||
{
|
||||
RelativeSpacing = 0.02f
|
||||
};
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetDefaultBindings"))
|
||||
{
|
||||
ToolTip = TextManager.Get("SetDefaultBindingsToolTip"),
|
||||
OnClicked = (button, data) =>
|
||||
{
|
||||
ResetControls(legacy: false);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetLegacyBindings"))
|
||||
{
|
||||
ToolTip = TextManager.Get("SetLegacyBindingsToolTip"),
|
||||
OnClicked = (button, data) =>
|
||||
{
|
||||
ResetControls(legacy: true);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//spacing
|
||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), buttonArea.RectTransform, Anchor.BottomLeft),
|
||||
TextManager.Get("Cancel"), style: "GUIButtonLarge")
|
||||
{
|
||||
@@ -827,8 +851,15 @@ namespace Barotrauma
|
||||
LoadDefaultConfig();
|
||||
CheckBindings(true);
|
||||
ApplySettings();
|
||||
ResetSettingsFrame();
|
||||
CreateSettingsFrame();
|
||||
if (Screen.Selected == GameMain.MainMenuScreen)
|
||||
{
|
||||
GameMain.MainMenuScreen.ResetSettingsFrame(currentTab);
|
||||
}
|
||||
else
|
||||
{
|
||||
ResetSettingsFrame();
|
||||
CreateSettingsFrame(currentTab);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -842,9 +873,10 @@ namespace Barotrauma
|
||||
applyButton.OnClicked = ApplyClicked;
|
||||
|
||||
UnsavedSettings = false; // Reset unsaved settings to false once the UI has been created
|
||||
SelectTab(Tab.Graphics);
|
||||
SelectTab(selectedTab);
|
||||
}
|
||||
|
||||
private Tab currentTab;
|
||||
private void SelectTab(Tab tab)
|
||||
{
|
||||
switch (tab)
|
||||
@@ -870,6 +902,7 @@ namespace Barotrauma
|
||||
tabs[i].Visible = (Tab)tabs[i].UserData == tab;
|
||||
tabButtons[i].Selected = tabs[i].Visible;
|
||||
}
|
||||
currentTab = tab;
|
||||
}
|
||||
|
||||
private void KeyBoxSelected(GUITextBox textBox, Keys key)
|
||||
@@ -886,14 +919,13 @@ namespace Barotrauma
|
||||
ApplySettings();
|
||||
if (Screen.Selected == GameMain.MainMenuScreen)
|
||||
{
|
||||
GameMain.MainMenuScreen.ResetSettingsFrame();
|
||||
GameMain.MainMenuScreen.ResetSettingsFrame(Tab.Controls);
|
||||
}
|
||||
else
|
||||
{
|
||||
ResetSettingsFrame();
|
||||
CreateSettingsFrame();
|
||||
CreateSettingsFrame(Tab.Controls);
|
||||
}
|
||||
SelectTab(Tab.Controls);
|
||||
}
|
||||
|
||||
private bool SelectResolution(GUIComponent selected, object userData)
|
||||
|
||||
@@ -527,10 +527,11 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetSettingsFrame()
|
||||
public void ResetSettingsFrame(GameSettings.Tab selectedTab = GameSettings.Tab.Graphics)
|
||||
{
|
||||
menuTabs[(int)Tab.Settings].RectTransform.ClearChildren();
|
||||
GameMain.Config.ResetSettingsFrame();
|
||||
GameMain.Config.CreateSettingsFrame(selectedTab);
|
||||
GameMain.Config.SettingsFrame.RectTransform.Parent = menuTabs[(int)Tab.Settings].RectTransform;
|
||||
GameMain.Config.SettingsFrame.RectTransform.RelativeSize = Vector2.One;
|
||||
}
|
||||
|
||||
@@ -26,10 +26,6 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private float blinkTimer;
|
||||
|
||||
private bool itemLoaded;
|
||||
|
||||
private float blinkTimer;
|
||||
|
||||
public PhysicsBody ParentBody;
|
||||
|
||||
[Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]
|
||||
|
||||
Reference in New Issue
Block a user