(5a377a8ee) Unstable v0.9.1000.0
This commit is contained in:
@@ -18,6 +18,7 @@ namespace Barotrauma
|
||||
{
|
||||
Graphics,
|
||||
Audio,
|
||||
VoiceChat,
|
||||
Controls,
|
||||
#if DEBUG
|
||||
Debug
|
||||
@@ -43,6 +44,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private const int inventoryHotkeyCount = 10;
|
||||
|
||||
public void SetDefaultBindings(XDocument doc = null, bool legacy = false)
|
||||
{
|
||||
keyMapping = new KeyOrMouse[Enum.GetNames(typeof(InputType)).Length];
|
||||
@@ -60,6 +63,7 @@ namespace Barotrauma
|
||||
keyMapping[(int)InputType.CrewOrders] = new KeyOrMouse(Keys.C);
|
||||
|
||||
keyMapping[(int)InputType.Voice] = new KeyOrMouse(Keys.V);
|
||||
keyMapping[(int)InputType.LocalVoice] = new KeyOrMouse(Keys.B);
|
||||
keyMapping[(int)InputType.Command] = new KeyOrMouse(MouseButton.MiddleMouse);
|
||||
|
||||
if (Language == "French")
|
||||
@@ -98,6 +102,13 @@ namespace Barotrauma
|
||||
keyMapping[(int)InputType.Select] = new KeyOrMouse(MouseButton.PrimaryMouse);
|
||||
// shoot and deselect are handled in CheckBindings() so that we don't override the legacy settings.
|
||||
}
|
||||
|
||||
inventoryKeyMapping = new KeyOrMouse[inventoryHotkeyCount];
|
||||
for (int i = 0; i < inventoryKeyMapping.Length; i++)
|
||||
{
|
||||
inventoryKeyMapping[i] = new KeyOrMouse(Keys.D0 + (i + 1) % 10);
|
||||
}
|
||||
|
||||
if (doc != null)
|
||||
{
|
||||
LoadControls(doc);
|
||||
@@ -177,6 +188,26 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadInventoryKeybinds(XElement element)
|
||||
{
|
||||
for (int i = 0; i < inventoryKeyMapping.Length; i++)
|
||||
{
|
||||
XAttribute attribute = element.Attributes().ElementAt(i);
|
||||
if (int.TryParse(attribute.Value.ToString(), out int mouseButtonInt))
|
||||
{
|
||||
inventoryKeyMapping[i] = new KeyOrMouse((MouseButton)mouseButtonInt);
|
||||
}
|
||||
else if (Enum.TryParse(attribute.Value.ToString(), true, out MouseButton mouseButton))
|
||||
{
|
||||
inventoryKeyMapping[i] = new KeyOrMouse(mouseButton);
|
||||
}
|
||||
else if (Enum.TryParse(attribute.Value.ToString(), true, out Keys key))
|
||||
{
|
||||
inventoryKeyMapping[i] = new KeyOrMouse(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadControls(XDocument doc)
|
||||
{
|
||||
XElement keyMapping = doc.Root.Element("keymapping");
|
||||
@@ -184,6 +215,12 @@ namespace Barotrauma
|
||||
{
|
||||
LoadKeyBinds(keyMapping);
|
||||
}
|
||||
|
||||
XElement inventoryKeyMapping = doc.Root.Element("inventorykeymapping");
|
||||
if (inventoryKeyMapping != null)
|
||||
{
|
||||
LoadInventoryKeybinds(inventoryKeyMapping);
|
||||
}
|
||||
}
|
||||
|
||||
public KeyOrMouse KeyBind(InputType inputType)
|
||||
@@ -193,25 +230,14 @@ namespace Barotrauma
|
||||
|
||||
public string KeyBindText(InputType inputType)
|
||||
{
|
||||
KeyOrMouse bind = keyMapping[(int)inputType];
|
||||
|
||||
if (bind.MouseButton != MouseButton.None)
|
||||
{
|
||||
switch (bind.MouseButton)
|
||||
{
|
||||
case MouseButton.PrimaryMouse:
|
||||
return PlayerInput.MouseButtonsSwapped() ? TextManager.Get("input.rightmouse") : TextManager.Get("input.leftmouse");
|
||||
case MouseButton.SecondaryMouse:
|
||||
return PlayerInput.MouseButtonsSwapped() ? TextManager.Get("input.leftmouse") : TextManager.Get("input.rightmouse");
|
||||
default:
|
||||
return TextManager.Get("input." + bind.MouseButton.ToString().ToLowerInvariant());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return bind.ToString();
|
||||
return keyMapping[(int)inputType].Name;
|
||||
}
|
||||
|
||||
|
||||
public KeyOrMouse InventoryKeyBind(int index)
|
||||
{
|
||||
return inventoryKeyMapping[index];
|
||||
}
|
||||
|
||||
private GUIListBox contentPackageList;
|
||||
|
||||
private bool ChangeSliderText(GUIScrollBar scrollBar, float barScroll)
|
||||
@@ -257,7 +283,8 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
settingsFrame = new GUIFrame(new RectTransform(Vector2.One, GUI.Canvas), style: null, color: Color.Black * 0.5f);
|
||||
settingsFrame = new GUIFrame(new RectTransform(Vector2.One, GUI.Canvas, Anchor.Center), style: null);
|
||||
new GUIFrame(new RectTransform(GUI.Canvas.RelativeSize, settingsFrame.RectTransform, Anchor.Center), style: "GUIBackgroundBlocker");
|
||||
var settingsFrameContent = new GUIFrame(new RectTransform(new Vector2(0.8f, 0.8f), settingsFrame.RectTransform, Anchor.Center));
|
||||
settingsHolder = settingsFrameContent.RectTransform;
|
||||
}
|
||||
@@ -290,6 +317,25 @@ namespace Barotrauma
|
||||
ButtonEnabled = ContentPackage.List.Count(cp => cp.CorePackage) > 1
|
||||
};
|
||||
|
||||
var filterContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.05f), leftPanel.RectTransform), isHorizontal: true)
|
||||
{
|
||||
Stretch = true
|
||||
};
|
||||
var searchTitle = new GUITextBlock(new RectTransform(new Vector2(0.001f, 1.0f), filterContainer.RectTransform), TextManager.Get("serverlog.filter"), textAlignment: Alignment.CenterLeft, font: GUI.Font);
|
||||
var searchBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 1.0f), filterContainer.RectTransform, Anchor.CenterRight), font: GUI.Font, createClearButton: true);
|
||||
filterContainer.RectTransform.MinSize = searchBox.RectTransform.MinSize;
|
||||
searchBox.OnSelected += (sender, userdata) => { searchTitle.Visible = false; };
|
||||
searchBox.OnDeselected += (sender, userdata) => { searchTitle.Visible = true; };
|
||||
searchBox.OnTextChanged += (textBox, text) =>
|
||||
{
|
||||
foreach (GUIComponent child in contentPackageList.Content.Children)
|
||||
{
|
||||
if (!(child.UserData is ContentPackage cp)) { continue; }
|
||||
child.Visible = string.IsNullOrEmpty(text) ? true : cp.Name.ToLower().Contains(text.ToLower());
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
contentPackageList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.70f), leftPanel.RectTransform))
|
||||
{
|
||||
OnSelected = (gc, obj) => false,
|
||||
@@ -443,11 +489,13 @@ namespace Barotrauma
|
||||
UserData = tab
|
||||
};
|
||||
|
||||
float tabWidth = 0.25f;
|
||||
#if DEBUG
|
||||
tabWidth = 0.2f;
|
||||
if (tab != Tab.Debug)
|
||||
{
|
||||
#endif
|
||||
tabButtons[(int)tab] = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tabButtonHolder.RectTransform),
|
||||
tabButtons[(int)tab] = new GUIButton(new RectTransform(new Vector2(tabWidth, 1.0f), tabButtonHolder.RectTransform),
|
||||
TextManager.Get("SettingsTab." + tab.ToString()), style: "GUITabButton")
|
||||
{
|
||||
UserData = tab,
|
||||
@@ -457,7 +505,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
tabButtons[(int)tab] = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tabButtonHolder.RectTransform), "Debug", style: "GUITabButton")
|
||||
tabButtons[(int)tab] = new GUIButton(new RectTransform(new Vector2(tabWidth, 1.0f), tabButtonHolder.RectTransform), "Debug", style: "GUITabButton")
|
||||
{
|
||||
UserData = tab,
|
||||
OnClicked = (bt, userdata) => { SelectTab((Tab)userdata); return true; }
|
||||
@@ -547,6 +595,37 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
|
||||
GUITickBox textureCompressionTickBox = new GUITickBox(new RectTransform(tickBoxScale, leftColumn.RectTransform), TextManager.Get("EnableTextureCompression"))
|
||||
{
|
||||
ToolTip = TextManager.Get("EnableTextureCompressionToolTip"),
|
||||
OnSelected = (GUITickBox box) =>
|
||||
{
|
||||
if (box.Selected == TextureCompressionEnabled) { return true; }
|
||||
bool prevTextureCompressionEnabled = TextureCompressionEnabled;
|
||||
TextureCompressionEnabled = box.Selected;
|
||||
|
||||
var msgBox = new GUIMessageBox(
|
||||
TextManager.Get("RestartRequiredLabel"),
|
||||
TextManager.Get("RestartRequiredGeneric"),
|
||||
buttons: new string[] { TextManager.Get("OK"), TextManager.Get("Cancel") });
|
||||
msgBox.Buttons[0].OnClicked += (btn, userdata) =>
|
||||
{
|
||||
ApplySettings();
|
||||
GameMain.Instance.Exit();
|
||||
return true;
|
||||
}; msgBox.Buttons[1].OnClicked += (btn, userdata) =>
|
||||
{
|
||||
TextureCompressionEnabled = prevTextureCompressionEnabled;
|
||||
box.Selected = prevTextureCompressionEnabled;
|
||||
msgBox.Close();
|
||||
return true;
|
||||
};
|
||||
|
||||
return true;
|
||||
},
|
||||
Selected = TextureCompressionEnabled
|
||||
};
|
||||
|
||||
GUITickBox pauseOnFocusLostBox = new GUITickBox(new RectTransform(tickBoxScale, leftColumn.RectTransform),
|
||||
TextManager.Get("PauseOnFocusLost"))
|
||||
{
|
||||
@@ -608,7 +687,8 @@ namespace Barotrauma
|
||||
{
|
||||
ChangeSliderText(scrollBar, barScroll);
|
||||
LightMapScale = MathHelper.Lerp(0.2f, 1.0f, barScroll);
|
||||
UnsavedSettings = true; return true;
|
||||
UnsavedSettings = true;
|
||||
return true;
|
||||
},
|
||||
Step = 0.25f
|
||||
};
|
||||
@@ -677,10 +757,10 @@ namespace Barotrauma
|
||||
|
||||
var audioContent = new GUILayoutGroup(new RectTransform(new Vector2(0.97f, 0.97f), tabs[(int)Tab.Audio].RectTransform, Anchor.Center), childAnchor: Anchor.TopCenter)
|
||||
{
|
||||
Stretch = true,
|
||||
Stretch = false,
|
||||
RelativeSpacing = 0.01f
|
||||
};
|
||||
|
||||
|
||||
GUITextBlock soundVolumeText = new GUITextBlock(new RectTransform(textBlockScale, audioContent.RectTransform), TextManager.Get("SoundVolume"), font: GUI.SubHeadingFont);
|
||||
GUIScrollBar soundScrollBar = new GUIScrollBar(new RectTransform(textBlockScale, audioContent.RectTransform),
|
||||
style: "GUISlider", barSize: 0.05f)
|
||||
@@ -718,15 +798,16 @@ namespace Barotrauma
|
||||
style: "GUISlider", barSize: 0.05f)
|
||||
{
|
||||
UserData = voiceChatVolumeText,
|
||||
BarScroll = VoiceChatVolume,
|
||||
OnMoved = (scrollBar, scroll) =>
|
||||
{
|
||||
ChangeSliderText(scrollBar, scroll);
|
||||
VoiceChatVolume = scroll;
|
||||
return true;
|
||||
},
|
||||
Range = new Vector2(0.0f, 2.0f),
|
||||
Step = 0.05f
|
||||
};
|
||||
voiceChatScrollBar.BarScrollValue = VoiceChatVolume;
|
||||
voiceChatScrollBar.OnMoved = (scrollBar, scroll) =>
|
||||
{
|
||||
ChangeSliderText(scrollBar, scrollBar.BarScrollValue);
|
||||
VoiceChatVolume = scrollBar.BarScrollValue;
|
||||
return true;
|
||||
};
|
||||
voiceChatScrollBar.OnMoved(voiceChatScrollBar, voiceChatScrollBar.BarScroll);
|
||||
|
||||
GUITickBox muteOnFocusLostBox = new GUITickBox(new RectTransform(tickBoxScale, audioContent.RectTransform), TextManager.Get("MuteOnFocusLost"))
|
||||
@@ -765,7 +846,15 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
|
||||
new GUITextBlock(new RectTransform(textBlockScale, audioContent.RectTransform), TextManager.Get("VoiceChat"), font: GUI.SubHeadingFont);
|
||||
/// Voice chat tab ----------------------------------------------------------------
|
||||
|
||||
var voiceChatContent = new GUILayoutGroup(new RectTransform(new Vector2(0.97f, 0.97f), tabs[(int)Tab.VoiceChat].RectTransform, Anchor.Center), childAnchor: Anchor.TopCenter)
|
||||
{
|
||||
Stretch = false,
|
||||
RelativeSpacing = 0.01f
|
||||
};
|
||||
|
||||
//new GUITextBlock(new RectTransform(textBlockScale, voiceChatContent.RectTransform), TextManager.Get("VoiceChat"), font: GUI.SubHeadingFont);
|
||||
|
||||
CaptureDeviceNames = Alc.GetStringList((IntPtr)null, Alc.CaptureDeviceSpecifier);
|
||||
foreach (string name in CaptureDeviceNames)
|
||||
@@ -773,7 +862,7 @@ namespace Barotrauma
|
||||
DebugConsole.NewMessage(name + " " + name.Length.ToString(), Color.Lime);
|
||||
}
|
||||
|
||||
GUITickBox directionalVoiceChat = new GUITickBox(new RectTransform(tickBoxScale, audioContent.RectTransform), TextManager.Get("DirectionalVoiceChat"))
|
||||
GUITickBox directionalVoiceChat = new GUITickBox(new RectTransform(tickBoxScale, voiceChatContent.RectTransform), TextManager.Get("DirectionalVoiceChat"))
|
||||
{
|
||||
Selected = UseDirectionalVoiceChat,
|
||||
ToolTip = TextManager.Get("DirectionalVoiceChatToolTip"),
|
||||
@@ -794,7 +883,7 @@ namespace Barotrauma
|
||||
VoiceSetting = VoiceMode.Disabled;
|
||||
}
|
||||
#if (!OSX)
|
||||
var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.15f), audioContent.RectTransform), TrimAudioDeviceName(VoiceCaptureDevice), CaptureDeviceNames.Count);
|
||||
var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.15f), voiceChatContent.RectTransform), TrimAudioDeviceName(VoiceCaptureDevice), CaptureDeviceNames.Count);
|
||||
if (CaptureDeviceNames?.Count > 0)
|
||||
{
|
||||
foreach (string name in CaptureDeviceNames)
|
||||
@@ -819,7 +908,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
#else
|
||||
var defaultDeviceGroup = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.3f), audioContent.RectTransform), true, Anchor.CenterLeft);
|
||||
var defaultDeviceGroup = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.3f), voiceChatContent.RectTransform), true, Anchor.CenterLeft);
|
||||
var currentDeviceTextBlock = new GUITextBlock(new RectTransform(new Vector2(.7f, 0.75f), null),
|
||||
TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), TrimAudioDeviceName(VoiceCaptureDevice)), font: GUI.SubHeadingFont)
|
||||
{
|
||||
@@ -857,15 +946,15 @@ namespace Barotrauma
|
||||
#endif
|
||||
|
||||
var voiceModeCount = Enum.GetNames(typeof(VoiceMode)).Length;
|
||||
var voiceModeDropDown = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.15f), audioContent.RectTransform), elementCount: voiceModeCount);
|
||||
var voiceModeDropDown = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.15f), voiceChatContent.RectTransform), elementCount: voiceModeCount);
|
||||
for (int i = 0; i < voiceModeCount; i++)
|
||||
{
|
||||
var voiceMode = "VoiceMode." + ((VoiceMode)i).ToString();
|
||||
voiceModeDropDown.AddItem(TextManager.Get(voiceMode), userData: i, toolTip: TextManager.Get(voiceMode + "ToolTip"));
|
||||
}
|
||||
|
||||
var micVolumeText = new GUITextBlock(new RectTransform(textBlockScale, audioContent.RectTransform), TextManager.Get("MicrophoneVolume"), font: GUI.SubHeadingFont);
|
||||
var micVolumeSlider = new GUIScrollBar(new RectTransform(textBlockScale, audioContent.RectTransform),
|
||||
var micVolumeText = new GUITextBlock(new RectTransform(textBlockScale, voiceChatContent.RectTransform), TextManager.Get("MicrophoneVolume"), font: GUI.SubHeadingFont);
|
||||
var micVolumeSlider = new GUIScrollBar(new RectTransform(textBlockScale, voiceChatContent.RectTransform),
|
||||
style: "GUISlider", barSize: 0.05f)
|
||||
{
|
||||
UserData = micVolumeText,
|
||||
@@ -882,7 +971,7 @@ namespace Barotrauma
|
||||
};
|
||||
micVolumeSlider.OnMoved(micVolumeSlider, micVolumeSlider.BarScroll);
|
||||
|
||||
var extraVoiceSettingsContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.25f), audioContent.RectTransform, Anchor.BottomCenter), style: null);
|
||||
var extraVoiceSettingsContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.2f), voiceChatContent.RectTransform, Anchor.BottomCenter), style: null);
|
||||
|
||||
var voiceActivityGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), extraVoiceSettingsContainer.RectTransform))
|
||||
{
|
||||
@@ -928,8 +1017,8 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
var voiceInputContainer = new GUILayoutGroup(
|
||||
new RectTransform(new Vector2(1.0f, 0.25f), extraVoiceSettingsContainer.RectTransform)
|
||||
var voiceInputContainerHorizontal = new GUILayoutGroup(
|
||||
new RectTransform(new Vector2(1.0f, 0.5f), extraVoiceSettingsContainer.RectTransform)
|
||||
{
|
||||
RelativeOffset = new Vector2(0.0f, voiceActivityGroup.RectTransform.RelativeSize.Y + 0.1f)
|
||||
},
|
||||
@@ -937,6 +1026,11 @@ namespace Barotrauma
|
||||
{
|
||||
Visible = VoiceSetting == VoiceMode.PushToTalk
|
||||
};
|
||||
|
||||
var voiceInputContainer = new GUILayoutGroup(
|
||||
new RectTransform(new Vector2(0.5f, 1.0f), voiceInputContainerHorizontal.RectTransform),
|
||||
isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), voiceInputContainer.RectTransform), TextManager.Get("InputType.Voice"), font: GUI.SubHeadingFont);
|
||||
var voiceKeyBox = new GUITextBox(new RectTransform(new Vector2(0.4f, 1.0f), voiceInputContainer.RectTransform, Anchor.TopRight), text: KeyBindText(InputType.Voice))
|
||||
{
|
||||
@@ -945,6 +1039,39 @@ namespace Barotrauma
|
||||
};
|
||||
voiceKeyBox.OnSelected += KeyBoxSelected;
|
||||
|
||||
var localVoiceInputContainer = new GUILayoutGroup(
|
||||
new RectTransform(new Vector2(0.5f, 1.0f), voiceInputContainerHorizontal.RectTransform),
|
||||
isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), localVoiceInputContainer.RectTransform), TextManager.Get("InputType.LocalVoice"), font: GUI.SubHeadingFont);
|
||||
var localVoiceKeyBox = new GUITextBox(new RectTransform(new Vector2(0.4f, 1.0f), localVoiceInputContainer.RectTransform, Anchor.TopRight), text: KeyBindText(InputType.LocalVoice))
|
||||
{
|
||||
SelectedColor = Color.Gold * 0.3f,
|
||||
UserData = InputType.LocalVoice
|
||||
};
|
||||
localVoiceKeyBox.OnSelected += KeyBoxSelected;
|
||||
|
||||
var cutoffPreventionText = new GUITextBlock(new RectTransform(textBlockScale, voiceChatContent.RectTransform), TextManager.Get("CutoffPrevention"), font: GUI.SubHeadingFont)
|
||||
{
|
||||
ToolTip = TextManager.Get("CutoffPreventionTooltip")
|
||||
};
|
||||
var cutoffPreventionSlider = new GUIScrollBar(new RectTransform(textBlockScale, voiceChatContent.RectTransform),
|
||||
style: "GUISlider", barSize: 0.05f)
|
||||
{
|
||||
UserData = micVolumeText,
|
||||
Range = new Vector2(0,540),
|
||||
Step = 1.0f / 9.0f
|
||||
};
|
||||
cutoffPreventionSlider.BarScrollValue = VoiceChatCutoffPrevention;
|
||||
cutoffPreventionSlider.OnMoved = (scrollBar, scroll) =>
|
||||
{
|
||||
VoiceChatCutoffPrevention = (int)scrollBar.BarScrollValue;
|
||||
cutoffPreventionText.Text = TextManager.Get("CutoffPrevention") +
|
||||
" " + TextManager.GetWithVariable("timeformatmilliseconds", "[milliseconds]", VoiceChatCutoffPrevention.ToString());
|
||||
return true;
|
||||
};
|
||||
cutoffPreventionSlider.OnMoved(cutoffPreventionSlider, cutoffPreventionSlider.BarScrollValue);
|
||||
|
||||
voiceModeDropDown.OnSelected = (GUIComponent selected, object userData) =>
|
||||
{
|
||||
try
|
||||
@@ -961,7 +1088,7 @@ namespace Barotrauma
|
||||
{
|
||||
VoiceSetting = vMode = VoiceMode.Disabled;
|
||||
voiceActivityGroup.Visible = false;
|
||||
voiceInputContainer.Visible = false;
|
||||
voiceInputContainerHorizontal.Visible = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -977,7 +1104,7 @@ namespace Barotrauma
|
||||
noiseGateText.Visible = (vMode == VoiceMode.Activity);
|
||||
noiseGateSlider.Visible = (vMode == VoiceMode.Activity);
|
||||
voiceActivityGroup.Visible = (vMode != VoiceMode.Disabled);
|
||||
voiceInputContainer.Visible = (vMode == VoiceMode.PushToTalk);
|
||||
voiceInputContainerHorizontal.Visible = (vMode == VoiceMode.PushToTalk);
|
||||
UnsavedSettings = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -1062,6 +1189,24 @@ namespace Barotrauma
|
||||
keyBox.SelectedColor = Color.Gold * 0.3f;
|
||||
}
|
||||
|
||||
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) };
|
||||
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 };
|
||||
inputNameBlocks.Add(inputName);
|
||||
var keyBox = new GUITextBox(new RectTransform(new Vector2(0.4f, 1.0f), inputContainer.RectTransform),
|
||||
text: inventoryKeyMapping[i].Name, font: GUI.SmallFont, style: "GUITextBoxNoIcon")
|
||||
{
|
||||
UserData = i
|
||||
};
|
||||
keyBox.Text = ToolBox.LimitString(keyBox.Text, keyBox.Font, (int)(keyBox.Rect.Width - keyBox.Padding.X - keyBox.Padding.Z));
|
||||
keyBox.OnSelected += InventoryKeyBoxSelected;
|
||||
keyBox.SelectedColor = Color.Gold * 0.3f;
|
||||
}
|
||||
|
||||
GUITextBlock.AutoScaleAndNormalize(inputNameBlocks);
|
||||
|
||||
var resetControlsArea = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.07f), controlsLayoutGroup.RectTransform), style: null);
|
||||
@@ -1302,7 +1447,7 @@ namespace Barotrauma
|
||||
{
|
||||
switch (tab)
|
||||
{
|
||||
case Tab.Audio:
|
||||
case Tab.VoiceChat:
|
||||
if (VoiceSetting != VoiceMode.Disabled)
|
||||
{
|
||||
if (GameMain.Client == null && VoipCapture.Instance == null)
|
||||
@@ -1329,7 +1474,13 @@ namespace Barotrauma
|
||||
private void KeyBoxSelected(GUITextBox textBox, Keys key)
|
||||
{
|
||||
textBox.Text = "";
|
||||
CoroutineManager.StartCoroutine(WaitForKeyPress(textBox));
|
||||
CoroutineManager.StartCoroutine(WaitForKeyPress(textBox, keyMapping));
|
||||
}
|
||||
|
||||
private void InventoryKeyBoxSelected(GUITextBox textBox, Keys key)
|
||||
{
|
||||
textBox.Text = "";
|
||||
CoroutineManager.StartCoroutine(WaitForKeyPress(textBox, inventoryKeyMapping));
|
||||
}
|
||||
|
||||
private void ResetControls(bool legacy)
|
||||
@@ -1425,7 +1576,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
private IEnumerable<object> WaitForKeyPress(GUITextBox keyBox)
|
||||
private IEnumerable<object> WaitForKeyPress(GUITextBox keyBox, KeyOrMouse[] keyArray)
|
||||
{
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
@@ -1449,42 +1600,43 @@ namespace Barotrauma
|
||||
|
||||
if (PlayerInput.LeftButtonClicked())
|
||||
{
|
||||
keyMapping[keyIndex] = new KeyOrMouse(MouseButton.LeftMouse);
|
||||
keyArray[keyIndex] = new KeyOrMouse(MouseButton.LeftMouse);
|
||||
}
|
||||
else if (PlayerInput.RightButtonClicked())
|
||||
{
|
||||
keyMapping[keyIndex] = new KeyOrMouse(MouseButton.RightMouse);
|
||||
keyArray[keyIndex] = new KeyOrMouse(MouseButton.RightMouse);
|
||||
}
|
||||
else if (PlayerInput.MidButtonClicked())
|
||||
{
|
||||
keyMapping[keyIndex] = new KeyOrMouse(MouseButton.MiddleMouse);
|
||||
keyArray[keyIndex] = new KeyOrMouse(MouseButton.MiddleMouse);
|
||||
}
|
||||
else if (PlayerInput.Mouse4ButtonClicked())
|
||||
{
|
||||
keyMapping[keyIndex] = new KeyOrMouse(MouseButton.MouseButton4);
|
||||
keyArray[keyIndex] = new KeyOrMouse(MouseButton.MouseButton4);
|
||||
}
|
||||
else if (PlayerInput.Mouse5ButtonClicked())
|
||||
{
|
||||
keyMapping[keyIndex] = new KeyOrMouse(MouseButton.MouseButton5);
|
||||
keyArray[keyIndex] = new KeyOrMouse(MouseButton.MouseButton5);
|
||||
}
|
||||
else if (PlayerInput.MouseWheelUpClicked())
|
||||
{
|
||||
keyMapping[keyIndex] = new KeyOrMouse(MouseButton.MouseWheelUp);
|
||||
keyArray[keyIndex] = new KeyOrMouse(MouseButton.MouseWheelUp);
|
||||
}
|
||||
else if (PlayerInput.MouseWheelDownClicked())
|
||||
{
|
||||
keyMapping[keyIndex] = new KeyOrMouse(MouseButton.MouseWheelDown);
|
||||
keyArray[keyIndex] = new KeyOrMouse(MouseButton.MouseWheelDown);
|
||||
}
|
||||
else if (PlayerInput.GetKeyboardState.GetPressedKeys().Length > 0)
|
||||
{
|
||||
Keys key = PlayerInput.GetKeyboardState.GetPressedKeys()[0];
|
||||
keyMapping[keyIndex] = new KeyOrMouse(key);
|
||||
keyArray[keyIndex] = new KeyOrMouse(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
keyBox.Text = KeyBindText((InputType)keyIndex);
|
||||
|
||||
keyBox.Text = keyArray[keyIndex].Name;
|
||||
keyBox.Text = ToolBox.LimitString(keyBox.Text, keyBox.Font, keyBox.Rect.Width);
|
||||
|
||||
keyBox.Deselect();
|
||||
|
||||
Reference in New Issue
Block a user