(2400ab447) Revert "Improved New Game panel" (easier to do the columns with layoutgroups than by setting the contents to half the width)

This commit is contained in:
Joonas Rikkonen
2019-04-01 22:51:50 +03:00
parent 8b12f85f48
commit a3eabfabac
5 changed files with 74 additions and 64 deletions

View File

@@ -656,6 +656,13 @@ namespace Barotrauma
msg.Timer -= deltaTime;
msg.Pos += msg.Velocity * deltaTime;
}
foreach (GUIMessage msg in messages)
{
if (!msg.WorldSpace) continue;
msg.Timer -= deltaTime;
msg.Pos += msg.Velocity * deltaTime;
}
}
messages.RemoveAll(m => m.Timer <= 0.0f);

View File

@@ -39,32 +39,44 @@ namespace Barotrauma
this.newGameContainer = newGameContainer;
this.loadGameContainer = loadGameContainer;
var columnContainer = new GUILayoutGroup(new RectTransform(Vector2.One, newGameContainer.RectTransform)) { RelativeSpacing = 0.005f };
//var rightColumn = new GUILayoutGroup(new RectTransform(Vector2.One, columnContainer.RectTransform));
//var leftColumn = new GUILayoutGroup(new RectTransform(Vector2.One, columnContainer.RectTransform));
// New game right side
new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), columnContainer.RectTransform), TextManager.Get("SaveName") + ":");
saveNameBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 0.075f), columnContainer.RectTransform), string.Empty);
new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), columnContainer.RectTransform), TextManager.Get("MapSeed") + ":");
seedBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 0.075f), columnContainer.RectTransform), ToolBox.RandomSeed(8));
if (!isMultiplayer)
var columnContainer = new GUILayoutGroup(new RectTransform(Vector2.One, newGameContainer.RectTransform), isHorizontal: true)
{
contextualTutorialBox = new GUITickBox(new RectTransform(new Point(30, 30), columnContainer.RectTransform), TextManager.Get("TutorialActive"));
UpdateTutorialSelection();
}
Stretch = true,
RelativeSpacing = 0.05f
};
var leftColumn = new GUILayoutGroup(new RectTransform(Vector2.One, columnContainer.RectTransform))
{
Stretch = true,
RelativeSpacing = 0.02f
};
var rightColumn = new GUILayoutGroup(new RectTransform(Vector2.One, columnContainer.RectTransform))
{
RelativeSpacing = 0.02f
};
// New game left side
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), columnContainer.RectTransform), TextManager.Get("SelectedSub") + ":");
subList = new GUIListBox(new RectTransform(new Vector2(0.5f, 0.5f), columnContainer.RectTransform));
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), leftColumn.RectTransform), TextManager.Get("SelectedSub") + ":", textAlignment: Alignment.BottomLeft);
subList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.65f), leftColumn.RectTransform));
UpdateSubList(submarines);
var startButton = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), columnContainer.RectTransform, Anchor.BottomCenter), TextManager.Get("StartCampaignButton"), style: "GUIButtonLarge")
// 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);
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), rightColumn.RectTransform), TextManager.Get("MapSeed") + ":", textAlignment: Alignment.BottomLeft);
seedBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.1f), rightColumn.RectTransform), ToolBox.RandomSeed(8));
if (!isMultiplayer)
{
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), rightColumn.RectTransform), TextManager.Get("TutorialActive") + ":", textAlignment: Alignment.BottomLeft);
contextualTutorialBox = new GUITickBox(new RectTransform(new Point(30, 30), rightColumn.RectTransform), string.Empty);
UpdateTutorialSelection();
}
var startButton = new GUIButton(new RectTransform(new Vector2(1.0f, 0.13f), rightColumn.RectTransform, Anchor.BottomRight), TextManager.Get("StartCampaignButton"), style: "GUIButtonLarge")
{
IgnoreLayoutGroups = true,
OnClicked = (GUIButton btn, object userData) =>
@@ -193,13 +205,12 @@ namespace Barotrauma
foreach (Submarine sub in subsToShow)
{
var textBlock = new GUITextBlock(
new RectTransform(new Vector2(1, 0.2f), subList.Content.RectTransform)
new RectTransform(new Vector2(1, 0.1f), subList.Content.RectTransform)
{
AbsoluteOffset = new Point(10, 0)
},
ToolBox.LimitString(sub.Name, GUI.Font, subList.Rect.Width - 65), style: "ListBoxElement")
{
IgnoreLayoutGroups = true,
ToolTip = sub.Description,
UserData = sub
};

View File

@@ -283,7 +283,7 @@ namespace Barotrauma
style: null);
menuTabs[(int)Tab.NewGame] = new GUIFrame(new RectTransform(relativeSize, GUI.Canvas, anchor, pivot, minSize, maxSize) { RelativeOffset = relativeSpacing });
var paddedNewGame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.95f), menuTabs[(int)Tab.NewGame].RectTransform, Anchor.Center)) { Stretch = true };
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) { RelativeOffset = relativeSpacing });
var paddedLoadGame = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.9f), menuTabs[(int)Tab.LoadGame].RectTransform, Anchor.Center), style: null);

View File

@@ -1216,43 +1216,6 @@ namespace Barotrauma
targetingTag = "room";
}
if (door != null)
{
// If there's not a more specific tag for the door
if (string.IsNullOrEmpty(targetingTag) || targetingTag == "room")
{
targetingTag = "door";
}
bool isOutdoor = door.LinkedGap?.FlowTargetHull != null && !door.LinkedGap.IsRoomToRoom;
bool isOpen = door.IsOpen || door.Item.Condition <= 0.0f;
//increase priority if the character is outside and an aggressive boarder, and the door is from outside to inside
if (aggressiveBoarding)
{
if (character.CurrentHull == null)
{
valueModifier = isOutdoor ? 1 : 0;
valueModifier *= isOpen ? 5 : 1;
}
}
else
{
// Ignore disabled walls
bool isDisabled = true;
for (int i = 0; i < s.Sections.Length; i++)
{
valueModifier = isOutdoor ? 0 : 1;
valueModifier *= isOpen ? 0 : 1;
}
if (isDisabled)
{
valueModifier = 0;
}
}
}
else
{
targetingTag = "room";
}
if (door != null)
{
// If there's not a more specific tag for the door
if (string.IsNullOrEmpty(targetingTag) || targetingTag == "room")
@@ -1279,10 +1242,6 @@ namespace Barotrauma
{
continue;
}
else if (isOpen) //ignore broken and open doors
{
continue;
}
}
else if (target.Entity is IDamageable targetDamageable && targetDamageable.Health <= 0.0f)
{

View File

@@ -1301,6 +1301,39 @@ namespace Barotrauma
AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList();
if (sprite == null)
{
DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!");
#if SERVER
sprite = new Sprite("", Vector2.Zero);
sprite.SourceRect = new Rectangle(0, 0, 32, 32);
#else
sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null)
{
Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2
};
#endif
size = sprite.size;
sprite.EntityID = identifier;
}
if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier))
{
DebugConsole.ThrowError(
"Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading.");
}
if (!string.IsNullOrEmpty(identifier))
{
MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier);
if (existingPrefab != null)
{
DebugConsole.ThrowError(
"Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!");
}
}
AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList();
List.Add(this);
}