(c896c51fb) Display submarine preview in the "new game" menu, layout tweaks
This commit is contained in:
@@ -656,13 +656,6 @@ namespace Barotrauma
|
|||||||
msg.Timer -= deltaTime;
|
msg.Timer -= deltaTime;
|
||||||
msg.Pos += msg.Velocity * deltaTime;
|
msg.Pos += msg.Velocity * deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (GUIMessage msg in messages)
|
|
||||||
{
|
|
||||||
if (!msg.WorldSpace) continue;
|
|
||||||
msg.Timer -= deltaTime;
|
|
||||||
msg.Pos += msg.Velocity * deltaTime;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
messages.RemoveAll(m => m.Timer <= 0.0f);
|
messages.RemoveAll(m => m.Timer <= 0.0f);
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
foreach (ContentPackage contentPackage in ContentPackage.List)
|
foreach (ContentPackage contentPackage in ContentPackage.List)
|
||||||
{
|
{
|
||||||
var tickBox = new GUITickBox(new RectTransform(new Vector2(0.05f, 0.05f), contentPackageList.Content.RectTransform, minSize: new Point(32, 32)), contentPackage.Name)
|
var tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.067f), contentPackageList.Content.RectTransform, minSize: new Point(0, 15)), contentPackage.Name)
|
||||||
{
|
{
|
||||||
UserData = contentPackage,
|
UserData = contentPackage,
|
||||||
OnSelected = SelectContentPackage,
|
OnSelected = SelectContentPackage,
|
||||||
@@ -118,8 +118,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.95f, 0.045f), generalLayoutGroup.RectTransform), TextManager.Get("Language"));
|
new GUITextBlock(new RectTransform(new Vector2(0.92f, 0.05f), generalLayoutGroup.RectTransform), TextManager.Get("Language"));
|
||||||
var languageDD = new GUIDropDown(new RectTransform(new Vector2(0.95f, 0.045f), generalLayoutGroup.RectTransform));
|
var languageDD = new GUIDropDown(new RectTransform(new Vector2(0.92f, 0.05f), generalLayoutGroup.RectTransform));
|
||||||
foreach (string language in TextManager.AvailableLanguages)
|
foreach (string language in TextManager.AvailableLanguages)
|
||||||
{
|
{
|
||||||
languageDD.AddItem(TextManager.Get("Language." + language), language);
|
languageDD.AddItem(TextManager.Get("Language." + language), language);
|
||||||
@@ -238,7 +238,7 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
GUITickBox vsyncTickBox = new GUITickBox(new RectTransform(new Point(32, 32), leftColumn.RectTransform), TextManager.Get("EnableVSync"))
|
GUITickBox vsyncTickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("EnableVSync"))
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("EnableVSyncToolTip"),
|
ToolTip = TextManager.Get("EnableVSyncToolTip"),
|
||||||
OnSelected = (GUITickBox box) =>
|
OnSelected = (GUITickBox box) =>
|
||||||
@@ -307,7 +307,7 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
lightScrollBar.OnMoved(lightScrollBar, lightScrollBar.BarScroll);
|
lightScrollBar.OnMoved(lightScrollBar, lightScrollBar.BarScroll);
|
||||||
|
|
||||||
new GUITickBox(new RectTransform(new Point(32, 32), rightColumn.RectTransform), TextManager.Get("SpecularLighting"))
|
new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), rightColumn.RectTransform), TextManager.Get("SpecularLighting"))
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("SpecularLightingToolTip"),
|
ToolTip = TextManager.Get("SpecularLightingToolTip"),
|
||||||
Selected = SpecularityEnabled,
|
Selected = SpecularityEnabled,
|
||||||
@@ -319,7 +319,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
new GUITickBox(new RectTransform(new Point(32, 32), rightColumn.RectTransform), TextManager.Get("ChromaticAberration"))
|
new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), rightColumn.RectTransform), TextManager.Get("ChromaticAberration"))
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("ChromaticAberrationToolTip"),
|
ToolTip = TextManager.Get("ChromaticAberrationToolTip"),
|
||||||
Selected = ChromaticAberrationEnabled,
|
Selected = ChromaticAberrationEnabled,
|
||||||
@@ -369,11 +369,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
var audioSliders = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.4f), tabs[(int)Tab.Audio].RectTransform, Anchor.TopCenter)
|
var audioSliders = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.4f), tabs[(int)Tab.Audio].RectTransform, Anchor.TopCenter)
|
||||||
{ RelativeOffset = new Vector2(0.0f, 0.02f) })
|
{ RelativeOffset = new Vector2(0.0f, 0.02f) })
|
||||||
{ RelativeSpacing = 0.01f };
|
{ RelativeSpacing = 0.01f, Stretch = true };
|
||||||
|
|
||||||
GUITextBlock soundVolumeText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), audioSliders.RectTransform), TextManager.Get("SoundVolume"));
|
GUITextBlock soundVolumeText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), audioSliders.RectTransform), TextManager.Get("SoundVolume"));
|
||||||
GUIScrollBar soundScrollBar = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.1f), audioSliders.RectTransform),
|
GUIScrollBar soundScrollBar = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.2f), audioSliders.RectTransform),
|
||||||
barSize: 0.05f)
|
barSize: 0.1f)
|
||||||
{
|
{
|
||||||
UserData = soundVolumeText,
|
UserData = soundVolumeText,
|
||||||
BarScroll = SoundVolume,
|
BarScroll = SoundVolume,
|
||||||
@@ -387,9 +387,9 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
soundScrollBar.OnMoved(soundScrollBar, soundScrollBar.BarScroll);
|
soundScrollBar.OnMoved(soundScrollBar, soundScrollBar.BarScroll);
|
||||||
|
|
||||||
GUITextBlock musicVolumeText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), audioSliders.RectTransform), TextManager.Get("MusicVolume"));
|
GUITextBlock musicVolumeText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.18f), audioSliders.RectTransform), TextManager.Get("MusicVolume"));
|
||||||
GUIScrollBar musicScrollBar = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.1f), audioSliders.RectTransform),
|
GUIScrollBar musicScrollBar = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.18f), audioSliders.RectTransform),
|
||||||
barSize: 0.05f)
|
barSize: 0.1f)
|
||||||
{
|
{
|
||||||
UserData = musicVolumeText,
|
UserData = musicVolumeText,
|
||||||
BarScroll = MusicVolume,
|
BarScroll = MusicVolume,
|
||||||
@@ -403,9 +403,9 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
musicScrollBar.OnMoved(musicScrollBar, musicScrollBar.BarScroll);
|
musicScrollBar.OnMoved(musicScrollBar, musicScrollBar.BarScroll);
|
||||||
|
|
||||||
GUITextBlock voiceChatVolumeText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), audioSliders.RectTransform), TextManager.Get("VoiceChatVolume"));
|
GUITextBlock voiceChatVolumeText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.18f), audioSliders.RectTransform), TextManager.Get("VoiceChatVolume"));
|
||||||
GUIScrollBar voiceChatScrollBar = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.1f), audioSliders.RectTransform),
|
GUIScrollBar voiceChatScrollBar = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.18f), audioSliders.RectTransform),
|
||||||
barSize: 0.05f)
|
barSize: 0.1f)
|
||||||
{
|
{
|
||||||
UserData = voiceChatVolumeText,
|
UserData = voiceChatVolumeText,
|
||||||
BarScroll = VoiceChatVolume,
|
BarScroll = VoiceChatVolume,
|
||||||
@@ -419,7 +419,7 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
voiceChatScrollBar.OnMoved(voiceChatScrollBar, voiceChatScrollBar.BarScroll);
|
voiceChatScrollBar.OnMoved(voiceChatScrollBar, voiceChatScrollBar.BarScroll);
|
||||||
|
|
||||||
GUITickBox muteOnFocusLostBox = new GUITickBox(new RectTransform(new Point(32, 32), audioSliders.RectTransform), TextManager.Get("MuteOnFocusLost"));
|
GUITickBox muteOnFocusLostBox = new GUITickBox(new RectTransform(new Vector2(0.95f, 0.15f), audioSliders.RectTransform), TextManager.Get("MuteOnFocusLost"));
|
||||||
muteOnFocusLostBox.Selected = MuteOnFocusLost;
|
muteOnFocusLostBox.Selected = MuteOnFocusLost;
|
||||||
muteOnFocusLostBox.ToolTip = TextManager.Get("MuteOnFocusLostToolTip");
|
muteOnFocusLostBox.ToolTip = TextManager.Get("MuteOnFocusLostToolTip");
|
||||||
muteOnFocusLostBox.OnSelected = (tickBox) =>
|
muteOnFocusLostBox.OnSelected = (tickBox) =>
|
||||||
@@ -429,11 +429,14 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
//var voiceSettings = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.5f), tabs[(int)Tab.Audio].RectTransform, Anchor.BottomCenter)
|
var voiceSettings = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.5f), tabs[(int)Tab.Audio].RectTransform, Anchor.BottomCenter)
|
||||||
// { RelativeOffset = new Vector2(0.0f, 0.04f) })
|
{ RelativeOffset = new Vector2(0.0f, 0.04f) })
|
||||||
// { RelativeSpacing = 0.01f };
|
{ RelativeSpacing = 0.01f, Stretch = true };
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), audioSliders.RectTransform), TextManager.Get("VoiceChat"));
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), voiceSettings.RectTransform), TextManager.Get("VoiceChat"));
|
||||||
|
|
||||||
|
//spacing
|
||||||
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.2f), rightColumn.RectTransform), style: null);
|
||||||
|
|
||||||
IList<string> deviceNames = Alc.GetString((IntPtr)null, AlcGetStringList.CaptureDeviceSpecifier);
|
IList<string> deviceNames = Alc.GetString((IntPtr)null, AlcGetStringList.CaptureDeviceSpecifier);
|
||||||
foreach (string name in deviceNames)
|
foreach (string name in deviceNames)
|
||||||
@@ -443,7 +446,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice)) VoiceCaptureDevice = deviceNames[0];
|
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice)) VoiceCaptureDevice = deviceNames[0];
|
||||||
#if (!OSX)
|
#if (!OSX)
|
||||||
var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.1f), audioSliders.RectTransform), VoiceCaptureDevice, deviceNames.Count);
|
var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.2f), voiceSettings.RectTransform), VoiceCaptureDevice, deviceNames.Count);
|
||||||
foreach (string name in deviceNames)
|
foreach (string name in deviceNames)
|
||||||
{
|
{
|
||||||
deviceList.AddItem(name, name);
|
deviceList.AddItem(name, name);
|
||||||
@@ -457,13 +460,13 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
var suavemente = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), audioSliders.RectTransform), TextManager.Get("CurrentDevice") + ": " + VoiceCaptureDevice)
|
var suavemente = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), voiceSettings.RectTransform), TextManager.Get("CurrentDevice") + ": " + VoiceCaptureDevice)
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("CurrentDeviceToolTip.OSX"),
|
ToolTip = TextManager.Get("CurrentDeviceToolTip.OSX"),
|
||||||
TextAlignment = Alignment.CenterX
|
TextAlignment = Alignment.CenterX
|
||||||
};
|
};
|
||||||
|
|
||||||
new GUIButton(new RectTransform(new Vector2(1.0f, 0.25f), audioSliders.RectTransform), TextManager.Get("RefreshDefaultDevice"))
|
new GUIButton(new RectTransform(new Vector2(1.0f, 0.25f), voiceSettings.RectTransform), TextManager.Get("RefreshDefaultDevice"))
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("RefreshDefaultDeviceToolTip"),
|
ToolTip = TextManager.Get("RefreshDefaultDeviceToolTip"),
|
||||||
OnClicked = (bt, userdata) =>
|
OnClicked = (bt, userdata) =>
|
||||||
@@ -479,16 +482,17 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
var radioButtonFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.6f), audioSliders.RectTransform))
|
var radioButtonFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.6f), voiceSettings.RectTransform))
|
||||||
{
|
{
|
||||||
RelativeSpacing = 0.01f
|
Stretch = true,
|
||||||
|
RelativeSpacing = 0.05f
|
||||||
};
|
};
|
||||||
|
|
||||||
GUIRadioButtonGroup voiceMode = new GUIRadioButtonGroup();
|
GUIRadioButtonGroup voiceMode = new GUIRadioButtonGroup();
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
string langStr = "VoiceMode." + ((VoiceMode)i).ToString();
|
string langStr = "VoiceMode." + ((VoiceMode)i).ToString();
|
||||||
var tick = new GUITickBox(new RectTransform(new Point(32, 32), radioButtonFrame.RectTransform), TextManager.Get(langStr))
|
var tick = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.33f), radioButtonFrame.RectTransform), TextManager.Get(langStr))
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get(langStr + "ToolTip")
|
ToolTip = TextManager.Get(langStr + "ToolTip")
|
||||||
};
|
};
|
||||||
@@ -496,9 +500,9 @@ namespace Barotrauma
|
|||||||
voiceMode.AddRadioButton((VoiceMode)i, tick);
|
voiceMode.AddRadioButton((VoiceMode)i, tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
var micVolumeText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), audioSliders.RectTransform), TextManager.Get("MicrophoneVolume"));
|
var micVolumeText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.18f), voiceSettings.RectTransform), TextManager.Get("MicrophoneVolume"));
|
||||||
var micVolumeSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.1f), audioSliders.RectTransform),
|
var micVolumeSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.18f), voiceSettings.RectTransform),
|
||||||
barSize: 0.05f)
|
barSize: 0.1f)
|
||||||
{
|
{
|
||||||
UserData = micVolumeText,
|
UserData = micVolumeText,
|
||||||
BarScroll = (float)Math.Sqrt(MathUtils.InverseLerp(0.2f, 5.0f, MicrophoneVolume)),
|
BarScroll = (float)Math.Sqrt(MathUtils.InverseLerp(0.2f, 5.0f, MicrophoneVolume)),
|
||||||
@@ -514,9 +518,9 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
micVolumeSlider.OnMoved(micVolumeSlider, micVolumeSlider.BarScroll);
|
micVolumeSlider.OnMoved(micVolumeSlider, micVolumeSlider.BarScroll);
|
||||||
|
|
||||||
var voiceInputContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), audioSliders.RectTransform, Anchor.BottomCenter));
|
var voiceInputContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 0.2f), voiceSettings.RectTransform, Anchor.BottomCenter));
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 0.1f), voiceInputContainer.RectTransform), TextManager.Get("InputType.Voice") + ": ");
|
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), voiceInputContainer.RectTransform), TextManager.Get("InputType.Voice") + ": ");
|
||||||
var voiceKeyBox = new GUITextBox(new RectTransform(new Vector2(0.4f, 0.1f), voiceInputContainer.RectTransform, Anchor.TopRight),
|
var voiceKeyBox = new GUITextBox(new RectTransform(new Vector2(0.4f, 1.0f), voiceInputContainer.RectTransform, Anchor.TopRight),
|
||||||
text: keyMapping[(int)InputType.Voice].ToString())
|
text: keyMapping[(int)InputType.Voice].ToString())
|
||||||
{
|
{
|
||||||
UserData = InputType.Voice
|
UserData = InputType.Voice
|
||||||
@@ -524,22 +528,22 @@ namespace Barotrauma
|
|||||||
voiceKeyBox.OnSelected += KeyBoxSelected;
|
voiceKeyBox.OnSelected += KeyBoxSelected;
|
||||||
voiceKeyBox.SelectedColor = Color.Gold * 0.3f;
|
voiceKeyBox.SelectedColor = Color.Gold * 0.3f;
|
||||||
|
|
||||||
var voiceActivityGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), audioSliders.RectTransform));
|
var voiceActivityGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.3f), voiceSettings.RectTransform));
|
||||||
GUITextBlock noiseGateText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), voiceActivityGroup.RectTransform), TextManager.Get("NoiseGateThreshold"))
|
GUITextBlock noiseGateText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), voiceActivityGroup.RectTransform), TextManager.Get("NoiseGateThreshold"))
|
||||||
{
|
{
|
||||||
TextGetter = () =>
|
TextGetter = () =>
|
||||||
{
|
{
|
||||||
return TextManager.Get("NoiseGateThreshold") + " " + ((int)NoiseGateThreshold).ToString() + " dB";
|
return TextManager.Get("NoiseGateThreshold") + " " + ((int)NoiseGateThreshold).ToString() + " dB";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var dbMeter = new GUIProgressBar(new RectTransform(new Vector2(1.0f, 0.1f), voiceActivityGroup.RectTransform), 0.0f, Color.Lime);
|
var dbMeter = new GUIProgressBar(new RectTransform(new Vector2(1.0f, 0.5f), voiceActivityGroup.RectTransform), 0.0f, Color.Lime);
|
||||||
dbMeter.ProgressGetter = () =>
|
dbMeter.ProgressGetter = () =>
|
||||||
{
|
{
|
||||||
if (VoipCapture.Instance == null) return 0.0f;
|
if (VoipCapture.Instance == null) return 0.0f;
|
||||||
dbMeter.Color = VoipCapture.Instance.LastdB > NoiseGateThreshold ? Color.Lime : Color.Orange; //TODO: i'm a filthy hack
|
dbMeter.Color = VoipCapture.Instance.LastdB > NoiseGateThreshold ? Color.Lime : Color.Orange; //TODO: i'm a filthy hack
|
||||||
return ((float)VoipCapture.Instance.LastdB + 100.0f) / 100.0f;
|
return ((float)VoipCapture.Instance.LastdB + 100.0f) / 100.0f;
|
||||||
};
|
};
|
||||||
var noiseGateSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.1f), dbMeter.RectTransform, Anchor.Center), color: Color.White, barSize: 0.03f);
|
var noiseGateSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 1.0f), dbMeter.RectTransform, Anchor.Center), color: Color.White, barSize: 0.03f);
|
||||||
noiseGateSlider.Frame.Visible = false;
|
noiseGateSlider.Frame.Visible = false;
|
||||||
noiseGateSlider.Step = 0.01f;
|
noiseGateSlider.Step = 0.01f;
|
||||||
noiseGateSlider.Range = new Vector2(-100.0f, 0.0f);
|
noiseGateSlider.Range = new Vector2(-100.0f, 0.0f);
|
||||||
@@ -595,12 +599,14 @@ namespace Barotrauma
|
|||||||
voiceMode.Selected = VoiceSetting;
|
voiceMode.Selected = VoiceSetting;
|
||||||
|
|
||||||
/// Controls tab -------------------------------------------------------------
|
/// Controls tab -------------------------------------------------------------
|
||||||
var controlsLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.95f), tabs[(int)Tab.Controls].RectTransform, Anchor.Center))
|
var controlsLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.95f), tabs[(int)Tab.Controls].RectTransform, Anchor.Center)
|
||||||
{ RelativeSpacing = 0.01f };
|
{ RelativeOffset = new Vector2(0.0f, 0.0f) })
|
||||||
|
{ RelativeSpacing = 0.01f, Stretch = true };
|
||||||
|
|
||||||
var inputFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.8f), controlsLayoutGroup.RectTransform))
|
var inputFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.8f), controlsLayoutGroup.RectTransform))
|
||||||
{ Stretch = true };
|
{
|
||||||
|
Stretch = true
|
||||||
|
};
|
||||||
var inputNames = Enum.GetValues(typeof(InputType));
|
var inputNames = Enum.GetValues(typeof(InputType));
|
||||||
for (int i = 0; i < inputNames.Length; i++)
|
for (int i = 0; i < inputNames.Length; i++)
|
||||||
{
|
{
|
||||||
@@ -617,7 +623,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
GUITextBlock aimAssistText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), controlsLayoutGroup.RectTransform), TextManager.Get("AimAssist"));
|
GUITextBlock aimAssistText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), controlsLayoutGroup.RectTransform), TextManager.Get("AimAssist"));
|
||||||
GUIScrollBar aimAssistSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.05f), controlsLayoutGroup.RectTransform),
|
GUIScrollBar aimAssistSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.05f), controlsLayoutGroup.RectTransform),
|
||||||
barSize: 0.05f)
|
barSize: 0.1f)
|
||||||
{
|
{
|
||||||
UserData = aimAssistText,
|
UserData = aimAssistText,
|
||||||
BarScroll = MathUtils.InverseLerp(0.0f, 5.0f, AimAssistAmount),
|
BarScroll = MathUtils.InverseLerp(0.0f, 5.0f, AimAssistAmount),
|
||||||
|
|||||||
@@ -278,19 +278,23 @@ namespace Barotrauma
|
|||||||
OnClicked = (btn, userdata) => { if (GUI.MouseOn == btn || GUI.MouseOn == btn.TextBlock) messageBox.Close(); return true; }
|
OnClicked = (btn, userdata) => { if (GUI.MouseOn == btn || GUI.MouseOn == btn.TextBlock) messageBox.Close(); return true; }
|
||||||
};
|
};
|
||||||
background.RectTransform.SetAsFirstChild();
|
background.RectTransform.SetAsFirstChild();
|
||||||
|
CreatePreviewWindow(messageBox.Content);
|
||||||
|
}
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1, 0), messageBox.Content.RectTransform, Anchor.TopCenter), Name, textAlignment: Alignment.Center, font: GUI.LargeFont, wrap: true);
|
public void CreatePreviewWindow(GUIComponent parent)
|
||||||
|
{
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(1, 0), parent.RectTransform, Anchor.TopCenter), Name, textAlignment: Alignment.Center, font: GUI.LargeFont, wrap: true);
|
||||||
|
|
||||||
var upperPart = new GUIFrame(new RectTransform(new Vector2(1, 0.4f), messageBox.Content.RectTransform, Anchor.Center, Pivot.BottomCenter), color: Color.Transparent);
|
var upperPart = new GUIFrame(new RectTransform(new Vector2(1, 0.4f), parent.RectTransform, Anchor.Center, Pivot.BottomCenter), color: Color.Transparent);
|
||||||
var descriptionBox = new GUIListBox(new RectTransform(new Vector2(1, 0.35f), messageBox.Content.RectTransform, Anchor.Center, Pivot.TopCenter));
|
var descriptionBox = new GUIListBox(new RectTransform(new Vector2(1, 0.35f), parent.RectTransform, Anchor.Center, Pivot.TopCenter));
|
||||||
|
|
||||||
if (PreviewImage == null)
|
if (PreviewImage == null)
|
||||||
{
|
{
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.45f, 1), upperPart.RectTransform), TextManager.Get("SubPreviewImageNotFound"));
|
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1), upperPart.RectTransform), TextManager.Get("SubPreviewImageNotFound"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new GUIImage(new RectTransform(new Vector2(0.45f, 1), upperPart.RectTransform), PreviewImage);
|
new GUIImage(new RectTransform(new Vector2(0.6f, 1), upperPart.RectTransform), PreviewImage, scaleToFit: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 realWorldDimensions = Dimensions * Physics.DisplayToRealWorldRatio;
|
Vector2 realWorldDimensions = Dimensions * Physics.DisplayToRealWorldRatio;
|
||||||
@@ -298,7 +302,7 @@ namespace Barotrauma
|
|||||||
TextManager.Get("Unknown") :
|
TextManager.Get("Unknown") :
|
||||||
TextManager.Get("DimensionsFormat").Replace("[width]", ((int)(realWorldDimensions.X)).ToString()).Replace("[height]", ((int)(realWorldDimensions.Y)).ToString());
|
TextManager.Get("DimensionsFormat").Replace("[width]", ((int)(realWorldDimensions.X)).ToString()).Replace("[height]", ((int)(realWorldDimensions.Y)).ToString());
|
||||||
|
|
||||||
var layoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(0.45f, 1), upperPart.RectTransform, Anchor.TopRight));
|
var layoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(0.38f, 1), upperPart.RectTransform, Anchor.TopRight));
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1, 0), layoutGroup.RectTransform),
|
new GUITextBlock(new RectTransform(new Vector2(1, 0), layoutGroup.RectTransform),
|
||||||
$"{TextManager.Get("Dimensions")}: {dimensionsStr}",
|
$"{TextManager.Get("Dimensions")}: {dimensionsStr}",
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ namespace Barotrauma
|
|||||||
private GUITextBox saveNameBox, seedBox;
|
private GUITextBox saveNameBox, seedBox;
|
||||||
private GUITickBox contextualTutorialBox;
|
private GUITickBox contextualTutorialBox;
|
||||||
|
|
||||||
|
private GUILayoutGroup subPreviewContainer;
|
||||||
|
|
||||||
private GUIButton loadGameButton;
|
private GUIButton loadGameButton;
|
||||||
|
|
||||||
public Action<Submarine, string, string> StartNewGame;
|
public Action<Submarine, string, string> StartNewGame;
|
||||||
@@ -51,34 +53,46 @@ namespace Barotrauma
|
|||||||
RelativeSpacing = 0.02f
|
RelativeSpacing = 0.02f
|
||||||
};
|
};
|
||||||
|
|
||||||
var rightColumn = new GUILayoutGroup(new RectTransform(Vector2.One, columnContainer.RectTransform))
|
var rightColumn = new GUILayoutGroup(new RectTransform(isMultiplayer ? Vector2.Zero : new Vector2(1.5f, 1.0f), columnContainer.RectTransform))
|
||||||
{
|
{
|
||||||
|
Stretch = true,
|
||||||
RelativeSpacing = 0.02f
|
RelativeSpacing = 0.02f
|
||||||
};
|
};
|
||||||
|
|
||||||
|
columnContainer.Recalculate();
|
||||||
|
|
||||||
// New game left side
|
// New game left side
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), leftColumn.RectTransform), TextManager.Get("SaveName") + ":", textAlignment: Alignment.BottomLeft);
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.07f), leftColumn.RectTransform), TextManager.Get("SaveName") + ":", textAlignment: Alignment.BottomLeft);
|
||||||
saveNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.1f), leftColumn.RectTransform), string.Empty);
|
saveNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.1f), leftColumn.RectTransform), string.Empty);
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), leftColumn.RectTransform), TextManager.Get("MapSeed") + ":", textAlignment: Alignment.BottomLeft);
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.07f), leftColumn.RectTransform), TextManager.Get("MapSeed") + ":", textAlignment: Alignment.BottomLeft);
|
||||||
seedBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.1f), leftColumn.RectTransform), ToolBox.RandomSeed(8));
|
seedBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.1f), leftColumn.RectTransform), ToolBox.RandomSeed(8));
|
||||||
|
|
||||||
if (!isMultiplayer)
|
if (!isMultiplayer)
|
||||||
{
|
{
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), leftColumn.RectTransform), TextManager.Get("TutorialActive") + ":", textAlignment: Alignment.BottomLeft);
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), leftColumn.RectTransform), style: null);
|
||||||
contextualTutorialBox = new GUITickBox(new RectTransform(new Point(30, 30), leftColumn.RectTransform), string.Empty);
|
contextualTutorialBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.1f), leftColumn.RectTransform), TextManager.Get("TutorialActive"));
|
||||||
UpdateTutorialSelection();
|
UpdateTutorialSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), leftColumn.RectTransform), TextManager.Get("SelectedSub") + ":", textAlignment: Alignment.BottomLeft);
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), leftColumn.RectTransform), TextManager.Get("SelectedSub") + ":", textAlignment: Alignment.BottomLeft);
|
||||||
subList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.65f), leftColumn.RectTransform));
|
subList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.65f), leftColumn.RectTransform));
|
||||||
|
|
||||||
UpdateSubList(submarines);
|
if (!isMultiplayer) { subList.OnSelected = OnSubSelected; }
|
||||||
|
|
||||||
// New game right side
|
// New game right side
|
||||||
var startButton = new GUIButton(new RectTransform(new Vector2(1.0f, 0.13f), rightColumn.RectTransform, Anchor.BottomRight), TextManager.Get("StartCampaignButton"), style: "GUIButtonLarge")
|
subPreviewContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.8f), rightColumn.RectTransform))
|
||||||
|
{
|
||||||
|
Stretch = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.13f),
|
||||||
|
(isMultiplayer ? leftColumn : rightColumn).RectTransform) { MaxSize = new Point(int.MaxValue, 60) }, childAnchor: Anchor.TopRight);
|
||||||
|
|
||||||
|
var startButton = new GUIButton(new RectTransform(isMultiplayer ? new Vector2(0.5f, 2.0f) : Vector2.One,
|
||||||
|
buttonContainer.RectTransform, Anchor.BottomRight) { MaxSize = new Point(350, 60) },
|
||||||
|
TextManager.Get("StartCampaignButton"), style: "GUIButtonLarge")
|
||||||
{
|
{
|
||||||
IgnoreLayoutGroups = true,
|
|
||||||
OnClicked = (GUIButton btn, object userData) =>
|
OnClicked = (GUIButton btn, object userData) =>
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(saveNameBox.Text))
|
if (string.IsNullOrWhiteSpace(saveNameBox.Text))
|
||||||
@@ -160,9 +174,27 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
leftColumn.Recalculate();
|
||||||
|
rightColumn.Recalculate();
|
||||||
|
|
||||||
|
|
||||||
|
UpdateSubList(submarines);
|
||||||
UpdateLoadMenu(saveFiles);
|
UpdateLoadMenu(saveFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool OnSubSelected(GUIComponent component, object obj)
|
||||||
|
{
|
||||||
|
if (subPreviewContainer == null) { return false; }
|
||||||
|
|
||||||
|
subPreviewContainer.ClearChildren();
|
||||||
|
|
||||||
|
Submarine sub = obj as Submarine;
|
||||||
|
if (sub == null) { return true; }
|
||||||
|
|
||||||
|
sub.CreatePreviewWindow(subPreviewContainer);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private IEnumerable<object> WaitForCampaignSetup()
|
private IEnumerable<object> WaitForCampaignSetup()
|
||||||
{
|
{
|
||||||
string headerText = TextManager.Get("CampaignStartingPleaseWait");
|
string headerText = TextManager.Get("CampaignStartingPleaseWait");
|
||||||
@@ -216,25 +248,13 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var infoButton = new GUIButton(new RectTransform(new Vector2(0.12f, 0.8f), textBlock.RectTransform, Anchor.CenterRight), text: "?")
|
|
||||||
{
|
|
||||||
UserData = sub
|
|
||||||
};
|
|
||||||
infoButton.OnClicked += (component, userdata) =>
|
|
||||||
{
|
|
||||||
// TODO: use relative size
|
|
||||||
((Submarine)userdata).CreatePreviewWindow(new GUIMessageBox("", "", 550, 400));
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (sub.HasTag(SubmarineTag.Shuttle))
|
if (sub.HasTag(SubmarineTag.Shuttle))
|
||||||
{
|
{
|
||||||
textBlock.TextColor = textBlock.TextColor * 0.85f;
|
textBlock.TextColor = textBlock.TextColor * 0.85f;
|
||||||
|
|
||||||
var shuttleText = new GUITextBlock(new RectTransform(new Point(100, textBlock.Rect.Height), textBlock.RectTransform, Anchor.CenterRight)
|
var shuttleText = new GUITextBlock(new RectTransform(new Point(100, textBlock.Rect.Height), textBlock.RectTransform, Anchor.CenterRight)
|
||||||
{
|
{
|
||||||
IsFixedSize = false,
|
IsFixedSize = false
|
||||||
RelativeOffset = new Vector2(infoButton.RectTransform.RelativeSize.X + 0.01f, 0)
|
|
||||||
},
|
},
|
||||||
TextManager.Get("Shuttle"), textAlignment: Alignment.Right, font: GUI.SmallFont)
|
TextManager.Get("Shuttle"), textAlignment: Alignment.Right, font: GUI.SmallFont)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ namespace Barotrauma
|
|||||||
SetupButtons(buttons);
|
SetupButtons(buttons);
|
||||||
buttons.ForEach(b => b.TextBlock.SetTextPos());*/
|
buttons.ForEach(b => b.TextBlock.SetTextPos());*/
|
||||||
|
|
||||||
var relativeSize = new Vector2(0.6f, 0.5f);
|
var relativeSize = new Vector2(0.6f, 0.65f);
|
||||||
var minSize = new Point(600, 400);
|
var minSize = new Point(600, 400);
|
||||||
var maxSize = new Point(2000, 1500);
|
var maxSize = new Point(2000, 1500);
|
||||||
var anchor = Anchor.CenterRight;
|
var anchor = Anchor.CenterRight;
|
||||||
@@ -341,8 +341,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
UpdateTutorialList();
|
UpdateTutorialList();
|
||||||
|
|
||||||
campaignSetupUI.UpdateSubList(Submarine.SavedSubmarines);
|
|
||||||
|
|
||||||
ResetButtonStates(null);
|
ResetButtonStates(null);
|
||||||
|
|
||||||
GameAnalyticsManager.SetCustomDimension01("");
|
GameAnalyticsManager.SetCustomDimension01("");
|
||||||
@@ -390,6 +388,7 @@ namespace Barotrauma
|
|||||||
case Tab.NewGame:
|
case Tab.NewGame:
|
||||||
campaignSetupUI.CreateDefaultSaveName();
|
campaignSetupUI.CreateDefaultSaveName();
|
||||||
campaignSetupUI.UpdateTutorialSelection();
|
campaignSetupUI.UpdateTutorialSelection();
|
||||||
|
campaignSetupUI.UpdateSubList(Submarine.SavedSubmarines);
|
||||||
break;
|
break;
|
||||||
case Tab.LoadGame:
|
case Tab.LoadGame:
|
||||||
campaignSetupUI.UpdateLoadMenu();
|
campaignSetupUI.UpdateLoadMenu();
|
||||||
|
|||||||
@@ -1216,6 +1216,43 @@ namespace Barotrauma
|
|||||||
targetingTag = "room";
|
targetingTag = "room";
|
||||||
}
|
}
|
||||||
if (door != null)
|
if (door != null)
|
||||||
|
{
|
||||||
|
// If there's not a more specific tag for the door
|
||||||
|
if (string.IsNullOrEmpty(targetingTag) || targetingTag == "room")
|
||||||
|
{
|
||||||
|
targetingTag = "door";
|
||||||
|
}
|
||||||
|
bool isOutdoor = door.LinkedGap?.FlowTargetHull != null && !door.LinkedGap.IsRoomToRoom;
|
||||||
|
bool isOpen = door.IsOpen || door.Item.Condition <= 0.0f;
|
||||||
|
//increase priority if the character is outside and an aggressive boarder, and the door is from outside to inside
|
||||||
|
if (aggressiveBoarding)
|
||||||
|
{
|
||||||
|
if (character.CurrentHull == null)
|
||||||
|
{
|
||||||
|
valueModifier = isOutdoor ? 1 : 0;
|
||||||
|
valueModifier *= isOpen ? 5 : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Ignore disabled walls
|
||||||
|
bool isDisabled = true;
|
||||||
|
for (int i = 0; i < s.Sections.Length; i++)
|
||||||
|
{
|
||||||
|
valueModifier = isOutdoor ? 0 : 1;
|
||||||
|
valueModifier *= isOpen ? 0 : 1;
|
||||||
|
}
|
||||||
|
if (isDisabled)
|
||||||
|
{
|
||||||
|
valueModifier = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
targetingTag = "room";
|
||||||
|
}
|
||||||
|
if (door != null)
|
||||||
{
|
{
|
||||||
// If there's not a more specific tag for the door
|
// If there's not a more specific tag for the door
|
||||||
if (string.IsNullOrEmpty(targetingTag) || targetingTag == "room")
|
if (string.IsNullOrEmpty(targetingTag) || targetingTag == "room")
|
||||||
@@ -1242,6 +1279,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (isOpen) //ignore broken and open doors
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (target.Entity is IDamageable targetDamageable && targetDamageable.Health <= 0.0f)
|
else if (target.Entity is IDamageable targetDamageable && targetDamageable.Health <= 0.0f)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1400,6 +1400,39 @@ namespace Barotrauma
|
|||||||
|
|
||||||
AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList();
|
AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList();
|
||||||
|
|
||||||
|
if (sprite == null)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!");
|
||||||
|
#if SERVER
|
||||||
|
sprite = new Sprite("", Vector2.Zero);
|
||||||
|
sprite.SourceRect = new Rectangle(0, 0, 32, 32);
|
||||||
|
#else
|
||||||
|
sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null)
|
||||||
|
{
|
||||||
|
Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
size = sprite.size;
|
||||||
|
sprite.EntityID = identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier))
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError(
|
||||||
|
"Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading.");
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(identifier))
|
||||||
|
{
|
||||||
|
MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier);
|
||||||
|
if (existingPrefab != null)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError(
|
||||||
|
"Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList();
|
||||||
|
|
||||||
List.Add(this);
|
List.Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user