Crew command menu and the info menu can't be open at the same time, UI layout tweaking again
This commit is contained in:
@@ -434,24 +434,24 @@ namespace Barotrauma
|
|||||||
"FPS: " + (int)GameMain.FrameCounter.AverageFramesPerSecond,
|
"FPS: " + (int)GameMain.FrameCounter.AverageFramesPerSecond,
|
||||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||||
|
|
||||||
DrawString(spriteBatch, new Vector2(10, 20),
|
DrawString(spriteBatch, new Vector2(10, 25),
|
||||||
"Physics: " + GameMain.World.UpdateTime,
|
"Physics: " + GameMain.World.UpdateTime,
|
||||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||||
|
|
||||||
DrawString(spriteBatch, new Vector2(10, 30),
|
DrawString(spriteBatch, new Vector2(10, 40),
|
||||||
"Bodies: " + GameMain.World.BodyList.Count + " (" + GameMain.World.BodyList.FindAll(b => b.Awake && b.Enabled).Count + " awake)",
|
"Bodies: " + GameMain.World.BodyList.Count + " (" + GameMain.World.BodyList.FindAll(b => b.Awake && b.Enabled).Count + " awake)",
|
||||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||||
|
|
||||||
if (Screen.Selected.Cam != null)
|
if (Screen.Selected.Cam != null)
|
||||||
{
|
{
|
||||||
DrawString(spriteBatch, new Vector2(10, 40),
|
DrawString(spriteBatch, new Vector2(10, 55),
|
||||||
"Camera pos: " + Screen.Selected.Cam.Position.ToPoint(),
|
"Camera pos: " + Screen.Selected.Cam.Position.ToPoint(),
|
||||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Submarine.MainSub != null)
|
if (Submarine.MainSub != null)
|
||||||
{
|
{
|
||||||
DrawString(spriteBatch, new Vector2(10, 50),
|
DrawString(spriteBatch, new Vector2(10, 70),
|
||||||
"Sub pos: " + Submarine.MainSub.Position.ToPoint(),
|
"Sub pos: " + Submarine.MainSub.Position.ToPoint(),
|
||||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
scrollBar.IsHorizontal = isHorizontal;
|
scrollBar.IsHorizontal = isHorizontal;
|
||||||
|
|
||||||
frame = new GUIFrame(Rectangle.Empty, style, this);
|
frame = new GUIFrame(new Rectangle(0, 0, this.rect.Width, this.rect.Height), style, this);
|
||||||
if (style != null) GUI.Style.Apply(frame, style, this);
|
if (style != null) GUI.Style.Apply(frame, style, this);
|
||||||
|
|
||||||
UpdateScrollBarSize();
|
UpdateScrollBarSize();
|
||||||
|
|||||||
@@ -20,12 +20,13 @@ namespace Barotrauma
|
|||||||
private GUIFrame guiFrame;
|
private GUIFrame guiFrame;
|
||||||
private GUIListBox listBox, orderListBox;
|
private GUIListBox listBox, orderListBox;
|
||||||
|
|
||||||
private bool crewFrameOpen;
|
|
||||||
//private GUIButton crewButton;
|
|
||||||
protected GUIFrame crewFrame;
|
|
||||||
|
|
||||||
private CrewCommander commander;
|
private CrewCommander commander;
|
||||||
|
|
||||||
|
public CrewCommander CrewCommander
|
||||||
|
{
|
||||||
|
get { return commander; }
|
||||||
|
}
|
||||||
|
|
||||||
public int Money
|
public int Money
|
||||||
{
|
{
|
||||||
get { return money; }
|
get { return money; }
|
||||||
@@ -143,7 +144,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
guiFrame.AddToGUIUpdateList();
|
guiFrame.AddToGUIUpdateList();
|
||||||
if (commander.Frame != null) commander.Frame.AddToGUIUpdateList();
|
if (commander.Frame != null) commander.Frame.AddToGUIUpdateList();
|
||||||
if (crewFrameOpen) crewFrame.AddToGUIUpdateList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(float deltaTime)
|
public void Update(float deltaTime)
|
||||||
@@ -166,7 +166,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (commander.Frame != null) commander.Frame.Update(deltaTime);
|
if (commander.Frame != null) commander.Frame.Update(deltaTime);
|
||||||
if (crewFrameOpen) crewFrame.Update(deltaTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReviveCharacter(Character revivedCharacter)
|
public void ReviveCharacter(Character revivedCharacter)
|
||||||
@@ -337,7 +336,6 @@ namespace Barotrauma
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
guiFrame.Draw(spriteBatch);
|
guiFrame.Draw(spriteBatch);
|
||||||
if (crewFrameOpen) crewFrame.Draw(spriteBatch);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -282,6 +282,11 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (infoFrame == null)
|
if (infoFrame == null)
|
||||||
{
|
{
|
||||||
|
if (CrewManager != null && CrewManager.CrewCommander!= null && CrewManager.CrewCommander.IsOpen)
|
||||||
|
{
|
||||||
|
CrewManager.CrewCommander.ToggleGUIFrame();
|
||||||
|
}
|
||||||
|
|
||||||
CreateInfoFrame();
|
CreateInfoFrame();
|
||||||
SelectInfoFrameTab(null, selectedTab);
|
SelectInfoFrameTab(null, selectedTab);
|
||||||
}
|
}
|
||||||
@@ -297,27 +302,31 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
int width = 600, height = 400;
|
int width = 600, height = 400;
|
||||||
|
|
||||||
|
|
||||||
infoFrame = new GUIFrame(
|
infoFrame = new GUIFrame(
|
||||||
new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "");
|
Rectangle.Empty, Color.Black * 0.8f, null);
|
||||||
|
|
||||||
infoFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
var innerFrame = new GUIFrame(
|
||||||
|
new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", infoFrame);
|
||||||
|
|
||||||
var crewButton = new GUIButton(new Rectangle(0, -30, 100, 20), "Crew", "", infoFrame);
|
innerFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||||
|
|
||||||
|
var crewButton = new GUIButton(new Rectangle(0, -30, 100, 20), "Crew", "", innerFrame);
|
||||||
crewButton.UserData = InfoFrameTab.Crew;
|
crewButton.UserData = InfoFrameTab.Crew;
|
||||||
crewButton.OnClicked = SelectInfoFrameTab;
|
crewButton.OnClicked = SelectInfoFrameTab;
|
||||||
|
|
||||||
var missionButton = new GUIButton(new Rectangle(100, -30, 100, 20), "Mission", "", infoFrame);
|
var missionButton = new GUIButton(new Rectangle(100, -30, 100, 20), "Mission", "", innerFrame);
|
||||||
missionButton.UserData = InfoFrameTab.Mission;
|
missionButton.UserData = InfoFrameTab.Mission;
|
||||||
missionButton.OnClicked = SelectInfoFrameTab;
|
missionButton.OnClicked = SelectInfoFrameTab;
|
||||||
|
|
||||||
if (GameMain.Server != null)
|
if (GameMain.Server != null)
|
||||||
{
|
{
|
||||||
var manageButton = new GUIButton(new Rectangle(200, -30, 130, 20), "Manage players", "", infoFrame);
|
var manageButton = new GUIButton(new Rectangle(200, -30, 130, 20), "Manage players", "", innerFrame);
|
||||||
manageButton.UserData = InfoFrameTab.ManagePlayers;
|
manageButton.UserData = InfoFrameTab.ManagePlayers;
|
||||||
manageButton.OnClicked = SelectInfoFrameTab;
|
manageButton.OnClicked = SelectInfoFrameTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
var closeButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Close", Alignment.BottomCenter, "", infoFrame);
|
var closeButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Close", Alignment.BottomCenter, "", innerFrame);
|
||||||
closeButton.OnClicked = ToggleInfoFrame;
|
closeButton.OnClicked = ToggleInfoFrame;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -331,13 +340,13 @@ namespace Barotrauma
|
|||||||
switch (selectedTab)
|
switch (selectedTab)
|
||||||
{
|
{
|
||||||
case InfoFrameTab.Crew:
|
case InfoFrameTab.Crew:
|
||||||
CrewManager.CreateCrewFrame(CrewManager.characters, infoFrame);
|
CrewManager.CreateCrewFrame(CrewManager.characters, infoFrame.children[0] as GUIFrame);
|
||||||
break;
|
break;
|
||||||
case InfoFrameTab.Mission:
|
case InfoFrameTab.Mission:
|
||||||
CreateMissionInfo(infoFrame);
|
CreateMissionInfo(infoFrame.children[0] as GUIFrame);
|
||||||
break;
|
break;
|
||||||
case InfoFrameTab.ManagePlayers:
|
case InfoFrameTab.ManagePlayers:
|
||||||
GameMain.Server.ManagePlayersFrame(infoFrame);
|
GameMain.Server.ManagePlayersFrame(infoFrame.children[0] as GUIFrame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,12 +371,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void AddToGUIUpdateList()
|
public void AddToGUIUpdateList()
|
||||||
{
|
{
|
||||||
if (CrewManager != null) CrewManager.AddToGUIUpdateList();
|
infoButton.AddToGUIUpdateList();
|
||||||
|
|
||||||
if (gameMode != null) gameMode.AddToGUIUpdateList();
|
if (gameMode != null) gameMode.AddToGUIUpdateList();
|
||||||
|
|
||||||
infoButton.AddToGUIUpdateList();
|
|
||||||
|
|
||||||
if (infoFrame != null) infoFrame.AddToGUIUpdateList();
|
if (infoFrame != null) infoFrame.AddToGUIUpdateList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,7 +389,15 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (gameMode != null) gameMode.Update(deltaTime);
|
if (gameMode != null) gameMode.Update(deltaTime);
|
||||||
if (Mission != null) Mission.Update(deltaTime);
|
if (Mission != null) Mission.Update(deltaTime);
|
||||||
if (infoFrame != null) infoFrame.Update(deltaTime);
|
if (infoFrame != null)
|
||||||
|
{
|
||||||
|
infoFrame.Update(deltaTime);
|
||||||
|
|
||||||
|
if (CrewManager != null && CrewManager.CrewCommander != null && CrewManager.CrewCommander.IsOpen)
|
||||||
|
{
|
||||||
|
infoFrame = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(SpriteBatch spriteBatch)
|
public void Draw(SpriteBatch spriteBatch)
|
||||||
|
|||||||
@@ -656,14 +656,14 @@ namespace Barotrauma
|
|||||||
highlightedList = highlightedEntities;
|
highlightedList = highlightedEntities;
|
||||||
|
|
||||||
highlightedListBox = new GUIListBox(
|
highlightedListBox = new GUIListBox(
|
||||||
new Rectangle((int)PlayerInput.MousePosition.X+15, (int)PlayerInput.MousePosition.Y+15, 150, highlightedEntities.Count * 15),
|
new Rectangle((int)PlayerInput.MousePosition.X+15, (int)PlayerInput.MousePosition.Y+15, 150, highlightedEntities.Count * 18 + 5),
|
||||||
null, Alignment.TopLeft, "GUIToolTip", null, false);
|
null, Alignment.TopLeft, "GUIToolTip", null, false);
|
||||||
|
|
||||||
foreach (MapEntity entity in highlightedEntities)
|
foreach (MapEntity entity in highlightedEntities)
|
||||||
{
|
{
|
||||||
var textBlock = new GUITextBlock(
|
var textBlock = new GUITextBlock(
|
||||||
new Rectangle(0,0,0,15),
|
new Rectangle(0, 0, highlightedListBox.Rect.Width, 18),
|
||||||
ToolBox.LimitString(entity.Name, GUI.SmallFont, 140), "", highlightedListBox, GUI.SmallFont);
|
ToolBox.LimitString(entity.Name, GUI.SmallFont, 140), "", Alignment.TopLeft, Alignment.CenterLeft, highlightedListBox, false, GUI.SmallFont);
|
||||||
|
|
||||||
textBlock.UserData = entity;
|
textBlock.UserData = entity;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user