(d9829ac) v0.9.4.0
This commit is contained in:
@@ -114,7 +114,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
string savePath = SaveUtil.CreateSavePath(isMultiplayer ? SaveUtil.SaveType.Multiplayer : SaveUtil.SaveType.Singleplayer, saveNameBox.Text);
|
||||
bool hasRequiredContentPackages = selectedSub.RequiredContentPackages.All(cp => GameMain.SelectedPackages.Any(cp2 => cp2.Name == cp));
|
||||
bool hasRequiredContentPackages = selectedSub.RequiredContentPackagesInstalled;
|
||||
|
||||
if (selectedSub.HasTag(SubmarineTag.Shuttle) || !hasRequiredContentPackages)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Barotrauma
|
||||
private GUIComponent selectedLocationInfo;
|
||||
private GUIListBox selectedMissionInfo;
|
||||
|
||||
private GUIButton repairHullsButton, repairItemsButton;
|
||||
private GUIButton repairHullsButton, replaceShuttlesButton, repairItemsButton;
|
||||
|
||||
private GUIFrame characterPreviewFrame;
|
||||
|
||||
@@ -281,6 +281,8 @@ namespace Barotrauma
|
||||
TextGetter = GetMoney
|
||||
};
|
||||
|
||||
// repair hulls -----------------------------------------------
|
||||
|
||||
var repairHullsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), repairContent.RectTransform), childAnchor: Anchor.TopRight)
|
||||
{
|
||||
RelativeSpacing = 0.05f,
|
||||
@@ -295,7 +297,7 @@ namespace Barotrauma
|
||||
{
|
||||
ForceUpperCase = true
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairHullsHolder.RectTransform), "500", textAlignment: Alignment.Right, font: GUI.LargeFont);
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairHullsHolder.RectTransform), CampaignMode.HullRepairCost.ToString(), textAlignment: Alignment.Right, font: GUI.LargeFont);
|
||||
repairHullsButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), repairHullsHolder.RectTransform), TextManager.Get("Repair"), style: "GUIButtonLarge")
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
@@ -324,6 +326,8 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
// repair items -------------------------------------------
|
||||
|
||||
var repairItemsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), repairContent.RectTransform), childAnchor: Anchor.TopRight)
|
||||
{
|
||||
RelativeSpacing = 0.05f,
|
||||
@@ -338,7 +342,7 @@ namespace Barotrauma
|
||||
{
|
||||
ForceUpperCase = true
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairItemsHolder.RectTransform), "500", textAlignment: Alignment.Right, font: GUI.LargeFont);
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairItemsHolder.RectTransform), CampaignMode.ItemRepairCost.ToString(), textAlignment: Alignment.Right, font: GUI.LargeFont);
|
||||
repairItemsButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), repairItemsHolder.RectTransform), TextManager.Get("Repair"), style: "GUIButtonLarge")
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
@@ -367,6 +371,59 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
// replace lost shuttles -------------------------------------------
|
||||
|
||||
var replaceShuttlesHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), repairContent.RectTransform), childAnchor: Anchor.TopRight)
|
||||
{
|
||||
RelativeSpacing = 0.05f,
|
||||
Stretch = true
|
||||
};
|
||||
new GUIImage(new RectTransform(new Vector2(0.3f, 1.0f), replaceShuttlesHolder.RectTransform, Anchor.CenterLeft), "ReplaceShuttlesButton")
|
||||
{
|
||||
IgnoreLayoutGroups = true,
|
||||
CanBeFocused = false
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), replaceShuttlesHolder.RectTransform), TextManager.Get("ReplaceLostShuttles"), textAlignment: Alignment.Right, font: GUI.LargeFont)
|
||||
{
|
||||
ForceUpperCase = true
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), replaceShuttlesHolder.RectTransform), CampaignMode.ShuttleReplaceCost.ToString(), textAlignment: Alignment.Right, font: GUI.LargeFont);
|
||||
replaceShuttlesButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), replaceShuttlesHolder.RectTransform), TextManager.Get("ReplaceShuttles"), style: "GUIButtonLarge")
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (GameMain.GameSession?.Submarine != null &&
|
||||
GameMain.GameSession.Submarine.LeftBehindSubDockingPortOccupied)
|
||||
{
|
||||
new GUIMessageBox("", TextManager.Get("ReplaceShuttleDockingPortOccupied"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (campaign.PurchasedLostShuttles)
|
||||
{
|
||||
campaign.Money += CampaignMode.ShuttleReplaceCost;
|
||||
campaign.PurchasedLostShuttles = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (campaign.Money >= CampaignMode.ShuttleReplaceCost)
|
||||
{
|
||||
campaign.Money -= CampaignMode.ShuttleReplaceCost;
|
||||
campaign.PurchasedLostShuttles = true;
|
||||
}
|
||||
}
|
||||
GameMain.Client?.SendCampaignState();
|
||||
btn.GetChild<GUITickBox>().Selected = campaign.PurchasedLostShuttles;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
new GUITickBox(new RectTransform(new Vector2(0.65f), replaceShuttlesButton.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point(10, 0) }, "")
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
|
||||
// mission info -------------------------------------------------------------------------
|
||||
|
||||
missionPanel = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.5f), container.RectTransform, Anchor.TopRight)
|
||||
@@ -853,6 +910,19 @@ namespace Barotrauma
|
||||
(Campaign.PurchasedItemRepairs || Campaign.Money >= CampaignMode.ItemRepairCost) &&
|
||||
(GameMain.Client == null || GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign));
|
||||
repairItemsButton.GetChild<GUITickBox>().Selected = Campaign.PurchasedItemRepairs;
|
||||
|
||||
if (GameMain.GameSession?.Submarine == null || !GameMain.GameSession.Submarine.SubsLeftBehind)
|
||||
{
|
||||
replaceShuttlesButton.Enabled = false;
|
||||
replaceShuttlesButton.GetChild<GUITickBox>().Selected = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
replaceShuttlesButton.Enabled =
|
||||
(Campaign.PurchasedLostShuttles || Campaign.Money >= CampaignMode.ShuttleReplaceCost) &&
|
||||
(GameMain.Client == null || GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign));
|
||||
replaceShuttlesButton.GetChild<GUITickBox>().Selected = Campaign.PurchasedLostShuttles;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1359
-1791
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -17,6 +17,7 @@ namespace Barotrauma
|
||||
GameMain.Instance.OnResolutionChanged += () => { ClearChildren(); Load(); };
|
||||
|
||||
var doc = XMLExtensions.TryLoadXml(configFile);
|
||||
if (doc == null) { return; }
|
||||
configElement = doc.Root;
|
||||
|
||||
Load();
|
||||
@@ -34,126 +35,17 @@ namespace Barotrauma
|
||||
|
||||
foreach (XElement subElement in configElement.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
{
|
||||
case "text":
|
||||
AddTextElement(subElement, listBox.Content.RectTransform);
|
||||
break;
|
||||
case "gridtext":
|
||||
AddGridTextElement(subElement, listBox.Content.RectTransform);
|
||||
break;
|
||||
case "spacing":
|
||||
AddSpacingElement(subElement, listBox.Content.RectTransform);
|
||||
break;
|
||||
case "image":
|
||||
AddImageElement(subElement, listBox.Content.RectTransform);
|
||||
break;
|
||||
}
|
||||
GUIComponent.FromXML(subElement, listBox.Content.RectTransform);
|
||||
}
|
||||
foreach (GUIComponent child in listBox.Children)
|
||||
{
|
||||
child.CanBeFocused = false;
|
||||
}
|
||||
|
||||
listBox.RecalculateChildren();
|
||||
listBox.UpdateScrollBarSize();
|
||||
}
|
||||
|
||||
private GUIComponent AddTextElement(XElement element, RectTransform parent, string overrideText = null, Anchor anchor = Anchor.Center)
|
||||
{
|
||||
var text = overrideText ?? element.ElementInnerText().Replace(@"\n", "\n");
|
||||
Color color = element.GetAttributeColor("color", Color.White);
|
||||
float scale = element.GetAttributeFloat("scale", 1.0f);
|
||||
Alignment alignment = Alignment.Center;
|
||||
Enum.TryParse(element.GetAttributeString("alignment", "Center"), out alignment);
|
||||
ScalableFont font = GUI.Font;
|
||||
switch (element.GetAttributeString("font", "Font").ToLowerInvariant())
|
||||
{
|
||||
case "font":
|
||||
font = GUI.Font;
|
||||
break;
|
||||
case "smallfont":
|
||||
font = GUI.SmallFont;
|
||||
break;
|
||||
case "largefont":
|
||||
font = GUI.LargeFont;
|
||||
break;
|
||||
case "videotitlefont":
|
||||
font = GUI.VideoTitleFont;
|
||||
break;
|
||||
case "objectivetitlefont":
|
||||
font = GUI.ObjectiveTitleFont;
|
||||
break;
|
||||
case "objectivenamefont":
|
||||
font = GUI.ObjectiveNameFont;
|
||||
break;
|
||||
}
|
||||
|
||||
var textHolder = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.0f), parent), style: null);
|
||||
var textBlock = new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), textHolder.RectTransform, anchor),
|
||||
text,
|
||||
color,
|
||||
font,
|
||||
alignment,
|
||||
wrap: true)
|
||||
{
|
||||
TextScale = scale
|
||||
};
|
||||
textBlock.RectTransform.IsFixedSize = textHolder.RectTransform.IsFixedSize = true;
|
||||
textBlock.RectTransform.NonScaledSize = new Point(textBlock.Rect.Width, textBlock.Rect.Height);
|
||||
textHolder.RectTransform.NonScaledSize = new Point(textHolder.Rect.Width, textBlock.Rect.Height);
|
||||
return textHolder;
|
||||
}
|
||||
|
||||
private void AddGridTextElement(XElement element, RectTransform parent)
|
||||
{
|
||||
var text = element.ElementInnerText().Replace(@"\n", "\n");
|
||||
string[] elements = text.Split(',');
|
||||
RectTransform lineContainer = null;
|
||||
for (int i = 0; i < elements.Length; i++)
|
||||
{
|
||||
switch (i % 3)
|
||||
{
|
||||
case 0:
|
||||
lineContainer = AddTextElement(element, parent, elements[i], Anchor.CenterLeft).RectTransform;
|
||||
lineContainer.Anchor = Anchor.TopCenter;
|
||||
lineContainer.Pivot = Pivot.TopCenter;
|
||||
lineContainer.NonScaledSize = new Point((int)(parent.NonScaledSize.X * 0.7f), lineContainer.NonScaledSize.Y);
|
||||
break;
|
||||
case 1:
|
||||
AddTextElement(element, lineContainer, elements[i], Anchor.Center).GetChild<GUITextBlock>().TextAlignment = Alignment.Center;
|
||||
break;
|
||||
case 2:
|
||||
AddTextElement(element, lineContainer, elements[i], Anchor.CenterRight).GetChild<GUITextBlock>().TextAlignment = Alignment.CenterRight;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddSpacingElement(XElement element, RectTransform parent)
|
||||
{
|
||||
if (element.Attribute("absoluteheight") != null)
|
||||
{
|
||||
int absoluteHeight = element.GetAttributeInt("absoluteheight", 10);
|
||||
var textHolder = new GUIFrame(new RectTransform(new Point(parent.NonScaledSize.X, absoluteHeight), parent), style: null);
|
||||
}
|
||||
else
|
||||
{
|
||||
float relativeHeight = element.GetAttributeFloat("relativeheight", 0.0f);
|
||||
var textHolder = new GUIFrame(new RectTransform(new Vector2(1.0f, relativeHeight), parent), style: null);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddImageElement(XElement element, RectTransform parent)
|
||||
{
|
||||
Sprite sprite = new Sprite(element);
|
||||
|
||||
if (element.Attribute("absoluteheight") != null)
|
||||
{
|
||||
int absoluteHeight = element.GetAttributeInt("absoluteheight", 10);
|
||||
new GUIImage(new RectTransform(new Point(parent.NonScaledSize.X, absoluteHeight), parent), sprite, scaleToFit: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
float relativeHeight = element.GetAttributeFloat("relativeheight", 0.0f);
|
||||
new GUIImage(new RectTransform(new Vector2(1.0f, relativeHeight), parent), sprite, scaleToFit: true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
listBox.BarScroll = 0.0f;
|
||||
|
||||
@@ -501,7 +501,7 @@ namespace Barotrauma
|
||||
foreach (string configFile in GameMain.Instance.GetFilesOfType(ContentType.LevelGenerationParameters))
|
||||
{
|
||||
XDocument doc = XMLExtensions.TryLoadXml(configFile);
|
||||
if (doc == null || doc.Root == null) continue;
|
||||
if (doc == null) { continue; }
|
||||
|
||||
foreach (LevelGenerationParams genParams in LevelGenerationParams.LevelParams)
|
||||
{
|
||||
@@ -523,7 +523,7 @@ namespace Barotrauma
|
||||
foreach (string configFile in GameMain.Instance.GetFilesOfType(ContentType.LevelObjectPrefabs))
|
||||
{
|
||||
XDocument doc = XMLExtensions.TryLoadXml(configFile);
|
||||
if (doc == null || doc.Root == null) continue;
|
||||
if (doc == null) { continue; }
|
||||
|
||||
foreach (LevelObjectPrefab levelObjPrefab in LevelObjectPrefab.List)
|
||||
{
|
||||
@@ -549,7 +549,7 @@ namespace Barotrauma
|
||||
foreach (string configFile in GameMain.Instance.GetFilesOfType(ContentType.LevelGenerationParameters))
|
||||
{
|
||||
XDocument doc = XMLExtensions.TryLoadXml(configFile);
|
||||
if (doc == null || doc.Root == null) continue;
|
||||
if (doc == null) { continue; }
|
||||
|
||||
bool elementFound = false;
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
@@ -664,7 +664,7 @@ namespace Barotrauma
|
||||
foreach (string configFile in GameMain.Instance.GetFilesOfType(ContentType.LevelObjectPrefabs))
|
||||
{
|
||||
XDocument doc = XMLExtensions.TryLoadXml(configFile);
|
||||
if (doc?.Root == null) continue;
|
||||
if (doc == null) { continue; }
|
||||
var newElement = new XElement(newPrefab.Name);
|
||||
newPrefab.Save(newElement);
|
||||
newElement.Add(new XElement("Sprite",
|
||||
|
||||
@@ -4,10 +4,12 @@ using Barotrauma.Tutorials;
|
||||
using Lidgren.Network;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using RestSharp;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
@@ -68,6 +70,16 @@ namespace Barotrauma
|
||||
RelativeSpacing = 0.02f
|
||||
};
|
||||
|
||||
FetchRemoteContent(Frame.RectTransform);
|
||||
/*var doc = XMLExtensions.TryLoadXml("Content/UI/MenuTextTest.xml");
|
||||
if (doc?.Root != null)
|
||||
{
|
||||
foreach (XElement subElement in doc?.Root.Elements())
|
||||
{
|
||||
GUIComponent.FromXML(subElement, Frame.RectTransform);
|
||||
}
|
||||
}*/
|
||||
|
||||
// === CAMPAIGN
|
||||
var campaignHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 1.0f), parent: buttonsParent.RectTransform) { RelativeOffset = new Vector2(0.1f, 0.0f) }, isHorizontal: true);
|
||||
|
||||
@@ -360,6 +372,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = SelectTab
|
||||
};
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -506,7 +519,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
titleText.Visible = true;
|
||||
selectedTab = 0;
|
||||
}
|
||||
|
||||
@@ -575,7 +589,7 @@ namespace Barotrauma
|
||||
//(gamesession.GameMode as SinglePlayerCampaign).GenerateMap(ToolBox.RandomSeed(8));
|
||||
gamesession.StartRound(ToolBox.RandomSeed(8));
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
// TODO: modding support
|
||||
string[] jobIdentifiers = new string[] { "captain", "engineer", "mechanic" };
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
@@ -587,14 +601,14 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
var characterInfo = new CharacterInfo(
|
||||
Character.HumanConfigFile,
|
||||
jobPrefab: JobPrefab.List.Find(j => j.Identifier == jobIdentifiers[i]));
|
||||
Character.HumanSpeciesName,
|
||||
jobPrefab: JobPrefab.Get(jobIdentifiers[i]));
|
||||
if (characterInfo.Job == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Failed to find the job \"" + jobIdentifiers[i] + "\"!");
|
||||
}
|
||||
|
||||
var newCharacter = Character.Create(Character.HumanConfigFile, spawnPoint.WorldPosition, ToolBox.RandomSeed(8), characterInfo);
|
||||
var newCharacter = Character.Create(Character.HumanSpeciesName, spawnPoint.WorldPosition, ToolBox.RandomSeed(8), characterInfo);
|
||||
newCharacter.GiveJobItems(spawnPoint);
|
||||
gamesession.CrewManager.AddCharacter(newCharacter);
|
||||
Character.Controlled = newCharacter;
|
||||
@@ -872,7 +886,7 @@ namespace Barotrauma
|
||||
GUI.DrawLine(spriteBatch, textPos, textPos - Vector2.UnitX * textSize.X, mouseOn ? Color.White : Color.White * 0.7f);
|
||||
if (mouseOn && PlayerInput.LeftButtonClicked())
|
||||
{
|
||||
Process.Start("http://privacypolicy.daedalic.com");
|
||||
GameMain.Instance.ShowOpenUrlInWebBrowserPrompt("http://privacypolicy.daedalic.com");
|
||||
}
|
||||
}
|
||||
textPos.Y -= textSize.Y;
|
||||
@@ -955,7 +969,7 @@ namespace Barotrauma
|
||||
if (File.Exists(ServerSettings.SettingsFile))
|
||||
{
|
||||
XDocument settingsDoc = XMLExtensions.TryLoadXml(ServerSettings.SettingsFile);
|
||||
if (settingsDoc?.Root != null)
|
||||
if (settingsDoc != null)
|
||||
{
|
||||
port = settingsDoc.Root.GetAttributeInt("port", port);
|
||||
queryPort = settingsDoc.Root.GetAttributeInt("queryport", queryPort);
|
||||
@@ -1050,7 +1064,47 @@ namespace Barotrauma
|
||||
OnClicked = HostServerClicked
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private void FetchRemoteContent(RectTransform parent)
|
||||
{
|
||||
if (string.IsNullOrEmpty(GameMain.Config.RemoteContentUrl)) { return; }
|
||||
try
|
||||
{
|
||||
var client = new RestClient(GameMain.Config.RemoteContentUrl);
|
||||
var request = new RestRequest("MenuContent.xml", Method.GET);
|
||||
|
||||
IRestResponse response = client.Execute(request);
|
||||
if (response.ResponseStatus != ResponseStatus.Completed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (response.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string xml = response.Content;
|
||||
int index = xml.IndexOf('<');
|
||||
if (index > 0) { xml = xml.Substring(index, xml.Length - index); }
|
||||
if (string.IsNullOrWhiteSpace(xml)) { return; }
|
||||
|
||||
XElement element = XDocument.Parse(xml)?.Root;
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
GUIComponent.FromXML(subElement, parent);
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
#if DEBUG
|
||||
DebugConsole.ThrowError("Fetching remote content to the main menu failed.", e);
|
||||
#endif
|
||||
GameAnalyticsManager.AddErrorEventOnce("MainMenuScreen.FetchRemoteContent:Exception", GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
|
||||
"Fetching remote content to the main menu failed. " + e.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,11 +449,7 @@ namespace Barotrauma
|
||||
{
|
||||
UserData = mode
|
||||
};
|
||||
//TODO: translate mission descriptions
|
||||
if (TextManager.Language == "English")
|
||||
{
|
||||
textBlock.ToolTip = mode.Description;
|
||||
}
|
||||
textBlock.ToolTip = mode.Description;
|
||||
}
|
||||
|
||||
//mission type ------------------------------------------------------------------
|
||||
@@ -731,7 +727,7 @@ namespace Barotrauma
|
||||
ReadyToStartBox.Selected = false;
|
||||
if (campaignUI != null)
|
||||
{
|
||||
//SelectTab(Tab.Map);
|
||||
campaignUI.SelectTab(CampaignUI.Tab.Map);
|
||||
if (campaignUI.StartButton != null)
|
||||
{
|
||||
campaignUI.StartButton.Visible = !GameMain.Client.GameStarted &&
|
||||
@@ -909,7 +905,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (characterInfo == null)
|
||||
{
|
||||
characterInfo = new CharacterInfo(Character.HumanConfigFile, GameMain.NetworkMember.Name, null);
|
||||
characterInfo = new CharacterInfo(Character.HumanSpeciesName, GameMain.Client.Name, null);
|
||||
characterInfo.RecreateHead(
|
||||
GameMain.Config.CharacterHeadIndex,
|
||||
GameMain.Config.CharacterRace,
|
||||
@@ -930,7 +926,7 @@ namespace Barotrauma
|
||||
UserData = characterInfo
|
||||
};
|
||||
|
||||
CharacterNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.1f), infoContainer.RectTransform), characterInfo.Name, font: GUI.LargeFont, textAlignment: Alignment.Center)
|
||||
CharacterNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.1f), infoContainer.RectTransform), characterInfo.Name, textAlignment: Alignment.Center)
|
||||
{
|
||||
MaxTextLength = Client.MaxNameLength,
|
||||
OverflowClip = true
|
||||
@@ -947,7 +943,7 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
ReadyToStartBox.Selected = false;
|
||||
GameMain.Client.Name = tb.Text;
|
||||
GameMain.Client.SetName(tb.Text);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1011,7 +1007,7 @@ namespace Barotrauma
|
||||
int i = 1;
|
||||
foreach (string jobIdentifier in GameMain.Config.JobPreferences)
|
||||
{
|
||||
JobPrefab job = JobPrefab.List.Find(j => j.Identifier == jobIdentifier);
|
||||
if (!JobPrefab.List.TryGetValue(jobIdentifier, out JobPrefab job)) { continue; }
|
||||
if (job == null || job.MaxNumber <= 0) continue;
|
||||
|
||||
var jobFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.2f), jobList.Content.RectTransform) { MinSize = new Point(0, 20) }, style: "ListBoxElement")
|
||||
@@ -1247,6 +1243,12 @@ namespace Barotrauma
|
||||
};
|
||||
}
|
||||
|
||||
if (!sub.RequiredContentPackagesInstalled)
|
||||
{
|
||||
subTextBlock.TextColor = Color.Lerp(subTextBlock.TextColor, Color.DarkRed, 0.5f);
|
||||
frame.ToolTip = TextManager.Get("ContentPackageMismatch") + "\n\n" + frame.ToolTip;
|
||||
}
|
||||
|
||||
if (sub.HasTag(SubmarineTag.Shuttle))
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), frame.RectTransform, Anchor.CenterRight) { RelativeOffset = new Vector2(0.1f, 0.0f) },
|
||||
@@ -1270,14 +1272,32 @@ namespace Barotrauma
|
||||
|
||||
public bool VotableClicked(GUIComponent component, object userData)
|
||||
{
|
||||
if (GameMain.Client == null) return false;
|
||||
if (GameMain.Client == null) { return false; }
|
||||
|
||||
VoteType voteType;
|
||||
if (component.Parent == GameMain.NetLobbyScreen.SubList.Content)
|
||||
{
|
||||
if (!GameMain.Client.ServerSettings.Voting.AllowSubVoting)
|
||||
{
|
||||
if (GameMain.Client.HasPermission(ClientPermissions.SelectSub))
|
||||
var selectedSub = component.UserData as Submarine;
|
||||
if (!selectedSub.RequiredContentPackagesInstalled)
|
||||
{
|
||||
var msgBox = new GUIMessageBox(TextManager.Get("ContentPackageMismatch"),
|
||||
selectedSub.RequiredContentPackages.Any() ?
|
||||
TextManager.GetWithVariable("ContentPackageMismatchWarning", "[requiredcontentpackages]", string.Join(", ", selectedSub.RequiredContentPackages)) :
|
||||
TextManager.Get("ContentPackageMismatchWarningGeneric"),
|
||||
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||
|
||||
msgBox.Buttons[0].OnClicked = msgBox.Close;
|
||||
msgBox.Buttons[0].OnClicked += (button, obj) =>
|
||||
{
|
||||
GameMain.Client.RequestSelectSub(component.Parent.GetChildIndex(component), isShuttle: false);
|
||||
return true;
|
||||
};
|
||||
msgBox.Buttons[1].OnClicked = msgBox.Close;
|
||||
return false;
|
||||
}
|
||||
else if (GameMain.Client.HasPermission(ClientPermissions.SelectSub))
|
||||
{
|
||||
GameMain.Client.RequestSelectSub(component.Parent.GetChildIndex(component), isShuttle: false);
|
||||
return true;
|
||||
@@ -1714,16 +1734,6 @@ namespace Barotrauma
|
||||
jobInfoFrame?.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public List<Submarine> GetSubList()
|
||||
{
|
||||
List<Submarine> subs = new List<Submarine>();
|
||||
foreach (GUIComponent component in subList.Content.Children)
|
||||
{
|
||||
if (component.UserData is Submarine) subs.Add((Submarine)component.UserData);
|
||||
}
|
||||
|
||||
return subs;
|
||||
}
|
||||
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
@@ -2057,7 +2067,7 @@ namespace Barotrauma
|
||||
.UserData as Submarine;
|
||||
|
||||
//matching sub found and already selected, all good
|
||||
if (sub != null && subList.SelectedData is Submarine selectedSub && selectedSub.MD5Hash?.Hash == md5Hash)
|
||||
if (sub != null && subList.SelectedData is Submarine selectedSub && selectedSub.MD5Hash?.Hash == md5Hash && System.IO.File.Exists(sub.FilePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -2090,12 +2100,12 @@ namespace Barotrauma
|
||||
FailedSelectedShuttle = null;
|
||||
|
||||
//hashes match, all good
|
||||
if (sub.MD5Hash?.Hash == md5Hash)
|
||||
if (sub.MD5Hash?.Hash == md5Hash && Submarine.SavedSubmarines.Contains(sub))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
//if we get to this point, a matching sub was not found or it has an incorrect MD5 hash
|
||||
|
||||
@@ -2105,14 +2115,15 @@ namespace Barotrauma
|
||||
FailedSelectedShuttle = new Pair<string, string>(subName, md5Hash);
|
||||
|
||||
string errorMsg = "";
|
||||
if (sub == null)
|
||||
if (sub == null || !Submarine.SavedSubmarines.Contains(sub))
|
||||
{
|
||||
errorMsg = TextManager.GetWithVariable("SubNotFoundError", "[subname]", subName) + " ";
|
||||
}
|
||||
else if (sub.MD5Hash?.Hash == null)
|
||||
{
|
||||
errorMsg = TextManager.GetWithVariable("SubLoadError", "[subname]", subName) + " ";
|
||||
subList.Content.GetChildByUserData(sub).GetChild<GUITextBox>().TextColor = Color.Red;
|
||||
GUITextBlock textBlock = subList.Content.GetChildByUserData(sub)?.GetChild<GUITextBlock>();
|
||||
if (textBlock != null) { textBlock.TextColor = Color.Red; }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace Barotrauma
|
||||
foreach (string configFile in GameMain.Instance.GetFilesOfType(ContentType.Particles))
|
||||
{
|
||||
XDocument doc = XMLExtensions.TryLoadXml(configFile);
|
||||
if (doc == null || doc.Root == null) continue;
|
||||
if (doc == null) { continue; }
|
||||
|
||||
var prefabList = GameMain.ParticleManager.GetPrefabList();
|
||||
foreach (ParticlePrefab prefab in prefabList)
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Barotrauma
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), clientNameHolder.RectTransform), TextManager.Get("YourName"));
|
||||
clientNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.5f), clientNameHolder.RectTransform), "")
|
||||
{
|
||||
Text = GameMain.Config.DefaultPlayerName,
|
||||
Text = GameMain.Config.PlayerName,
|
||||
MaxTextLength = Client.MaxNameLength,
|
||||
OverflowClip = true
|
||||
};
|
||||
@@ -822,11 +822,20 @@ namespace Barotrauma
|
||||
|
||||
private void ServerQueryFinished()
|
||||
{
|
||||
if (serverList.Content.Children.All(c => !c.Visible))
|
||||
if (!serverList.Content.Children.Any())
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
|
||||
TextManager.Get("NoMatchingServers"))
|
||||
new GUITextBlock(new RectTransform(Vector2.One, serverList.Content.RectTransform),
|
||||
TextManager.Get("NoServers"), textAlignment: Alignment.Center)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
}
|
||||
else if (serverList.Content.Children.All(c => !c.Visible))
|
||||
{
|
||||
new GUITextBlock(new RectTransform(Vector2.One, serverList.Content.RectTransform),
|
||||
TextManager.Get("NoMatchingServers"), textAlignment: Alignment.Center)
|
||||
{
|
||||
CanBeFocused = false,
|
||||
UserData = "noresults"
|
||||
};
|
||||
}
|
||||
@@ -918,7 +927,7 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
GameMain.Config.DefaultPlayerName = clientNameBox.Text;
|
||||
GameMain.Config.PlayerName = clientNameBox.Text;
|
||||
GameMain.Config.SaveNewPlayerConfig();
|
||||
|
||||
CoroutineManager.StartCoroutine(ConnectToServer(ip, serverName));
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace Barotrauma
|
||||
if (file.Path.EndsWith(".xml"))
|
||||
{
|
||||
XDocument doc = XMLExtensions.TryLoadXml(file.Path);
|
||||
if (doc != null && doc.Root != null)
|
||||
if (doc != null)
|
||||
{
|
||||
LoadSprites(doc.Root);
|
||||
}
|
||||
|
||||
@@ -164,8 +164,7 @@ namespace Barotrauma
|
||||
if (userdata is Facepunch.Steamworks.Workshop.Item item)
|
||||
{
|
||||
if (!item.Installed) { return false; }
|
||||
CreateWorkshopItem(item);
|
||||
ShowCreateItemFrame();
|
||||
if (CreateWorkshopItem(item)) { ShowCreateItemFrame(); }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -310,7 +309,7 @@ namespace Barotrauma
|
||||
CreateMyItemFrame(contentPackage, myItemList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnItemsReceived(IList<Facepunch.Steamworks.Workshop.Item> itemDetails, GUIListBox listBox)
|
||||
{
|
||||
listBox.ClearChildren();
|
||||
@@ -525,6 +524,9 @@ namespace Barotrauma
|
||||
OnClicked = DownloadItem
|
||||
};
|
||||
}
|
||||
|
||||
innerFrame.Recalculate();
|
||||
listBox.RecalculateChildren();
|
||||
}
|
||||
|
||||
private void RemoveItemFromLists(ulong itemID)
|
||||
@@ -651,6 +653,9 @@ namespace Barotrauma
|
||||
{
|
||||
if (!(tickBox.UserData is Facepunch.Steamworks.Workshop.Item item)) { return false; }
|
||||
|
||||
//currently editing the item, don't allow enabling/disabling it
|
||||
if (itemEditor?.Id == item.Id) { tickBox.Selected = true; return false; }
|
||||
|
||||
var updateButton = tickBox.Parent.FindChild("updatebutton");
|
||||
|
||||
string errorMsg = "";
|
||||
@@ -724,23 +729,30 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
|
||||
var headerArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), content.RectTransform)) { Color = Color.Black };
|
||||
var centerArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), content.RectTransform), isHorizontal: true)
|
||||
{
|
||||
Stretch = true,
|
||||
RelativeSpacing = 0.01f,
|
||||
Color = Color.Black * 0.9f
|
||||
};
|
||||
|
||||
if (itemPreviewSprites.ContainsKey(item.PreviewImageUrl))
|
||||
{
|
||||
new GUIImage(new RectTransform(Vector2.One, headerArea.RectTransform), itemPreviewSprites[item.PreviewImageUrl], scaleToFit: true);
|
||||
new GUIImage(new RectTransform(new Vector2(0.5f, 1.0f), centerArea.RectTransform), itemPreviewSprites[item.PreviewImageUrl], scaleToFit: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
new GUIImage(new RectTransform(Vector2.One, headerArea.RectTransform), SteamManager.Instance.DefaultPreviewImage, scaleToFit: true);
|
||||
new GUIImage(new RectTransform(new Vector2(0.5f, 0.0f), centerArea.RectTransform), SteamManager.Instance.DefaultPreviewImage, scaleToFit: true);
|
||||
}
|
||||
|
||||
var descriptionContainer = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.2f), content.RectTransform)) { ScrollBarVisible = true };
|
||||
var descriptionContainer = new GUIListBox(new RectTransform(new Vector2(0.5f, 1.0f), centerArea.RectTransform)) { ScrollBarVisible = true };
|
||||
|
||||
//spacing
|
||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.0f), descriptionContainer.Content.RectTransform) { MinSize = new Point(0, 5) }, style: null);
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), descriptionContainer.Content.RectTransform), TextManager.EnsureUTF8(item.Description), wrap: true)
|
||||
string description = TextManager.EnsureUTF8(item.Description);
|
||||
description = ToolBox.RemoveBBCodeTags(description);
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), descriptionContainer.Content.RectTransform), description, wrap: true)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
@@ -799,12 +811,24 @@ namespace Barotrauma
|
||||
|
||||
var modificationDate = new GUITextBlock(new RectTransform(new Vector2(0.7f, 0.0f), content.RectTransform), TextManager.Get("WorkshopItemModificationDate"));
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), modificationDate.RectTransform, Anchor.CenterRight), item.Modified.ToString("dd.MM.yyyy"), textAlignment: Alignment.TopRight);
|
||||
}
|
||||
|
||||
/*private void CreateWorkshopItem()
|
||||
{
|
||||
SteamManager.CreateWorkshopItemStaging("ModName", out itemEditor, out itemContentPackage);
|
||||
}*/
|
||||
if (item.Subscribed)
|
||||
{
|
||||
var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.05f), content.RectTransform) { MinSize = new Point(0, 25) }, isHorizontal: true);
|
||||
new GUIButton(new RectTransform(new Vector2(0.5f, 0.95f), buttonContainer.RectTransform), TextManager.Get("WorkshopItemUnsubscribe"))
|
||||
{
|
||||
UserData = item,
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
item.UnSubscribe();
|
||||
subscribedItemList.RemoveChild(subscribedItemList.Content.GetChildByUserData(item));
|
||||
itemPreviewFrame.ClearChildren();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateWorkshopItem(Submarine sub)
|
||||
{
|
||||
string destinationFolder = Path.Combine("Mods", sub.Name);
|
||||
@@ -826,7 +850,7 @@ namespace Barotrauma
|
||||
itemContentPackage.Name = sub.Name;
|
||||
itemContentPackage.Save(itemContentPackage.Path);
|
||||
ContentPackage.List.Add(itemContentPackage);
|
||||
GameMain.Config.SelectedContentPackages.Add(itemContentPackage);
|
||||
GameMain.Config.SelectContentPackage(itemContentPackage);
|
||||
|
||||
itemEditor.Title = sub.Name;
|
||||
itemEditor.Tags.Add("Submarine");
|
||||
@@ -886,15 +910,21 @@ namespace Barotrauma
|
||||
}*/
|
||||
|
||||
}
|
||||
private void CreateWorkshopItem(Facepunch.Steamworks.Workshop.Item item)
|
||||
private bool CreateWorkshopItem(Facepunch.Steamworks.Workshop.Item item)
|
||||
{
|
||||
if (!item.Installed)
|
||||
{
|
||||
new GUIMessageBox(TextManager.Get("Error"),
|
||||
new GUIMessageBox(TextManager.Get("Error"),
|
||||
TextManager.GetWithVariable("WorkshopErrorInstallRequiredToEdit", "[itemname]", TextManager.EnsureUTF8(item.Title)));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
SteamManager.CreateWorkshopItemStaging(item, out itemEditor, out itemContentPackage);
|
||||
if (!SteamManager.CreateWorkshopItemStaging(item, out itemEditor, out itemContentPackage))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var tickBox = publishedItemList.Content.GetChildByUserData(item)?.GetAnyChild<GUITickBox>();
|
||||
if (tickBox != null) { tickBox.Selected = true; }
|
||||
return true;
|
||||
}
|
||||
|
||||
private void ShowCreateItemFrame()
|
||||
@@ -1256,6 +1286,14 @@ namespace Barotrauma
|
||||
createItemFileList.Flash(Color.Red);
|
||||
}
|
||||
|
||||
if (!itemContentPackage.CheckValidity(out List<string> errorMessages))
|
||||
{
|
||||
new GUIMessageBox(
|
||||
TextManager.GetWithVariable("workshopitempublishfailed", "[itemname]", itemEditor.Title),
|
||||
string.Join("\n", errorMessages));
|
||||
return false;
|
||||
}
|
||||
|
||||
PublishWorkshopItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -242,16 +242,16 @@ namespace Barotrauma
|
||||
//empty guiframe as a separator
|
||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), paddedLeftPanel.RectTransform) { AbsoluteOffset = new Point(0, TopPanel.Rect.Height) }, style: null);
|
||||
|
||||
var itemCountText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedLeftPanel.RectTransform), TextManager.Get("Items"));
|
||||
var itemCount = new GUITextBlock(new RectTransform(Vector2.One, itemCountText.RectTransform), "", textAlignment: Alignment.TopRight);
|
||||
var itemCountText = new GUITextBlock(new RectTransform(new Vector2(0.75f, 0.0f), paddedLeftPanel.RectTransform), TextManager.Get("Items"));
|
||||
var itemCount = new GUITextBlock(new RectTransform(new Vector2(0.33f, 1.0f), itemCountText.RectTransform, Anchor.TopRight, Pivot.TopLeft), "", textAlignment: Alignment.TopRight);
|
||||
itemCount.TextGetter = () =>
|
||||
{
|
||||
itemCount.TextColor = ToolBox.GradientLerp(Item.ItemList.Count / 5000.0f, Color.LightGreen, Color.Yellow, Color.Red);
|
||||
return Item.ItemList.Count.ToString();
|
||||
};
|
||||
|
||||
var structureCountText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedLeftPanel.RectTransform), TextManager.Get("Structures"));
|
||||
var structureCount = new GUITextBlock(new RectTransform(Vector2.One, structureCountText.RectTransform), "", textAlignment: Alignment.TopRight);
|
||||
var structureCountText = new GUITextBlock(new RectTransform(new Vector2(0.75f, 0.0f), paddedLeftPanel.RectTransform), TextManager.Get("Structures"));
|
||||
var structureCount = new GUITextBlock(new RectTransform(new Vector2(0.33f, 1.0f), structureCountText.RectTransform, Anchor.TopRight, Pivot.TopLeft), "", textAlignment: Alignment.TopRight);
|
||||
structureCount.TextGetter = () =>
|
||||
{
|
||||
int count = (MapEntity.mapEntityList.Count - Item.ItemList.Count - Hull.hullList.Count - WayPoint.WayPointList.Count - Gap.GapList.Count);
|
||||
@@ -259,13 +259,43 @@ namespace Barotrauma
|
||||
return count.ToString();
|
||||
};
|
||||
|
||||
var wallCountText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedLeftPanel.RectTransform), TextManager.Get("Walls"));
|
||||
var wallCount = new GUITextBlock(new RectTransform(Vector2.One, wallCountText.RectTransform), "", textAlignment: Alignment.TopRight);
|
||||
var wallCountText = new GUITextBlock(new RectTransform(new Vector2(0.75f, 0.0f), paddedLeftPanel.RectTransform), TextManager.Get("Walls"));
|
||||
var wallCount = new GUITextBlock(new RectTransform(new Vector2(0.33f, 1.0f), wallCountText.RectTransform, Anchor.TopRight, Pivot.TopLeft), "", textAlignment: Alignment.TopRight);
|
||||
wallCount.TextGetter = () =>
|
||||
{
|
||||
wallCount.TextColor = ToolBox.GradientLerp(Structure.WallList.Count / 500.0f, Color.LightGreen, Color.Yellow, Color.Red);
|
||||
return Structure.WallList.Count.ToString();
|
||||
};
|
||||
|
||||
var lightCountText = new GUITextBlock(new RectTransform(new Vector2(0.75f, 0.0f), paddedLeftPanel.RectTransform), TextManager.Get("SubEditorLights"));
|
||||
var lightCount = new GUITextBlock(new RectTransform(new Vector2(0.33f, 1.0f), lightCountText.RectTransform, Anchor.TopRight, Pivot.TopLeft), "", textAlignment: Alignment.TopRight);
|
||||
lightCount.TextGetter = () =>
|
||||
{
|
||||
int disabledItemLightCount = 0;
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
if (item.ParentInventory == null) { continue; }
|
||||
disabledItemLightCount += item.GetComponents<LightComponent>().Count();
|
||||
}
|
||||
int count = GameMain.LightManager.Lights.Count() - disabledItemLightCount;
|
||||
lightCount.TextColor = ToolBox.GradientLerp(count / 250.0f, Color.LightGreen, Color.Yellow, Color.Red);
|
||||
return count.ToString();
|
||||
};
|
||||
var shadowCastingLightCountText = new GUITextBlock(new RectTransform(new Vector2(0.75f, 0.0f), paddedLeftPanel.RectTransform), TextManager.Get("SubEditorShadowCastingLights"));
|
||||
var shadowCastingLightCount = new GUITextBlock(new RectTransform(new Vector2(0.33f, 1.0f), shadowCastingLightCountText.RectTransform, Anchor.TopRight, Pivot.TopLeft), "", textAlignment: Alignment.TopRight);
|
||||
shadowCastingLightCount.TextGetter = () =>
|
||||
{
|
||||
int disabledItemLightCount = 0;
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
if (item.ParentInventory == null) { continue; }
|
||||
disabledItemLightCount += item.GetComponents<LightComponent>().Count();
|
||||
}
|
||||
int count = GameMain.LightManager.Lights.Count(l => l.CastShadows) - disabledItemLightCount;
|
||||
shadowCastingLightCount.TextColor = ToolBox.GradientLerp(count / 60.0f, Color.LightGreen, Color.Yellow, Color.Red);
|
||||
return count.ToString();
|
||||
};
|
||||
GUITextBlock.AutoScaleAndNormalize(paddedLeftPanel.Children.Where(c => c is GUITextBlock).Cast<GUITextBlock>());
|
||||
|
||||
hullVolumeFrame = new GUIFrame(new RectTransform(new Vector2(0.15f, 2.0f), TopPanel.RectTransform, Anchor.BottomLeft, Pivot.TopLeft, minSize: new Point(300, 85)) { AbsoluteOffset = new Point(LeftPanel.Rect.Width, 0) }, "GUIToolTip")
|
||||
{
|
||||
@@ -855,7 +885,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (dummyCharacter != null) RemoveDummyCharacter();
|
||||
|
||||
dummyCharacter = Character.Create(Character.HumanConfigFile, Vector2.Zero, "", hasAi: false);
|
||||
dummyCharacter = Character.Create(Character.HumanSpeciesName, Vector2.Zero, "", hasAi: false);
|
||||
|
||||
//make space for the entity menu
|
||||
for (int i = 0; i < dummyCharacter.Inventory.SlotPositions.Length; i++)
|
||||
@@ -1037,8 +1067,6 @@ namespace Barotrauma
|
||||
ChangeSubDescription(textBox, text);
|
||||
return true;
|
||||
};
|
||||
descriptionBox.Text = Submarine.MainSub == null ? "" : Submarine.MainSub.Description;
|
||||
submarineDescriptionCharacterCount.Text = descriptionBox.Text.Length + " / " + submarineDescriptionLimit;
|
||||
|
||||
var crewSizeArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.03f), leftColumn.RectTransform), isHorizontal: true) { AbsoluteSpacing = 5 };
|
||||
|
||||
@@ -1256,7 +1284,10 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = SaveSub
|
||||
};
|
||||
|
||||
paddedSaveFrame.Recalculate();
|
||||
leftColumn.Recalculate();
|
||||
descriptionBox.Text = Submarine.MainSub == null ? "" : Submarine.MainSub.Description;
|
||||
submarineDescriptionCharacterCount.Text = descriptionBox.Text.Length + " / " + submarineDescriptionLimit;
|
||||
}
|
||||
|
||||
|
||||
@@ -2258,7 +2289,7 @@ namespace Barotrauma
|
||||
me.IsHighlighted = false;
|
||||
}
|
||||
|
||||
if (WiringMode && dummyCharacter.SelectedConstruction==null)
|
||||
if (WiringMode && dummyCharacter.SelectedConstruction == null)
|
||||
{
|
||||
List<Wire> wires = new List<Wire>();
|
||||
foreach (Item item in Item.ItemList)
|
||||
@@ -2269,8 +2300,29 @@ namespace Barotrauma
|
||||
Wire.UpdateEditing(wires);
|
||||
}
|
||||
|
||||
if (dummyCharacter.SelectedConstruction==null || dummyCharacter.SelectedConstruction.GetComponent<Pickable>() != null)
|
||||
if (dummyCharacter.SelectedConstruction == null ||
|
||||
dummyCharacter.SelectedConstruction.GetComponent<Pickable>() != null)
|
||||
{
|
||||
if (WiringMode && (PlayerInput.KeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift) || PlayerInput.KeyDown(Microsoft.Xna.Framework.Input.Keys.Right)))
|
||||
{
|
||||
Wire equippedWire =
|
||||
Character.Controlled?.SelectedItems[0]?.GetComponent<Wire>() ??
|
||||
Character.Controlled?.SelectedItems[1]?.GetComponent<Wire>();
|
||||
if (equippedWire != null && equippedWire.GetNodes().Count > 0)
|
||||
{
|
||||
Vector2 lastNode = equippedWire.GetNodes().Last();
|
||||
if (equippedWire.Item.Submarine != null)
|
||||
{
|
||||
lastNode += equippedWire.Item.Submarine.HiddenSubPosition + equippedWire.Item.Submarine.Position;
|
||||
}
|
||||
|
||||
dummyCharacter.CursorPosition =
|
||||
Math.Abs(dummyCharacter.CursorPosition.X - lastNode.X) < Math.Abs(dummyCharacter.CursorPosition.Y - lastNode.Y) ?
|
||||
new Vector2(lastNode.X, dummyCharacter.CursorPosition.Y) :
|
||||
dummyCharacter.CursorPosition = new Vector2(dummyCharacter.CursorPosition.X, lastNode.Y);
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 mouseSimPos = FarseerPhysics.ConvertUnits.ToSimUnits(dummyCharacter.CursorPosition);
|
||||
foreach (Limb limb in dummyCharacter.AnimController.Limbs)
|
||||
{
|
||||
@@ -2403,10 +2455,13 @@ namespace Barotrauma
|
||||
Submarine.DrawBack(spriteBatch, editing: true);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, transformMatrix: cam.Transform);
|
||||
Submarine.DrawDamageable(spriteBatch, null, editing: true);
|
||||
spriteBatch.End();
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, transformMatrix: cam.Transform);
|
||||
Submarine.DrawFront(spriteBatch, editing: true);
|
||||
|
||||
if (!CharacterMode && !WiringMode && GUI.MouseOn == null)
|
||||
{
|
||||
MapEntityPrefab.Selected?.DrawPlacing(spriteBatch, cam);
|
||||
|
||||
Reference in New Issue
Block a user