(ad567dea) v0.9.7.1
This commit is contained in:
-3
@@ -3347,7 +3347,6 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
void CreateCloseButton(SerializableEntityEditor editor, Action onButtonClicked, float size = 1)
|
||||
{
|
||||
if (editor == null) { return; }
|
||||
int height = 30;
|
||||
var parent = new GUIFrame(new RectTransform(new Point(editor.Rect.Width, (int)(height * size * GUI.yScale)), editor.RectTransform, isFixedSize: true), style: null)
|
||||
{
|
||||
@@ -3367,7 +3366,6 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
void CreateAddButtonAtLast(ParamsEditor editor, Action onButtonClicked, string text)
|
||||
{
|
||||
if (editor == null) { return; }
|
||||
var parentFrame = new GUIFrame(new RectTransform(new Point(editor.EditorBox.Rect.Width, (int)(50 * GUI.yScale)), editor.EditorBox.Content.RectTransform), style: null, color: ParamsEditor.Color)
|
||||
{
|
||||
CanBeFocused = false
|
||||
@@ -3385,7 +3383,6 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
void CreateAddButton(SerializableEntityEditor editor, Action onButtonClicked, string text)
|
||||
{
|
||||
if (editor == null) { return; }
|
||||
var parent = new GUIFrame(new RectTransform(new Point(editor.Rect.Width, (int)(60 * GUI.yScale)), editor.RectTransform), style: null)
|
||||
{
|
||||
CanBeFocused = false
|
||||
|
||||
@@ -394,7 +394,7 @@ namespace Barotrauma.CharacterEditor
|
||||
return false;
|
||||
}
|
||||
var path = Path.GetFileName(TexturePath);
|
||||
if (!path.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
|
||||
if (!path.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("WrongFileType"), GUI.Style.Red);
|
||||
texturePathElement.Flash(GUI.Style.Red);
|
||||
@@ -724,8 +724,8 @@ namespace Barotrauma.CharacterEditor
|
||||
{
|
||||
ParseLimbsFromGUIElements();
|
||||
ParseJointsFromGUIElements();
|
||||
var main = LimbXElements.Values.Select(xe => xe.Attribute("type")).Where(a => a.Value.Equals("torso", StringComparison.OrdinalIgnoreCase)).FirstOrDefault() ??
|
||||
LimbXElements.Values.Select(xe => xe.Attribute("type")).Where(a => a.Value.Equals("head", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
|
||||
var main = LimbXElements.Values.Select(xe => xe.Attribute("type")).Where(a => a.Value.ToLowerInvariant() == "torso").FirstOrDefault() ??
|
||||
LimbXElements.Values.Select(xe => xe.Attribute("type")).Where(a => a.Value.ToLowerInvariant() == "head").FirstOrDefault();
|
||||
if (main == null)
|
||||
{
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("MissingTorsoOrHead"), GUI.Style.Red);
|
||||
|
||||
@@ -91,13 +91,7 @@ namespace Barotrauma
|
||||
c.DoVisibilityCheck(cam);
|
||||
if (c.IsVisible != wasVisible)
|
||||
{
|
||||
c.AnimController.Limbs.ForEach(l =>
|
||||
{
|
||||
if (l.LightSource != null)
|
||||
{
|
||||
l.LightSource.Enabled = c.IsVisible;
|
||||
}
|
||||
});
|
||||
c.AnimController.Limbs.ForEach(l => { if (l.LightSource != null) l.LightSource.Enabled = c.IsVisible; });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,23 +282,14 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.LinearWrap, DepthStencilState.None, null, null, cam.Transform);
|
||||
foreach (Character c in Character.CharacterList)
|
||||
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch, cam);
|
||||
|
||||
if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch, cam);
|
||||
if (GameMain.DebugDraw && GameMain.GameSession?.EventManager != null)
|
||||
{
|
||||
c.DrawFront(spriteBatch, cam);
|
||||
}
|
||||
if (Level.Loaded != null)
|
||||
{
|
||||
Level.Loaded.DrawFront(spriteBatch, cam);
|
||||
}
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
MapEntity.mapEntityList.ForEach(me => me.AiTarget?.Draw(spriteBatch));
|
||||
Character.CharacterList.ForEach(c => c.AiTarget?.Draw(spriteBatch));
|
||||
if (GameMain.GameSession?.EventManager != null)
|
||||
{
|
||||
GameMain.GameSession.EventManager.DebugDraw(spriteBatch);
|
||||
}
|
||||
GameMain.GameSession.EventManager.DebugDraw(spriteBatch);
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
if (GameMain.LightManager.LosEnabled && GameMain.LightManager.LosMode != LosMode.None && Character.Controlled != null)
|
||||
|
||||
@@ -517,21 +517,8 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
XElement levelParamElement = element;
|
||||
if (element.IsOverride())
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals(genParams.Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SerializableProperty.SerializeProperties(genParams, subElement, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (element.Name.ToString().Equals(genParams.Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SerializableProperty.SerializeProperties(genParams, element, true);
|
||||
}
|
||||
if (element.Name.ToString().ToLowerInvariant() != genParams.Name.ToLowerInvariant()) continue;
|
||||
SerializableProperty.SerializeProperties(genParams, element, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -552,7 +539,7 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
if (!element.Name.ToString().Equals(levelObjPrefab.Name, StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (element.Name.ToString().ToLowerInvariant() != levelObjPrefab.Name.ToLowerInvariant()) continue;
|
||||
levelObjPrefab.Save(element);
|
||||
break;
|
||||
}
|
||||
@@ -577,7 +564,7 @@ namespace Barotrauma
|
||||
bool elementFound = false;
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
if (!element.Name.ToString().Equals(genParams.Name, StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (element.Name.ToString().ToLowerInvariant() != genParams.Name.ToLowerInvariant()) continue;
|
||||
SerializableProperty.SerializeProperties(genParams, element, true);
|
||||
elementFound = true;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,8 @@ namespace Barotrauma
|
||||
private IEnumerable<object> LoadRound()
|
||||
{
|
||||
GameMain.GameSession.StartRound(campaignUI.SelectedLevel,
|
||||
reloadSub: true,
|
||||
reloadSub: true,
|
||||
loadSecondSub: false,
|
||||
mirrorLevel: GameMain.GameSession.Map.CurrentLocation != GameMain.GameSession.Map.SelectedConnection.Locations[0]);
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
|
||||
@@ -443,7 +443,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (!(FileTransferFrame.UserData is FileReceiver.FileTransferIn transfer)) { return false; }
|
||||
if (!(userdata is FileReceiver.FileTransferIn transfer)) { return false; }
|
||||
GameMain.Client?.CancelFileTransfer(transfer);
|
||||
GameMain.Client.FileReceiver.StopTransfer(transfer);
|
||||
return true;
|
||||
@@ -658,7 +658,7 @@ namespace Barotrauma
|
||||
OnClicked = (btn, obj) =>
|
||||
{
|
||||
GameMain.Client.RequestStartRound();
|
||||
CoroutineManager.StartCoroutine(WaitForStartRound(StartButton, allowCancel: false), "WaitForStartRound");
|
||||
CoroutineManager.StartCoroutine(WaitForStartRound(StartButton, allowCancel: true), "WaitForStartRound");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1147,22 +1147,6 @@ namespace Barotrauma
|
||||
clientDisabledElements.AddRange(botSpawnModeButtons);
|
||||
}
|
||||
|
||||
public void StopWaitingForStartRound()
|
||||
{
|
||||
CoroutineManager.StopCoroutines("WaitForStartRound");
|
||||
|
||||
GUIMessageBox.CloseAll();
|
||||
if (StartButton != null)
|
||||
{
|
||||
StartButton.Enabled = true;
|
||||
}
|
||||
if (campaignUI?.StartButton != null)
|
||||
{
|
||||
campaignUI.StartButton.Enabled = true;
|
||||
}
|
||||
GUI.ClearCursorWait();
|
||||
}
|
||||
|
||||
public IEnumerable<object> WaitForStartRound(GUIButton startButton, bool allowCancel)
|
||||
{
|
||||
GUI.SetCursorWaiting();
|
||||
@@ -1189,8 +1173,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
DateTime timeOut = DateTime.Now + new TimeSpan(0, 0, 10);
|
||||
while (Selected == GameMain.NetLobbyScreen &&
|
||||
DateTime.Now < timeOut)
|
||||
while (Selected == GameMain.NetLobbyScreen && DateTime.Now < timeOut)
|
||||
{
|
||||
msgBox.Header.Text = headerText + new string('.', ((int)Timing.TotalTime % 3 + 1));
|
||||
yield return CoroutineStatus.Running;
|
||||
@@ -1339,8 +1322,6 @@ namespace Barotrauma
|
||||
if (GameMain.Client == null) return;
|
||||
spectateButton.Visible = true;
|
||||
spectateButton.Enabled = true;
|
||||
|
||||
StartButton.Visible = false;
|
||||
}
|
||||
|
||||
public void SetCampaignCharacterInfo(CharacterInfo newCampaignCharacterInfo)
|
||||
@@ -1780,7 +1761,7 @@ namespace Barotrauma
|
||||
}
|
||||
GameMain.Client.RequestSelectMode(component.Parent.GetChildIndex(component));
|
||||
HighlightMode(SelectedModeIndex);
|
||||
return !presetName.Equals("multiplayercampaign", StringComparison.OrdinalIgnoreCase);
|
||||
return (presetName.ToLowerInvariant() != "multiplayercampaign");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -2260,7 +2241,7 @@ namespace Barotrauma
|
||||
targetMicStyle = "GUIMicrophoneDisabled";
|
||||
}
|
||||
|
||||
if (!targetMicStyle.Equals(currMicStyle, StringComparison.OrdinalIgnoreCase))
|
||||
if (targetMicStyle.ToLowerInvariant() != currMicStyle.ToLowerInvariant())
|
||||
{
|
||||
GUI.Style.Apply(micIcon, targetMicStyle);
|
||||
}
|
||||
@@ -2616,7 +2597,7 @@ namespace Barotrauma
|
||||
GUILayoutGroup row = null;
|
||||
int itemsInRow = 0;
|
||||
|
||||
XElement headElement = info.Ragdoll.MainElement.Elements().FirstOrDefault(e => e.GetAttributeString("type", "").Equals("head", StringComparison.OrdinalIgnoreCase));
|
||||
XElement headElement = info.Ragdoll.MainElement.Elements().FirstOrDefault(e => e.GetAttributeString("type", "").ToLowerInvariant() == "head");
|
||||
XElement headSpriteElement = headElement.Element("sprite");
|
||||
string spritePathWithTags = headSpriteElement.Attribute("texture").Value;
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
if (!element.Name.ToString().Equals(prefab.Name, StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (element.Name.ToString().ToLowerInvariant() != prefab.Name.ToLowerInvariant()) continue;
|
||||
SerializableProperty.SerializeProperties(prefab, element, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -965,7 +965,7 @@ namespace Barotrauma
|
||||
|
||||
child.Visible =
|
||||
serverInfo.OwnerVerified &&
|
||||
serverInfo.ServerName.Contains(searchBox.Text, StringComparison.OrdinalIgnoreCase) &&
|
||||
serverInfo.ServerName.ToLowerInvariant().Contains(searchBox.Text.ToLowerInvariant()) &&
|
||||
(!filterSameVersion.Selected || (remoteVersion != null && NetworkMember.IsCompatible(remoteVersion, GameMain.Version))) &&
|
||||
(!filterPassword.Selected || !serverInfo.HasPassword) &&
|
||||
(!filterIncompatible.Selected || !incompatible) &&
|
||||
@@ -996,7 +996,7 @@ namespace Barotrauma
|
||||
foreach (GUITickBox tickBox in gameModeTickBoxes)
|
||||
{
|
||||
var gameMode = (string)tickBox.UserData;
|
||||
if (!tickBox.Selected && serverInfo.GameMode.Equals(gameMode, StringComparison.OrdinalIgnoreCase))
|
||||
if (!tickBox.Selected && (serverInfo.GameMode == gameMode.ToLowerInvariant() || serverInfo.GameMode == gameMode))
|
||||
{
|
||||
child.Visible = false;
|
||||
break;
|
||||
@@ -1512,7 +1512,7 @@ namespace Barotrauma
|
||||
{
|
||||
serverList.ClearChildren();
|
||||
|
||||
if (masterServerData.Substring(0, 5).Equals("error", StringComparison.OrdinalIgnoreCase))
|
||||
if (masterServerData.Substring(0, 5).ToLowerInvariant() == "error")
|
||||
{
|
||||
DebugConsole.ThrowError("Error while connecting to master server (" + masterServerData + ")!");
|
||||
return;
|
||||
|
||||
@@ -1097,7 +1097,7 @@ namespace Barotrauma
|
||||
var tagBtn = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tagHolder.Content.RectTransform, anchor: Anchor.CenterLeft),
|
||||
tag.CapitaliseFirstInvariant(), style: "GUIButtonRound");
|
||||
tagBtn.TextBlock.AutoScaleHorizontal = true;
|
||||
tagBtn.Selected = itemEditor?.Tags?.Any(t => t.Equals(tag, StringComparison.OrdinalIgnoreCase)) ?? false;
|
||||
tagBtn.Selected = itemEditor?.Tags?.Any(t => t.ToLowerInvariant() == tag) ?? false;
|
||||
|
||||
tagBtn.OnClicked = (btn, userdata) =>
|
||||
{
|
||||
@@ -1108,7 +1108,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
itemEditor?.Tags?.RemoveAll(t => t.Equals(tagBtn.Text, StringComparison.OrdinalIgnoreCase));
|
||||
itemEditor?.Tags?.RemoveAll(t => t.ToLowerInvariant() == tagBtn.Text.ToLowerInvariant());
|
||||
tagBtn.Selected = false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -7,8 +7,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using EventInput;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -90,9 +88,6 @@ namespace Barotrauma
|
||||
private GUITextBlock submarineDescriptionCharacterCount;
|
||||
|
||||
private Mode mode;
|
||||
|
||||
// Prevent the mode from changing
|
||||
private bool lockMode;
|
||||
|
||||
public override Camera Cam
|
||||
{
|
||||
@@ -238,21 +233,15 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
var spacing = new GUIFrame(new RectTransform(new Vector2(0.02f, 1.0f), paddedTopPanel.RectTransform), style: null);
|
||||
new GUIFrame(new RectTransform(new Vector2(0.1f, 0.9f), spacing.RectTransform, Anchor.Center), style: "VerticalLine");
|
||||
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.9f), paddedTopPanel.RectTransform), style: "VerticalLine");
|
||||
|
||||
defaultModeTickBox = new GUITickBox(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "EditSubButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("SubEditorEditingMode"),
|
||||
OnSelected = (GUITickBox tBox) =>
|
||||
{
|
||||
if (!lockMode)
|
||||
{
|
||||
if (tBox.Selected) { SetMode(Mode.Default); }
|
||||
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
if (tBox.Selected) { SetMode(Mode.Default); }
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -261,12 +250,8 @@ namespace Barotrauma
|
||||
ToolTip = TextManager.Get("CharacterModeButton") + '\n' + TextManager.Get("CharacterModeToolTip"),
|
||||
OnSelected = (GUITickBox tBox) =>
|
||||
{
|
||||
if (!lockMode)
|
||||
{
|
||||
SetMode(tBox.Selected ? Mode.Character : Mode.Default);
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
SetMode(tBox.Selected ? Mode.Character : Mode.Default);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -275,17 +260,20 @@ namespace Barotrauma
|
||||
ToolTip = TextManager.Get("WiringModeButton") + '\n' + TextManager.Get("WiringModeToolTip"),
|
||||
OnSelected = (GUITickBox tBox) =>
|
||||
{
|
||||
if (!lockMode)
|
||||
{
|
||||
SetMode(tBox.Selected ? Mode.Wiring : Mode.Default);
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
SetMode(tBox.Selected ? Mode.Wiring : Mode.Default);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
spacing = new GUIFrame(new RectTransform(new Vector2(0.02f, 1.0f), paddedTopPanel.RectTransform), style: null);
|
||||
new GUIFrame(new RectTransform(new Vector2(0.1f, 0.9f), spacing.RectTransform, Anchor.Center), style: "VerticalLine");
|
||||
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.9f), paddedTopPanel.RectTransform), style: "VerticalLine");
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "GenerateWaypointsButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("GenerateWaypointsButton") + '\n' + TextManager.Get("GenerateWaypointsToolTip"),
|
||||
OnClicked = GenerateWaypoints
|
||||
};
|
||||
|
||||
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.9f), paddedTopPanel.RectTransform), style: "VerticalLine");
|
||||
|
||||
var visibilityButton = new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "SetupVisibilityButton")
|
||||
{
|
||||
@@ -311,42 +299,6 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
|
||||
spacing = new GUIFrame(new RectTransform(new Vector2(0.02f, 1.0f), paddedTopPanel.RectTransform), style: null);
|
||||
new GUIFrame(new RectTransform(new Vector2(0.1f, 0.9f), spacing.RectTransform, Anchor.Center), style: "VerticalLine");
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "GenerateWaypointsButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("GenerateWaypointsButton") + '\n' + TextManager.Get("GenerateWaypointsToolTip"),
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (WayPoint.WayPointList.Any())
|
||||
{
|
||||
var generateWaypointsVerification = new GUIMessageBox("", TextManager.Get("generatewaypointsverification"), new string[] { TextManager.Get("ok"), TextManager.Get("cancel") });
|
||||
generateWaypointsVerification.Buttons[0].OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (GenerateWaypoints())
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("waypointsgeneratedsuccesfully"), GUI.Style.Green);
|
||||
}
|
||||
WayPoint.ShowWayPoints = true;
|
||||
generateWaypointsVerification.Close();
|
||||
return true;
|
||||
};
|
||||
generateWaypointsVerification.Buttons[1].OnClicked = generateWaypointsVerification.Close;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GenerateWaypoints())
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("waypointsgeneratedsuccesfully"), GUI.Style.Green);
|
||||
}
|
||||
WayPoint.ShowWayPoints = true;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(0.1f, 1.0f), paddedTopPanel.RectTransform, Anchor.CenterRight), style: "GUINotificationButton")
|
||||
{
|
||||
IgnoreLayoutGroups = true,
|
||||
@@ -1035,27 +987,18 @@ namespace Barotrauma
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
}
|
||||
var result = SaveSubToFile(nameBox.Text);
|
||||
saveFrame = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
private bool SaveSubToFile(string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
|
||||
foreach (char illegalChar in Path.GetInvalidFileNameChars())
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("SubNameMissingWarning"), GUI.Style.Red);
|
||||
return false;
|
||||
if (nameBox.Text.Contains(illegalChar))
|
||||
{
|
||||
GUI.AddMessage(TextManager.GetWithVariable("SubNameIllegalCharsWarning", "[illegalchar]", illegalChar.ToString()), GUI.Style.Red);
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var illegalChar in Path.GetInvalidFileNameChars())
|
||||
{
|
||||
if (!name.Contains(illegalChar)) continue;
|
||||
GUI.AddMessage(TextManager.GetWithVariable("SubNameIllegalCharsWarning", "[illegalchar]", illegalChar.ToString()), GUI.Style.Red);
|
||||
return false;
|
||||
}
|
||||
|
||||
string savePath = name + ".sub";
|
||||
string savePath = nameBox.Text + ".sub";
|
||||
string prevSavePath = null;
|
||||
if (Submarine.MainSub != null)
|
||||
{
|
||||
@@ -1072,8 +1015,8 @@ namespace Barotrauma
|
||||
if (vanilla != null)
|
||||
{
|
||||
var vanillaSubs = vanilla.GetFilesOfType(ContentType.Submarine);
|
||||
string pathToCompare = savePath.Replace(@"\", @"/");
|
||||
if (vanillaSubs.Any(sub => sub.Replace(@"\", @"/").Equals(pathToCompare, StringComparison.OrdinalIgnoreCase)))
|
||||
string pathToCompare = savePath.Replace(@"\", @"/").ToLowerInvariant();
|
||||
if (vanillaSubs.Any(sub => sub.Replace(@"\", @"/").ToLowerInvariant() == pathToCompare))
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("CannotEditVanillaSubs"), GUI.Style.Red, font: GUI.LargeFont);
|
||||
return false;
|
||||
@@ -1081,7 +1024,7 @@ namespace Barotrauma
|
||||
}
|
||||
#endif
|
||||
|
||||
if (previewImage?.Sprite?.Texture != null)
|
||||
if (previewImage.Sprite?.Texture != null)
|
||||
{
|
||||
using (MemoryStream imgStream = new MemoryStream())
|
||||
{
|
||||
@@ -1093,7 +1036,7 @@ namespace Barotrauma
|
||||
{
|
||||
Submarine.SaveCurrent(savePath);
|
||||
}
|
||||
Submarine.MainSub?.CheckForErrors();
|
||||
Submarine.MainSub.CheckForErrors();
|
||||
|
||||
GUI.AddMessage(TextManager.GetWithVariable("SubSavedNotification", "[filepath]", Submarine.MainSub.FilePath), GUI.Style.Green);
|
||||
|
||||
@@ -1111,6 +1054,8 @@ namespace Barotrauma
|
||||
|
||||
subNameLabel.Text = ToolBox.LimitString(Submarine.MainSub.Name, subNameLabel.Font, subNameLabel.Rect.Width);
|
||||
|
||||
saveFrame = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1679,10 +1624,7 @@ namespace Barotrauma
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
var lightComponent = item.GetComponent<LightComponent>();
|
||||
if (lightComponent != null)
|
||||
{
|
||||
lightComponent.Light.Enabled = item.ParentInventory == null;
|
||||
}
|
||||
if (lightComponent != null) lightComponent.Light.Enabled = item.ParentInventory == null;
|
||||
}
|
||||
|
||||
if (selectedSub.GameVersion < new Version("0.8.9.0"))
|
||||
@@ -1812,20 +1754,18 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetMode(Mode newMode)
|
||||
public void SetMode(Mode mode)
|
||||
{
|
||||
if (newMode == mode) { return; }
|
||||
mode = newMode;
|
||||
if (mode == this.mode) { return; }
|
||||
this.mode = mode;
|
||||
|
||||
lockMode = true;
|
||||
defaultModeTickBox.Selected = newMode == Mode.Default;
|
||||
defaultModeTickBox.Selected = mode == Mode.Default;
|
||||
defaultModeTickBox.CanBeFocused = !defaultModeTickBox.Selected;
|
||||
|
||||
characterModeTickBox.Selected = newMode == Mode.Character;
|
||||
wiringModeTickBox.Selected = newMode == Mode.Wiring;
|
||||
lockMode = false;
|
||||
|
||||
switch (newMode)
|
||||
characterModeTickBox.Selected = mode == Mode.Character;
|
||||
wiringModeTickBox.Selected = mode == Mode.Wiring;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case Mode.Character:
|
||||
CreateDummyCharacter();
|
||||
@@ -1850,7 +1790,6 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
MapEntity.DeselectAll();
|
||||
MapEntity.FilteredSelectedList.Clear();
|
||||
}
|
||||
|
||||
private void RemoveDummyCharacter()
|
||||
@@ -2065,10 +2004,12 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool GenerateWaypoints()
|
||||
private bool GenerateWaypoints(GUIButton button, object obj)
|
||||
{
|
||||
if (Submarine.MainSub == null) { return false; }
|
||||
return WayPoint.GenerateSubWaypoints(Submarine.MainSub);
|
||||
if (Submarine.MainSub == null) return false;
|
||||
|
||||
WayPoint.GenerateSubWaypoints(Submarine.MainSub);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void AddPreviouslyUsed(MapEntityPrefab mapEntityPrefab)
|
||||
@@ -2465,53 +2406,12 @@ namespace Barotrauma
|
||||
hullVolumeFrame.Visible = MapEntity.SelectedList.Any(s => s is Hull);
|
||||
saveAssemblyFrame.Visible = MapEntity.SelectedList.Count > 0;
|
||||
|
||||
if (GUI.KeyboardDispatcher.Subscriber == null)
|
||||
if (PlayerInput.KeyHit(Microsoft.Xna.Framework.Input.Keys.Tab))
|
||||
{
|
||||
// TODO adjust when the new inventory stuff rolls in
|
||||
if (PlayerInput.KeyHit(Keys.Q) && mode == Mode.Default)
|
||||
{
|
||||
toggleEntityMenuButton.OnClicked?.Invoke(toggleEntityMenuButton, toggleEntityMenuButton.UserData);
|
||||
}
|
||||
|
||||
if (PlayerInput.KeyHit(Keys.Tab))
|
||||
{
|
||||
entityFilterBox.Select();
|
||||
}
|
||||
|
||||
if (PlayerInput.KeyDown(Keys.LeftControl))
|
||||
{
|
||||
// Save menu
|
||||
if (PlayerInput.KeyHit(Keys.S))
|
||||
{
|
||||
if (PlayerInput.KeyDown(Keys.LeftShift))
|
||||
{
|
||||
// Save the sub without a menu
|
||||
if (subNameLabel != null)
|
||||
{
|
||||
SaveSubToFile(subNameLabel.Text);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save menu
|
||||
if (saveFrame == null)
|
||||
{
|
||||
CreateSaveScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 1-3 keys on the keyboard for switching modes
|
||||
if (PlayerInput.KeyHit(Keys.D1)) { SetMode(Mode.Default); }
|
||||
if (PlayerInput.KeyHit(Keys.D2)) { SetMode(Mode.Character); }
|
||||
if (PlayerInput.KeyHit(Keys.D3)) { SetMode(Mode.Wiring); }
|
||||
}
|
||||
else
|
||||
{
|
||||
cam.MoveCamera((float) deltaTime, true);
|
||||
}
|
||||
entityFilterBox.Select();
|
||||
}
|
||||
|
||||
|
||||
cam.MoveCamera((float)deltaTime, true);
|
||||
if (PlayerInput.MidButtonHeld())
|
||||
{
|
||||
Vector2 moveSpeed = PlayerInput.MouseSpeed * (float)deltaTime * 100.0f / cam.Zoom;
|
||||
|
||||
Reference in New Issue
Block a user