Build 0.20.4.0
This commit is contained in:
@@ -104,6 +104,7 @@ namespace Barotrauma
|
||||
|
||||
public struct CampaignSettingElements
|
||||
{
|
||||
public SettingValue<bool> TutorialEnabled;
|
||||
public SettingValue<bool> RadiationEnabled;
|
||||
public SettingValue<int> MaxMissionCount;
|
||||
public SettingValue<StartingBalanceAmount> StartingFunds;
|
||||
@@ -114,6 +115,7 @@ namespace Barotrauma
|
||||
{
|
||||
return new CampaignSettings(element: null)
|
||||
{
|
||||
TutorialEnabled = TutorialEnabled.GetValue(),
|
||||
RadiationEnabled = RadiationEnabled.GetValue(),
|
||||
MaxMissionCount = MaxMissionCount.GetValue(),
|
||||
StartingBalanceAmount = StartingFunds.GetValue(),
|
||||
@@ -159,7 +161,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
protected static CampaignSettingElements CreateCampaignSettingList(GUIComponent parent, CampaignSettings prevSettings)
|
||||
protected static CampaignSettingElements CreateCampaignSettingList(GUIComponent parent, CampaignSettings prevSettings, bool isSinglePlayer)
|
||||
{
|
||||
const float verticalSize = 0.14f;
|
||||
|
||||
@@ -180,6 +182,9 @@ namespace Barotrauma
|
||||
Spacing = GUI.IntScale(5)
|
||||
};
|
||||
|
||||
SettingValue<bool> tutorialEnabled = isSinglePlayer ?
|
||||
CreateTickbox(settingsList.Content, TextManager.Get("CampaignOption.EnableTutorial"), TextManager.Get("campaignoption.enabletutorial.tooltip"), prevSettings.TutorialEnabled, verticalSize) :
|
||||
new SettingValue<bool>(() => false, b => { });
|
||||
SettingValue<bool> radiationEnabled = CreateTickbox(settingsList.Content, TextManager.Get("CampaignOption.EnableRadiation"), TextManager.Get("campaignoption.enableradiation.tooltip"), prevSettings.RadiationEnabled, verticalSize);
|
||||
|
||||
ImmutableArray<SettingCarouselElement<Identifier>> startingSetOptions = StartItemSet.Sets.OrderBy(s => s.Order).Select(set => new SettingCarouselElement<Identifier>(set.Identifier, $"startitemset.{set.Identifier}")).ToImmutableArray();
|
||||
@@ -214,6 +219,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (o is CampaignSettings settings)
|
||||
{
|
||||
tutorialEnabled.SetValue(isSinglePlayer && settings.TutorialEnabled);
|
||||
radiationEnabled.SetValue(settings.RadiationEnabled);
|
||||
maxMissionCountInput.SetValue(settings.MaxMissionCount);
|
||||
startingFundsInput.SetValue(settings.StartingBalanceAmount);
|
||||
@@ -226,6 +232,7 @@ namespace Barotrauma
|
||||
|
||||
return new CampaignSettingElements
|
||||
{
|
||||
TutorialEnabled = tutorialEnabled,
|
||||
RadiationEnabled = radiationEnabled,
|
||||
MaxMissionCount = maxMissionCountInput,
|
||||
StartingFunds = startingFundsInput,
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ namespace Barotrauma
|
||||
|
||||
nameSeedLayout.RectTransform.MinSize = new Point(0, nameSeedLayout.Children.Sum(c => c.RectTransform.MinSize.Y));
|
||||
|
||||
CampaignSettingElements elements = CreateCampaignSettingList(campaignSettingLayout, CampaignSettings.Empty);
|
||||
CampaignSettingElements elements = CreateCampaignSettingList(campaignSettingLayout, CampaignSettings.Empty, false);
|
||||
|
||||
var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.1f),
|
||||
verticalLayout.RectTransform) { MaxSize = new Point(int.MaxValue, 60) }, childAnchor: Anchor.BottomRight, isHorizontal: true);
|
||||
|
||||
+5
-4
@@ -370,7 +370,7 @@ namespace Barotrauma
|
||||
GUILayoutGroup campaignSettingContent = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.8f), CampaignCustomizeSettings.Content.RectTransform, Anchor.TopCenter));
|
||||
|
||||
|
||||
CampaignSettingElements elements = CreateCampaignSettingList(campaignSettingContent, prevSettings);
|
||||
CampaignSettingElements elements = CreateCampaignSettingList(campaignSettingContent, prevSettings, true);
|
||||
CampaignCustomizeSettings.Buttons[0].OnClicked += (button, o) =>
|
||||
{
|
||||
|
||||
@@ -608,15 +608,16 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
var saveFolder = SaveUtil.GetSaveFolder(SaveUtil.SaveType.Singleplayer);
|
||||
try
|
||||
{
|
||||
ToolBox.OpenFileWithShell(SaveUtil.SaveFolder);
|
||||
ToolBox.OpenFileWithShell(saveFolder);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
new GUIMessageBox(
|
||||
TextManager.Get("error"),
|
||||
TextManager.GetWithVariables("showinfoldererror", ("[folder]", SaveUtil.SaveFolder), ("[errormessage]", e.Message)));
|
||||
TextManager.Get("error"),
|
||||
TextManager.GetWithVariables("showinfoldererror", ("[folder]", saveFolder), ("[errormessage]", e.Message)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
+13
-7
@@ -39,6 +39,7 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
private bool ShowExtraRagdollControls => editLimbs || editJoints;
|
||||
|
||||
public Character SpawnedCharacter => character;
|
||||
private Character character;
|
||||
private Vector2 spawnPosition;
|
||||
|
||||
@@ -1513,7 +1514,7 @@ namespace Barotrauma.CharacterEditor
|
||||
}
|
||||
}
|
||||
|
||||
private Character SpawnCharacter(Identifier speciesName, RagdollParams ragdoll = null)
|
||||
public Character SpawnCharacter(Identifier speciesName, RagdollParams ragdoll = null)
|
||||
{
|
||||
DebugConsole.NewMessage(GetCharacterEditorTranslation("TryingToSpawnCharacter").Replace("[config]", speciesName.ToString()), Color.HotPink);
|
||||
OnPreSpawn();
|
||||
@@ -3181,10 +3182,7 @@ namespace Barotrauma.CharacterEditor
|
||||
OnClicked = (button, data) =>
|
||||
{
|
||||
ResetView();
|
||||
CharacterParams.Serialize();
|
||||
RagdollParams.Serialize();
|
||||
AnimParams.ForEach(a => a.Serialize());
|
||||
Wizard.Instance.CopyExisting(CharacterParams, RagdollParams, AnimParams);
|
||||
PrepareCharacterCopy();
|
||||
Wizard.Instance.SelectTab(Wizard.Tab.Character);
|
||||
return true;
|
||||
}
|
||||
@@ -3209,9 +3207,17 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
fileEditPanel.RectTransform.MinSize = new Point(0, (int)(layoutGroup.RectTransform.Children.Sum(c => c.MinSize.Y + layoutGroup.AbsoluteSpacing) * 1.2f));
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region ToggleButtons
|
||||
public void PrepareCharacterCopy()
|
||||
{
|
||||
CharacterParams.Serialize();
|
||||
RagdollParams.Serialize();
|
||||
AnimParams.ForEach(a => a.Serialize());
|
||||
Wizard.Instance.CopyExisting(CharacterParams, RagdollParams, AnimParams);
|
||||
}
|
||||
|
||||
#region ToggleButtons
|
||||
private enum Direction
|
||||
{
|
||||
Left,
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Barotrauma.CharacterEditor
|
||||
{
|
||||
bool isSamePackage = contentPackage.GetFiles<CharacterFile>().Any(f => Path.GetFileNameWithoutExtension(f.Path.Value) == name);
|
||||
LocalizedString verificationText = isSamePackage ? GetCharacterEditorTranslation("existingcharacterfoundreplaceverification") : GetCharacterEditorTranslation("existingcharacterfoundoverrideverification");
|
||||
var msgBox = new GUIMessageBox("", verificationText, new LocalizedString[] { TextManager.Get("Yes"), TextManager.Get("No") })
|
||||
var msgBox = new GUIMessageBox("", verificationText, new LocalizedString[] { TextManager.Get("Yes"), TextManager.Get("No") }, type: GUIMessageBox.Type.Warning)
|
||||
{
|
||||
UserData = "verificationprompt"
|
||||
};
|
||||
@@ -356,7 +356,7 @@ namespace Barotrauma.CharacterEditor
|
||||
}
|
||||
if (ContentPackageManager.AllPackages.Any(cp => cp.Name.ToLower() == contentPackageNameElement.Text.ToLower()))
|
||||
{
|
||||
new GUIMessageBox("", TextManager.Get("charactereditor.contentpackagenameinuse", "leveleditorlevelobjnametaken"));
|
||||
new GUIMessageBox("", TextManager.Get("charactereditor.contentpackagenameinuse", "leveleditorlevelobjnametaken"), type: GUIMessageBox.Type.Warning);
|
||||
return false;
|
||||
}
|
||||
string modName = contentPackageNameElement.Text;
|
||||
@@ -428,17 +428,26 @@ namespace Barotrauma.CharacterEditor
|
||||
texturePathElement.Flash(useRectangleFlash: true);
|
||||
return false;
|
||||
}
|
||||
if (Name == CharacterPrefab.HumanSpeciesName && !IsCopy)
|
||||
{
|
||||
// Force a copy when trying to override a human, because handling the crash would be very difficult (we require humans to have certain definitions).
|
||||
if (!CharacterEditorScreen.Instance.SpawnedCharacter.IsHuman)
|
||||
{
|
||||
CharacterEditorScreen.Instance.SpawnCharacter(CharacterPrefab.HumanSpeciesName);
|
||||
}
|
||||
CharacterEditorScreen.Instance.PrepareCharacterCopy();
|
||||
}
|
||||
if (IsCopy)
|
||||
{
|
||||
SourceRagdoll.Texture = evaluatedTexturePath;
|
||||
SourceRagdoll.CanEnterSubmarine = CanEnterSubmarine;
|
||||
SourceRagdoll.CanWalk = CanWalk;
|
||||
SourceRagdoll.Serialize();
|
||||
Wizard.Instance.CreateCharacter(SourceRagdoll.MainElement, SourceCharacter.MainElement, SourceAnimations);
|
||||
Instance.CreateCharacter(SourceRagdoll.MainElement, SourceCharacter.MainElement, SourceAnimations);
|
||||
}
|
||||
else
|
||||
{
|
||||
Wizard.Instance.SelectTab(Tab.Ragdoll);
|
||||
Instance.SelectTab(Tab.Ragdoll);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -470,9 +479,6 @@ namespace Barotrauma.CharacterEditor
|
||||
Stretch = true,
|
||||
RelativeSpacing = 0.02f
|
||||
};
|
||||
// HTML
|
||||
GUIMessageBox htmlBox = null;
|
||||
var loadHtmlButton = new GUIButton(new RectTransform(new Point(content.Rect.Width / 3, elementSize), content.RectTransform), GetCharacterEditorTranslation("LoadFromHTML"));
|
||||
// Limbs
|
||||
var limbsElement = new GUIFrame(new RectTransform(new Vector2(1, 0.05f), content.RectTransform), style: null) { CanBeFocused = false };
|
||||
|
||||
@@ -689,69 +695,6 @@ namespace Barotrauma.CharacterEditor
|
||||
return true;
|
||||
}
|
||||
};
|
||||
loadHtmlButton.OnClicked = (b, d) =>
|
||||
{
|
||||
if (htmlBox == null)
|
||||
{
|
||||
htmlBox = new GUIMessageBox(GetCharacterEditorTranslation("LoadHTML"), string.Empty, new LocalizedString[] { TextManager.Get("Close"), TextManager.Get("Load") }, new Vector2(0.65f, 1f));
|
||||
htmlBox.Header.Font = GUIStyle.LargeFont;
|
||||
var element = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.05f), htmlBox.Content.RectTransform), style: null, color: Color.Gray * 0.25f);
|
||||
//new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform), GetCharacterEditorTranslation("HTMLPath"));
|
||||
var htmlPathElement = new GUITextBox(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.TopRight), GetCharacterEditorTranslation("HTMLPath").Value);
|
||||
LocalizedString title = GetCharacterEditorTranslation("SelectFile");
|
||||
new GUIButton(new RectTransform(new Vector2(0.3f, 1), element.RectTransform), title)
|
||||
{
|
||||
OnClicked = (button, data) =>
|
||||
{
|
||||
FileSelection.OnFileSelected = (file) =>
|
||||
{
|
||||
htmlPathElement.Text = file;
|
||||
};
|
||||
FileSelection.ClearFileTypeFilters();
|
||||
FileSelection.AddFileTypeFilter("HTML", "*.html, *.htm");
|
||||
FileSelection.AddFileTypeFilter("All files", "*.*");
|
||||
FileSelection.SelectFileTypeFilter("*.html, *.htm");
|
||||
FileSelection.Open = true;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
var list = new GUIListBox(new RectTransform(new Vector2(1, 0.8f), htmlBox.Content.RectTransform));
|
||||
var htmlOutput = new GUITextBlock(new RectTransform(Vector2.One, list.Content.RectTransform), string.Empty) { CanBeFocused = false };
|
||||
htmlBox.Buttons[0].OnClicked += (_b, _d) =>
|
||||
{
|
||||
htmlBox.Close();
|
||||
return true;
|
||||
};
|
||||
htmlBox.Buttons[1].OnClicked += (_b, _d) =>
|
||||
{
|
||||
LimbGUIElements.ForEach(l => l.RectTransform.Parent = null);
|
||||
LimbGUIElements.Clear();
|
||||
JointGUIElements.ForEach(j => j.RectTransform.Parent = null);
|
||||
JointGUIElements.Clear();
|
||||
LimbXElements.Clear();
|
||||
JointXElements.Clear();
|
||||
ParseRagdollFromHTML(htmlPathElement.Text, (id, limbName, limbType, rect) =>
|
||||
{
|
||||
CreateLimbGUIElement(limbsList.Content.RectTransform, elementSize, id, limbName, limbType, rect);
|
||||
}, (id1, id2, anchor1, anchor2, jointName) =>
|
||||
{
|
||||
CreateJointGUIElement(jointsList.Content.RectTransform, elementSize, id1, id2, anchor1, anchor2, jointName);
|
||||
});
|
||||
htmlOutput.Text = new XDocument(new XElement("Ragdoll", new object[]
|
||||
{
|
||||
new XAttribute("type", Name), LimbXElements.Values, JointXElements
|
||||
})).ToString();
|
||||
htmlOutput.CalculateHeightFromText();
|
||||
list.UpdateScrollBarSize();
|
||||
return true;
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
GUIMessageBox.MessageBoxes.Add(htmlBox);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
// Previous
|
||||
box.Buttons[0].OnClicked += (b, d) =>
|
||||
{
|
||||
@@ -1070,7 +1013,6 @@ namespace Barotrauma.CharacterEditor
|
||||
// Rectangles
|
||||
colliderAttributes.Add(new XAttribute("height", (int)(height * 0.85f)));
|
||||
colliderAttributes.Add(new XAttribute("width", (int)(width * 0.85f)));
|
||||
idToCodeName.TryGetValue(id, out string notes);
|
||||
LimbXElements.Add(id.ToString(), new XElement("limb",
|
||||
new XAttribute("id", id),
|
||||
new XAttribute("name", limbName),
|
||||
@@ -1107,188 +1049,6 @@ namespace Barotrauma.CharacterEditor
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<int, string> idToCodeName = new Dictionary<int, string>();
|
||||
protected void ParseRagdollFromHTML(string path, Action<int, string, LimbType, Rectangle> limbCallback = null, Action<int, int, Vector2, Vector2, string> jointCallback = null)
|
||||
{
|
||||
// TODO: parse as xml files -> allows to load ragdolls onto the wizard.
|
||||
//XDocument doc = XMLExtensions.TryLoadXml(path);
|
||||
//var xElements = doc.Elements().ToArray();
|
||||
string html = string.Empty;
|
||||
try
|
||||
{
|
||||
html = File.ReadAllText(path);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError(GetCharacterEditorTranslation("FailedToReadHTML").Replace("[path]", path), e);
|
||||
return;
|
||||
}
|
||||
|
||||
var lines = html.Split(new string[] { "<div", "</div>", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Where(s => s.Contains("left") && s.Contains("top") && s.Contains("width") && s.Contains("height"));
|
||||
int id = 0;
|
||||
Dictionary<string, int> hierarchyToID = new Dictionary<string, int>();
|
||||
Dictionary<int, string> idToHierarchy = new Dictionary<int, string>();
|
||||
Dictionary<int, string> idToPositionCode = new Dictionary<int, string>();
|
||||
Dictionary<int, string> idToName = new Dictionary<int, string>();
|
||||
idToCodeName.Clear();
|
||||
foreach (var line in lines)
|
||||
{
|
||||
var codeNames = new string(line.SkipWhile(c => c != '>').Skip(1).ToArray()).Split(',');
|
||||
for (int i = 0; i < codeNames.Length; i++)
|
||||
{
|
||||
string codeName = codeNames[i].Trim();
|
||||
if (string.IsNullOrWhiteSpace(codeName)) { continue; }
|
||||
idToCodeName.Add(id, codeName);
|
||||
string limbName = new string(codeName.SkipWhile(c => c != '_').Skip(1).ToArray());
|
||||
if (string.IsNullOrWhiteSpace(limbName)) { continue; }
|
||||
idToName.Add(id, limbName);
|
||||
var parts = line.Split(' ');
|
||||
int ParseToInt(string selector)
|
||||
{
|
||||
string part = parts.First(p => p.Contains(selector));
|
||||
string s = new string(part.SkipWhile(c => c != ':').Skip(1).TakeWhile(c => char.IsNumber(c)).ToArray());
|
||||
int.TryParse(s, out int v);
|
||||
return v;
|
||||
};
|
||||
// example: 111311cr -> 111311
|
||||
string hierarchy = new string(codeName.TakeWhile(c => char.IsNumber(c)).ToArray());
|
||||
if (hierarchyToID.ContainsKey(hierarchy))
|
||||
{
|
||||
DebugConsole.ThrowError(GetCharacterEditorTranslation("MultipleItemsWithSameHierarchy").Replace("[hierarchy]", hierarchy).Replace("[name]", codeName));
|
||||
return;
|
||||
}
|
||||
hierarchyToID.Add(hierarchy, id);
|
||||
idToHierarchy.Add(id, hierarchy);
|
||||
string positionCode = new string(codeName.SkipWhile(c => char.IsNumber(c)).TakeWhile(c => c != '_').ToArray());
|
||||
idToPositionCode.Add(id, positionCode.ToLowerInvariant());
|
||||
int x = ParseToInt("left");
|
||||
int y = ParseToInt("top");
|
||||
int width = ParseToInt("width");
|
||||
int height = ParseToInt("height");
|
||||
// This is overridden when the data is loaded from the gui fields.
|
||||
LimbXElements.Add(hierarchy, new XElement("limb",
|
||||
new XAttribute("id", id),
|
||||
new XAttribute("name", limbName),
|
||||
new XAttribute("type", ParseLimbType(limbName).ToString()),
|
||||
new XElement("sprite",
|
||||
new XAttribute("texture", ""),
|
||||
new XAttribute("sourcerect", $"{x}, {y}, {width}, {height}"))
|
||||
));
|
||||
limbCallback?.Invoke(id, limbName, ParseLimbType(limbName), new Rectangle(x, y, width, height));
|
||||
id++;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < id; i++)
|
||||
{
|
||||
if (idToHierarchy.TryGetValue(i, out string hierarchy))
|
||||
{
|
||||
if (hierarchy != "0")
|
||||
{
|
||||
// NEW LOGIC: if hierarchy length == 1, parent to 0
|
||||
// Else parent to the last bone in the current hierarchy (11 is parented to 1, 212 is parented to 21 etc)
|
||||
string parent = hierarchy.Length > 1 ? hierarchy.Remove(hierarchy.Length - 1, 1) : "0";
|
||||
if (hierarchyToID.TryGetValue(parent, out int parentID))
|
||||
{
|
||||
Vector2 anchor1 = Vector2.Zero;
|
||||
Vector2 anchor2 = Vector2.Zero;
|
||||
idToName.TryGetValue(parentID, out string parentName);
|
||||
idToName.TryGetValue(i, out string limbName);
|
||||
string jointName = $"{GetCharacterEditorTranslation("Joint")} {parentName} - {limbName}";
|
||||
if (idToPositionCode.TryGetValue(i, out string positionCode))
|
||||
{
|
||||
float scalar = 0.8f;
|
||||
if (LimbXElements.TryGetValue(parent, out XElement parentElement))
|
||||
{
|
||||
Rectangle parentSourceRect = parentElement.Element("sprite").GetAttributeRect("sourcerect", Rectangle.Empty);
|
||||
float parentWidth = parentSourceRect.Width / 2 * scalar;
|
||||
float parentHeight = parentSourceRect.Height / 2 * scalar;
|
||||
switch (positionCode)
|
||||
{
|
||||
case "tl": // -1, 1
|
||||
anchor1 = new Vector2(-parentWidth, parentHeight);
|
||||
break;
|
||||
case "tc": // 0, 1
|
||||
anchor1 = new Vector2(0, parentHeight);
|
||||
break;
|
||||
case "tr": // -1, 1
|
||||
anchor1 = new Vector2(-parentWidth, parentHeight);
|
||||
break;
|
||||
case "cl": // -1, 0
|
||||
anchor1 = new Vector2(-parentWidth, 0);
|
||||
break;
|
||||
case "cr": // 1, 0
|
||||
anchor1 = new Vector2(parentWidth, 0);
|
||||
break;
|
||||
case "bl": // -1, -1
|
||||
anchor1 = new Vector2(-parentWidth, -parentHeight);
|
||||
break;
|
||||
case "bc": // 0, -1
|
||||
anchor1 = new Vector2(0, -parentHeight);
|
||||
break;
|
||||
case "br": // 1, -1
|
||||
anchor1 = new Vector2(parentWidth, -parentHeight);
|
||||
break;
|
||||
}
|
||||
if (LimbXElements.TryGetValue(hierarchy, out XElement element))
|
||||
{
|
||||
Rectangle sourceRect = element.Element("sprite").GetAttributeRect("sourcerect", Rectangle.Empty);
|
||||
float width = sourceRect.Width / 2 * scalar;
|
||||
float height = sourceRect.Height / 2 * scalar;
|
||||
switch (positionCode)
|
||||
{
|
||||
// Inverse
|
||||
case "tl":
|
||||
// br
|
||||
anchor2 = new Vector2(-width, -height);
|
||||
break;
|
||||
case "tc":
|
||||
// bc
|
||||
anchor2 = new Vector2(0, -height);
|
||||
break;
|
||||
case "tr":
|
||||
// bl
|
||||
anchor2 = new Vector2(-width, -height);
|
||||
break;
|
||||
case "cl":
|
||||
// cr
|
||||
anchor2 = new Vector2(width, 0);
|
||||
break;
|
||||
case "cr":
|
||||
// cl
|
||||
anchor2 = new Vector2(-width, 0);
|
||||
break;
|
||||
case "bl":
|
||||
// tr
|
||||
anchor2 = new Vector2(-width, height);
|
||||
break;
|
||||
case "bc":
|
||||
// tc
|
||||
anchor2 = new Vector2(0, height);
|
||||
break;
|
||||
case "br":
|
||||
// tl
|
||||
anchor2 = new Vector2(-width, height);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// This is overridden when the data is loaded from the gui fields.
|
||||
JointXElements.Add(new XElement("joint",
|
||||
new XAttribute("name", jointName),
|
||||
new XAttribute("limb1", parentID),
|
||||
new XAttribute("limb2", i),
|
||||
new XAttribute("limb1anchor", $"{anchor1.X.Format(2)}, {anchor1.Y.Format(2)}"),
|
||||
new XAttribute("limb2anchor", $"{anchor2.X.Format(2)}, {anchor2.Y.Format(2)}")
|
||||
));
|
||||
jointCallback?.Invoke(parentID, i, anchor1, anchor2, jointName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected LimbType ParseLimbType(string limbName)
|
||||
{
|
||||
var limbType = LimbType.None;
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
#if USE_STEAM
|
||||
steamWorkshopButton = new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), customizeList.RectTransform), TextManager.Get("SteamWorkshopButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton")
|
||||
steamWorkshopButton = new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), customizeList.RectTransform), TextManager.Get("settingstab.mods"), textAlignment: Alignment.Left, style: "MainMenuGUIButton")
|
||||
{
|
||||
ForceUpperCase = ForceUpperCase.Yes,
|
||||
Enabled = true,
|
||||
@@ -463,13 +463,17 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
var tutorialPreview = new GUILayoutGroup(new RectTransform(new Vector2(0.6f, 1.0f), tutorialContent.RectTransform)) { RelativeSpacing = 0.05f, Stretch = true };
|
||||
var imageContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.6f), tutorialPreview.RectTransform), style: "InnerFrame");
|
||||
var imageContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.5f), tutorialPreview.RectTransform), style: "InnerFrame");
|
||||
tutorialBanner = new GUIImage(new RectTransform(Vector2.One, imageContainer.RectTransform), style: null, scaleToFit: true);
|
||||
|
||||
var infoContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.4f), tutorialPreview.RectTransform), style: "GUIFrameListBox");
|
||||
var infoContent = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), infoContainer.RectTransform, Anchor.Center), childAnchor: Anchor.TopCenter);
|
||||
var infoContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.5f), tutorialPreview.RectTransform), style: "GUIFrameListBox");
|
||||
var infoContent = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), infoContainer.RectTransform, Anchor.Center), childAnchor: Anchor.TopLeft)
|
||||
{
|
||||
AbsoluteSpacing = GUI.IntScale(10)
|
||||
};
|
||||
|
||||
tutorialHeader = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.75f), infoContent.RectTransform), string.Empty, font: GUIStyle.SubHeadingFont, textAlignment: Alignment.Center);
|
||||
tutorialHeader = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoContent.RectTransform), string.Empty, font: GUIStyle.SubHeadingFont);
|
||||
tutorialDescription = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoContent.RectTransform), string.Empty, wrap: true);
|
||||
|
||||
var startButton = new GUIButton(new RectTransform(new Vector2(0.5f, 0.0f), infoContent.RectTransform, Anchor.BottomRight), text: TextManager.Get("startgamebutton"))
|
||||
{
|
||||
@@ -500,6 +504,10 @@ namespace Barotrauma
|
||||
private void SelectTutorial(Tutorial tutorial)
|
||||
{
|
||||
tutorialHeader.Text = tutorial.DisplayName;
|
||||
tutorialHeader.CalculateHeightFromText();
|
||||
tutorialDescription.Text = tutorial.Description;
|
||||
tutorialDescription.CalculateHeightFromText();
|
||||
(tutorialDescription.Parent as GUILayoutGroup)?.Recalculate();
|
||||
tutorial.TutorialPrefab.Banner?.EnsureLazyLoaded();
|
||||
tutorialBanner.Sprite = tutorial.TutorialPrefab.Banner;
|
||||
tutorialBanner.Color = tutorial.TutorialPrefab.Banner == null ? Color.Black : Color.White;
|
||||
|
||||
@@ -2487,7 +2487,7 @@ namespace Barotrauma
|
||||
{
|
||||
IntValue = MainSub.Info.Tier,
|
||||
MinValueInt = 1,
|
||||
MaxValueInt = 3,
|
||||
MaxValueInt = SubmarineInfo.HighestTier,
|
||||
OnValueChanged = (numberInput) =>
|
||||
{
|
||||
MainSub.Info.Tier = numberInput.IntValue;
|
||||
@@ -2495,7 +2495,7 @@ namespace Barotrauma
|
||||
};
|
||||
if (MainSub?.Info != null)
|
||||
{
|
||||
MainSub.Info.Tier = Math.Clamp(MainSub.Info.Tier, 1, 3);
|
||||
MainSub.Info.Tier = Math.Clamp(MainSub.Info.Tier, 1, SubmarineInfo.HighestTier);
|
||||
}
|
||||
|
||||
var crewSizeArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.25f), subSettingsContainer.RectTransform), isHorizontal: true)
|
||||
@@ -3228,7 +3228,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
string pathWithoutUserName = Path.GetFullPath(sub.FilePath);
|
||||
string saveFolder = Path.GetFullPath(SaveUtil.SaveFolder);
|
||||
string saveFolder = Path.GetFullPath(SaveUtil.DefaultSaveFolder);
|
||||
if (pathWithoutUserName.StartsWith(saveFolder))
|
||||
{
|
||||
pathWithoutUserName = "..." + pathWithoutUserName[saveFolder.Length..];
|
||||
@@ -4217,7 +4217,8 @@ namespace Barotrauma
|
||||
GUIListBox listBox = new GUIListBox(new RectTransform(new Vector2(0.9f, 0.9f), frame.RectTransform, Anchor.Center))
|
||||
{
|
||||
PlaySoundOnSelect = true,
|
||||
OnSelected = SelectWire
|
||||
OnSelected = SelectWire,
|
||||
CanTakeKeyBoardFocus = false
|
||||
};
|
||||
|
||||
List<ItemPrefab> wirePrefabs = new List<ItemPrefab>();
|
||||
@@ -5866,7 +5867,7 @@ namespace Barotrauma
|
||||
decimal realWorldDistance = decimal.Round((decimal) (Vector2.Distance(startPos, mouseWorldPos) * Physics.DisplayToRealWorldRatio), 2);
|
||||
|
||||
Vector2 offset = new Vector2(GUI.IntScale(24));
|
||||
GUI.DrawString(spriteBatch, PlayerInput.MousePosition + offset, $"{realWorldDistance}m", GUIStyle.TextColorNormal, font: GUIStyle.SubHeadingFont, backgroundColor: Color.Black, backgroundPadding: 4);
|
||||
GUI.DrawString(spriteBatch, PlayerInput.MousePosition + offset, $"{realWorldDistance} m", GUIStyle.TextColorNormal, font: GUIStyle.Font, backgroundColor: Color.Black, backgroundPadding: 4);
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
Reference in New Issue
Block a user