Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git
This commit is contained in:
+10
-6
@@ -1,13 +1,10 @@
|
||||
using Barotrauma.Tutorials;
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.IO;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Barotrauma.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using System.Globalization;
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.Networking;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -64,6 +61,7 @@ namespace Barotrauma
|
||||
maxMissionCount = MathHelper.Clamp(maxMissionCount,
|
||||
CampaignSettings.MinMissionCountLimit,
|
||||
CampaignSettings.MaxMissionCountLimit);
|
||||
|
||||
maxMissionCountText.Text = maxMissionCount.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
maxMissionCountButtons[1]
|
||||
@@ -246,6 +244,12 @@ namespace Barotrauma
|
||||
|
||||
foreach (string saveFile in saveFiles)
|
||||
{
|
||||
if (string.IsNullOrEmpty(saveFile))
|
||||
{
|
||||
DebugConsole.AddWarning("Error when updating campaign load menu: path to a save file was empty.\n" + Environment.StackTrace);
|
||||
continue;
|
||||
}
|
||||
|
||||
string fileName = saveFile;
|
||||
string subName = "";
|
||||
string saveTime = "";
|
||||
|
||||
@@ -45,6 +45,8 @@ namespace Barotrauma
|
||||
|
||||
public UpgradeStore UpgradeStore { get; set; }
|
||||
|
||||
public MedicalClinicUI MedicalClinic { get; set; }
|
||||
|
||||
public CampaignUI(CampaignMode campaign, GUIComponent container)
|
||||
{
|
||||
Campaign = campaign;
|
||||
@@ -149,6 +151,7 @@ namespace Barotrauma
|
||||
if (Campaign.Money >= CampaignMode.HullRepairCost)
|
||||
{
|
||||
Campaign.Money -= CampaignMode.HullRepairCost;
|
||||
GameAnalyticsManager.AddMoneySpentEvent(CampaignMode.HullRepairCost, GameAnalyticsManager.MoneySink.Service, "hullrepairs");
|
||||
Campaign.PurchasedHullRepairs = true;
|
||||
}
|
||||
}
|
||||
@@ -194,6 +197,7 @@ namespace Barotrauma
|
||||
if (Campaign.Money >= CampaignMode.ItemRepairCost)
|
||||
{
|
||||
Campaign.Money -= CampaignMode.ItemRepairCost;
|
||||
GameAnalyticsManager.AddMoneySpentEvent(CampaignMode.ItemRepairCost, GameAnalyticsManager.MoneySink.Service, "devicerepairs");
|
||||
Campaign.PurchasedItemRepairs = true;
|
||||
}
|
||||
}
|
||||
@@ -246,6 +250,7 @@ namespace Barotrauma
|
||||
if (Campaign.Money >= CampaignMode.ShuttleReplaceCost)
|
||||
{
|
||||
Campaign.Money -= CampaignMode.ShuttleReplaceCost;
|
||||
GameAnalyticsManager.AddMoneySpentEvent(CampaignMode.ShuttleReplaceCost, GameAnalyticsManager.MoneySink.Service, "retrieveshuttle");
|
||||
Campaign.PurchasedLostShuttles = true;
|
||||
}
|
||||
}
|
||||
@@ -270,6 +275,9 @@ namespace Barotrauma
|
||||
// Submarine buying tab
|
||||
tabs[(int)CampaignMode.InteractionType.PurchaseSub] = new GUIFrame(new RectTransform(Vector2.One, container.RectTransform, Anchor.TopLeft), color: Color.Black * 0.9f);
|
||||
|
||||
tabs[(int)CampaignMode.InteractionType.MedicalClinic] = new GUIFrame(new RectTransform(Vector2.One, container.RectTransform), color: Color.Black * 0.9f);
|
||||
MedicalClinic = new MedicalClinicUI(Campaign.MedicalClinic, GetTabContainer(CampaignMode.InteractionType.MedicalClinic));
|
||||
|
||||
// mission info -------------------------------------------------------------------------
|
||||
|
||||
locationInfoPanel = new GUIFrame(new RectTransform(new Vector2(0.35f, 0.75f), GetTabContainer(CampaignMode.InteractionType.Map).RectTransform, Anchor.CenterRight)
|
||||
@@ -355,6 +363,10 @@ namespace Barotrauma
|
||||
case CampaignMode.InteractionType.Store:
|
||||
Store?.Update(deltaTime);
|
||||
break;
|
||||
|
||||
case CampaignMode.InteractionType.MedicalClinic:
|
||||
MedicalClinic?.Update(deltaTime);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+36
-25
@@ -251,7 +251,7 @@ namespace Barotrauma.CharacterEditor
|
||||
GUI.ForceMouseOn(null);
|
||||
if (isEndlessRunner)
|
||||
{
|
||||
Submarine.MainSub.Remove();
|
||||
Submarine.MainSub?.Remove();
|
||||
GameMain.World.ProcessChanges();
|
||||
isEndlessRunner = false;
|
||||
Reset();
|
||||
@@ -500,29 +500,34 @@ namespace Barotrauma.CharacterEditor
|
||||
int index = 0;
|
||||
bool isSwimming = character.AnimController.ForceSelectAnimationType == AnimationType.SwimFast || character.AnimController.ForceSelectAnimationType == AnimationType.SwimSlow;
|
||||
bool isMovingFast = character.AnimController.ForceSelectAnimationType == AnimationType.Run || character.AnimController.ForceSelectAnimationType == AnimationType.SwimFast;
|
||||
if (isMovingFast)
|
||||
if (character.AnimController.CanWalk)
|
||||
{
|
||||
if (isSwimming || !character.AnimController.CanWalk)
|
||||
if (isMovingFast)
|
||||
{
|
||||
index = !character.AnimController.CanWalk ? (int)AnimationType.SwimFast : (int)AnimationType.SwimSlow;
|
||||
if (isSwimming)
|
||||
{
|
||||
index = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
index = (int)AnimationType.Walk;
|
||||
if (isSwimming)
|
||||
{
|
||||
index = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = 1;
|
||||
}
|
||||
}
|
||||
index -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isSwimming || !character.AnimController.CanWalk)
|
||||
{
|
||||
index = !character.AnimController.CanWalk ? (int)AnimationType.SwimSlow : (int)AnimationType.SwimFast;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = (int)AnimationType.Run;
|
||||
}
|
||||
index -= 1;
|
||||
index = isMovingFast ? 0 : 1;
|
||||
}
|
||||
if (animSelection.SelectedIndex != index)
|
||||
{
|
||||
@@ -536,17 +541,13 @@ namespace Barotrauma.CharacterEditor
|
||||
bool isSwimming = character.AnimController.ForceSelectAnimationType == AnimationType.SwimFast || character.AnimController.ForceSelectAnimationType == AnimationType.SwimSlow;
|
||||
if (isSwimming)
|
||||
{
|
||||
animSelection.Select((int)AnimationType.Walk - 1);
|
||||
animSelection.Select(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
animSelection.Select((int)AnimationType.SwimSlow - 1);
|
||||
animSelection.Select(2);
|
||||
}
|
||||
}
|
||||
if (PlayerInput.KeyHit(Keys.F))
|
||||
{
|
||||
SetToggle(freezeToggle, !freezeToggle.Selected);
|
||||
}
|
||||
if (PlayerInput.SecondaryMouseButtonClicked() || PlayerInput.KeyHit(Keys.Escape))
|
||||
{
|
||||
bool reset = false;
|
||||
@@ -853,6 +854,16 @@ namespace Barotrauma.CharacterEditor
|
||||
{
|
||||
DrawRagdoll(spriteBatch, (float)deltaTime);
|
||||
}
|
||||
// Mouth
|
||||
Limb head = character.AnimController.GetLimb(LimbType.Head);
|
||||
if (head != null && character.CanEat && selectedLimbs.Contains(head))
|
||||
{
|
||||
var mouthPos = character.AnimController.GetMouthPosition();
|
||||
if (mouthPos.HasValue)
|
||||
{
|
||||
ShapeExtensions.DrawPoint(spriteBatch, SimToScreen(mouthPos.Value), GUI.Style.Red, size: 8);
|
||||
}
|
||||
}
|
||||
if (showSpritesheet)
|
||||
{
|
||||
DrawSpritesheetEditor(spriteBatch, (float)deltaTime);
|
||||
@@ -2606,13 +2617,13 @@ namespace Barotrauma.CharacterEditor
|
||||
{
|
||||
animSelection.AddItem(AnimationType.Walk.ToString(), AnimationType.Walk);
|
||||
animSelection.AddItem(AnimationType.Run.ToString(), AnimationType.Run);
|
||||
if (character.IsHumanoid)
|
||||
{
|
||||
animSelection.AddItem(AnimationType.Crouch.ToString(), AnimationType.Crouch);
|
||||
}
|
||||
}
|
||||
animSelection.AddItem(AnimationType.SwimSlow.ToString(), AnimationType.SwimSlow);
|
||||
animSelection.AddItem(AnimationType.SwimFast.ToString(), AnimationType.SwimFast);
|
||||
if (character.AnimController.CanWalk && character.IsHumanoid)
|
||||
{
|
||||
animSelection.AddItem(AnimationType.Crouch.ToString(), AnimationType.Crouch);
|
||||
}
|
||||
if (character.AnimController.ForceSelectAnimationType == AnimationType.NotDefined)
|
||||
{
|
||||
animSelection.SelectItem(character.AnimController.CanWalk ? AnimationType.Walk : AnimationType.SwimSlow);
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Barotrauma
|
||||
|
||||
private void CreateGUI()
|
||||
{
|
||||
GuiFrame = new GUIFrame(new RectTransform(new Vector2(0.2f, 0.4f), GUICanvas.Instance) { MinSize = new Point(300, 400) });
|
||||
GuiFrame = new GUIFrame(new RectTransform(new Vector2(0.2f, 0.4f), GUI.Canvas) { MinSize = new Point(300, 400) });
|
||||
GUILayoutGroup layoutGroup = new GUILayoutGroup(RectTransform(0.9f, 0.9f, GuiFrame, Anchor.Center)) { Stretch = true };
|
||||
|
||||
// === BUTTONS === //
|
||||
@@ -247,16 +247,6 @@ namespace Barotrauma
|
||||
return msgBox;
|
||||
}
|
||||
|
||||
private void NotifyPrompt(string header, string body)
|
||||
{
|
||||
GUIMessageBox msgBox = new GUIMessageBox(header, body, new[] { TextManager.Get("Ok") }, new Vector2(0.2f, 0.175f), minSize: new Point(300, 175));
|
||||
msgBox.Buttons[0].OnClicked = delegate
|
||||
{
|
||||
msgBox.Close();
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
private bool SaveProjectToFile(GUIButton button, object o)
|
||||
{
|
||||
string directory = Path.GetFullPath("EventProjects");
|
||||
@@ -315,7 +305,7 @@ namespace Barotrauma
|
||||
CreateNodes(prefab.ConfigElement, ref hadNodes);
|
||||
if (!hadNodes)
|
||||
{
|
||||
NotifyPrompt(TextManager.Get("EventEditor.RandomGenerationHeader"), TextManager.Get("EventEditor.RandomGenerationBody"));
|
||||
GUI.NotifyPrompt(TextManager.Get("EventEditor.RandomGenerationHeader"), TextManager.Get("EventEditor.RandomGenerationBody"));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Barotrauma
|
||||
|
||||
#if TEST_REMOTE_CONTENT
|
||||
|
||||
var doc = XMLExtensions.TryLoadXml("Content/UI/MenuTextTest.xml");
|
||||
var doc = XMLExtensions.TryLoadXml("Content/UI/MenuContent.xml");
|
||||
if (doc?.Root != null)
|
||||
{
|
||||
foreach (XElement subElement in doc?.Root.Elements())
|
||||
@@ -564,8 +564,6 @@ namespace Barotrauma
|
||||
|
||||
ResetButtonStates(null);
|
||||
|
||||
GameAnalyticsManager.SetCustomDimension01("");
|
||||
|
||||
if (GameMain.SteamWorkshopScreen != null)
|
||||
{
|
||||
CoroutineManager.StartCoroutine(GameMain.SteamWorkshopScreen.RefreshDownloadState());
|
||||
@@ -782,7 +780,7 @@ namespace Barotrauma
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void QuickStart(bool fixedSeed = false, string sub = null, float difficulty = 40, LevelGenerationParams levelGenerationParams = null)
|
||||
public void QuickStart(bool fixedSeed = false, string sub = null, float difficulty = 50, LevelGenerationParams levelGenerationParams = null)
|
||||
{
|
||||
if (fixedSeed)
|
||||
{
|
||||
@@ -1082,7 +1080,10 @@ namespace Barotrauma
|
||||
|
||||
if (backgroundSprite == null)
|
||||
{
|
||||
backgroundSprite = (LocationType.List.Where(l => l.UseInMainMenu).GetRandom())?.GetPortrait(0);
|
||||
#if UNSTABLE
|
||||
backgroundSprite = new Sprite("Content/UnstableBackground.png", sourceRectangle: null);
|
||||
#endif
|
||||
backgroundSprite ??= LocationType.List.Where(l => l.UseInMainMenu).GetRandom()?.GetPortrait(0);
|
||||
}
|
||||
|
||||
if (backgroundSprite != null)
|
||||
@@ -1226,7 +1227,7 @@ namespace Barotrauma
|
||||
GameMain.Lua.Initialize();
|
||||
}
|
||||
|
||||
#region UI Methods
|
||||
#region UI Methods
|
||||
private void CreateCampaignSetupUI()
|
||||
{
|
||||
menuTabs[(int)Tab.NewGame].ClearChildren();
|
||||
@@ -1462,7 +1463,7 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ForbiddenWordFilter.IsForbidden(name, out string forbiddenWord))
|
||||
if (isPublicBox.Selected && ForbiddenWordFilter.IsForbidden(name, out string forbiddenWord))
|
||||
{
|
||||
var msgBox = new GUIMessageBox("",
|
||||
TextManager.GetWithVariables("forbiddenservernameverification", new string[] { "[forbiddenword]", "[servername]" }, new string[] { forbiddenWord, name }),
|
||||
@@ -1499,7 +1500,7 @@ namespace Barotrauma
|
||||
playstyleDescription.TextAlignment = playstyleDescription.WrappedText.Contains('\n') ?
|
||||
Alignment.CenterLeft : Alignment.Center;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private void FetchRemoteContent()
|
||||
{
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.Networking;
|
||||
using Barotrauma.Steam;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Barotrauma.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.Steam;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class NetLobbyScreen : Screen
|
||||
{
|
||||
//private readonly List<Sprite> jobPreferenceSprites = new List<Sprite>();
|
||||
|
||||
private readonly GUIFrame infoFrame, modeFrame;
|
||||
private readonly GUILayoutGroup infoFrameContent;
|
||||
private readonly GUIFrame myCharacterFrame;
|
||||
@@ -221,7 +217,6 @@ namespace Barotrauma
|
||||
public SubmarineInfo SelectedShuttle => ShuttleList.SelectedData as SubmarineInfo;
|
||||
|
||||
public MultiPlayerCampaignSetupUI CampaignSetupUI;
|
||||
public List<SubmarineInfo> CampaignSubmarines = new List<SubmarineInfo>();
|
||||
|
||||
// Passed onto the gamesession when created
|
||||
public List<SubmarineInfo> ServerOwnedSubmarines = new List<SubmarineInfo>();
|
||||
@@ -611,6 +606,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (btn, obj) =>
|
||||
{
|
||||
if (GameMain.Client == null) { return true; }
|
||||
GameMain.Client.RequestStartRound();
|
||||
CoroutineManager.StartCoroutine(WaitForStartRound(StartButton), "WaitForStartRound");
|
||||
return true;
|
||||
@@ -628,7 +624,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnSelected = (tickBox) =>
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, autoRestart: tickBox.Selected);
|
||||
GameMain.Client?.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, autoRestart: tickBox.Selected);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -655,6 +651,7 @@ namespace Barotrauma
|
||||
};
|
||||
ServerName.OnDeselected += (textBox, key) =>
|
||||
{
|
||||
if (GameMain.Client == null) { return; }
|
||||
if (!textBox.Readonly)
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Name);
|
||||
@@ -669,6 +666,7 @@ namespace Barotrauma
|
||||
ToolTip = TextManager.Get("addtofavorites"),
|
||||
OnSelected = (tickbox) =>
|
||||
{
|
||||
if (GameMain.Client == null) { return true; }
|
||||
ServerInfo info = GameMain.Client.ServerSettings.GetServerListInfo();
|
||||
if (tickbox.Selected)
|
||||
{
|
||||
@@ -766,6 +764,7 @@ namespace Barotrauma
|
||||
};
|
||||
ServerMessage.OnDeselected += (textBox, key) =>
|
||||
{
|
||||
if (GameMain.Client == null) { return; }
|
||||
if (!textBox.Readonly)
|
||||
{
|
||||
GameMain.Client?.ServerSettings?.ClientAdminWrite(ServerSettings.NetFlags.Message);
|
||||
@@ -849,7 +848,7 @@ namespace Barotrauma
|
||||
Selected = true,
|
||||
OnSelected = (GUITickBox box) =>
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, useRespawnShuttle: box.Selected);
|
||||
GameMain.Client?.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, useRespawnShuttle: box.Selected);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -868,7 +867,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnSelected = (component, obj) =>
|
||||
{
|
||||
GameMain.Client.RequestSelectSub(component.Parent.GetChildIndex(component), isShuttle: true);
|
||||
GameMain.Client?.RequestSelectSub(component.Parent.GetChildIndex(component), isShuttle: true);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -970,7 +969,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (_, __) =>
|
||||
{
|
||||
GameMain.Client.RequestSelectMode(ModeList.Content.GetChildIndex(ModeList.Content.GetChildByUserData(GameModePreset.Sandbox)));
|
||||
GameMain.Client?.RequestSelectMode(ModeList.Content.GetChildIndex(ModeList.Content.GetChildByUserData(GameModePreset.Sandbox)));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1026,7 +1025,7 @@ namespace Barotrauma
|
||||
{
|
||||
int missionTypeOr = tickbox.Selected ? (int)tickbox.UserData : (int)MissionType.None;
|
||||
int missionTypeAnd = (int)MissionType.All & (!tickbox.Selected ? (~(int)tickbox.UserData) : (int)MissionType.All);
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, (int)missionTypeOr, (int)missionTypeAnd);
|
||||
GameMain.Client?.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, (int)missionTypeOr, (int)missionTypeAnd);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1059,7 +1058,7 @@ namespace Barotrauma
|
||||
SeedBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 1.0f), seedLabel.RectTransform, Anchor.CenterRight));
|
||||
SeedBox.OnDeselected += (textBox, key) =>
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.LevelSeed);
|
||||
GameMain.Client?.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.LevelSeed);
|
||||
};
|
||||
clientDisabledElements.Add(SeedBox);
|
||||
LevelSeed = ToolBox.RandomSeed(8);
|
||||
@@ -1080,7 +1079,7 @@ namespace Barotrauma
|
||||
ToolTip = TextManager.Get("leveldifficultyexplanation"),
|
||||
OnReleased = (scrollbar, value) =>
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, levelDifficulty: scrollbar.BarScrollValue);
|
||||
GameMain.Client?.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, levelDifficulty: scrollbar.BarScrollValue);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1112,8 +1111,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (button, obj) =>
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, traitorSetting: -1);
|
||||
|
||||
GameMain.Client?.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, traitorSetting: -1);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1124,8 +1122,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (button, obj) =>
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, traitorSetting: 1);
|
||||
|
||||
GameMain.Client?.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, traitorSetting: 1);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1143,7 +1140,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (button, obj) =>
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, botCount: -1);
|
||||
GameMain.Client?.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, botCount: -1);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1153,7 +1150,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (button, obj) =>
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, botCount: 1);
|
||||
GameMain.Client?.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, botCount: 1);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1169,7 +1166,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (button, obj) =>
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, botSpawnMode: -1);
|
||||
GameMain.Client?.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, botSpawnMode: -1);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1179,7 +1176,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (button, obj) =>
|
||||
{
|
||||
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, botSpawnMode: 1);
|
||||
GameMain.Client?.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Misc, botSpawnMode: 1);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1345,9 +1342,9 @@ namespace Barotrauma
|
||||
StartButton.Visible = GameMain.Client.HasPermission(ClientPermissions.ManageRound) && !GameMain.Client.GameStarted && !CampaignSetupFrame.Visible && !CampaignFrame.Visible;
|
||||
ServerName.Readonly = !GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
ServerMessage.Readonly = !GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
shuttleTickBox.Enabled = GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
shuttleTickBox.Enabled = GameMain.Client.HasPermission(ClientPermissions.ManageSettings) && !GameMain.Client.GameStarted;
|
||||
SubList.Enabled = !CampaignFrame.Visible && (GameMain.Client.ServerSettings.Voting.AllowSubVoting || GameMain.Client.HasPermission(ClientPermissions.SelectSub));
|
||||
ShuttleList.Enabled = ShuttleList.ButtonEnabled = GameMain.Client.HasPermission(ClientPermissions.SelectSub);
|
||||
ShuttleList.Enabled = ShuttleList.ButtonEnabled = GameMain.Client.HasPermission(ClientPermissions.SelectSub) && !GameMain.Client.GameStarted;
|
||||
ModeList.Enabled = GameMain.Client.ServerSettings.Voting.AllowModeVoting || GameMain.Client.HasPermission(ClientPermissions.SelectMode);
|
||||
LogButtons.Visible = GameMain.Client.HasPermission(ClientPermissions.ServerLog);
|
||||
GameMain.Client.ShowLogButton.Visible = GameMain.Client.HasPermission(ClientPermissions.ServerLog);
|
||||
@@ -3576,7 +3573,13 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CheckIfCampaignSubMatches(SubmarineInfo serverSubmarine, string deliveryData)
|
||||
public enum SubmarineDeliveryData
|
||||
{
|
||||
Owned,
|
||||
Campaign
|
||||
}
|
||||
|
||||
public bool CheckIfCampaignSubMatches(SubmarineInfo serverSubmarine, SubmarineDeliveryData deliveryData)
|
||||
{
|
||||
if (GameMain.Client == null) return false;
|
||||
|
||||
@@ -3630,11 +3633,11 @@ namespace Barotrauma
|
||||
{
|
||||
FailedSubInfo fileInfo = (FailedSubInfo)userdata;
|
||||
|
||||
if (deliveryData == "owned") //owned!!!!
|
||||
if (deliveryData == SubmarineDeliveryData.Owned)
|
||||
{
|
||||
FailedOwnedSubs.Add(fileInfo);
|
||||
}
|
||||
else if (deliveryData == "campaign")
|
||||
else if (deliveryData == SubmarineDeliveryData.Campaign)
|
||||
{
|
||||
FailedCampaignSubs.Add(fileInfo);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (frame == null)
|
||||
{
|
||||
frame = new GUIFrame(new RectTransform(GUICanvas.Instance.RelativeSize, GUICanvas.Instance), style: null)
|
||||
frame = new GUIFrame(new RectTransform(GUI.Canvas.RelativeSize, GUI.Canvas), style: null)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ using Microsoft.Xna.Framework.Graphics;
|
||||
using RestSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
@@ -21,6 +22,11 @@ namespace Barotrauma
|
||||
//how often the client is allowed to refresh servers
|
||||
private readonly TimeSpan AllowedRefreshInterval = new TimeSpan(0, 0, 3);
|
||||
|
||||
public ImmutableDictionary<UInt64, ContentPackage> ContentPackagesByWorkshopId { get; private set; }
|
||||
= ImmutableDictionary<UInt64, ContentPackage>.Empty;
|
||||
public ImmutableDictionary<string, ContentPackage> ContentPackagesByHash { get; private set; }
|
||||
= ImmutableDictionary<string, ContentPackage>.Empty;
|
||||
|
||||
private GUIFrame menu;
|
||||
|
||||
private GUIListBox serverList;
|
||||
@@ -1011,6 +1017,17 @@ namespace Barotrauma
|
||||
public override void Select()
|
||||
{
|
||||
base.Select();
|
||||
|
||||
ContentPackagesByWorkshopId = ContentPackage.AllPackages
|
||||
.Select(p => new KeyValuePair<UInt64, ContentPackage>(p.SteamWorkshopId, p))
|
||||
.Where(p => p.Key != 0)
|
||||
.GroupBy(x => x.Key).Select(g => g.First())
|
||||
.ToImmutableDictionary();
|
||||
ContentPackagesByHash = ContentPackage.AllPackages
|
||||
.Select(p => new KeyValuePair<string, ContentPackage>(p.MD5hash.Hash, p))
|
||||
.GroupBy(x => x.Key).Select(g => g.First())
|
||||
.ToImmutableDictionary();
|
||||
|
||||
SelectedTab = ServerListTab.All;
|
||||
LoadServerFilters(GameMain.Config.ServerFilterElement);
|
||||
if (GameSettings.ShowOffensiveServerPrompt)
|
||||
@@ -1039,6 +1056,8 @@ namespace Barotrauma
|
||||
|
||||
public override void Deselect()
|
||||
{
|
||||
ContentPackagesByWorkshopId = ImmutableDictionary<UInt64, ContentPackage>.Empty;
|
||||
ContentPackagesByHash = ImmutableDictionary<string, ContentPackage>.Empty;
|
||||
base.Deselect();
|
||||
|
||||
GameMain.Config.SaveNewPlayerConfig();
|
||||
@@ -1491,7 +1510,7 @@ namespace Barotrauma
|
||||
}
|
||||
TaskPool.Add($"Get{avatarSize}AvatarAsync", avatarFunc(friend.Id), (task) =>
|
||||
{
|
||||
Steamworks.Data.Image? img = ((Task<Steamworks.Data.Image?>)task).Result;
|
||||
if (!task.TryGetResult(out Steamworks.Data.Image? img)) { return; }
|
||||
if (!img.HasValue) { return; }
|
||||
|
||||
var avatarImage = img.Value;
|
||||
@@ -2203,7 +2222,7 @@ namespace Barotrauma
|
||||
TaskPool.PrintTaskExceptions(t, $"Failed to retrieve Workshop item info (ID {entry.Id})");
|
||||
return;
|
||||
}
|
||||
Steamworks.Ugc.Item? item = ((Task<Steamworks.Ugc.Item?>)t).Result;
|
||||
t.TryGetResult(out Steamworks.Ugc.Item? item);
|
||||
|
||||
if (!item.HasValue)
|
||||
{
|
||||
@@ -2313,7 +2332,7 @@ namespace Barotrauma
|
||||
{
|
||||
var info = obj.Item1;
|
||||
var text = obj.Item2;
|
||||
info.Ping = ((Task<int>)rtt).Result; info.PingChecked = true;
|
||||
rtt.TryGetResult(out info.Ping); info.PingChecked = true;
|
||||
text.TextColor = GetPingTextColor(info.Ping);
|
||||
text.Text = info.Ping > -1 ? info.Ping.ToString() : "?";
|
||||
lock (activePings)
|
||||
|
||||
@@ -854,7 +854,7 @@ namespace Barotrauma
|
||||
(var it, var lb) = tuple;
|
||||
if (lb.Content.FindChild(item)?.GetChildByUserData("previewimage") is GUIImage previewImage)
|
||||
{
|
||||
previewImage.Sprite = ((Task<Sprite>)task).Result;
|
||||
if (task.TryGetResult(out Sprite sprite)) { previewImage.Sprite = sprite; }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
@@ -21,6 +22,38 @@ namespace Barotrauma
|
||||
{
|
||||
class SubEditorScreen : EditorScreen
|
||||
{
|
||||
private enum LayerVisibility
|
||||
{
|
||||
Visible,
|
||||
Invisible
|
||||
}
|
||||
|
||||
private enum LayerLinkage
|
||||
{
|
||||
Unlinked,
|
||||
Linked
|
||||
}
|
||||
|
||||
private readonly struct LayerData
|
||||
{
|
||||
public readonly LayerVisibility Visible;
|
||||
public readonly LayerLinkage Linkage;
|
||||
|
||||
public static readonly LayerData Default = new LayerData(LayerVisibility.Visible, LayerLinkage.Unlinked);
|
||||
|
||||
public LayerData(LayerVisibility visible, LayerLinkage linkage)
|
||||
{
|
||||
Visible = visible;
|
||||
Linkage = linkage;
|
||||
}
|
||||
|
||||
public void Deconstruct(out LayerVisibility isvisible, out LayerLinkage islinked)
|
||||
{
|
||||
isvisible = Visible;
|
||||
islinked = Linkage;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly string[] crewExperienceLevels =
|
||||
{
|
||||
"CrewExperienceLow",
|
||||
@@ -94,11 +127,16 @@ namespace Barotrauma
|
||||
private GUIFrame hullVolumeFrame;
|
||||
|
||||
private GUIFrame saveAssemblyFrame;
|
||||
private GUIFrame snapToGridFrame;
|
||||
|
||||
const int PreviouslyUsedCount = 10;
|
||||
private GUIFrame previouslyUsedPanel;
|
||||
private GUIListBox previouslyUsedList;
|
||||
|
||||
private GUIButton visibilityButton;
|
||||
private GUIFrame layerPanel;
|
||||
private GUIListBox layerList;
|
||||
|
||||
private GUIFrame undoBufferPanel;
|
||||
private GUIFrame undoBufferDisclaimer;
|
||||
private GUIListBox undoBufferList;
|
||||
@@ -106,7 +144,7 @@ namespace Barotrauma
|
||||
private GUIDropDown linkedSubBox;
|
||||
|
||||
private static GUIComponent autoSaveLabel;
|
||||
private static int maxAutoSaves = GameSettings.MaximumAutoSaves;
|
||||
private readonly static int maxAutoSaves = GameSettings.MaximumAutoSaves;
|
||||
|
||||
public static readonly object ItemAddMutex = new object(), ItemRemoveMutex = new object();
|
||||
|
||||
@@ -234,6 +272,8 @@ namespace Barotrauma
|
||||
|
||||
public bool WiringMode => mode == Mode.Wiring;
|
||||
|
||||
private static readonly Dictionary<string, LayerData> Layers = new Dictionary<string, LayerData>();
|
||||
|
||||
public SubEditorScreen()
|
||||
{
|
||||
cam = new Camera
|
||||
@@ -320,19 +360,34 @@ namespace Barotrauma
|
||||
|
||||
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.9f), paddedTopPanel.RectTransform), style: "VerticalLine");
|
||||
|
||||
var visibilityButton = new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "SetupVisibilityButton")
|
||||
visibilityButton = new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "SetupVisibilityButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("SubEditorVisibilityButton") + '\n' + TextManager.Get("SubEditorVisibilityToolTip"),
|
||||
OnClicked = (btn, userData) =>
|
||||
{
|
||||
previouslyUsedPanel.Visible = false;
|
||||
undoBufferPanel.Visible = false;
|
||||
layerPanel.Visible = false;
|
||||
showEntitiesPanel.Visible = !showEntitiesPanel.Visible;
|
||||
showEntitiesPanel.RectTransform.AbsoluteOffset = new Point(Math.Max(Math.Max(btn.Rect.X, entityCountPanel.Rect.Right), saveAssemblyFrame.Rect.Right), TopPanel.Rect.Height);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "EditorLayerButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("editor.layer.button") + '\n' + TextManager.Get("editor.layer.tooltip"),
|
||||
OnClicked = (btn, userData) =>
|
||||
{
|
||||
previouslyUsedPanel.Visible = false;
|
||||
showEntitiesPanel.Visible = false;
|
||||
undoBufferPanel.Visible = false;
|
||||
layerPanel.Visible = !layerPanel.Visible;
|
||||
layerPanel.RectTransform.AbsoluteOffset = new Point(Math.Max(Math.Max(btn.Rect.X, entityCountPanel.Rect.Right), saveAssemblyFrame.Rect.Right), TopPanel.Rect.Height);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
var previouslyUsedButton = new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "RecentlyUsedButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("PreviouslyUsedLabel"),
|
||||
@@ -340,6 +395,7 @@ namespace Barotrauma
|
||||
{
|
||||
showEntitiesPanel.Visible = false;
|
||||
undoBufferPanel.Visible = false;
|
||||
layerPanel.Visible = false;
|
||||
previouslyUsedPanel.Visible = !previouslyUsedPanel.Visible;
|
||||
previouslyUsedPanel.RectTransform.AbsoluteOffset = new Point(Math.Max(Math.Max(btn.Rect.X, entityCountPanel.Rect.Right), saveAssemblyFrame.Rect.Right), TopPanel.Rect.Height);
|
||||
return true;
|
||||
@@ -353,6 +409,7 @@ namespace Barotrauma
|
||||
{
|
||||
showEntitiesPanel.Visible = false;
|
||||
previouslyUsedPanel.Visible = false;
|
||||
layerPanel.Visible = false;
|
||||
undoBufferPanel.Visible = !undoBufferPanel.Visible;
|
||||
undoBufferPanel.RectTransform.AbsoluteOffset = new Point(Math.Max(Math.Max(btn.Rect.X, entityCountPanel.Rect.Right), saveAssemblyFrame.Rect.Right), TopPanel.Rect.Height);
|
||||
return true;
|
||||
@@ -484,14 +541,84 @@ namespace Barotrauma
|
||||
|
||||
//-----------------------------------------------
|
||||
|
||||
layerPanel = new GUIFrame(new RectTransform(new Vector2(0.25f, 0.4f), GUI.Canvas, minSize: new Point(300, 320)))
|
||||
{
|
||||
Visible = false
|
||||
};
|
||||
|
||||
GUILayoutGroup layerGroup = new GUILayoutGroup(new RectTransform(new Vector2(0.9f), layerPanel.RectTransform, anchor: Anchor.Center));
|
||||
|
||||
layerList = new GUIListBox(new RectTransform(new Vector2(1f, 0.8f), layerGroup.RectTransform))
|
||||
{
|
||||
ScrollBarVisible = true,
|
||||
AutoHideScrollBar = false,
|
||||
OnSelected = (component, o) =>
|
||||
{
|
||||
if (GUI.MouseOn is GUITickBox) { return false; } // lol
|
||||
if (!(o is string layer)) { return false; }
|
||||
|
||||
MapEntity.SelectedList.Clear();
|
||||
foreach (MapEntity entity in MapEntity.mapEntityList.Where(me => !me.Removed && me.Layer == layer))
|
||||
{
|
||||
if (entity.IsSelected) { continue; }
|
||||
|
||||
MapEntity.SelectedList.Add(entity);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
GUILayoutGroup layerButtonGroup = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.2f), layerGroup.RectTransform));
|
||||
|
||||
GUILayoutGroup layerButtonTopGroup = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.5f), layerButtonGroup.RectTransform), isHorizontal: true);
|
||||
|
||||
GUIButton layerAddButton = new GUIButton(new RectTransform(new Vector2(0.5f, 1f), layerButtonTopGroup.RectTransform), text: TextManager.Get("editor.layer.newlayer"), style: "GUIButtonFreeScale")
|
||||
{
|
||||
OnClicked = (button, o) =>
|
||||
{
|
||||
CreateNewLayer(null, MapEntity.SelectedList.ToList());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
GUIButton layerDeleteButton = new GUIButton(new RectTransform(new Vector2(0.5f, 1f), layerButtonTopGroup.RectTransform), text: TextManager.Get("editor.layer.deletelayer"), style: "GUIButtonFreeScale")
|
||||
{
|
||||
OnClicked = (button, o) =>
|
||||
{
|
||||
if (layerList.SelectedData is string layer)
|
||||
{
|
||||
RenameLayer(layer, null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
GUIButton layerRenameButton = new GUIButton(new RectTransform(new Vector2(1f, 0.5f), layerButtonGroup.RectTransform), text: TextManager.Get("editor.layer.renamelayer"), style: "GUIButtonFreeScale")
|
||||
{
|
||||
OnClicked = (button, o) =>
|
||||
{
|
||||
if (layerList.SelectedData is string layer)
|
||||
{
|
||||
GUI.PromptTextInput(TextManager.Get("editor.layer.renamelayer"), layer, newName =>
|
||||
{
|
||||
RenameLayer(layer, newName);
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
GUITextBlock.AutoScaleAndNormalize(layerAddButton.TextBlock, layerDeleteButton.TextBlock, layerRenameButton.TextBlock);
|
||||
|
||||
|
||||
Vector2 subPanelSize = new Vector2(0.925f, 0.9f);
|
||||
|
||||
undoBufferPanel = new GUIFrame(new RectTransform(new Vector2(0.15f, 0.2f), GUI.Canvas) { MinSize = new Point(200, 200) })
|
||||
{
|
||||
Visible = false
|
||||
};
|
||||
|
||||
Vector2 undoSize = new Vector2(0.925f, 0.9f);
|
||||
|
||||
undoBufferList = new GUIListBox(new RectTransform(undoSize, undoBufferPanel.RectTransform, Anchor.Center))
|
||||
undoBufferList = new GUIListBox(new RectTransform(subPanelSize, undoBufferPanel.RectTransform, Anchor.Center))
|
||||
{
|
||||
ScrollBarVisible = true,
|
||||
OnSelected = (_, userData) =>
|
||||
@@ -522,7 +649,7 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
|
||||
undoBufferDisclaimer = new GUIFrame(new RectTransform(undoSize, undoBufferPanel.RectTransform, Anchor.Center), style: null)
|
||||
undoBufferDisclaimer = new GUIFrame(new RectTransform(subPanelSize, undoBufferPanel.RectTransform, Anchor.Center), style: null)
|
||||
{
|
||||
Color = Color.Black,
|
||||
Visible = false
|
||||
@@ -757,6 +884,19 @@ namespace Barotrauma
|
||||
};
|
||||
saveAssemblyFrame.RectTransform.MinSize = new Point(saveAssemblyFrame.Rect.Width, (int)(saveAssemblyButton.Rect.Height / saveAssemblyButton.RectTransform.RelativeSize.Y));
|
||||
|
||||
snapToGridFrame = new GUIFrame(new RectTransform(new Vector2(0.08f, 0.5f), TopPanel.RectTransform, Anchor.BottomLeft, Pivot.TopLeft)
|
||||
{ MinSize = new Point((int)(250 * GUI.Scale), (int)(80 * GUI.Scale)), AbsoluteOffset = new Point((int)(10 * GUI.Scale), -saveAssemblyFrame.Rect.Height - entityCountPanel.Rect.Height - (int)(10 * GUI.Scale)) }, "InnerFrame")
|
||||
{
|
||||
Visible = false
|
||||
};
|
||||
var saveStampButton = new GUIButton(new RectTransform(new Vector2(0.9f, 0.8f), snapToGridFrame.RectTransform, Anchor.Center), TextManager.Get("subeditor.snaptogrid", fallBackTag: "spriteeditor.snaptogrid"));
|
||||
saveStampButton.TextBlock.AutoScaleHorizontal = true;
|
||||
saveStampButton.OnClicked += (btn, userdata) =>
|
||||
{
|
||||
SnapToGrid();
|
||||
return true;
|
||||
};
|
||||
snapToGridFrame.RectTransform.MinSize = new Point(snapToGridFrame.Rect.Width, (int)(saveStampButton.Rect.Height / saveStampButton.RectTransform.RelativeSize.Y));
|
||||
|
||||
//Entity menu
|
||||
//------------------------------------------------
|
||||
@@ -851,7 +991,7 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
paddedTab.Recalculate();
|
||||
|
||||
UpdateLayerPanel();
|
||||
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
}
|
||||
|
||||
@@ -1071,6 +1211,7 @@ namespace Barotrauma
|
||||
{
|
||||
CanBeFocused = false,
|
||||
LoadAsynchronously = true,
|
||||
SpriteEffects = icon.effects,
|
||||
Color = legacy ? iconColor * 0.6f : iconColor
|
||||
};
|
||||
}
|
||||
@@ -1254,8 +1395,8 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
ImageManager.OnEditorSelected();
|
||||
ReconstructLayers();
|
||||
|
||||
GameAnalyticsManager.SetCustomDimension01("editor");
|
||||
if (!GameMain.Config.EditorDisclaimerShown)
|
||||
{
|
||||
GameMain.Instance.ShowEditorDisclaimer();
|
||||
@@ -1354,7 +1495,7 @@ namespace Barotrauma
|
||||
|
||||
TimeSpan timeInEditor = DateTime.Now - editorSelectedTime;
|
||||
#if USE_STEAM
|
||||
Steam.SteamManager.IncrementStat("hoursineditor", (float)timeInEditor.TotalHours);
|
||||
SteamAchievementManager.IncrementStat("hoursineditor", (float)timeInEditor.TotalHours);
|
||||
#endif
|
||||
|
||||
GUI.ForceMouseOn(null);
|
||||
@@ -1365,7 +1506,6 @@ namespace Barotrauma
|
||||
loadFrame = null;
|
||||
|
||||
MapEntity.DeselectAll();
|
||||
MapEntity.SelectionGroups.Clear();
|
||||
ClearUndoBuffer();
|
||||
|
||||
SetMode(Mode.Default);
|
||||
@@ -1400,6 +1540,7 @@ namespace Barotrauma
|
||||
});
|
||||
|
||||
ClearFilter();
|
||||
ClearLayers();
|
||||
}
|
||||
|
||||
private void CreateDummyCharacter()
|
||||
@@ -1752,11 +1893,11 @@ namespace Barotrauma
|
||||
DebugConsole.ThrowError($"Saving the preview image of the submarine \"{Submarine.MainSub.Info.Name}\" failed.", e);
|
||||
savePreviewImage = false;
|
||||
}
|
||||
Submarine.MainSub.SaveAs(savePath, savePreviewImage ? imgStream : null);
|
||||
Submarine.MainSub.TrySaveAs(savePath, savePreviewImage ? imgStream : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
Submarine.MainSub.SaveAs(savePath);
|
||||
Submarine.MainSub.TrySaveAs(savePath);
|
||||
}
|
||||
Barotrauma.IO.Validation.SkipValidationInDebugBuilds = false;
|
||||
|
||||
@@ -2114,7 +2255,7 @@ namespace Barotrauma
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), priceGroup.RectTransform),
|
||||
TextManager.Get("subeditor.price"), textAlignment: Alignment.CenterLeft, wrap: true);
|
||||
|
||||
int basePrice = GameMain.DebugDraw ? 0 : Submarine.MainSub?.CalculateBasePrice() ?? 1000;
|
||||
int basePrice = (GameMain.DebugDraw ? 0 : Submarine.MainSub?.CalculateBasePrice()) ?? 1000;
|
||||
new GUINumberInput(new RectTransform(new Vector2(0.4f, 1.0f), priceGroup.RectTransform), GUINumberInput.NumberType.Int, hidePlusMinusButtons: true)
|
||||
{
|
||||
IntValue = Math.Max(Submarine.MainSub?.Info?.Price ?? basePrice, basePrice),
|
||||
@@ -2591,6 +2732,38 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
private void SnapToGrid()
|
||||
{
|
||||
// First move components
|
||||
foreach (Item item in MapEntity.SelectedList.Where(entity => entity is Item).Cast<Item>())
|
||||
{
|
||||
var wire = item.GetComponent<Wire>();
|
||||
if (wire == null)
|
||||
{
|
||||
// Items snap to centre of nearest grid square
|
||||
Vector2 offset = item.Position;
|
||||
offset = new Vector2((MathF.Floor(offset.X / Submarine.GridSize.X) + .5f) * Submarine.GridSize.X - offset.X, (MathF.Floor(offset.Y / Submarine.GridSize.Y) + .5f) * Submarine.GridSize.Y - offset.Y);
|
||||
item.Move(offset);
|
||||
}
|
||||
}
|
||||
|
||||
// Then move wires, separated as moving components also moves the start and end node of wires
|
||||
foreach (Item item in MapEntity.SelectedList.Where(entity => entity is Item).Cast<Item>())
|
||||
{
|
||||
var wire = item.GetComponent<Wire>();
|
||||
if (wire != null)
|
||||
{
|
||||
for (int i = 0; i < wire.GetNodes().Count; i++)
|
||||
{
|
||||
// Items wire nodes to centre of nearest grid square
|
||||
Vector2 offset = wire.GetNodes()[i] + Submarine.MainSub.HiddenSubPosition;
|
||||
offset = new Vector2((MathF.Floor(offset.X / Submarine.GridSize.X) + .5f) * Submarine.GridSize.X - offset.X, (MathF.Floor(offset.Y / Submarine.GridSize.Y) + .5f) * Submarine.GridSize.Y - offset.Y);
|
||||
wire.MoveNode(i, offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateLoadScreen()
|
||||
{
|
||||
CloseItem();
|
||||
@@ -2890,6 +3063,8 @@ namespace Barotrauma
|
||||
};
|
||||
adjustLightsPrompt.Buttons[1].OnClicked += adjustLightsPrompt.Close;
|
||||
}
|
||||
|
||||
ReconstructLayers();
|
||||
}
|
||||
|
||||
private void TryDeleteSub(SubmarineInfo sub)
|
||||
@@ -3075,6 +3250,8 @@ namespace Barotrauma
|
||||
if (container == null || container.DrawInventory) { target = item; }
|
||||
}
|
||||
|
||||
bool hasTargets = targets.Count > 0;
|
||||
|
||||
// Holding shift brings up special context menu options
|
||||
if (PlayerInput.IsShiftDown())
|
||||
{
|
||||
@@ -3083,7 +3260,7 @@ namespace Barotrauma
|
||||
new ContextMenuOption("SubEditor.ToggleTransparency", isEnabled: true, onSelected: () => TransparentWiringMode = !TransparentWiringMode),
|
||||
new ContextMenuOption("SubEditor.ToggleGrid", isEnabled: true, onSelected: () => ShouldDrawGrid = !ShouldDrawGrid),
|
||||
new ContextMenuOption("SubEditor.PasteAssembly", isEnabled: true, () => PasteAssembly()),
|
||||
new ContextMenuOption("Editor.SelectSame", isEnabled: targets.Count > 0, onSelected: delegate
|
||||
new ContextMenuOption("Editor.SelectSame", isEnabled: hasTargets, onSelected: delegate
|
||||
{
|
||||
bool doorGapSelected = targets.Any(t => t is Gap gap && gap.ConnectedDoor != null);
|
||||
foreach (MapEntity match in MapEntity.mapEntityList.Where(e => e.prefab != null && targets.Any(t => t.prefab?.Identifier == e.prefab.Identifier) && !MapEntity.SelectedList.Contains(e)))
|
||||
@@ -3115,12 +3292,43 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
List<ContextMenuOption> availableLayerOptions = new List<ContextMenuOption>
|
||||
{
|
||||
new ContextMenuOption("editor.layer.nolayer", true, onSelected: () => { MoveToLayer(null, targets); })
|
||||
};
|
||||
|
||||
availableLayerOptions.AddRange(Layers.Select(layer => new ContextMenuOption(layer.Key, true, onSelected: () => { MoveToLayer(layer.Key, targets); })));
|
||||
|
||||
ContextMenuOption[] layerOptions =
|
||||
{
|
||||
new ContextMenuOption("editor.layer.movetolayer", isEnabled: hasTargets, availableLayerOptions.ToArray()),
|
||||
new ContextMenuOption("editor.layer.createlayer", isEnabled: hasTargets, onSelected: () => { CreateNewLayer(null, targets); }),
|
||||
new ContextMenuOption("editor.layer.selectall", isEnabled: hasTargets, onSelected: () =>
|
||||
{
|
||||
foreach (MapEntity match in MapEntity.mapEntityList.Where(e => targets.Any(t => !string.IsNullOrWhiteSpace(t.Layer) && t.Layer == e.Layer && !MapEntity.SelectedList.Contains(e))))
|
||||
{
|
||||
if (MapEntity.SelectedList.Contains(match)) { continue; }
|
||||
MapEntity.SelectedList.Add(match);
|
||||
}
|
||||
}),
|
||||
new ContextMenuOption("editor.layer.openlayermenu", isEnabled: true, onSelected: () =>
|
||||
{
|
||||
previouslyUsedPanel.Visible = false;
|
||||
undoBufferPanel.Visible = false;
|
||||
showEntitiesPanel.Visible = false;
|
||||
layerPanel.Visible = !layerPanel.Visible;
|
||||
layerPanel.RectTransform.AbsoluteOffset = new Point(Math.Max(Math.Max(visibilityButton.Rect.X, entityCountPanel.Rect.Right), saveAssemblyFrame.Rect.Right), TopPanel.Rect.Height);
|
||||
})
|
||||
};
|
||||
|
||||
GUIContextMenu.CreateContextMenu(
|
||||
new ContextMenuOption("label.openlabel", isEnabled: target != null, onSelected: () => OpenItem(target)),
|
||||
new ContextMenuOption("editor.cut", isEnabled: targets.Count > 0, onSelected: () => MapEntity.Cut(targets)),
|
||||
new ContextMenuOption("editor.copytoclipboard", isEnabled: targets.Count > 0, onSelected: () => MapEntity.Copy(targets)),
|
||||
new ContextMenuOption("editor.paste", isEnabled: MapEntity.CopiedList.Any(), onSelected: () => MapEntity.Paste(cam.ScreenToWorld(PlayerInput.MousePosition))),
|
||||
new ContextMenuOption("delete", isEnabled: targets.Count > 0, onSelected: delegate
|
||||
new ContextMenuOption("label.openlabel", isEnabled: target != null, onSelected: () => OpenItem(target)),
|
||||
new ContextMenuOption("editor.layer", isEnabled: hasTargets, layerOptions),
|
||||
new ContextMenuOption("editor.cut", isEnabled: hasTargets, onSelected: () => MapEntity.Cut(targets)),
|
||||
new ContextMenuOption("editor.copytoclipboard", isEnabled: hasTargets, onSelected: () => MapEntity.Copy(targets)),
|
||||
new ContextMenuOption("editor.paste", isEnabled: MapEntity.CopiedList.Any(), onSelected: () => MapEntity.Paste(cam.ScreenToWorld(PlayerInput.MousePosition))),
|
||||
new ContextMenuOption("delete", isEnabled: hasTargets, onSelected: delegate
|
||||
{
|
||||
StoreCommand(new AddOrDeleteCommand(targets, true));
|
||||
foreach (var me in targets)
|
||||
@@ -3131,6 +3339,76 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveToLayer(string layer, List<MapEntity> content)
|
||||
{
|
||||
layer ??= string.Empty;
|
||||
|
||||
foreach (MapEntity entity in content)
|
||||
{
|
||||
entity.Layer = layer;
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateNewLayer(string name, List<MapEntity> content)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
name = TextManager.Get("editor.layer.newlayer");
|
||||
}
|
||||
|
||||
string incrementedName = name;
|
||||
|
||||
for (int i = 1; Layers.ContainsKey(incrementedName); i++)
|
||||
{
|
||||
incrementedName = $"{name} ({i})";
|
||||
}
|
||||
|
||||
name = incrementedName;
|
||||
|
||||
if (content != null)
|
||||
{
|
||||
MoveToLayer(name, content);
|
||||
}
|
||||
|
||||
Layers.Add(name, LayerData.Default);
|
||||
UpdateLayerPanel();
|
||||
}
|
||||
|
||||
private void RenameLayer(string original, string newName)
|
||||
{
|
||||
Layers.Remove(original);
|
||||
|
||||
foreach (MapEntity entity in MapEntity.mapEntityList.Where(entity => entity.Layer == original))
|
||||
{
|
||||
entity.Layer = newName ?? string.Empty;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(newName))
|
||||
{
|
||||
Layers.TryAdd(newName, LayerData.Default);
|
||||
}
|
||||
UpdateLayerPanel();
|
||||
}
|
||||
|
||||
private void ReconstructLayers()
|
||||
{
|
||||
ClearLayers();
|
||||
foreach (MapEntity entity in MapEntity.mapEntityList)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(entity.Layer))
|
||||
{
|
||||
Layers.TryAdd(entity.Layer, LayerData.Default);
|
||||
}
|
||||
}
|
||||
UpdateLayerPanel();
|
||||
}
|
||||
|
||||
private void ClearLayers()
|
||||
{
|
||||
Layers.Clear();
|
||||
UpdateLayerPanel();
|
||||
}
|
||||
|
||||
private void PasteAssembly(string text = null, Vector2? pos = null)
|
||||
{
|
||||
pos ??= cam.ScreenToWorld(PlayerInput.MousePosition);
|
||||
@@ -4044,6 +4322,7 @@ namespace Barotrauma
|
||||
previouslyUsedPanel.AddToGUIUpdateList();
|
||||
undoBufferPanel.AddToGUIUpdateList();
|
||||
entityCountPanel.AddToGUIUpdateList();
|
||||
layerPanel.AddToGUIUpdateList();
|
||||
TopPanel.AddToGUIUpdateList();
|
||||
|
||||
if (WiringMode)
|
||||
@@ -4147,9 +4426,92 @@ namespace Barotrauma
|
||||
GameMain.SubEditorScreen.UpdateUndoHistoryPanel();
|
||||
}
|
||||
|
||||
private void UpdateLayerPanel()
|
||||
{
|
||||
if (layerPanel is null || layerList is null) { return; }
|
||||
|
||||
layerList.Content.ClearChildren();
|
||||
|
||||
layerList.Deselect();
|
||||
GUILayoutGroup buttonHeaders = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.075f), layerList.Content.RectTransform), isHorizontal: true, childAnchor: Anchor.BottomLeft);
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.25f, 1f), buttonHeaders.RectTransform), TextManager.Get("editor.layer.headervisible"), style: "GUIButtonSmallFreeScale") { ForceUpperCase = true };
|
||||
new GUIButton(new RectTransform(new Vector2(0.15f, 1f), buttonHeaders.RectTransform), TextManager.Get("editor.layer.headerlink"), style: "GUIButtonSmallFreeScale") { ForceUpperCase = true };
|
||||
new GUIButton(new RectTransform(new Vector2(0.6f, 1f), buttonHeaders.RectTransform), TextManager.Get("name"), style: "GUIButtonSmallFreeScale") { ForceUpperCase = true };
|
||||
|
||||
foreach (var (layer, (visibility, linkage)) in Layers)
|
||||
{
|
||||
GUIFrame parent = new GUIFrame(new RectTransform(new Vector2(1f, 0.1f), layerList.Content.RectTransform), style: "ListBoxElement")
|
||||
{
|
||||
UserData = layer
|
||||
};
|
||||
|
||||
GUILayoutGroup layerGroup = new GUILayoutGroup(new RectTransform(Vector2.One, parent.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
||||
|
||||
GUILayoutGroup layerVisibilityLayout = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 1f), layerGroup.RectTransform), childAnchor: Anchor.Center);
|
||||
GUITickBox layerVisibleButton = new GUITickBox(new RectTransform(Vector2.One, layerVisibilityLayout.RectTransform, scaleBasis: ScaleBasis.BothHeight), string.Empty)
|
||||
{
|
||||
Selected = visibility == LayerVisibility.Visible,
|
||||
OnSelected = box =>
|
||||
{
|
||||
if (!Layers.TryGetValue(layer, out LayerData data))
|
||||
{
|
||||
UpdateLayerPanel();
|
||||
return false;
|
||||
}
|
||||
|
||||
Layers[layer] = new LayerData(box.Selected ? LayerVisibility.Visible : LayerVisibility.Invisible, data.Linkage);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
GUILayoutGroup layerChainLayout = new GUILayoutGroup(new RectTransform(new Vector2(0.15f, 1f), layerGroup.RectTransform), childAnchor: Anchor.Center);
|
||||
GUITickBox layerChainButton = new GUITickBox(new RectTransform(Vector2.One, layerChainLayout.RectTransform, scaleBasis: ScaleBasis.BothHeight), string.Empty)
|
||||
{
|
||||
Selected = linkage == LayerLinkage.Linked,
|
||||
OnSelected = box =>
|
||||
{
|
||||
if (!Layers.TryGetValue(layer, out LayerData data))
|
||||
{
|
||||
UpdateLayerPanel();
|
||||
return false;
|
||||
}
|
||||
|
||||
Layers[layer] = new LayerData(data.Visible, box.Selected ? LayerLinkage.Linked : LayerLinkage.Unlinked);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
layerGroup.Recalculate();
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1f), layerGroup.RectTransform), layer, textAlignment: Alignment.CenterLeft)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
layerGroup.Recalculate();
|
||||
layerChainLayout.Recalculate();
|
||||
layerVisibilityLayout.Recalculate();
|
||||
}
|
||||
|
||||
layerList.RecalculateChildren();
|
||||
buttonHeaders.Recalculate();
|
||||
foreach (var child in buttonHeaders.Children)
|
||||
{
|
||||
var btn = child as GUIButton;
|
||||
string originalBtnText = btn.Text;
|
||||
btn.Text = ToolBox.LimitString(btn.Text, btn.Font, btn.Rect.Width);
|
||||
if (originalBtnText != btn.Text)
|
||||
{
|
||||
btn.ToolTip = originalBtnText;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void UpdateUndoHistoryPanel()
|
||||
{
|
||||
if (undoBufferPanel == null) { return; }
|
||||
if (undoBufferPanel is null) { return; }
|
||||
|
||||
undoBufferDisclaimer.Visible = mode == Mode.Wiring;
|
||||
|
||||
@@ -4203,13 +4565,14 @@ namespace Barotrauma
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
SkipInventorySlotUpdate = false;
|
||||
ImageManager.Update((float) deltaTime);
|
||||
ImageManager.Update((float)deltaTime);
|
||||
|
||||
if (GameMain.GraphicsWidth != screenResolution.X || GameMain.GraphicsHeight != screenResolution.Y)
|
||||
{
|
||||
saveFrame = null;
|
||||
loadFrame = null;
|
||||
saveAssemblyFrame = null;
|
||||
snapToGridFrame = null;
|
||||
CreateUI();
|
||||
UpdateEntityList();
|
||||
}
|
||||
@@ -4257,6 +4620,7 @@ namespace Barotrauma
|
||||
hullVolumeFrame.Visible = MapEntity.SelectedList.Any(s => s is Hull);
|
||||
hullVolumeFrame.RectTransform.AbsoluteOffset = new Point(Math.Max(showEntitiesPanel.Rect.Right, previouslyUsedPanel.Rect.Right), 0);
|
||||
saveAssemblyFrame.Visible = MapEntity.SelectedList.Count > 0;
|
||||
snapToGridFrame.Visible = MapEntity.SelectedList.Count > 0;
|
||||
|
||||
var offset = cam.WorldView.Top - cam.ScreenToWorld(new Vector2(0, GameMain.GraphicsHeight - EntityMenu.Rect.Top)).Y;
|
||||
|
||||
@@ -4718,8 +5082,14 @@ namespace Barotrauma
|
||||
MouseDragStart = Vector2.Zero;
|
||||
}
|
||||
|
||||
if (!saveAssemblyFrame.Rect.Contains(PlayerInput.MousePosition) && dummyCharacter?.SelectedConstruction == null && !WiringMode && GUI.MouseOn == null)
|
||||
if (!saveAssemblyFrame.Rect.Contains(PlayerInput.MousePosition) && !snapToGridFrame.Rect.Contains(PlayerInput.MousePosition) &&
|
||||
dummyCharacter?.SelectedConstruction == null && !WiringMode && GUI.MouseOn == null)
|
||||
{
|
||||
if (layerList is { Visible: true } && GUI.KeyboardDispatcher.Subscriber == layerList)
|
||||
{
|
||||
GUI.KeyboardDispatcher.Subscriber = null;
|
||||
}
|
||||
|
||||
MapEntity.UpdateSelecting(cam);
|
||||
}
|
||||
|
||||
@@ -4998,7 +5368,7 @@ namespace Barotrauma
|
||||
|
||||
var prevScissorRect = GameMain.Instance.GraphicsDevice.ScissorRectangle;
|
||||
|
||||
Rectangle subDimensions = Submarine.MainSub.CalculateDimensions(false);
|
||||
Rectangle subDimensions = Submarine.MainSub.CalculateDimensions(onlyHulls: false);
|
||||
Vector2 viewPos = subDimensions.Center.ToVector2();
|
||||
float scale = Math.Min(width / (float)subDimensions.Width, height / (float)subDimensions.Height);
|
||||
|
||||
@@ -5087,5 +5457,36 @@ namespace Barotrauma
|
||||
public static bool IsSubEditor() => Screen.Selected is SubEditorScreen && !Submarine.Unloading;
|
||||
public static bool IsWiringMode() => Screen.Selected == GameMain.SubEditorScreen && GameMain.SubEditorScreen.WiringMode && !Submarine.Unloading;
|
||||
|
||||
public static bool IsLayerVisible(MapEntity entity)
|
||||
{
|
||||
if (!IsSubEditor() || string.IsNullOrWhiteSpace(entity.Layer)) { return true; }
|
||||
|
||||
if (!Layers.TryGetValue(entity.Layer, out LayerData data))
|
||||
{
|
||||
Layers.TryAdd(entity.Layer, LayerData.Default);
|
||||
return true;
|
||||
}
|
||||
|
||||
return data.Visible == LayerVisibility.Visible;
|
||||
}
|
||||
|
||||
public static bool IsLayerLinked(MapEntity entity)
|
||||
{
|
||||
if (!IsSubEditor() || string.IsNullOrWhiteSpace(entity.Layer)) { return false; }
|
||||
|
||||
if (!Layers.TryGetValue(entity.Layer, out LayerData data))
|
||||
{
|
||||
Layers.TryAdd(entity.Layer, LayerData.Default);
|
||||
return true;
|
||||
}
|
||||
|
||||
return data.Linkage == LayerLinkage.Linked;
|
||||
}
|
||||
|
||||
public static ImmutableHashSet<MapEntity> GetEntitiesInSameLayer(MapEntity entity)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(entity.Layer)) { return ImmutableHashSet<MapEntity>.Empty; }
|
||||
return MapEntity.mapEntityList.Where(me => me.Layer == entity.Layer).ToImmutableHashSet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace Barotrauma
|
||||
private Submarine? submarine;
|
||||
private Character? dummyCharacter;
|
||||
public static Effect BlueprintEffect;
|
||||
private GUIFrame container;
|
||||
|
||||
private TabMenu tabMenu;
|
||||
|
||||
@@ -42,34 +43,37 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
// dummyCharacter.Info.Name = "Galldren";
|
||||
// dummyCharacter.Inventory.CreateSlots();
|
||||
|
||||
Character.Controlled = dummyCharacter;
|
||||
GameMain.World.ProcessChanges();
|
||||
TabMenu.selectedTab = TabMenu.InfoFrameTab.Talents;
|
||||
tabMenu = new TabMenu();
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
Frame.AddToGUIUpdateList();
|
||||
CharacterHUD.AddToGUIUpdateList(dummyCharacter);
|
||||
dummyCharacter?.SelectedConstruction?.AddToGUIUpdateList();
|
||||
tabMenu.AddToGUIUpdateList();
|
||||
container.AddToGUIUpdateList();
|
||||
// CharacterHUD.AddToGUIUpdateList(dummyCharacter);
|
||||
// dummyCharacter?.SelectedConstruction?.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override void Update(double deltaTime)
|
||||
@@ -92,12 +96,12 @@ namespace Barotrauma
|
||||
graphics.Clear(BackgroundColor);
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront, transformMatrix: Cam.Transform);
|
||||
miniMapItem?.Draw(spriteBatch, false);
|
||||
if (dummyCharacter is { } dummy)
|
||||
{
|
||||
dummyCharacter.DrawFront(spriteBatch, Cam);
|
||||
dummyCharacter.Draw(spriteBatch, Cam);
|
||||
}
|
||||
// miniMapItem?.Draw(spriteBatch, false);
|
||||
// if (dummyCharacter is { } dummy)
|
||||
// {
|
||||
// dummyCharacter.DrawFront(spriteBatch, Cam);
|
||||
// dummyCharacter.Draw(spriteBatch, Cam);
|
||||
// }
|
||||
spriteBatch.End();
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, samplerState: GUI.SamplerState);
|
||||
|
||||
Reference in New Issue
Block a user