(ae643deeb) Added alive checks to a couple of diving gear status effects (don't consume tanks when dead)
This commit is contained in:
@@ -62,7 +62,7 @@ namespace Barotrauma
|
||||
|
||||
UpdateSubList(submarines);
|
||||
|
||||
// New game right side
|
||||
// New game right sideon
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), rightColumn.RectTransform), TextManager.Get("SaveName") + ":", textAlignment: Alignment.BottomLeft);
|
||||
saveNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.1f), rightColumn.RectTransform), string.Empty);
|
||||
|
||||
@@ -262,11 +262,6 @@ namespace Barotrauma
|
||||
saveFiles = SaveUtil.GetSaveFiles(isMultiplayer ? SaveUtil.SaveType.Multiplayer : SaveUtil.SaveType.Singleplayer);
|
||||
}
|
||||
|
||||
saveList = new GUIListBox(new RectTransform(new Vector2(0.5f, 1.0f), loadGameContainer.RectTransform, Anchor.CenterLeft))
|
||||
{
|
||||
OnSelected = SelectSaveFile
|
||||
};
|
||||
|
||||
saveList = new GUIListBox(new RectTransform(new Vector2(0.5f, 1.0f), loadGameContainer.RectTransform, Anchor.CenterLeft))
|
||||
{
|
||||
OnSelected = SelectSaveFile
|
||||
@@ -274,7 +269,9 @@ namespace Barotrauma
|
||||
|
||||
foreach (string saveFile in saveFiles)
|
||||
{
|
||||
XDocument doc = SaveUtil.LoadGameSessionDoc(saveFile);
|
||||
string fileName = saveFile;
|
||||
string subName = "";
|
||||
string saveTime = "";
|
||||
var saveFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.1f), saveList.Content.RectTransform), style: "ListBoxElement")
|
||||
{
|
||||
UserData = saveFile
|
||||
@@ -282,25 +279,38 @@ namespace Barotrauma
|
||||
|
||||
var nameText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), saveFrame.RectTransform),
|
||||
text: Path.GetFileNameWithoutExtension(saveFile));
|
||||
if (doc?.Root == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error loading save file \"" + saveFile + "\". The file may be corrupted.");
|
||||
nameText.Color = Color.Red;
|
||||
continue;
|
||||
}
|
||||
|
||||
string submarineName = doc.Root.GetAttributeString("submarine", "");
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), saveFrame.RectTransform, Anchor.BottomLeft),
|
||||
text: submarineName, font: GUI.SmallFont)
|
||||
if (!isMultiplayer)
|
||||
{
|
||||
UserData = saveFile
|
||||
XDocument doc = SaveUtil.LoadGameSessionDoc(saveFile);
|
||||
if (doc?.Root == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error loading save file \"" + saveFile + "\". The file may be corrupted.");
|
||||
nameText.Color = Color.Red;
|
||||
continue;
|
||||
}
|
||||
subName = doc.Root.GetAttributeString("submarine", "");
|
||||
saveTime = doc.Root.GetAttributeString("savetime", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] splitSaveFile = saveFile.Split(';');
|
||||
saveFrame.UserData = splitSaveFile[0];
|
||||
fileName = nameText.Text = Path.GetFileNameWithoutExtension(splitSaveFile[0]);
|
||||
if (splitSaveFile.Length > 1) { subName = splitSaveFile[1]; }
|
||||
if (splitSaveFile.Length > 2) { saveTime = splitSaveFile[2]; }
|
||||
}
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), saveFrame.RectTransform, Anchor.BottomLeft),
|
||||
text: subName, font: GUI.SmallFont)
|
||||
{
|
||||
UserData = fileName
|
||||
};
|
||||
|
||||
string saveTime = doc.Root.GetAttributeString("savetime", "");
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), saveFrame.RectTransform),
|
||||
text: saveTime, textAlignment: Alignment.Right, font: GUI.SmallFont)
|
||||
{
|
||||
UserData = saveFile
|
||||
UserData = fileName
|
||||
};
|
||||
}
|
||||
|
||||
@@ -345,13 +355,6 @@ namespace Barotrauma
|
||||
};
|
||||
}
|
||||
|
||||
public void UpdateTutorialSelection()
|
||||
{
|
||||
if (isMultiplayer) return;
|
||||
Tutorial contextualTutorial = Tutorial.Tutorials.Find(t => t is ContextualTutorial);
|
||||
contextualTutorialBox.Selected = (contextualTutorial != null) ? !GameMain.Config.CompletedTutorialNames.Contains(contextualTutorial.Name) : true;
|
||||
}
|
||||
|
||||
public void UpdateTutorialSelection()
|
||||
{
|
||||
if (isMultiplayer) return;
|
||||
|
||||
@@ -457,11 +457,14 @@ namespace Barotrauma
|
||||
{
|
||||
IgnoreLayoutGroups = true,
|
||||
OnClicked = (GUIButton btn, object obj) => { StartRound?.Invoke(); return true; },
|
||||
Enabled = true,
|
||||
Visible = GameMain.Client == null ||
|
||||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign)
|
||||
Enabled = true
|
||||
};
|
||||
if (GameMain.Client != null)
|
||||
{
|
||||
startButton.Visible = !GameMain.Client.GameStarted &&
|
||||
(GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign));
|
||||
}
|
||||
}
|
||||
|
||||
OnLocationSelected?.Invoke(location, connection);
|
||||
|
||||
@@ -118,6 +118,19 @@ namespace Barotrauma
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
AnimParams.ForEach(a => a.Reset(true));
|
||||
RagdollParams.Reset(true);
|
||||
RagdollParams.ClearHistory();
|
||||
CurrentAnimation.ClearHistory();
|
||||
if (!character.Removed)
|
||||
{
|
||||
character.Remove();
|
||||
}
|
||||
character = null;
|
||||
}
|
||||
|
||||
public override void Deselect()
|
||||
{
|
||||
base.Deselect();
|
||||
@@ -128,15 +141,7 @@ namespace Barotrauma
|
||||
isEndlessRunner = false;
|
||||
if (character != null)
|
||||
{
|
||||
AnimParams.ForEach(a => a.Reset(true));
|
||||
RagdollParams.Reset(true);
|
||||
RagdollParams.ClearHistory();
|
||||
CurrentAnimation.ClearHistory();
|
||||
if (!character.Removed)
|
||||
{
|
||||
character.Remove();
|
||||
}
|
||||
character = null;
|
||||
Reset();
|
||||
}
|
||||
GameMain.World.ProcessChanges();
|
||||
}
|
||||
@@ -393,6 +398,12 @@ namespace Barotrauma
|
||||
}
|
||||
if (!isFreezed)
|
||||
{
|
||||
if (character.AnimController.Invalid)
|
||||
{
|
||||
Reset();
|
||||
SpawnCharacter(currentCharacterConfig);
|
||||
}
|
||||
|
||||
Submarine.MainSub.SetPrevTransform(Submarine.MainSub.Position);
|
||||
Submarine.MainSub.Update((float)deltaTime);
|
||||
|
||||
@@ -1215,7 +1226,7 @@ namespace Barotrauma
|
||||
Cam.Position = character.WorldPosition;
|
||||
}
|
||||
|
||||
private bool CreateCharacter(string name, bool isHumanoid, params object[] ragdollConfig)
|
||||
private bool CreateCharacter(string name, string mainFolder, bool isHumanoid, params object[] ragdollConfig)
|
||||
{
|
||||
var contentPackage = GameMain.Config.SelectedContentPackages.LastOrDefault();
|
||||
if (contentPackage == null)
|
||||
@@ -1228,23 +1239,22 @@ namespace Barotrauma
|
||||
#if !DEBUG
|
||||
if (vanilla != null && contentPackage == vanilla)
|
||||
{
|
||||
GUI.AddMessage($"Cannot edit the Vanilla content!", Color.Red, font: GUI.LargeFont);
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("CannotEditVanillaCharacters"), Color.Red, font: GUI.LargeFont);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
string speciesName = name;
|
||||
string mainFolder = $"Content/Characters/{speciesName}";
|
||||
// Config file
|
||||
string configFilePath = $"{mainFolder}/{speciesName}.xml";
|
||||
string configFilePath = Path.Combine(mainFolder, $"{speciesName}.xml").Replace(@"\", @"/");
|
||||
if (ContentPackage.GetFilesOfType(GameMain.SelectedPackages, ContentType.Character).None(path => path.Contains(speciesName)))
|
||||
{
|
||||
// Create the config file
|
||||
XElement mainElement = new XElement("Character",
|
||||
new XAttribute("name", speciesName),
|
||||
new XAttribute("humanoid", isHumanoid),
|
||||
new XElement("ragdolls"),
|
||||
new XElement("animations"),
|
||||
new XElement("ragdolls", new XAttribute("folder", Path.Combine(mainFolder, $"Ragdolls/").Replace(@"\", @"/"))),
|
||||
new XElement("animations", new XAttribute("folder", Path.Combine(mainFolder, $"Animations/").Replace(@"\", @"/"))),
|
||||
new XElement("health"),
|
||||
new XElement("ai"));
|
||||
XDocument doc = new XDocument(mainElement);
|
||||
@@ -1259,13 +1269,13 @@ namespace Barotrauma
|
||||
DebugConsole.NewMessage(GetCharacterEditorTranslation("ContentPackageSaved").Replace("[path]", contentPackage.Path));
|
||||
}
|
||||
// Ragdoll
|
||||
string ragdollFolder = RagdollParams.GetDefaultFolder(speciesName);
|
||||
string ragdollFolder = RagdollParams.GetFolder(speciesName);
|
||||
string ragdollPath = RagdollParams.GetDefaultFile(speciesName);
|
||||
RagdollParams ragdollParams = isHumanoid
|
||||
? RagdollParams.CreateDefault<HumanRagdollParams>(ragdollPath, speciesName, ragdollConfig)
|
||||
: RagdollParams.CreateDefault<FishRagdollParams>(ragdollPath, speciesName, ragdollConfig) as RagdollParams;
|
||||
// Animations
|
||||
string animFolder = AnimationParams.GetDefaultFolder(speciesName);
|
||||
string animFolder = AnimationParams.GetFolder(speciesName);
|
||||
foreach (AnimationType animType in Enum.GetValues(typeof(AnimationType)))
|
||||
{
|
||||
if (animType != AnimationType.NotDefined)
|
||||
@@ -1869,7 +1879,7 @@ namespace Barotrauma
|
||||
#if !DEBUG
|
||||
if (VanillaCharacters != null && VanillaCharacters.Contains(currentCharacterConfig))
|
||||
{
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("CantEditVanillaContent"), Color.Red, font: GUI.LargeFont);
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("CannotEditVanillaCharacters"), Color.Red, font: GUI.LargeFont);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -1884,7 +1894,7 @@ namespace Barotrauma
|
||||
#if !DEBUG
|
||||
if (VanillaCharacters != null && VanillaCharacters.Contains(currentCharacterConfig))
|
||||
{
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("CantEditVanillaContent"), Color.Red, font: GUI.LargeFont);
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("CannotEditVanillaCharacters"), Color.Red, font: GUI.LargeFont);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -1956,7 +1966,7 @@ namespace Barotrauma
|
||||
#if !DEBUG
|
||||
if (VanillaCharacters != null && VanillaCharacters.Contains(currentCharacterConfig))
|
||||
{
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("CantEditVanillaContent"), Color.Red, font: GUI.LargeFont);
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("CannotEditVanillaCharacters"), Color.Red, font: GUI.LargeFont);
|
||||
box.Close();
|
||||
return false;
|
||||
}
|
||||
@@ -2089,7 +2099,7 @@ namespace Barotrauma
|
||||
#if !DEBUG
|
||||
if (VanillaCharacters != null && VanillaCharacters.Contains(currentCharacterConfig))
|
||||
{
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("CantEditVanillaContent"), Color.Red, font: GUI.LargeFont);
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("CannotEditVanillaCharacters"), Color.Red, font: GUI.LargeFont);
|
||||
box.Close();
|
||||
return false;
|
||||
}
|
||||
@@ -3918,7 +3928,7 @@ namespace Barotrauma
|
||||
|
||||
private void DrawJointLimitWidgets(SpriteBatch spriteBatch, Limb limb, LimbJoint joint, Vector2 drawPos, bool autoFreeze, bool allowPairEditing, float rotationOffset = 0)
|
||||
{
|
||||
rotationOffset -= MathHelper.ToRadians(RagdollParams.SpritesheetOrientation);
|
||||
rotationOffset += MathHelper.ToRadians(RagdollParams.SpritesheetOrientation);
|
||||
Color angleColor = joint.UpperLimit - joint.LowerLimit > 0 ? Color.LightGreen * 0.5f : Color.Red;
|
||||
DrawRadialWidget(spriteBatch, drawPos, MathHelper.ToDegrees(joint.UpperLimit), $"joint.jointParams.Name {GetCharacterEditorTranslation("UpperLimit")}", Color.Cyan, angle =>
|
||||
{
|
||||
@@ -4652,7 +4662,7 @@ namespace Barotrauma
|
||||
LimbXElements.Values,
|
||||
JointXElements
|
||||
};
|
||||
if (CharacterEditorScreen.instance.CreateCharacter(Name, IsHumanoid, ragdollParams))
|
||||
if (CharacterEditorScreen.instance.CreateCharacter(Name, Path.GetDirectoryName(XMLPath), IsHumanoid, ragdollParams))
|
||||
{
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("CharacterCreated").Replace("[name]", Name), Color.Green, font: GUI.Font);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Barotrauma
|
||||
new GUIImage(new RectTransform(new Vector2(0.35f, 0.2f), Frame.RectTransform, Anchor.BottomRight) { RelativeOffset = new Vector2(0.05f, 0.05f) },
|
||||
style: "TitleText");
|
||||
|
||||
buttonsParent = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 0.85f), parent: Frame.RectTransform, anchor: Anchor.BottomLeft, pivot: Pivot.BottomLeft)
|
||||
buttonsParent = new GUILayoutGroup(new RectTransform(new Vector2(0.3f, 0.85f), parent: Frame.RectTransform, anchor: Anchor.BottomLeft, pivot: Pivot.BottomLeft)
|
||||
{
|
||||
AbsoluteOffset = new Point(50, 0)
|
||||
})
|
||||
@@ -61,7 +61,7 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
// === CAMPAIGN
|
||||
var campaignHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 1.0f), parent: buttonsParent.RectTransform) { RelativeOffset = new Vector2(0.1f, 0.0f) }, isHorizontal: true);
|
||||
var campaignHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 1.0f), parent: buttonsParent.RectTransform) { RelativeOffset = new Vector2(0.1f, 0.0f) }, isHorizontal: true);
|
||||
|
||||
new GUIImage(new RectTransform(new Vector2(0.2f, 0.7f), campaignHolder.RectTransform), "MainMenuCampaignIcon")
|
||||
{
|
||||
@@ -107,7 +107,7 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
// === MULTIPLAYER
|
||||
var multiplayerHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 1.0f), parent: buttonsParent.RectTransform) { RelativeOffset = new Vector2(0.05f, 0.0f) }, isHorizontal: true);
|
||||
var multiplayerHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 1.0f), parent: buttonsParent.RectTransform) { RelativeOffset = new Vector2(0.05f, 0.0f) }, isHorizontal: true);
|
||||
|
||||
new GUIImage(new RectTransform(new Vector2(0.2f, 0.7f), multiplayerHolder.RectTransform), "MainMenuMultiplayerIcon")
|
||||
{
|
||||
@@ -152,7 +152,7 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
// === CUSTOMIZE
|
||||
var customizeHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 1.0f), parent: buttonsParent.RectTransform) { RelativeOffset = new Vector2(0.15f, 0.0f) }, isHorizontal: true);
|
||||
var customizeHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 1.0f), parent: buttonsParent.RectTransform) { RelativeOffset = new Vector2(0.15f, 0.0f) }, isHorizontal: true);
|
||||
|
||||
new GUIImage(new RectTransform(new Vector2(0.2f, 0.7f), customizeHolder.RectTransform), "MainMenuCustomizeIcon")
|
||||
{
|
||||
@@ -209,7 +209,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
// === OPTION
|
||||
var optionHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 0.5f), parent: buttonsParent.RectTransform), isHorizontal: true);
|
||||
var optionHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.5f), parent: buttonsParent.RectTransform), isHorizontal: true);
|
||||
|
||||
new GUIImage(new RectTransform(new Vector2(0.15f, 0.6f), optionHolder.RectTransform), "MainMenuOptionIcon")
|
||||
{
|
||||
@@ -219,7 +219,7 @@ namespace Barotrauma
|
||||
//spacing
|
||||
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.0f), optionHolder.RectTransform), style: null);
|
||||
|
||||
var optionButtons = new GUILayoutGroup(new RectTransform(new Vector2(0.55f, 1.0f), parent: optionHolder.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.15f) });
|
||||
var optionButtons = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 1.0f), parent: optionHolder.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.15f) });
|
||||
|
||||
var optionList = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 0.15f), parent: optionButtons.RectTransform))
|
||||
{
|
||||
@@ -241,7 +241,7 @@ namespace Barotrauma
|
||||
|
||||
//debug button for quickly starting a new round
|
||||
#if DEBUG
|
||||
new GUIButton(new RectTransform(new Vector2(0.5f, 0.1f), buttonsParent.RectTransform, Anchor.TopLeft, Pivot.BottomLeft) { AbsoluteOffset = new Point(0, -40) },
|
||||
new GUIButton(new RectTransform(new Vector2(0.8f, 0.1f), buttonsParent.RectTransform, Anchor.TopLeft, Pivot.BottomLeft) { AbsoluteOffset = new Point(0, -40) },
|
||||
"Quickstart (dev)", style: "GUIButtonLarge", color: Color.Red)
|
||||
{
|
||||
IgnoreLayoutGroups = true,
|
||||
@@ -255,7 +255,7 @@ namespace Barotrauma
|
||||
#endif
|
||||
|
||||
var minButtonSize = new Point(120, 20);
|
||||
var maxButtonSize = new Point(240, 40);
|
||||
var maxButtonSize = new Point(480, 80);
|
||||
|
||||
/*new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonsParent.RectTransform), TextManager.Get("TutorialButton"), style: "GUIButtonLarge")
|
||||
{
|
||||
@@ -270,16 +270,21 @@ namespace Barotrauma
|
||||
SetupButtons(buttons);
|
||||
buttons.ForEach(b => b.TextBlock.SetTextPos());*/
|
||||
|
||||
var relativeSize = new Vector2(0.5f, 0.5f);
|
||||
var relativeSize = new Vector2(0.6f, 0.5f);
|
||||
var minSize = new Point(600, 400);
|
||||
var maxSize = new Point(900, 600);
|
||||
var anchor = Anchor.Center;
|
||||
var pivot = Pivot.Center;
|
||||
menuTabs = new GUIFrame[Enum.GetValues(typeof(Tab)).Length + 1];
|
||||
var maxSize = new Point(2000, 1500);
|
||||
var anchor = Anchor.CenterRight;
|
||||
var pivot = Pivot.CenterRight;
|
||||
Vector2 relativeSpacing = new Vector2(0.05f, 0.0f);
|
||||
|
||||
menuTabs[(int)Tab.NewGame] = new GUIFrame(new RectTransform(relativeSize, GUI.Canvas, anchor, pivot, minSize, maxSize));
|
||||
menuTabs = new GUIFrame[Enum.GetValues(typeof(Tab)).Length + 1];
|
||||
|
||||
menuTabs[(int)Tab.Settings] = new GUIFrame(new RectTransform(new Vector2(relativeSize.X, 0.8f), GUI.Canvas, anchor, pivot, minSize, maxSize) { RelativeOffset = relativeSpacing },
|
||||
style: null);
|
||||
|
||||
menuTabs[(int)Tab.NewGame] = new GUIFrame(new RectTransform(relativeSize, GUI.Canvas, anchor, pivot, minSize, maxSize) { RelativeOffset = relativeSpacing });
|
||||
var paddedNewGame = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.9f), menuTabs[(int)Tab.NewGame].RectTransform, Anchor.Center), style: null);
|
||||
menuTabs[(int)Tab.LoadGame] = new GUIFrame(new RectTransform(relativeSize, GUI.Canvas, anchor, pivot, minSize, maxSize));
|
||||
menuTabs[(int)Tab.LoadGame] = new GUIFrame(new RectTransform(relativeSize, GUI.Canvas, anchor, pivot, minSize, maxSize) { RelativeOffset = relativeSpacing });
|
||||
var paddedLoadGame = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.9f), menuTabs[(int)Tab.LoadGame].RectTransform, Anchor.Center), style: null);
|
||||
|
||||
campaignSetupUI = new CampaignSetupUI(false, paddedNewGame, paddedLoadGame, Submarine.SavedSubmarines)
|
||||
@@ -290,13 +295,13 @@ namespace Barotrauma
|
||||
|
||||
var hostServerScale = new Vector2(0.7f, 1.0f);
|
||||
menuTabs[(int)Tab.HostServer] = new GUIFrame(new RectTransform(
|
||||
Vector2.Multiply(relativeSize, hostServerScale), GUI.Canvas, anchor, pivot, minSize.Multiply(hostServerScale), maxSize.Multiply(hostServerScale)));
|
||||
Vector2.Multiply(relativeSize, hostServerScale), GUI.Canvas, anchor, pivot, minSize.Multiply(hostServerScale), maxSize.Multiply(hostServerScale)) { RelativeOffset = relativeSpacing });
|
||||
|
||||
CreateHostServerFields();
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
menuTabs[(int)Tab.Tutorials] = new GUIFrame(new RectTransform(relativeSize, GUI.Canvas, anchor, pivot, minSize, maxSize));
|
||||
menuTabs[(int)Tab.Tutorials] = new GUIFrame(new RectTransform(relativeSize, GUI.Canvas, anchor, pivot, minSize, maxSize) { RelativeOffset = relativeSpacing });
|
||||
|
||||
//PLACEHOLDER
|
||||
var tutorialList = new GUIListBox(
|
||||
@@ -377,6 +382,7 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
GameMain.Config.ResetSettingsFrame();
|
||||
selectedTab = (Tab)obj;
|
||||
|
||||
switch (selectedTab)
|
||||
@@ -389,8 +395,9 @@ namespace Barotrauma
|
||||
campaignSetupUI.UpdateLoadMenu();
|
||||
break;
|
||||
case Tab.Settings:
|
||||
GameMain.Config.ResetSettingsFrame();
|
||||
menuTabs[(int)Tab.Settings] = GameMain.Config.SettingsFrame;
|
||||
menuTabs[(int)Tab.Settings].RectTransform.ClearChildren();
|
||||
GameMain.Config.SettingsFrame.RectTransform.Parent = menuTabs[(int)Tab.Settings].RectTransform;
|
||||
GameMain.Config.SettingsFrame.RectTransform.RelativeSize = Vector2.One;
|
||||
break;
|
||||
case Tab.JoinServer:
|
||||
GameMain.ServerListScreen.Select();
|
||||
|
||||
@@ -233,7 +233,8 @@ namespace Barotrauma
|
||||
|
||||
levelSeed = value;
|
||||
|
||||
backgroundSprite = LocationType.Random(levelSeed)?.GetPortrait(ToolBox.StringToInt(levelSeed));
|
||||
int intSeed = ToolBox.StringToInt(levelSeed);
|
||||
backgroundSprite = LocationType.Random(new MTRandom(intSeed))?.GetPortrait(intSeed);
|
||||
seedBox.Text = levelSeed;
|
||||
|
||||
//lastUpdateID++;
|
||||
@@ -726,6 +727,12 @@ namespace Barotrauma
|
||||
spectateButton.Visible = GameMain.Client.GameStarted;
|
||||
ReadyToStartBox.Visible = !GameMain.Client.GameStarted;
|
||||
ReadyToStartBox.Selected = false;
|
||||
if (campaignUI?.StartButton != null)
|
||||
{
|
||||
campaignUI.StartButton.Visible = !GameMain.Client.GameStarted &&
|
||||
(GameMain.Client.HasPermission(ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(ClientPermissions.ManageCampaign));
|
||||
}
|
||||
GameMain.Client.SetReadyToStart(ReadyToStartBox);
|
||||
}
|
||||
else
|
||||
@@ -847,9 +854,9 @@ namespace Barotrauma
|
||||
|
||||
if (campaignUI?.StartButton != null)
|
||||
{
|
||||
campaignUI.StartButton.Visible =
|
||||
GameMain.Client.HasPermission(ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(ClientPermissions.ManageCampaign);
|
||||
campaignUI.StartButton.Visible = !GameMain.Client.GameStarted &&
|
||||
(GameMain.Client.HasPermission(ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(ClientPermissions.ManageCampaign));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,18 +867,21 @@ namespace Barotrauma
|
||||
spectateButton.Enabled = true;
|
||||
}
|
||||
|
||||
public void SetCampaignCharacterInfo(CharacterInfo characterInfo)
|
||||
{
|
||||
if (CampaignCharacterDiscarded) return;
|
||||
|
||||
campaignCharacterInfo = characterInfo;
|
||||
if (campaignCharacterInfo != null)
|
||||
public void SetCampaignCharacterInfo(CharacterInfo newCampaignCharacterInfo)
|
||||
{
|
||||
if (newCampaignCharacterInfo != null)
|
||||
{
|
||||
UpdatePlayerFrame(campaignCharacterInfo, false);
|
||||
if (CampaignCharacterDiscarded) { return; }
|
||||
if (campaignCharacterInfo != newCampaignCharacterInfo)
|
||||
{
|
||||
campaignCharacterInfo = newCampaignCharacterInfo;
|
||||
UpdatePlayerFrame(campaignCharacterInfo, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (campaignCharacterInfo != null)
|
||||
{
|
||||
UpdatePlayerFrame(null, true);
|
||||
campaignCharacterInfo = null;
|
||||
UpdatePlayerFrame(campaignCharacterInfo, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -337,7 +337,24 @@ namespace Barotrauma
|
||||
var tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowLighting"))
|
||||
{
|
||||
Selected = lightingEnabled,
|
||||
OnSelected = (GUITickBox obj) => { lightingEnabled = obj.Selected; return true; }
|
||||
OnSelected = (GUITickBox obj) =>
|
||||
{
|
||||
lightingEnabled = obj.Selected;
|
||||
if (lightingEnabled)
|
||||
{
|
||||
//turn off lights that are inside containers
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
foreach (LightComponent lightComponent in item.GetComponents<LightComponent>())
|
||||
{
|
||||
lightComponent.Light.Color = item.Container != null || (item.body != null && !item.body.Enabled) ?
|
||||
Color.Transparent :
|
||||
lightComponent.LightColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowWalls"))
|
||||
{
|
||||
@@ -564,6 +581,9 @@ namespace Barotrauma
|
||||
|
||||
MapEntityPrefab.Selected = null;
|
||||
|
||||
saveFrame = null;
|
||||
loadFrame = null;
|
||||
|
||||
MapEntity.DeselectAll();
|
||||
MapEntity.SelectionGroups.Clear();
|
||||
|
||||
@@ -766,6 +786,20 @@ namespace Barotrauma
|
||||
savePath = Path.Combine(Submarine.SavePath, savePath);
|
||||
}
|
||||
|
||||
#if !DEBUG
|
||||
var vanilla = GameMain.VanillaContent;
|
||||
if (vanilla != null)
|
||||
{
|
||||
var vanillaSubs = vanilla.GetFilesOfType(ContentType.Submarine);
|
||||
string pathToCompare = savePath.Replace(@"\", @"/").ToLowerInvariant();
|
||||
if (vanillaSubs.Any(sub => sub.Replace(@"\", @"/").ToLowerInvariant() == pathToCompare))
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("CannotEditVanillaSubs"), Color.Red, font: GUI.LargeFont);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*foreach (var contentPackage in GameMain.Config.SelectedContentPackages)
|
||||
{
|
||||
Submarine.MainSub.RequiredContentPackages.Add(contentPackage.Name);
|
||||
@@ -2040,6 +2074,10 @@ namespace Barotrauma
|
||||
dummyCharacter.SelectedConstruction = null;
|
||||
}
|
||||
}
|
||||
else if (MapEntity.SelectedList.Count == 1)
|
||||
{
|
||||
(MapEntity.SelectedList[0] as Item)?.UpdateHUD(cam, dummyCharacter, (float)deltaTime);
|
||||
}
|
||||
|
||||
CharacterHUD.Update((float)deltaTime, dummyCharacter, cam);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user