Unstable 0.17.1.0
This commit is contained in:
+11
@@ -278,6 +278,17 @@ namespace Barotrauma
|
||||
characterInfos.Add((new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: jobPrefab, variant: variant), jobPrefab));
|
||||
}
|
||||
}
|
||||
if (characterInfos.Count == 0)
|
||||
{
|
||||
DebugConsole.ThrowError($"No starting crew found! If you're using mods, it may be that the mods have overridden the vanilla jobs without specifying which types of characters the starting crew should consist of. If you're the developer of the mod, ensure that you've set the {nameof(JobPrefab.InitialCount)} properties for the custom jobs.");
|
||||
DebugConsole.AddWarning("Choosing the first available jobs as the starting crew...");
|
||||
foreach (JobPrefab jobPrefab in JobPrefab.Prefabs)
|
||||
{
|
||||
var variant = Rand.Range(0, jobPrefab.Variants);
|
||||
characterInfos.Add((new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: jobPrefab, variant: variant), jobPrefab));
|
||||
if (characterInfos.Count >= 3) { break; }
|
||||
}
|
||||
}
|
||||
characterInfos.Sort((a, b) => Math.Sign(b.Job.MinKarma - a.Job.MinKarma));
|
||||
|
||||
characterInfoColumns.ClearChildren();
|
||||
|
||||
@@ -143,14 +143,13 @@ namespace Barotrauma
|
||||
{
|
||||
if (Campaign.PurchasedHullRepairs)
|
||||
{
|
||||
Campaign.Money += CampaignMode.HullRepairCost;
|
||||
Campaign.Wallet.Refund(CampaignMode.HullRepairCost);
|
||||
Campaign.PurchasedHullRepairs = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Campaign.Money >= CampaignMode.HullRepairCost)
|
||||
if (Campaign.Wallet.TryDeduct(CampaignMode.HullRepairCost))
|
||||
{
|
||||
Campaign.Money -= CampaignMode.HullRepairCost;
|
||||
GameAnalyticsManager.AddMoneySpentEvent(CampaignMode.HullRepairCost, GameAnalyticsManager.MoneySink.Service, "hullrepairs");
|
||||
Campaign.PurchasedHullRepairs = true;
|
||||
}
|
||||
@@ -189,14 +188,13 @@ namespace Barotrauma
|
||||
{
|
||||
if (Campaign.PurchasedItemRepairs)
|
||||
{
|
||||
Campaign.Money += CampaignMode.ItemRepairCost;
|
||||
Campaign.Wallet.Refund(CampaignMode.ItemRepairCost);
|
||||
Campaign.PurchasedItemRepairs = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Campaign.Money >= CampaignMode.ItemRepairCost)
|
||||
if (Campaign.Wallet.TryDeduct(CampaignMode.ItemRepairCost))
|
||||
{
|
||||
Campaign.Money -= CampaignMode.ItemRepairCost;
|
||||
GameAnalyticsManager.AddMoneySpentEvent(CampaignMode.ItemRepairCost, GameAnalyticsManager.MoneySink.Service, "devicerepairs");
|
||||
Campaign.PurchasedItemRepairs = true;
|
||||
}
|
||||
@@ -242,14 +240,13 @@ namespace Barotrauma
|
||||
|
||||
if (Campaign.PurchasedLostShuttles)
|
||||
{
|
||||
Campaign.Money += CampaignMode.ShuttleReplaceCost;
|
||||
Campaign.Wallet.Refund(CampaignMode.ShuttleReplaceCost);
|
||||
Campaign.PurchasedLostShuttles = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Campaign.Money >= CampaignMode.ShuttleReplaceCost)
|
||||
if (Campaign.Wallet.TryDeduct(CampaignMode.ShuttleReplaceCost))
|
||||
{
|
||||
Campaign.Money -= CampaignMode.ShuttleReplaceCost;
|
||||
GameAnalyticsManager.AddMoneySpentEvent(CampaignMode.ShuttleReplaceCost, GameAnalyticsManager.MoneySink.Service, "retrieveshuttle");
|
||||
Campaign.PurchasedLostShuttles = true;
|
||||
}
|
||||
@@ -445,7 +442,7 @@ namespace Barotrauma
|
||||
{
|
||||
Color = MapGenerationParams.Instance.IndicatorColor,
|
||||
HoverColor = Color.Lerp(MapGenerationParams.Instance.IndicatorColor, Color.White, 0.5f),
|
||||
ToolTip = TextManager.Get(connection.LevelData.IsBeaconActive ? "BeaconStationActiveTooltip" : "BeaconStationInactiveTooltip")
|
||||
ToolTip = RichString.Rich(TextManager.Get(connection.LevelData.IsBeaconActive ? "BeaconStationActiveTooltip" : "BeaconStationInactiveTooltip"))
|
||||
};
|
||||
new GUITextBlock(new RectTransform(Vector2.One, beaconStationContent.RectTransform),
|
||||
TextManager.Get("submarinetype.beaconstation", "beaconstationsonarlabel"), font: GUIStyle.SubHeadingFont, textAlignment: Alignment.CenterLeft)
|
||||
@@ -462,7 +459,7 @@ namespace Barotrauma
|
||||
{
|
||||
Color = MapGenerationParams.Instance.IndicatorColor,
|
||||
HoverColor = Color.Lerp(MapGenerationParams.Instance.IndicatorColor, Color.White, 0.5f),
|
||||
ToolTip = TextManager.Get("HuntingGroundsTooltip")
|
||||
ToolTip = RichString.Rich(TextManager.Get("HuntingGroundsTooltip"))
|
||||
};
|
||||
new GUITextBlock(new RectTransform(Vector2.One, huntingGroundsContent.RectTransform),
|
||||
TextManager.Get("missionname.huntinggrounds"), font: GUIStyle.SubHeadingFont, textAlignment: Alignment.CenterLeft)
|
||||
@@ -705,11 +702,11 @@ namespace Barotrauma
|
||||
{
|
||||
case CampaignMode.InteractionType.Repair:
|
||||
repairHullsButton.Enabled =
|
||||
(Campaign.PurchasedHullRepairs || Campaign.Money >= CampaignMode.HullRepairCost) &&
|
||||
(Campaign.PurchasedHullRepairs || Campaign.Wallet.CanAfford(CampaignMode.HullRepairCost)) &&
|
||||
Campaign.AllowedToManageCampaign();
|
||||
repairHullsButton.GetChild<GUITickBox>().Selected = Campaign.PurchasedHullRepairs;
|
||||
repairItemsButton.Enabled =
|
||||
(Campaign.PurchasedItemRepairs || Campaign.Money >= CampaignMode.ItemRepairCost) &&
|
||||
(Campaign.PurchasedItemRepairs || Campaign.Wallet.CanAfford(CampaignMode.ItemRepairCost)) &&
|
||||
Campaign.AllowedToManageCampaign();
|
||||
repairItemsButton.GetChild<GUITickBox>().Selected = Campaign.PurchasedItemRepairs;
|
||||
|
||||
@@ -721,7 +718,7 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
replaceShuttlesButton.Enabled =
|
||||
(Campaign.PurchasedLostShuttles || Campaign.Money >= CampaignMode.ShuttleReplaceCost) &&
|
||||
(Campaign.PurchasedLostShuttles || Campaign.Wallet.CanAfford(CampaignMode.ShuttleReplaceCost)) &&
|
||||
Campaign.AllowedToManageCampaign();
|
||||
replaceShuttlesButton.GetChild<GUITickBox>().Selected = Campaign.PurchasedLostShuttles;
|
||||
}
|
||||
@@ -742,7 +739,7 @@ namespace Barotrauma
|
||||
|
||||
public static LocalizedString GetMoney()
|
||||
{
|
||||
return TextManager.GetWithVariable("PlayerCredits", "[credits]", (GameMain.GameSession?.Campaign == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", GameMain.GameSession.Campaign.Money));
|
||||
return TextManager.GetWithVariable("PlayerCredits", "[credits]", (GameMain.GameSession?.Campaign == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", GameMain.GameSession.Campaign.Wallet.Balance));
|
||||
}
|
||||
|
||||
private void UpdateMaxMissions(Location location)
|
||||
|
||||
+4
-10
@@ -1668,11 +1668,7 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
if (contentPackage == null)
|
||||
{
|
||||
#if DEBUG
|
||||
contentPackage = ContentPackageManager.EnabledPackages.All.LastOrDefault();
|
||||
#else
|
||||
contentPackage = ContentPackageManager.EnabledPackages.All.LastOrDefault(cp => cp != vanilla);
|
||||
#endif
|
||||
}
|
||||
if (contentPackage == null)
|
||||
{
|
||||
@@ -1680,13 +1676,11 @@ namespace Barotrauma.CharacterEditor
|
||||
DebugConsole.ThrowError(GetCharacterEditorTranslation("NoContentPackageSelected"));
|
||||
return false;
|
||||
}
|
||||
#if !DEBUG
|
||||
if (vanilla != null && contentPackage == vanilla)
|
||||
{
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("CannotEditVanillaCharacters"), GUIStyle.Red, font: GUIStyle.LargeFont);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
// Content package
|
||||
if (contentPackage is RegularPackage regular && !ContentPackageManager.EnabledPackages.Regular.Contains(regular))
|
||||
{
|
||||
@@ -1721,9 +1715,9 @@ namespace Barotrauma.CharacterEditor
|
||||
}
|
||||
else
|
||||
{
|
||||
config.SetAttributeValue("speciesname", name);
|
||||
config.SetAttributeValue("humanoid", isHumanoid);
|
||||
var ragdollElement = config.Element("ragdolls");
|
||||
config.SetAttributeValue("speciesname", name, StringComparison.OrdinalIgnoreCase);
|
||||
config.SetAttributeValue("humanoid", isHumanoid, StringComparison.OrdinalIgnoreCase);
|
||||
var ragdollElement = config.GetChildElement("ragdolls");
|
||||
if (ragdollElement == null)
|
||||
{
|
||||
config.Add(new XElement("ragdolls", CreateRagdollPath()));
|
||||
@@ -1736,7 +1730,7 @@ namespace Barotrauma.CharacterEditor
|
||||
ragdollElement.ReplaceWith(new XElement("ragdolls", CreateRagdollPath()));
|
||||
}
|
||||
}
|
||||
var animationElement = config.Element("animations");
|
||||
var animationElement = config.GetChildElement("animations");
|
||||
if (animationElement == null)
|
||||
{
|
||||
config.Add(new XElement("animations", CreateAnimationPath()));
|
||||
|
||||
@@ -160,8 +160,7 @@ namespace Barotrauma.CharacterEditor
|
||||
bool isTextureSelected = false;
|
||||
void UpdatePaths()
|
||||
{
|
||||
string pathBase = ContentPackage == GameMain.VanillaContent ? $"Content/Characters/{Name}/{Name}"
|
||||
: $"{ContentPath.ModDirStr}/Characters/{Name}/{Name}";
|
||||
string pathBase = $"{ContentPath.ModDirStr}/Characters/{Name}/{Name}";
|
||||
XMLPath = $"{pathBase}.xml";
|
||||
xmlPathElement.Text = XMLPath;
|
||||
if (updateTexturePath)
|
||||
@@ -307,10 +306,10 @@ namespace Barotrauma.CharacterEditor
|
||||
contentPackageDropDown = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.5f), rightContainer.RectTransform, Anchor.TopRight));
|
||||
foreach (ContentPackage contentPackage in ContentPackageManager.EnabledPackages.All)
|
||||
{
|
||||
#if !DEBUG
|
||||
if (contentPackage == GameMain.VanillaContent) { continue; }
|
||||
#endif
|
||||
contentPackageDropDown.AddItem(contentPackage.Name, userData: contentPackage, toolTip: contentPackage.Path);
|
||||
if (contentPackage != GameMain.VanillaContent)
|
||||
{
|
||||
contentPackageDropDown.AddItem(contentPackage.Name, userData: contentPackage, toolTip: contentPackage.Path);
|
||||
}
|
||||
}
|
||||
contentPackageDropDown.OnSelected = (obj, userdata) =>
|
||||
{
|
||||
|
||||
@@ -1329,6 +1329,11 @@ namespace Barotrauma
|
||||
}
|
||||
SeedBox.Enabled = !CampaignFrame.Visible && !CampaignSetupFrame.Visible && GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
levelDifficultyScrollBar.Enabled = !CampaignFrame.Visible && !CampaignSetupFrame.Visible && GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
levelDifficultyScrollBar.ToolTip = string.Empty;
|
||||
if (!levelDifficultyScrollBar.Enabled)
|
||||
{
|
||||
levelDifficultyScrollBar.ToolTip = TextManager.Get("campaigndifficultydisabled");
|
||||
}
|
||||
|
||||
traitorProbabilityButtons[0].Enabled = traitorProbabilityButtons[1].Enabled = traitorProbabilityText.Enabled =
|
||||
!CampaignFrame.Visible && !CampaignSetupFrame.Visible && GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
|
||||
@@ -32,7 +32,10 @@ namespace Barotrauma
|
||||
private GUIScrollBar zoomBar;
|
||||
private readonly List<Sprite> selectedSprites = new List<Sprite>();
|
||||
private readonly List<Sprite> dirtySprites = new List<Sprite>();
|
||||
private Sprite selectedTexture;
|
||||
private Texture2D SelectedTexture => lastSprite?.Texture;
|
||||
private Sprite lastSprite;
|
||||
private string selectedTexturePath;
|
||||
|
||||
private Rectangle textureRect;
|
||||
private float zoom = 1;
|
||||
private const float MinZoom = 0.25f, MaxZoom = 10.0f;
|
||||
@@ -82,12 +85,11 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (button, userData) =>
|
||||
{
|
||||
if (!(textureList.SelectedData is Texture2D selectedTexture)) { return false; }
|
||||
var selected = selectedSprites;
|
||||
Sprite firstSelected = selected.First();
|
||||
selected.ForEach(s => s.ReloadTexture());
|
||||
RefreshLists();
|
||||
textureList.Select(firstSelected.Texture, autoScroll: false);
|
||||
textureList.Select(firstSelected.FullPath, autoScroll: false);
|
||||
selected.ForEachMod(s => spriteList.Select(s, autoScroll: false));
|
||||
texturePathText.Text = TextManager.GetWithVariable("spriteeditor.texturesreloaded", "[filepath]", firstSelected.FilePath.Value);
|
||||
texturePathText.TextColor = GUIStyle.Green;
|
||||
@@ -101,10 +103,10 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (button, userData) =>
|
||||
{
|
||||
if (selectedTexture == null) { return false; }
|
||||
if (SelectedTexture == null) { return false; }
|
||||
foreach (Sprite sprite in loadedSprites)
|
||||
{
|
||||
if (sprite.FullPath != selectedTexture.FullPath) { continue; }
|
||||
if (sprite.FullPath != selectedTexturePath) { continue; }
|
||||
var element = sprite.SourceElement;
|
||||
if (element == null) { continue; }
|
||||
// Not all sprites have a sourcerect defined, in which case we'll want to use the current source rect instead of an empty rect.
|
||||
@@ -206,23 +208,20 @@ namespace Barotrauma
|
||||
{
|
||||
OnSelected = (listBox, userData) =>
|
||||
{
|
||||
var previousSprite = selectedTexture;
|
||||
selectedTexture = userData as Sprite;
|
||||
if (previousSprite != selectedTexture)
|
||||
var newTexturePath = userData as string;
|
||||
if (selectedTexturePath == null || selectedTexturePath != newTexturePath)
|
||||
{
|
||||
selectedTexturePath = newTexturePath;
|
||||
ResetZoom();
|
||||
spriteList.Select(loadedSprites.First(s => s.FilePath == selectedTexturePath), autoScroll: false);
|
||||
UpdateScrollBar(spriteList);
|
||||
}
|
||||
foreach (GUIComponent child in spriteList.Content.Children)
|
||||
{
|
||||
var textBlock = (GUITextBlock)child;
|
||||
var sprite = (Sprite)textBlock.UserData;
|
||||
textBlock.TextColor = new Color(textBlock.TextColor, sprite.FilePath == selectedTexture.FilePath ? 1.0f : 0.4f);
|
||||
if (sprite.FilePath == selectedTexture.FilePath) { textBlock.Visible = true; }
|
||||
}
|
||||
if (selectedSprites.None(s => s.FilePath == selectedTexture.FilePath))
|
||||
{
|
||||
spriteList.Select(loadedSprites.First(s => s.FilePath == selectedTexture.FilePath), autoScroll: false);
|
||||
UpdateScrollBar(spriteList);
|
||||
textBlock.TextColor = new Color(textBlock.TextColor, sprite.FilePath == selectedTexturePath ? 1.0f : 0.4f);
|
||||
if (sprite.FilePath == selectedTexturePath) { textBlock.Visible = true; }
|
||||
}
|
||||
texturePathText.TextColor = Color.LightGray;
|
||||
topPanelContents.Visible = true;
|
||||
@@ -251,9 +250,12 @@ namespace Barotrauma
|
||||
{
|
||||
OnSelected = (listBox, userData) =>
|
||||
{
|
||||
if (!(userData is Sprite sprite)) return false;
|
||||
SelectSprite(sprite);
|
||||
return true;
|
||||
if (userData is Sprite sprite)
|
||||
{
|
||||
SelectSprite(sprite);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -410,12 +412,12 @@ namespace Barotrauma
|
||||
|
||||
private bool SaveSprites(IEnumerable<Sprite> sprites)
|
||||
{
|
||||
if (selectedTexture == null) { return false; }
|
||||
if (SelectedTexture == null) { return false; }
|
||||
if (sprites.None()) { return false; }
|
||||
HashSet<XDocument> docsToSave = new HashSet<XDocument>();
|
||||
foreach (Sprite sprite in sprites)
|
||||
{
|
||||
if (sprite.FullPath != selectedTexture.FullPath) { continue; }
|
||||
if (sprite.FullPath != selectedTexturePath) { continue; }
|
||||
var element = sprite.SourceElement;
|
||||
if (element == null) { continue; }
|
||||
element.SetAttributeValue("sourcerect", XMLExtensions.RectToString(sprite.SourceRect));
|
||||
@@ -469,11 +471,11 @@ namespace Barotrauma
|
||||
// Select rects with the mouse
|
||||
if (Widget.selectedWidgets.None() || Widget.EnableMultiSelect)
|
||||
{
|
||||
if (selectedTexture != null && GUI.MouseOn == null)
|
||||
if (SelectedTexture != null && GUI.MouseOn == null)
|
||||
{
|
||||
foreach (Sprite sprite in loadedSprites)
|
||||
{
|
||||
if (sprite.FullPath != selectedTexture.FullPath) { continue; }
|
||||
if (sprite.FullPath != selectedTexturePath) { continue; }
|
||||
if (PlayerInput.PrimaryMouseButtonClicked())
|
||||
{
|
||||
var scaledRect = new Rectangle(textureRect.Location + sprite.SourceRect.Location.Multiply(zoom), sprite.SourceRect.Size.Multiply(zoom));
|
||||
@@ -637,20 +639,20 @@ namespace Barotrauma
|
||||
|
||||
var viewArea = GetViewArea;
|
||||
|
||||
if (selectedTexture != null)
|
||||
if (SelectedTexture != null)
|
||||
{
|
||||
textureRect = new Rectangle(
|
||||
(int)(viewArea.Center.X - selectedTexture.Texture.Bounds.Width / 2f * zoom),
|
||||
(int)(viewArea.Center.Y - selectedTexture.Texture.Bounds.Height / 2f * zoom),
|
||||
(int)(selectedTexture.Texture.Bounds.Width * zoom),
|
||||
(int)(selectedTexture.Texture.Bounds.Height * zoom));
|
||||
(int)(viewArea.Center.X - SelectedTexture.Bounds.Width / 2f * zoom),
|
||||
(int)(viewArea.Center.Y - SelectedTexture.Bounds.Height / 2f * zoom),
|
||||
(int)(SelectedTexture.Bounds.Width * zoom),
|
||||
(int)(SelectedTexture.Bounds.Height * zoom));
|
||||
|
||||
spriteBatch.Draw(selectedTexture.Texture,
|
||||
spriteBatch.Draw(SelectedTexture,
|
||||
viewArea.Center.ToVector2(),
|
||||
sourceRectangle: null,
|
||||
color: Color.White,
|
||||
rotation: 0.0f,
|
||||
origin: new Vector2(selectedTexture.Texture.Bounds.Width / 2.0f, selectedTexture.Texture.Bounds.Height / 2.0f),
|
||||
origin: new Vector2(SelectedTexture.Bounds.Width / 2.0f, SelectedTexture.Bounds.Height / 2.0f),
|
||||
scale: zoom,
|
||||
effects: SpriteEffects.None,
|
||||
layerDepth: 0);
|
||||
@@ -666,7 +668,7 @@ namespace Barotrauma
|
||||
foreach (GUIComponent element in spriteList.Content.Children)
|
||||
{
|
||||
if (!(element.UserData is Sprite sprite)) { continue; }
|
||||
if (sprite.FullPath != selectedTexture.FullPath) { continue; }
|
||||
if (sprite.FullPath != selectedTexturePath) { continue; }
|
||||
|
||||
Rectangle sourceRect = new Rectangle(
|
||||
textureRect.X + (int)(sprite.SourceRect.X * zoom),
|
||||
@@ -874,13 +876,13 @@ namespace Barotrauma
|
||||
|
||||
public void SelectSprite(Sprite sprite)
|
||||
{
|
||||
lastSprite = sprite;
|
||||
if (!loadedSprites.Contains(sprite))
|
||||
{
|
||||
loadedSprites.Add(sprite);
|
||||
RefreshLists();
|
||||
}
|
||||
|
||||
if (selectedSprites.Any(s => s.FullPath != selectedTexture.FullPath))
|
||||
if (selectedSprites.Any(s => s.FullPath != selectedTexturePath))
|
||||
{
|
||||
ResetWidgets();
|
||||
}
|
||||
@@ -902,9 +904,9 @@ namespace Barotrauma
|
||||
selectedSprites.Add(sprite);
|
||||
dirtySprites.Add(sprite);
|
||||
}
|
||||
if (selectedTexture?.FullPath != sprite.FullPath)
|
||||
if (sprite.FullPath != selectedTexturePath)
|
||||
{
|
||||
textureList.Select(sprite.Texture, autoScroll: false);
|
||||
textureList.Select(sprite.FullPath, autoScroll: false);
|
||||
UpdateScrollBar(textureList);
|
||||
}
|
||||
xmlPathText.Text = string.Empty;
|
||||
@@ -926,7 +928,6 @@ namespace Barotrauma
|
||||
|
||||
public void RefreshLists()
|
||||
{
|
||||
//selectedTexture = null;
|
||||
selectedSprites.Clear();
|
||||
textureList.ClearChildren();
|
||||
spriteList.ClearChildren();
|
||||
@@ -936,7 +937,7 @@ namespace Barotrauma
|
||||
foreach (Sprite sprite in loadedSprites.OrderBy(s => Path.GetFileNameWithoutExtension(s.FilePath.Value)))
|
||||
{
|
||||
//ignore sprites that don't have a file path (e.g. submarine pics)
|
||||
if (sprite.FilePath.IsNullOrEmpty()) continue;
|
||||
if (sprite.FilePath.IsNullOrEmpty()) { continue; }
|
||||
string normalizedFilePath = sprite.FilePath.FullPath;
|
||||
if (!textures.Contains(normalizedFilePath))
|
||||
{
|
||||
@@ -944,7 +945,7 @@ namespace Barotrauma
|
||||
Path.GetFileName(sprite.FilePath.Value))
|
||||
{
|
||||
ToolTip = sprite.FilePath.Value,
|
||||
UserData = sprite
|
||||
UserData = sprite.FullPath
|
||||
};
|
||||
textures.Add(normalizedFilePath);
|
||||
}
|
||||
@@ -965,10 +966,10 @@ namespace Barotrauma
|
||||
|
||||
public void ResetZoom()
|
||||
{
|
||||
if (selectedTexture == null) { return; }
|
||||
if (SelectedTexture == null) { return; }
|
||||
var viewArea = GetViewArea;
|
||||
float width = viewArea.Width / (float)selectedTexture.Texture.Width;
|
||||
float height = viewArea.Height / (float)selectedTexture.Texture.Height;
|
||||
float width = viewArea.Width / (float)SelectedTexture.Width;
|
||||
float height = viewArea.Height / (float)SelectedTexture.Height;
|
||||
zoom = Math.Min(1, Math.Min(width, height));
|
||||
zoomBar.BarScroll = GetBarScrollValue();
|
||||
viewAreaOffset = Point.Zero;
|
||||
|
||||
@@ -5,12 +5,10 @@ using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using System.Threading.Tasks;
|
||||
#if DEBUG
|
||||
using System.IO;
|
||||
#else
|
||||
@@ -21,6 +19,12 @@ namespace Barotrauma
|
||||
{
|
||||
class SubEditorScreen : EditorScreen
|
||||
{
|
||||
public const int MaxStructures = 2000;
|
||||
public const int MaxWalls = 500;
|
||||
public const int MaxItems = 5000;
|
||||
public const int MaxLights = 300;
|
||||
public const int MaxShadowCastingLights = 60;
|
||||
|
||||
private static Submarine MainSub
|
||||
{
|
||||
get => Submarine.MainSub;
|
||||
@@ -83,7 +87,11 @@ namespace Barotrauma
|
||||
NoCargoSpawnpoints,
|
||||
NoBallastTag,
|
||||
NonLinkedGaps,
|
||||
TooManyLights
|
||||
StructureCount,
|
||||
WallCount,
|
||||
ItemCount,
|
||||
LightCount,
|
||||
ShadowCastingLightCount
|
||||
}
|
||||
|
||||
public static Vector2 MouseDragStart = Vector2.Zero;
|
||||
@@ -102,7 +110,7 @@ namespace Barotrauma
|
||||
private bool wasSelectedBefore;
|
||||
|
||||
public GUIComponent TopPanel;
|
||||
private GUIComponent showEntitiesPanel, entityCountPanel;
|
||||
public GUIComponent showEntitiesPanel, entityCountPanel;
|
||||
private readonly List<GUITickBox> showEntitiesTickBoxes = new List<GUITickBox>();
|
||||
private readonly Dictionary<string, bool> hiddenSubCategories = new Dictionary<string, bool>();
|
||||
|
||||
@@ -809,7 +817,7 @@ namespace Barotrauma
|
||||
var itemCount = new GUITextBlock(new RectTransform(new Vector2(0.33f, 1.0f), itemCountText.RectTransform, Anchor.TopRight, Pivot.TopLeft), "", textAlignment: Alignment.CenterRight);
|
||||
itemCount.TextGetter = () =>
|
||||
{
|
||||
itemCount.TextColor = ToolBox.GradientLerp(Item.ItemList.Count / 5000.0f, GUIStyle.Green, GUIStyle.Orange, GUIStyle.Red);
|
||||
itemCount.TextColor = Item.ItemList.Count > MaxItems ? GUIStyle.Red : Color.Lerp(GUIStyle.Green, GUIStyle.Orange, Item.ItemList.Count / (float)MaxItems);
|
||||
return Item.ItemList.Count.ToString();
|
||||
};
|
||||
|
||||
@@ -818,8 +826,8 @@ namespace Barotrauma
|
||||
var structureCount = new GUITextBlock(new RectTransform(new Vector2(0.33f, 1.0f), structureCountText.RectTransform, Anchor.TopRight, Pivot.TopLeft), "", textAlignment: Alignment.CenterRight);
|
||||
structureCount.TextGetter = () =>
|
||||
{
|
||||
int count = (MapEntity.mapEntityList.Count - Item.ItemList.Count - Hull.HullList.Count - WayPoint.WayPointList.Count - Gap.GapList.Count);
|
||||
structureCount.TextColor = ToolBox.GradientLerp(count / 1000.0f, GUIStyle.Green, GUIStyle.Orange, GUIStyle.Red);
|
||||
int count = MapEntity.mapEntityList.Count - Item.ItemList.Count - Hull.HullList.Count - WayPoint.WayPointList.Count - Gap.GapList.Count;
|
||||
structureCount.TextColor = count > MaxStructures ? GUIStyle.Red : Color.Lerp(GUIStyle.Green, GUIStyle.Orange, count / (float)MaxStructures);
|
||||
return count.ToString();
|
||||
};
|
||||
|
||||
@@ -828,7 +836,7 @@ namespace Barotrauma
|
||||
var wallCount = new GUITextBlock(new RectTransform(new Vector2(0.33f, 1.0f), wallCountText.RectTransform, Anchor.TopRight, Pivot.TopLeft), "", textAlignment: Alignment.CenterRight);
|
||||
wallCount.TextGetter = () =>
|
||||
{
|
||||
wallCount.TextColor = ToolBox.GradientLerp(Structure.WallList.Count / 500.0f, GUIStyle.Green, GUIStyle.Orange, GUIStyle.Red);
|
||||
wallCount.TextColor = Structure.WallList.Count > MaxWalls ? GUIStyle.Red : Color.Lerp(GUIStyle.Green, GUIStyle.Orange, Structure.WallList.Count / (float)MaxWalls);
|
||||
return Structure.WallList.Count.ToString();
|
||||
};
|
||||
|
||||
@@ -843,7 +851,7 @@ namespace Barotrauma
|
||||
if (item.ParentInventory != null) { continue; }
|
||||
lightCount += item.GetComponents<LightComponent>().Count();
|
||||
}
|
||||
lightCountText.TextColor = ToolBox.GradientLerp(lightCount / 250.0f, GUIStyle.Green, GUIStyle.Orange, GUIStyle.Red);
|
||||
lightCountText.TextColor = lightCount > MaxLights ? GUIStyle.Red : Color.Lerp(GUIStyle.Green, GUIStyle.Orange, lightCount / (float)MaxLights);
|
||||
return lightCount.ToString();
|
||||
};
|
||||
var shadowCastingLightCountLabel = new GUITextBlock(new RectTransform(new Vector2(0.75f, 0.0f), paddedEntityCountPanel.RectTransform), TextManager.Get("SubEditorShadowCastingLights"),
|
||||
@@ -857,7 +865,7 @@ namespace Barotrauma
|
||||
if (item.ParentInventory != null) { continue; }
|
||||
lightCount += item.GetComponents<LightComponent>().Count(l => l.CastShadows);
|
||||
}
|
||||
shadowCastingLightCountText.TextColor = ToolBox.GradientLerp(lightCount / 60.0f, GUIStyle.Green, GUIStyle.Orange, GUIStyle.Red);
|
||||
shadowCastingLightCountText.TextColor = lightCount > MaxShadowCastingLights ? GUIStyle.Red : Color.Lerp(GUIStyle.Green, GUIStyle.Orange, lightCount / (float)MaxShadowCastingLights);
|
||||
return lightCount.ToString();
|
||||
};
|
||||
entityCountPanel.RectTransform.NonScaledSize =
|
||||
@@ -1448,7 +1456,7 @@ namespace Barotrauma
|
||||
case ".jpeg":
|
||||
if (saveFrame == null) { break; }
|
||||
|
||||
Texture2D texture = Sprite.LoadTexture(filePath);
|
||||
Texture2D texture = Sprite.LoadTexture(filePath, compress: false);
|
||||
previewImage.Sprite = new Sprite(texture, null, null);
|
||||
if (MainSub != null)
|
||||
{
|
||||
@@ -1548,7 +1556,7 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (GUIColorPicker colorPicker in msgBox.GetAllChildren<GUIColorPicker>())
|
||||
{
|
||||
colorPicker.DisposeTextures();
|
||||
colorPicker.Dispose();
|
||||
}
|
||||
|
||||
msgBox.Close();
|
||||
@@ -1827,6 +1835,21 @@ namespace Barotrauma
|
||||
modProject.Save(packagePath);
|
||||
}
|
||||
|
||||
if (!GameMain.DebugDraw)
|
||||
{
|
||||
if (Submarine.GetLightCount() > MaxLights)
|
||||
{
|
||||
new GUIMessageBox(TextManager.Get("error"), TextManager.GetWithVariable("subeditor.lightcounterror", "[max]", MaxShadowCastingLights.ToString()));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Submarine.GetShadowCastingLightCount() > MaxShadowCastingLights)
|
||||
{
|
||||
new GUIMessageBox(TextManager.Get("error"), TextManager.GetWithVariable("subeditor.shadowcastinglightcounterror", "[max]", MaxShadowCastingLights.ToString()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("SubNameMissingWarning"), GUIStyle.Red);
|
||||
@@ -3634,7 +3657,7 @@ namespace Barotrauma
|
||||
|
||||
closeButton.OnClicked = (button, o) =>
|
||||
{
|
||||
colorPicker.DisposeTextures();
|
||||
colorPicker.Dispose();
|
||||
msgBox.Close();
|
||||
|
||||
Color newColor = SetColor(null);
|
||||
@@ -3678,7 +3701,7 @@ namespace Barotrauma
|
||||
|
||||
cancelButton.OnClicked = (button, o) =>
|
||||
{
|
||||
colorPicker.DisposeTextures();
|
||||
colorPicker.Dispose();
|
||||
msgBox.Close();
|
||||
|
||||
foreach (var (e, color, prop) in entities)
|
||||
|
||||
@@ -21,16 +21,16 @@ namespace Barotrauma
|
||||
private Item? miniMapItem;
|
||||
|
||||
private Submarine? submarine;
|
||||
private Character? dummyCharacter;
|
||||
public static Effect BlueprintEffect = null!;
|
||||
private GUIFrame container = null!;
|
||||
public static Character? dummyCharacter;
|
||||
public static Effect? BlueprintEffect;
|
||||
private GUIFrame? container;
|
||||
|
||||
private TabMenu? tabMenu;
|
||||
|
||||
public TestScreen()
|
||||
{
|
||||
Cam = new Camera();
|
||||
BlueprintEffect = GameMain.GameScreen.BlueprintEffect!;
|
||||
BlueprintEffect = GameMain.GameScreen.BlueprintEffect;
|
||||
|
||||
new GUIButton(new RectTransform(new Point(256, 256), Frame.RectTransform), "Reload shader")
|
||||
{
|
||||
@@ -38,7 +38,7 @@ namespace Barotrauma
|
||||
{
|
||||
BlueprintEffect.Dispose();
|
||||
GameMain.Instance.Content.Unload();
|
||||
BlueprintEffect = GameMain.Instance.Content.Load<Effect>("Effects/blueprintshader_opengl")!;
|
||||
BlueprintEffect = GameMain.Instance.Content.Load<Effect>("Effects/blueprintshader_opengl");
|
||||
GameMain.GameScreen.BlueprintEffect = BlueprintEffect;
|
||||
return true;
|
||||
}
|
||||
@@ -47,21 +47,19 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
public override void Select()
|
||||
{
|
||||
{
|
||||
base.Select();
|
||||
container = new GUIFrame(new RectTransform(Vector2.One, GUI.Canvas, Anchor.Center), style: "InnerGlow", color: Color.Black);
|
||||
var tab = new GUIFrame(new RectTransform(Vector2.One, container.RectTransform), color: Color.Black * 0.9f);
|
||||
MedicalClinicUI clinic = new MedicalClinicUI(new MedicalClinic(null!), tab);
|
||||
clinic.RequestLatestPending();
|
||||
if (dummyCharacter is { Removed: false })
|
||||
{
|
||||
dummyCharacter?.Remove();
|
||||
}
|
||||
|
||||
// dummyCharacter = Character.Create(CharacterPrefab.HumanSpeciesName, Vector2.Zero, "", id: Entity.DummyID, hasAi: false);
|
||||
// dummyCharacter.Info.Job = new Job(JobPrefab.Prefabs.Where(jp => TalentTree.JobTalentTrees.ContainsKey(jp.Identifier)).GetRandom());
|
||||
// dummyCharacter.Info.Name = "Galldren";
|
||||
// dummyCharacter.Inventory.CreateSlots();
|
||||
dummyCharacter = Character.Create(CharacterPrefab.HumanSpeciesName, Vector2.Zero, "", id: Entity.DummyID, hasAi: false);
|
||||
dummyCharacter.Info.Job = new Job(JobPrefab.Prefabs.Where(jp => TalentTree.JobTalentTrees.ContainsKey(jp.Identifier)).GetRandom(Rand.RandSync.Unsynced));
|
||||
dummyCharacter.Info.Name = "Galldren";
|
||||
dummyCharacter.Inventory.CreateSlots();
|
||||
|
||||
Character.Controlled = dummyCharacter;
|
||||
GameMain.World.ProcessChanges();
|
||||
@@ -71,7 +69,8 @@ namespace Barotrauma
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
Frame.AddToGUIUpdateList();
|
||||
container.AddToGUIUpdateList();
|
||||
container?.AddToGUIUpdateList();
|
||||
tabMenu?.AddToGUIUpdateList();
|
||||
// CharacterHUD.AddToGUIUpdateList(dummyCharacter);
|
||||
// dummyCharacter?.SelectedConstruction?.AddToGUIUpdateList();
|
||||
}
|
||||
@@ -79,15 +78,13 @@ namespace Barotrauma
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
base.Update(deltaTime);
|
||||
tabMenu!.Update();
|
||||
|
||||
if (dummyCharacter is { } dummy)
|
||||
{
|
||||
dummy.ControlLocalPlayer((float)deltaTime, Cam, false);
|
||||
dummy.Control((float)deltaTime, Cam);
|
||||
}
|
||||
|
||||
GUI.Update((float)deltaTime);
|
||||
tabMenu?.Update((float)deltaTime);
|
||||
}
|
||||
|
||||
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||
|
||||
Reference in New Issue
Block a user