(86a1bac17) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev

This commit is contained in:
Joonas Rikkonen
2019-04-04 11:12:46 +03:00
parent 3b35ba056d
commit 6ac3ecd2b2
7 changed files with 1 additions and 248 deletions
@@ -651,151 +651,6 @@ namespace Barotrauma
keyBox.OnSelected += KeyBoxSelected; keyBox.OnSelected += KeyBoxSelected;
keyBox.SelectedColor = Color.Gold * 0.3f; keyBox.SelectedColor = Color.Gold * 0.3f;
} }
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),
barSize: 0.05f)
{
UserData = aimAssistText,
BarScroll = MathUtils.InverseLerp(0.0f, 5.0f, AimAssistAmount),
OnMoved = (scrollBar, scroll) =>
{
ChangeSliderText(scrollBar, scroll);
AimAssistAmount = MathHelper.Lerp(0.0f, 5.0f, scroll);
return true;
},
Step = 0.1f
};
aimAssistSlider.OnMoved(aimAssistSlider, aimAssistSlider.BarScroll);
new GUIButton(new RectTransform(new Vector2(0.25f, 0.07f), controlsLayoutGroup.RectTransform), TextManager.Get("LegacyBindings"), style: "GUIButton")
{
OnClicked = (button, data) =>
{
// TODO: add a prompt?
SetDefaultBindings(legacy: true);
CheckBindings(true);
ApplySettings();
// TODO: refresh the settings frame instead of closing it.
GameMain.MainMenuScreen.ReturnToMainMenu(null, null);
GUI.SettingsMenuOpen = false;
return true;
}
};
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);
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")
{
IgnoreLayoutGroups = true,
OnClicked = (x, y) =>
{
if (UnsavedSettings)
{
LoadPlayerConfig();
}
if (Screen.Selected == GameMain.MainMenuScreen) GameMain.MainMenuScreen.ReturnToMainMenu(null, null);
GUI.SettingsMenuOpen = false;
return true;
}
};
new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), buttonArea.RectTransform, Anchor.BottomCenter),
TextManager.Get("Reset"), style: "GUIButtonLarge")
{
IgnoreLayoutGroups = true,
OnClicked = (button, data) =>
{
// TODO: add a prompt
LoadDefaultConfig();
CheckBindings(true);
ApplySettings();
ResetSettingsFrame();
CreateSettingsFrame();
return true;
}
};
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);
var resetControlsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.07f), controlsLayoutGroup.RectTransform), isHorizontal: true) var resetControlsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.07f), controlsLayoutGroup.RectTransform), isHorizontal: true)
{ {
@@ -290,14 +290,6 @@ namespace Barotrauma.Items.Components
itemList.UpdateScrollBarSize(); itemList.UpdateScrollBarSize();
itemList.BarScroll = 0.0f; itemList.BarScroll = 0.0f;
float degreeOfSuccess = user == null ? 0.0f : DegreeOfSuccess(user, selectedItem.RequiredSkills);
if (degreeOfSuccess > 0.5f) { degreeOfSuccess = 1.0f; }
float requiredTime = user == null ? selectedItem.RequiredTime : GetRequiredTime(selectedItem, user);
string requiredTimeText = TextManager.Get("FabricatorRequiredTime") + ": " + ToolBox.SecondsToReadableTime(requiredTime);
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedFrame.RectTransform),
requiredTimeText, textColor: ToolBox.GradientLerp(degreeOfSuccess, Color.Red, Color.Yellow, Color.LightGreen), font: GUI.SmallFont);
return true; return true;
} }
@@ -10,8 +10,6 @@ namespace Barotrauma
{ {
protected Texture2D texture; protected Texture2D texture;
private bool preMultipliedAlpha;
public Texture2D Texture public Texture2D Texture
{ {
get get
@@ -912,82 +912,6 @@ namespace Barotrauma
foreach (XElement subElement in doc.Root.Elements()) foreach (XElement subElement in doc.Root.Elements())
{ {
switch (subElement.Name.ToString().ToLowerInvariant()) switch (subElement.Name.ToString().ToLowerInvariant())
{
case "keymapping":
foreach (XAttribute attribute in subElement.Attributes())
{
if (Enum.TryParse(attribute.Name.ToString(), true, out InputType inputType))
{
if (int.TryParse(attribute.Value.ToString(), out int mouseButton))
{
keyMapping[(int)inputType] = new KeyOrMouse(mouseButton);
}
else
{
if (Enum.TryParse(attribute.Value.ToString(), true, out Keys key))
{
keyMapping[(int)inputType] = new KeyOrMouse(key);
}
}
}
}
break;
case "gameplay":
jobPreferences = new List<string>();
foreach (XElement ele in subElement.Element("jobpreferences").Elements("job"))
{
string jobIdentifier = ele.GetAttributeString("identifier", "");
if (string.IsNullOrEmpty(jobIdentifier)) continue;
jobPreferences.Add(jobIdentifier);
}
break;
case "player":
defaultPlayerName = subElement.GetAttributeString("name", defaultPlayerName);
CharacterHeadIndex = subElement.GetAttributeInt("headindex", CharacterHeadIndex);
if (Enum.TryParse(subElement.GetAttributeString("gender", "none"), true, out Gender g))
{
CharacterGender = g;
}
if (Enum.TryParse(subElement.GetAttributeString("race", "white"), true, out Race r))
{
CharacterRace = r;
}
else
{
CharacterRace = Race.White;
}
CharacterHairIndex = subElement.GetAttributeInt("hairindex", CharacterHairIndex);
CharacterBeardIndex = subElement.GetAttributeInt("beardindex", CharacterBeardIndex);
CharacterMoustacheIndex = subElement.GetAttributeInt("moustacheindex", CharacterMoustacheIndex);
CharacterFaceAttachmentIndex = subElement.GetAttributeInt("faceattachmentindex", CharacterFaceAttachmentIndex);
break;
case "tutorials":
foreach (XElement tutorialElement in subElement.Elements())
{
CompletedTutorialNames.Add(tutorialElement.GetAttributeString("name", ""));
}
break;
}
}
UnsavedSettings = false;
selectedContentPackagePaths = new HashSet<string>();
foreach (XElement subElement in doc.Root.Elements())
{
DebugConsole.ThrowError(TextManager.Get("ContentPackageNotFound").Replace("[packagepath]", missingPackagePath));
}
foreach (ContentPackage incompatiblePackage in incompatiblePackages)
{
DebugConsole.ThrowError(TextManager.Get(incompatiblePackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage")
.Replace("[packagename]", incompatiblePackage.Name)
.Replace("[packageversion]", incompatiblePackage.GameVersion.ToString())
.Replace("[gameversion]", GameMain.Version.ToString()));
}
foreach (ContentPackage contentPackage in SelectedContentPackages)
{
foreach (ContentFile file in contentPackage.Files)
{ {
case "contentpackage": case "contentpackage":
string path = System.IO.Path.GetFullPath(subElement.GetAttributeString("path", "")); string path = System.IO.Path.GetFullPath(subElement.GetAttributeString("path", ""));
@@ -1087,7 +1011,6 @@ namespace Barotrauma
new XAttribute("autocheckupdates", AutoCheckUpdates), new XAttribute("autocheckupdates", AutoCheckUpdates),
new XAttribute("musicvolume", musicVolume), new XAttribute("musicvolume", musicVolume),
new XAttribute("soundvolume", soundVolume), new XAttribute("soundvolume", soundVolume),
new XAttribute("voicechatvolume", voiceChatVolume),
new XAttribute("verboselogging", VerboseLogging), new XAttribute("verboselogging", VerboseLogging),
new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs), new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs),
new XAttribute("enablesplashscreen", EnableSplashScreen), new XAttribute("enablesplashscreen", EnableSplashScreen),
@@ -1109,6 +1032,7 @@ namespace Barotrauma
gMode = new XElement("graphicsmode"); gMode = new XElement("graphicsmode");
doc.Root.Add(gMode); doc.Root.Add(gMode);
} }
if (GraphicsWidth == 0 || GraphicsHeight == 0) if (GraphicsWidth == 0 || GraphicsHeight == 0)
{ {
gMode.ReplaceAttributes(new XAttribute("displaymode", windowMode)); gMode.ReplaceAttributes(new XAttribute("displaymode", windowMode));
@@ -171,15 +171,6 @@ namespace Barotrauma.Items.Components
} }
public override bool SecondaryUse(float deltaTime, Character character = null) public override bool SecondaryUse(float deltaTime, Character character = null)
{
if (item.RequireAimToUse)
{
return Control(deltaTime, character);
}
return false;
}
private bool Control(float deltaTime, Character character = null)
{ {
if (this.character != character) if (this.character != character)
{ {
@@ -24,12 +24,6 @@ namespace Barotrauma.Items.Components
private bool itemLoaded; private bool itemLoaded;
private float blinkTimer;
private bool itemLoaded;
private float blinkTimer;
public PhysicsBody ParentBody; public PhysicsBody ParentBody;
[Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)] [Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]
@@ -584,7 +584,6 @@ namespace Barotrauma
/// </summary> /// </summary>
public void ApplyLinearImpulse(Vector2 impulse, float maxVelocity) public void ApplyLinearImpulse(Vector2 impulse, float maxVelocity)
{ {
if (!IsValidValue(impulse / body.Mass, "new velocity")) return;
if (!IsValidValue(impulse, "impulse", -1e10f, 1e10f)) return; if (!IsValidValue(impulse, "impulse", -1e10f, 1e10f)) return;
if (!IsValidValue(maxVelocity, "max velocity")) return; if (!IsValidValue(maxVelocity, "max velocity")) return;