- Crewcommander close button & info text notifying about the hotkey

- Doors can only be selected when they are broken
- Fixed crashing when placing a door while no sub is loaded
- Generating waypoints for an empty sub won't crash the game
- Drawing characterHUD in editor
This commit is contained in:
Regalis11
2016-01-24 17:03:25 +02:00
parent 7098a9a5e0
commit 28af6fa1f4
6 changed files with 36 additions and 9 deletions
Binary file not shown.
@@ -10,11 +10,13 @@ namespace Barotrauma
{ {
class CrewCommander class CrewCommander
{ {
CrewManager crewManager; private CrewManager crewManager;
GUIFrame frame; private GUIFrame frame;
//GUIListBox characterList; //GUIListBox characterList;
private bool infoTextShown;
private int characterFrameBottom; private int characterFrameBottom;
public GUIFrame Frame public GUIFrame Frame
@@ -39,6 +41,12 @@ namespace Barotrauma
if (IsOpen) if (IsOpen)
{ {
if (!infoTextShown)
{
GUI.AddMessage("Press " + GameMain.Config.KeyBind(InputType.CrewOrders) + " to open/close the command menu", Color.Cyan, 5.0f);
infoTextShown = true;
}
if (frame == null) CreateGUIFrame(); if (frame == null) CreateGUIFrame();
UpdateCharacters(); UpdateCharacters();
} }
@@ -49,6 +57,13 @@ namespace Barotrauma
frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.6f); frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.6f);
frame.Padding = new Vector4(200.0f, 100.0f, 200.0f, 100.0f); frame.Padding = new Vector4(200.0f, 100.0f, 200.0f, 100.0f);
GUIButton closeButton = new GUIButton(new Rectangle(0, 50, 100, 20), "Close", GUI.Style, frame);
closeButton.OnClicked = (GUIButton button, object userData) =>
{
ToggleGUIFrame();
return false;
};
//UpdateCharacters(); //UpdateCharacters();
int buttonWidth = 130; int buttonWidth = 130;
@@ -62,7 +77,7 @@ namespace Barotrauma
Order.PrefabList.FindAll(o => o.ItemComponentType == null) : Order.PrefabList.FindAll(o => o.ItemComponentType == null) :
Order.PrefabList.FindAll(o=> o.ItemComponentType != null); Order.PrefabList.FindAll(o=> o.ItemComponentType != null);
int startX = (int)-(buttonWidth * orders.Count + spacing * (orders.Count - 1)) / 2; int startX = -(buttonWidth * orders.Count + spacing * (orders.Count - 1)) / 2;
int i=0; int i=0;
foreach (Order order in orders) foreach (Order order in orders)
+6 -1
View File
@@ -7,7 +7,6 @@ using FarseerPhysics.Factories;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Barotrauma.Lights; using Barotrauma.Lights;
using System.Collections.Generic;
namespace Barotrauma.Items.Components namespace Barotrauma.Items.Components
{ {
@@ -250,6 +249,12 @@ namespace Barotrauma.Items.Components
return true; return true;
} }
public override bool Select(Character character)
{
//can only be selected if the item is broken
return item.Condition <= 0.0f;
}
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
{ {
if (!isStuck) if (!isStuck)
+1 -1
View File
@@ -130,7 +130,7 @@ namespace Barotrauma
placePosition = Vector2.Zero; placePosition = Vector2.Zero;
item.Submarine = Submarine.Loaded; item.Submarine = Submarine.Loaded;
item.SetTransform(ConvertUnits.ToSimUnits(item.Position - Submarine.Loaded.Position), 0.0f); item.SetTransform(ConvertUnits.ToSimUnits(Submarine.Loaded == null ? item.Position : item.Position - Submarine.Loaded.Position), 0.0f);
item.FindHull(); item.FindHull();
//selected = null; //selected = null;
+6
View File
@@ -287,6 +287,12 @@ namespace Barotrauma
public static void GenerateSubWaypoints() public static void GenerateSubWaypoints()
{ {
if (!Hull.hullList.Any())
{
DebugConsole.ThrowError("Couldn't generate waypoints: no hulls found.");
return;
}
List<WayPoint> existingWaypoints = WayPointList.FindAll(wp => wp.spawnType == SpawnType.Path); List<WayPoint> existingWaypoints = WayPointList.FindAll(wp => wp.spawnType == SpawnType.Path);
foreach (WayPoint wayPoint in existingWaypoints) foreach (WayPoint wayPoint in existingWaypoints)
{ {
+4 -3
View File
@@ -467,8 +467,6 @@ namespace Barotrauma
GUIpanel.Draw(spriteBatch); GUIpanel.Draw(spriteBatch);
if (selectedTab > -1) GUItabs[selectedTab].Draw(spriteBatch);
//EntityPrefab.DrawList(spriteBatch, new Vector2(20,50)); //EntityPrefab.DrawList(spriteBatch, new Vector2(20,50));
if (characterMode) if (characterMode)
@@ -497,12 +495,15 @@ namespace Barotrauma
dummyCharacter.SelectedConstruction = null; dummyCharacter.SelectedConstruction = null;
} }
} }
} }
dummyCharacter.DrawHUD(spriteBatch, cam);
} }
else else
{ {
if (selectedTab > -1) GUItabs[selectedTab].Draw(spriteBatch);
MapEntity.Edit(spriteBatch, cam); MapEntity.Edit(spriteBatch, cam);
} }