v0.12.0.2
This commit is contained in:
@@ -68,6 +68,9 @@ namespace Barotrauma
|
||||
keyMapping[(int)InputType.PreviousFireMode] = new KeyOrMouse(MouseButton.MouseWheelDown);
|
||||
keyMapping[(int)InputType.NextFireMode] = new KeyOrMouse(MouseButton.MouseWheelUp);
|
||||
|
||||
keyMapping[(int)InputType.TakeHalfFromInventorySlot] = new KeyOrMouse(Keys.LeftShift);
|
||||
keyMapping[(int)InputType.TakeOneFromInventorySlot] = new KeyOrMouse(Keys.LeftControl);
|
||||
|
||||
if (Language == "French")
|
||||
{
|
||||
keyMapping[(int)InputType.Up] = new KeyOrMouse(Keys.Z);
|
||||
@@ -173,6 +176,13 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XAttribute attribute in element.Attributes())
|
||||
{
|
||||
//backwards compatibility
|
||||
if (attribute.Name.ToString() == "TakeAllFromInventorySlot")
|
||||
{
|
||||
keyMapping[(int)InputType.TakeHalfFromInventorySlot] = new KeyOrMouse(Keys.LeftShift);
|
||||
keyMapping[(int)InputType.TakeOneFromInventorySlot] = new KeyOrMouse(Keys.LeftControl);
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(attribute.Name.ToString(), true, out InputType inputType)) { continue; }
|
||||
|
||||
if (int.TryParse(attribute.Value.ToString(), out int mouseButtonInt))
|
||||
@@ -223,6 +233,40 @@ namespace Barotrauma
|
||||
{
|
||||
LoadInventoryKeybinds(inventoryKeyMapping);
|
||||
}
|
||||
|
||||
XElement debugConsoleMapping = doc.Root.Element("debugconsolemapping");
|
||||
|
||||
if (debugConsoleMapping == null) { return; }
|
||||
|
||||
ConsoleKeybinds.Clear();
|
||||
DebugConsole.Keybinds.Clear();
|
||||
|
||||
foreach (XElement element in debugConsoleMapping.Elements())
|
||||
{
|
||||
string keyString = element.GetAttributeString("key", string.Empty);
|
||||
string command = element.GetAttributeString("command", string.Empty);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(keyString) || string.IsNullOrWhiteSpace(command)) { continue; }
|
||||
|
||||
if (Enum.TryParse(typeof(Keys), keyString, ignoreCase: true, out object @out) && @out is Keys key)
|
||||
{
|
||||
ConsoleKeybinds.TryAdd(key, command);
|
||||
}
|
||||
}
|
||||
|
||||
DebugConsole.Keybinds = new Dictionary<Keys, string>(ConsoleKeybinds);
|
||||
}
|
||||
|
||||
private void LoadSubEditorImages(XDocument doc)
|
||||
{
|
||||
XElement element = doc.Root?.Element("editorimages");
|
||||
if (element == null)
|
||||
{
|
||||
SubEditorScreen.ImageManager.Clear(alsoPending: true);
|
||||
return;
|
||||
}
|
||||
|
||||
SubEditorScreen.ImageManager.Load(element);
|
||||
}
|
||||
|
||||
public KeyOrMouse KeyBind(InputType inputType)
|
||||
@@ -242,7 +286,7 @@ namespace Barotrauma
|
||||
|
||||
private GUIListBox contentPackageList;
|
||||
|
||||
private bool ChangeSliderText(GUIScrollBar scrollBar, float barScroll)
|
||||
private bool ChangeSliderText(GUIScrollBar scrollBar, float scale)
|
||||
{
|
||||
UnsavedSettings = true;
|
||||
GUITextBlock text = scrollBar.UserData as GUITextBlock;
|
||||
@@ -261,7 +305,7 @@ namespace Barotrauma
|
||||
}
|
||||
label = text.Text.Substring(0, index);
|
||||
}
|
||||
text.Text = label + " " + (int)(barScroll * 100) + "%";
|
||||
text.Text = label + " " + (int)Math.Round(scale * 100) + "%";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -705,6 +749,18 @@ namespace Barotrauma
|
||||
}
|
||||
};*/
|
||||
|
||||
new GUITickBox(new RectTransform(tickBoxScale, rightColumn.RectTransform), TextManager.Get("RadialDistortion"))
|
||||
{
|
||||
ToolTip = TextManager.Get("RadialDistortionToolTip"),
|
||||
Selected = EnableRadialDistortion,
|
||||
OnSelected = (tickBox) =>
|
||||
{
|
||||
EnableRadialDistortion = tickBox.Selected;
|
||||
UnsavedSettings = true;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
new GUITickBox(new RectTransform(tickBoxScale, rightColumn.RectTransform), TextManager.Get("ChromaticAberration"))
|
||||
{
|
||||
ToolTip = TextManager.Get("ChromaticAberrationToolTip"),
|
||||
@@ -725,13 +781,12 @@ namespace Barotrauma
|
||||
BarScroll = (HUDScale - MinHUDScale) / (MaxHUDScale - MinHUDScale),
|
||||
OnMoved = (scrollBar, scroll) =>
|
||||
{
|
||||
ChangeSliderText(scrollBar, scroll);
|
||||
HUDScale = MathHelper.Lerp(MinHUDScale, MaxHUDScale, scroll);
|
||||
UnsavedSettings = true;
|
||||
ChangeSliderText(scrollBar, HUDScale);
|
||||
OnHUDScaleChanged?.Invoke();
|
||||
return true;
|
||||
},
|
||||
Step = 0.05f
|
||||
Step = 0.02f
|
||||
};
|
||||
HUDScaleScrollBar.OnMoved(HUDScaleScrollBar, HUDScaleScrollBar.BarScroll);
|
||||
|
||||
@@ -743,15 +798,31 @@ namespace Barotrauma
|
||||
BarScroll = (InventoryScale - MinInventoryScale) / (MaxInventoryScale - MinInventoryScale),
|
||||
OnMoved = (scrollBar, scroll) =>
|
||||
{
|
||||
ChangeSliderText(scrollBar, scroll);
|
||||
InventoryScale = MathHelper.Lerp(MinInventoryScale, MaxInventoryScale, scroll);
|
||||
UnsavedSettings = true;
|
||||
ChangeSliderText(scrollBar, InventoryScale);
|
||||
return true;
|
||||
},
|
||||
Step = 0.05f
|
||||
Step = 0.02f
|
||||
};
|
||||
inventoryScaleScrollBar.OnMoved(inventoryScaleScrollBar, inventoryScaleScrollBar.BarScroll);
|
||||
|
||||
GUITextBlock textScaleText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), rightColumn.RectTransform), TextManager.Get("TextScale"), font: GUI.SubHeadingFont);
|
||||
GUIScrollBar textScaleScrollBar = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.05f), rightColumn.RectTransform),
|
||||
style: "GUISlider", barSize: 0.1f)
|
||||
{
|
||||
UserData = textScaleText,
|
||||
BarScroll = (TextScale - MinTextScale) / (MaxTextScale - MinTextScale),
|
||||
OnMoved = (scrollBar, scroll) =>
|
||||
{
|
||||
TextScale = MathHelper.Lerp(MinTextScale, MaxTextScale, scroll);
|
||||
textScaleDirty = true;
|
||||
ChangeSliderText(scrollBar, TextScale);
|
||||
return true;
|
||||
},
|
||||
Step = 0.01f
|
||||
};
|
||||
textScaleScrollBar.OnMoved(textScaleScrollBar, textScaleScrollBar.BarScroll);
|
||||
|
||||
/// Audio tab ----------------------------------------------------------------
|
||||
|
||||
var audioContent = new GUILayoutGroup(new RectTransform(new Vector2(0.97f, 0.97f), tabs[(int)Tab.Audio].RectTransform, Anchor.Center), childAnchor: Anchor.TopCenter)
|
||||
@@ -809,8 +880,7 @@ namespace Barotrauma
|
||||
ChangeSliderText(scrollBar, scroll);
|
||||
SoundVolume = scroll;
|
||||
return true;
|
||||
},
|
||||
Step = 0.05f
|
||||
}
|
||||
};
|
||||
soundScrollBar.OnMoved(soundScrollBar, soundScrollBar.BarScroll);
|
||||
|
||||
@@ -825,8 +895,7 @@ namespace Barotrauma
|
||||
ChangeSliderText(scrollBar, scroll);
|
||||
MusicVolume = scroll;
|
||||
return true;
|
||||
},
|
||||
Step = 0.05f
|
||||
}
|
||||
};
|
||||
musicScrollBar.OnMoved(musicScrollBar, musicScrollBar.BarScroll);
|
||||
|
||||
@@ -835,8 +904,7 @@ namespace Barotrauma
|
||||
style: "GUISlider", barSize: 0.05f)
|
||||
{
|
||||
UserData = voiceChatVolumeText,
|
||||
Range = new Vector2(0.0f, 2.0f),
|
||||
Step = 0.05f
|
||||
Range = new Vector2(0.0f, 2.0f)
|
||||
};
|
||||
voiceChatScrollBar.BarScrollValue = VoiceChatVolume;
|
||||
voiceChatScrollBar.OnMoved = (scrollBar, scroll) =>
|
||||
@@ -1014,6 +1082,19 @@ namespace Barotrauma
|
||||
{
|
||||
Visible = VoiceSetting != VoiceMode.Disabled
|
||||
};
|
||||
GUITickBox localVoiceByDefault = new GUITickBox(
|
||||
new RectTransform(tickBoxScale, voiceActivityGroup.RectTransform), TextManager.Get("LocalVoiceByDefault"))
|
||||
{
|
||||
Visible = VoiceSetting == VoiceMode.Activity,
|
||||
Selected = UseLocalVoiceByDefault,
|
||||
ToolTip = TextManager.Get("LocalVoiceByDefaultTooltip"),
|
||||
OnSelected = (tickBox) =>
|
||||
{
|
||||
UseLocalVoiceByDefault = tickBox.Selected;
|
||||
UnsavedSettings = true;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
GUITextBlock noiseGateText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), voiceActivityGroup.RectTransform), TextManager.Get("NoiseGateThreshold"), font: GUI.SubHeadingFont)
|
||||
{
|
||||
Visible = VoiceSetting == VoiceMode.Activity,
|
||||
@@ -1140,6 +1221,7 @@ namespace Barotrauma
|
||||
|
||||
noiseGateText.Visible = (vMode == VoiceMode.Activity);
|
||||
noiseGateSlider.Visible = (vMode == VoiceMode.Activity);
|
||||
localVoiceByDefault.Visible = (vMode == VoiceMode.Activity);
|
||||
voiceActivityGroup.Visible = (vMode != VoiceMode.Disabled);
|
||||
voiceInputContainerHorizontal.Visible = (vMode == VoiceMode.PushToTalk);
|
||||
UnsavedSettings = true;
|
||||
@@ -1183,7 +1265,7 @@ namespace Barotrauma
|
||||
AimAssistAmount = MathHelper.Lerp(0.0f, 5.0f, scroll);
|
||||
return true;
|
||||
},
|
||||
Step = 0.1f
|
||||
Step = 0.01f
|
||||
};
|
||||
aimAssistSlider.OnMoved(aimAssistSlider, aimAssistSlider.BarScroll);
|
||||
|
||||
@@ -1199,19 +1281,21 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
|
||||
var inputFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.75f), controlsLayoutGroup.RectTransform), isHorizontal: true)
|
||||
{ Stretch = true, RelativeSpacing = 0.03f };
|
||||
var controlListBox = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.75f), controlsLayoutGroup.RectTransform));
|
||||
|
||||
var inputFrame = new GUILayoutGroup(new RectTransform(Vector2.One, controlListBox.Content.RectTransform), isHorizontal: true)
|
||||
{ Stretch = true, RelativeSpacing = 0.01f };
|
||||
|
||||
var inputColumnLeft = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 1.0f), inputFrame.RectTransform))
|
||||
{ Stretch = true, RelativeSpacing = 0.02f };
|
||||
{ Stretch = true, RelativeSpacing = 0.005f };
|
||||
var inputColumnRight = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 1.0f), inputFrame.RectTransform))
|
||||
{ Stretch = true, RelativeSpacing = 0.02f };
|
||||
{ Stretch = true, RelativeSpacing = 0.005f };
|
||||
|
||||
var inputNames = Enum.GetValues(typeof(InputType));
|
||||
var inputNameBlocks = new List<GUITextBlock>();
|
||||
for (int i = 0; i < inputNames.Length; i++)
|
||||
{
|
||||
var inputContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.06f),(i <= (inputNames.Length / 2.2f) ? inputColumnLeft : inputColumnRight).RectTransform))
|
||||
var inputContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.06f),(i <= (inputNames.Length / 2) ? inputColumnLeft : inputColumnRight).RectTransform))
|
||||
{ Stretch = true, IsHorizontal = true, RelativeSpacing = 0.01f, Color = new Color(12, 14, 15, 215) };
|
||||
var inputName = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), inputContainer.RectTransform, Anchor.TopLeft) { MinSize = new Point(100, 0) },
|
||||
TextManager.Get("InputType." + ((InputType)i)), font: GUI.SmallFont) { ForceUpperCase = true };
|
||||
@@ -1226,14 +1310,17 @@ namespace Barotrauma
|
||||
{
|
||||
keyBox.Text = ToolBox.LimitString(keyText, keyBox.Font, (int)(keyBox.Rect.Width - keyBox.Padding.X - keyBox.Padding.Z));
|
||||
};
|
||||
inputContainer.RectTransform.MinSize = keyBox.RectTransform.MinSize;
|
||||
keyBox.OnSelected += KeyBoxSelected;
|
||||
keyBox.SelectedColor = Color.Gold * 0.3f;
|
||||
}
|
||||
|
||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.06f), inputColumnRight.RectTransform, minSize: inputColumnRight.Children.First().RectTransform.MinSize), style: null);
|
||||
|
||||
for (int i = 0; i < inventoryHotkeyCount; i++)
|
||||
{
|
||||
var inputContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.06f), ((i + 1) <= inventoryHotkeyCount / 2 ? inputColumnLeft : inputColumnRight).RectTransform))
|
||||
{ Stretch = true, IsHorizontal = true, RelativeSpacing = 0.01f, Color = new Color(12, 14, 15, 215) };
|
||||
{ Stretch = true, IsHorizontal = true, RelativeSpacing = 0.01f, Color = new Color(12, 14, 15, 215), CanBeFocused = true };
|
||||
var inputName = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), inputContainer.RectTransform, Anchor.TopLeft) { MinSize = new Point(100, 0) },
|
||||
TextManager.GetWithVariable("inventoryslotkeybind", "[slotnumber]", (i + 1).ToString()), font: GUI.SmallFont)
|
||||
{ ForceUpperCase = true };
|
||||
@@ -1244,11 +1331,20 @@ namespace Barotrauma
|
||||
UserData = i
|
||||
};
|
||||
keyBox.Text = ToolBox.LimitString(keyBox.Text, keyBox.Font, (int)(keyBox.Rect.Width - keyBox.Padding.X - keyBox.Padding.Z));
|
||||
inputContainer.RectTransform.MinSize = keyBox.RectTransform.MinSize;
|
||||
keyBox.OnSelected += InventoryKeyBoxSelected;
|
||||
keyBox.SelectedColor = Color.Gold * 0.3f;
|
||||
}
|
||||
|
||||
GUITextBlock.AutoScaleAndNormalize(inputNameBlocks);
|
||||
inputNameBlocks.First().RectTransform.SizeChanged += () =>
|
||||
{
|
||||
GUITextBlock.AutoScaleAndNormalize(inputNameBlocks);
|
||||
};
|
||||
|
||||
inputFrame.RectTransform.MinSize = new Point(0,
|
||||
(int)Math.Max(
|
||||
inputColumnLeft.Children.Sum(c => c.Rect.Height * (1.0f + inputColumnLeft.RelativeSpacing)),
|
||||
inputColumnRight.Children.Sum(c => c.Rect.Height * (1.0f + inputColumnLeft.RelativeSpacing))));
|
||||
|
||||
var resetControlsArea = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.07f), controlsLayoutGroup.RectTransform), style: null);
|
||||
var resetControlsHolder = new GUILayoutGroup(new RectTransform(new Vector2(buttonArea.RectTransform.RelativeSize.X / controlsLayoutGroup.RectTransform.RelativeSize.X / rightPanel.RectTransform.RelativeSize.X, 1.0f), resetControlsArea.RectTransform, Anchor.Center),
|
||||
@@ -1597,7 +1693,7 @@ namespace Barotrauma
|
||||
if (!EnabledRegularPackages.Contains(contentPackage)) { return; }
|
||||
}
|
||||
|
||||
ContentPackage.SortContentPackages(cp => listBox.Content.GetChildIndex(listBox.Content.GetChildByUserData(cp)), true);
|
||||
ContentPackage.SortContentPackages(cp => listBox.Content.GetChildIndex(listBox.Content.GetChildByUserData(cp)), true, this);
|
||||
|
||||
UnsavedSettings = true;
|
||||
}
|
||||
@@ -1616,7 +1712,9 @@ namespace Barotrauma
|
||||
{
|
||||
DisableRegularPackage(contentPackage);
|
||||
}
|
||||
|
||||
|
||||
ContentPackage.SortContentPackages(cp => contentPackageList.Content.GetChildIndex(contentPackageList.Content.GetChildByUserData(cp)), false, this);
|
||||
|
||||
UnsavedSettings = true;
|
||||
return true;
|
||||
}
|
||||
@@ -1707,22 +1805,11 @@ namespace Barotrauma
|
||||
|
||||
SettingsFrame.Flash(GUI.Style.Green);
|
||||
|
||||
if (GameMain.WindowMode != GameMain.Config.WindowMode || GameMain.Config.GraphicsWidth != GameMain.GraphicsWidth || GameMain.Config.GraphicsHeight != GameMain.GraphicsHeight)
|
||||
if (textScaleDirty || GameMain.WindowMode != GameMain.Config.WindowMode || GameMain.Config.GraphicsWidth != GameMain.GraphicsWidth || GameMain.Config.GraphicsHeight != GameMain.GraphicsHeight)
|
||||
{
|
||||
GameMain.Instance.ApplyGraphicsSettings();
|
||||
textScaleDirty = false;
|
||||
}
|
||||
|
||||
/*if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
|
||||
{
|
||||
#if OSX
|
||||
if (GameMain.Config.WindowMode != WindowMode.BorderlessWindowed)
|
||||
{
|
||||
#endif
|
||||
new GUIMessageBox(TextManager.Get("RestartRequiredLabel"), TextManager.Get("RestartRequiredResolution"));
|
||||
#if OSX
|
||||
}
|
||||
#endif
|
||||
}*/
|
||||
}
|
||||
|
||||
private bool ApplyClicked(GUIButton button, object userData)
|
||||
|
||||
Reference in New Issue
Block a user