diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj index 4d256f821..8658afc07 100644 --- a/Subsurface/Barotrauma.csproj +++ b/Subsurface/Barotrauma.csproj @@ -60,6 +60,8 @@ + + @@ -71,7 +73,7 @@ - + @@ -127,10 +129,10 @@ - + - + @@ -160,7 +162,7 @@ - + diff --git a/Subsurface/Source/Characters/AI/CrewCommander.cs b/Subsurface/Source/Characters/AI/CrewCommander.cs new file mode 100644 index 000000000..fd98fd6e3 --- /dev/null +++ b/Subsurface/Source/Characters/AI/CrewCommander.cs @@ -0,0 +1,160 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Barotrauma +{ + class CrewCommander + { + CrewManager crewManager; + + GUIFrame frame; + //GUIListBox characterList; + + public GUIFrame Frame + { + get { return IsOpen ? frame : null; } + } + + public bool IsOpen + { + get; + private set; + } + + public CrewCommander(CrewManager crewManager) + { + this.crewManager = crewManager; + + } + + public void ToggleGUIFrame() + { + IsOpen = !IsOpen; + + if (IsOpen && frame == null) CreateGUIFrame(); + } + + private void CreateGUIFrame() + { + frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.3f); + frame.Padding = new Vector4(200.0f, 100.0f, 200.0f, 100.0f); + + int x = 0, y = 0; + foreach (Character character in crewManager.characters) + { + GUIButton characterButton = new GUIButton(new Rectangle(x,y, 150, 40), "", Color.Transparent, null, frame); + characterButton.UserData = character; + characterButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); + + + if (character == Character.Controlled) + { + characterButton.CanBeSelected = false; + characterButton.Color = Color.LightGray * 0.3f; + } + else + { + characterButton.HoverColor = Color.LightGray * 0.5f; + characterButton.SelectedColor = Color.Gold * 0.5f; + } + + string name = character.Info.Name.Replace(' ', '\n'); + + GUITextBlock textBlock = new GUITextBlock( + new Rectangle(40, 0, 0, 25), + name, + Color.Transparent, Color.White, + Alignment.Left, Alignment.Left, + null, characterButton, false); + textBlock.Font = GUI.SmallFont; + textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f); + + new GUIImage(new Rectangle(-10, -5, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, characterButton); + + x += 160; + } + + x = 0; + y = 150; + foreach (Order command in Order.List) + { + var button = new GUIButton(new Rectangle(x, y, 150, 20), command.Name, GUI.Style, frame); + button.UserData = command; + button.OnClicked = SetOrder; + + x += button.Rect.Width + 10; + } + } + + private bool SetOrder(GUIButton button, object userData) + { + Order order = userData as Order; + + List selectedCharacters = new List(); + foreach (GUIComponent child in frame.children) + { + var characterButton = child as GUIButton; + characterButton.State = GUIComponent.ComponentState.None; + + if (!characterButton.Selected) continue; + characterButton.Selected = false; + + var character = child.UserData as Character; + if (character == null) continue; + + var humanAi = character.AIController as HumanAIController; + if (humanAi == null) continue; + + var existingOrder = characterButton.children.Find(c => c.UserData as Order != null); + if (existingOrder != null) characterButton.RemoveChild(existingOrder); + + var orderFrame = new GUIFrame(new Rectangle(0, characterButton.Rect.Height, 0, 30 + order.Options.Length*15), null, characterButton); + orderFrame.OutlineColor = Color.LightGray * 0.8f; + orderFrame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); + orderFrame.UserData = order; + new GUITextBlock(new Rectangle(0,0,0,20), order.DoingText, GUI.Style, Alignment.TopLeft, Alignment.TopCenter, orderFrame); + + var optionList = new GUIListBox(new Rectangle(0,20,0,80), Color.Transparent, null, orderFrame); + optionList.UserData = order; + optionList.OnSelected = SelectOrderOption; + foreach (string option in order.Options) + { + var optionBox = new GUITextBlock(new Rectangle(0,0,0,15), option, GUI.Style, optionList); + optionBox.Font = GUI.SmallFont; + optionBox.UserData = option; + } + + humanAi.SetOrder(order, ""); + } + + //characterList.Deselect(); + + return true; + } + + private bool SelectOrderOption(GUIComponent component, object userData) + { + string option = userData.ToString(); + Order order = component.Parent.UserData as Order; + Character character = component.Parent.Parent.Parent.UserData as Character; + + var humanAi = character.AIController as HumanAIController; + if (humanAi == null) return false; + + humanAi.SetOrder(order, option); + + return true; + } + + public void Draw(SpriteBatch spriteBatch) + { + if (!IsOpen) return; + + frame.Draw(spriteBatch); + } + } +} diff --git a/Subsurface/Source/Characters/AI/HumanAIController.cs b/Subsurface/Source/Characters/AI/HumanAIController.cs index b092bd76c..961025d0e 100644 --- a/Subsurface/Source/Characters/AI/HumanAIController.cs +++ b/Subsurface/Source/Characters/AI/HumanAIController.cs @@ -58,12 +58,17 @@ namespace Barotrauma Character.AnimController.TargetDir = Character.AnimController.TargetMovement.X > 0.0f ? Direction.Right : Direction.Left; } - float currObjectivePriority = objectiveManager.CurrentObjective == null ? 0.0f : objectiveManager.CurrentObjective.GetPriority(Character); + float currObjectivePriority = objectiveManager.GetCurrentPriority(Character); float moveSpeed = MathHelper.Clamp(currObjectivePriority/10.0f, 1.0f, 3.0f); steeringManager.Update(moveSpeed); } + public void SetOrder(Order order, string option) + { + objectiveManager.SetOrder(order, option); + } + public override void SelectTarget(AITarget target) { selectedAiTarget = target; diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs index 63e6a1614..48621d21b 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs @@ -14,10 +14,13 @@ namespace Barotrauma Vector2 targetPos; + bool repeat; + public override bool CanBeCompleted { get { + if (repeat) return true; var pathSteering = character.AIController.SteeringManager as IndoorsSteeringManager; return (pathSteering.CurrentPath == null || !pathSteering.CurrentPath.Unreachable); } @@ -28,10 +31,11 @@ namespace Barotrauma get { return target; } } - public AIObjectiveGoTo(AITarget target, Character character) + public AIObjectiveGoTo(AITarget target, Character character, bool repeat = false) : base (character) { this.target = target; + this.repeat = false; } @@ -51,6 +55,7 @@ namespace Barotrauma public override bool IsCompleted() { + if (repeat) return false; return Vector2.Distance(target != null ? target.SimPosition : ConvertUnits.ToDisplayUnits(targetPos), character.SimPosition) < 0.5f; } } diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs index 3f413d27f..d46b9f26b 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs @@ -1,4 +1,5 @@ -using System; +using Barotrauma.Items.Components; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -7,14 +8,19 @@ namespace Barotrauma { class AIObjectiveManager { + const float OrderPriority = 50.0f; + private List objectives; private Character character; + + private AIObjective currentOrder; public AIObjective CurrentObjective { get { + if (currentOrder != null) return currentOrder; return objectives.Any() ? objectives[0] : null; } } @@ -33,9 +39,15 @@ namespace Barotrauma objectives.Add(objective); } + public float GetCurrentPriority(Character character) + { + if (currentOrder != null) return OrderPriority; + return (CurrentObjective == null) ? 0.0f : CurrentObjective.GetPriority(character); + } + public void UpdateObjectives() { - if (!objectives.Any()) return; + if (currentOrder != null || !objectives.Any()) return; //remove completed objectives objectives = objectives.FindAll(o => !o.IsCompleted()); @@ -57,8 +69,33 @@ namespace Barotrauma public void DoCurrentObjective(float deltaTime) { + if (currentOrder != null) + { + currentOrder.TryComplete(deltaTime); + return; + } + if (!objectives.Any()) return; objectives[0].TryComplete(deltaTime); } + + public void SetOrder(Order order, string option) + { + switch (order.Name.ToLower()) + { + case "follow": + currentOrder = new AIObjectiveGoTo(Character.Controlled.AiTarget, character, true); + break; + case "operate reactor": + var reactorItem = Item.ItemList.Find(i => i.GetComponent() != null); + if (reactorItem == null) return; + + currentOrder = new AIObjectiveOperateItem(reactorItem.GetComponent(), character); + break; + default: + currentOrder = null; + break; + } + } } } diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveOperateItem.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveOperateItem.cs index fe4107793..681189155 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveOperateItem.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveOperateItem.cs @@ -1,4 +1,6 @@ -using System; +using Barotrauma.Items.Components; +using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -7,9 +9,9 @@ namespace Barotrauma { class AIObjectiveOperateItem : AIObjective { - private Item targetItem; + private ItemComponent targetItem; - public AIObjectiveOperateItem(Item item, Character character) + public AIObjectiveOperateItem(ItemComponent item, Character character) :base (character) { targetItem = item; @@ -17,7 +19,13 @@ namespace Barotrauma protected override void Act(float deltaTime) { - //item.AIOperate(float deltaTime, Character character) or something + if (Vector2.Distance(character.SimPosition, targetItem.Item.SimPosition) < targetItem.Item.PickDistance) + { + //targetItem.Pick(character, false, true); + return; + } + + subObjectives.Add(new AIObjectiveGoTo(targetItem.Item.SimPosition, character)); } public override bool IsDuplicate(AIObjective otherObjective) diff --git a/Subsurface/Source/Characters/AI/Order.cs b/Subsurface/Source/Characters/AI/Order.cs new file mode 100644 index 000000000..5f5532566 --- /dev/null +++ b/Subsurface/Source/Characters/AI/Order.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Barotrauma +{ + class Order + { + public static List List; + + public readonly string Name; + public readonly string DoingText; + + Sprite buttonSprite; + + public readonly string[] Options; + + static Order() + { + List = new List(); + + new Order("Follow", "Following"); + new Order("Operate Reactor", "Operating reactor", new string[] {"Power Up", "Shutdown"}); + + new Order("Dismiss", "Dismissed"); + } + + private Order(string name, string doingText, string[] parameters = null) + { + this.Name = name; + this.DoingText = doingText; + this.Options = parameters == null ? new string[0] : parameters; + + List.Add(this); + } + } + +} diff --git a/Subsurface/Source/Characters/AI/SteeringManager.cs b/Subsurface/Source/Characters/AI/SteeringManager.cs index 30a447b00..a25896691 100644 --- a/Subsurface/Source/Characters/AI/SteeringManager.cs +++ b/Subsurface/Source/Characters/AI/SteeringManager.cs @@ -35,9 +35,9 @@ namespace Barotrauma wanderAngle = Rand.Range(0.0f, MathHelper.TwoPi); } - public void SteeringSeek(Vector2 target, float speed = 1.0f) + public void SteeringSeek(Vector2 targetSimPos, float speed = 1.0f) { - steering += DoSteeringSeek(target, speed); + steering += DoSteeringSeek(targetSimPos, speed); } public void SteeringWander(float speed = 1.0f) diff --git a/Subsurface/Source/Characters/AnimController.cs b/Subsurface/Source/Characters/Animation/AnimController.cs similarity index 100% rename from Subsurface/Source/Characters/AnimController.cs rename to Subsurface/Source/Characters/Animation/AnimController.cs diff --git a/Subsurface/Source/Characters/FishAnimController.cs b/Subsurface/Source/Characters/Animation/FishAnimController.cs similarity index 100% rename from Subsurface/Source/Characters/FishAnimController.cs rename to Subsurface/Source/Characters/Animation/FishAnimController.cs diff --git a/Subsurface/Source/Characters/HumanoidAnimController.cs b/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs similarity index 100% rename from Subsurface/Source/Characters/HumanoidAnimController.cs rename to Subsurface/Source/Characters/Animation/HumanoidAnimController.cs diff --git a/Subsurface/Source/Characters/Ragdoll.cs b/Subsurface/Source/Characters/Animation/Ragdoll.cs similarity index 99% rename from Subsurface/Source/Characters/Ragdoll.cs rename to Subsurface/Source/Characters/Animation/Ragdoll.cs index 2428fa4d4..488694d18 100644 --- a/Subsurface/Source/Characters/Ragdoll.cs +++ b/Subsurface/Source/Characters/Animation/Ragdoll.cs @@ -306,7 +306,7 @@ namespace Barotrauma float stairPosY = structure.StairDirection == Direction.Right ? lowestLimb.Position.X - structure.Rect.X : structure.Rect.Width - (lowestLimb.Position.X - structure.Rect.X); - if (lowestLimb.Position.Y < stairPosY) return; + if (lowestLimb.Position.Y < structure.Rect.Y - structure.Rect.Height + stairPosY) return false; if (targetMovement.Y < 0.5f) { @@ -383,7 +383,9 @@ namespace Barotrauma } public virtual void Draw(SpriteBatch spriteBatch) - { + { + if (simplePhysicsEnabled) return; + foreach (Limb limb in Limbs) { limb.Draw(spriteBatch); @@ -392,7 +394,8 @@ namespace Barotrauma public void DebugDraw(SpriteBatch spriteBatch) { - if (!GameMain.DebugDraw) return; + if (!GameMain.DebugDraw || !character.Enabled) return; + if (simplePhysicsEnabled) return; foreach (Limb limb in Limbs) { diff --git a/Subsurface/Source/Characters/BackgroundSprite/BackgroundSprite.cs b/Subsurface/Source/Characters/BackgroundSprite/BackgroundSprite.cs index 00859d6a7..a13f75f2d 100644 --- a/Subsurface/Source/Characters/BackgroundSprite/BackgroundSprite.cs +++ b/Subsurface/Source/Characters/BackgroundSprite/BackgroundSprite.cs @@ -67,6 +67,8 @@ namespace Barotrauma Rand.Range(-prefab.Speed, prefab.Speed), Rand.Range(-prefab.Speed, prefab.Speed), Rand.Range(0.0f, prefab.WanderZAmount)); + + checkWallsTimer = Rand.Range(0.0f, CheckWallsInterval); } diff --git a/Subsurface/Source/GUI/GUIButton.cs b/Subsurface/Source/GUI/GUIButton.cs index 8973d95eb..e5a12ad2c 100644 --- a/Subsurface/Source/GUI/GUIButton.cs +++ b/Subsurface/Source/GUI/GUIButton.cs @@ -39,6 +39,19 @@ namespace Barotrauma } } + public override Color SelectedColor + { + get + { + return base.SelectedColor; + } + set + { + base.SelectedColor = value; + frame.SelectedColor = value; + } + } + public override Color OutlineColor { get { return base.OutlineColor; } @@ -120,7 +133,7 @@ namespace Barotrauma { if (!Visible) return; - if (rect.Contains(PlayerInput.MousePosition) && Enabled && (MouseOn == null || MouseOn == this || IsParentOf(MouseOn))) + if (rect.Contains(PlayerInput.MousePosition) && CanBeSelected && Enabled && (MouseOn == null || MouseOn == this || IsParentOf(MouseOn))) { state = ComponentState.Hover; if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed) @@ -136,6 +149,11 @@ namespace Barotrauma { if (OnClicked(this, UserData) && CanBeSelected) state = ComponentState.Selected; } + else + { + Selected = !Selected; + // state = state == ComponentState.Selected ? ComponentState.None : ComponentState.Selected; + } } } else diff --git a/Subsurface/Source/GUI/GUIListBox.cs b/Subsurface/Source/GUI/GUIListBox.cs index 47c9b8310..16f3ae654 100644 --- a/Subsurface/Source/GUI/GUIListBox.cs +++ b/Subsurface/Source/GUI/GUIListBox.cs @@ -1,13 +1,15 @@ using System; +using System.Linq; using System.Diagnostics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; namespace Barotrauma { public class GUIListBox : GUIComponent { - protected GUIComponent selected; + protected List selected; public delegate bool OnSelectedHandler(GUIComponent component, object obj); public OnSelectedHandler OnSelected; @@ -27,19 +29,26 @@ namespace Barotrauma private bool enabled; + public bool SelectMultiple; + public GUIComponent Selected { get { - return selected; + return selected.Any() ? selected[0] : null; } } + + public List AllSelected + { + get { return selected; } + } public object SelectedData { get { - return (selected == null) ? null : selected.UserData; + return (Selected == null) ? null : Selected.UserData; } } @@ -47,8 +56,8 @@ namespace Barotrauma { get { - if (selected == null) return -1; - return children.FindIndex(x => x == selected); + if (Selected == null) return -1; + return children.FindIndex(x => x == Selected); } } @@ -108,12 +117,14 @@ namespace Barotrauma { } - public GUIListBox(Rectangle rect, Color? color, Alignment alignment, GUIStyle style = null, GUIComponent parent = null) + public GUIListBox(Rectangle rect, Color? color, Alignment alignment, GUIStyle style = null, GUIComponent parent = null, bool isHorizontal = false) : base(style) { this.rect = rect; this.alignment = alignment; + selected = new List(); + if (color!=null) this.color = (Color)color; if (parent != null) @@ -121,8 +132,17 @@ namespace Barotrauma scrollBarHidden = true; - scrollBar = new GUIScrollBar( - new Rectangle(this.rect.X + this.rect.Width-20, this.rect.Y, 20, this.rect.Height), color, 1.0f, GUI.Style); + if (isHorizontal) + { + scrollBar = new GUIScrollBar( + new Rectangle(this.rect.X, this.rect.Bottom-20, this.rect.Width, 20), color, 1.0f, GUI.Style); + } + else + { + scrollBar = new GUIScrollBar( + new Rectangle(this.rect.Right - 20, this.rect.Y, 20, this.rect.Height), color, 1.0f, GUI.Style); + } + frame = new GUIFrame(Rectangle.Empty, style, this); if (style != null) style.Apply(frame, this); @@ -140,16 +160,17 @@ namespace Barotrauma public void Select(object selection) { - foreach (GUIComponent child in children) + for (int i = 0; i < children.Count; i++ ) { - if (child.UserData != selection) continue; - - selected = child; - if (OnSelected != null) OnSelected(selected, selected.UserData); - return; + if (children[i].UserData != selection) continue; + + Select(i); + + if (OnSelected != null) OnSelected(Selected, Selected.UserData); + if (!SelectMultiple) return; } } - + public override void Update(float deltaTime) { if (!Visible) return; @@ -167,17 +188,34 @@ namespace Barotrauma public void Select(int childIndex) { //children[0] is the GUIFrame, ignore it - childIndex += 1; + //childIndex += 1; if (childIndex >= children.Count || childIndex<0) return; - selected = children[childIndex]; - if (OnSelected != null) OnSelected(selected, selected.UserData); + if (SelectMultiple) + { + if (selected.Contains(children[childIndex])) + { + selected.Remove(children[childIndex]); + } + else + { + selected.Add(children[childIndex]); + } + } + else + { + selected.Clear(); + selected.Add(children[childIndex]); + } + + if (OnSelected != null) OnSelected(Selected, Selected.UserData); + } public void Deselect() { - selected = null; + selected.Clear(); } public void UpdateScrollBarSize() @@ -218,14 +256,14 @@ namespace Barotrauma public override void ClearChildren() { base.ClearChildren(); - selected = null; + selected.Clear(); } public override void RemoveChild(GUIComponent child) { base.RemoveChild(child); - if (selected == child) selected = null; + if (selected.Contains(child)) selected.Remove(child); UpdateScrollBarSize(); } @@ -272,8 +310,16 @@ namespace Barotrauma GUIComponent child = children[i]; if (child == frame) continue; - child.Rect = new Rectangle(child.Rect.X, y, child.Rect.Width, child.Rect.Height); - y += child.Rect.Height + spacing; + child.Rect = new Rectangle(x, y, child.Rect.Width, child.Rect.Height); + if (scrollBar.IsHorizontal) + { + x += child.Rect.Width + spacing; + } + else + { + y += child.Rect.Height + spacing; + } + if (child.Rect.Y + child.Rect.Height < rect.Y) continue; if (child.Rect.Y + child.Rect.Height > rect.Y + rect.Height) break; @@ -284,30 +330,31 @@ namespace Barotrauma continue; } - if (selected == child) - { - child.State = ComponentState.Selected; - - if (CheckSelected != null) - { - if (CheckSelected() != selected.UserData) selected = null; - } - } - else if (enabled && child.CanBeFocused && + if (enabled && child.CanBeFocused && (MouseOn == this || (MouseOn != null && this.IsParentOf(MouseOn))) && child.Rect.Contains(PlayerInput.MousePosition)) { child.State = ComponentState.Hover; if (PlayerInput.LeftButtonClicked()) { Debug.WriteLine("clicked"); - selected = child; - if (OnSelected != null) - { - if (!OnSelected(selected, child.UserData)) selected = null; - } + Select(i); + //selected = child; + //if (OnSelected != null) + //{ + // if (!OnSelected(selected, child.UserData)) selected = null; + //} } } + else if(selected.Contains(child)) + { + child.State = ComponentState.Selected; + + if (CheckSelected != null) + { + if (CheckSelected() != child.UserData) selected.Remove(child); + } + } else { child.State = ComponentState.None; diff --git a/Subsurface/Source/GameSession/CrewManager.cs b/Subsurface/Source/GameSession/CrewManager.cs index e7c30ad55..b1b5650e8 100644 --- a/Subsurface/Source/GameSession/CrewManager.cs +++ b/Subsurface/Source/GameSession/CrewManager.cs @@ -12,9 +12,6 @@ namespace Barotrauma public List characters; public List characterInfos; - //public static string mapFile; - //public string saveFile; - private int money; private GUIFrame guiFrame; @@ -24,7 +21,8 @@ namespace Barotrauma private GUIButton crewButton; protected GUIFrame crewFrame; - + private CrewCommander commander; + public int Money { get { return money; } @@ -45,6 +43,8 @@ namespace Barotrauma crewButton = new GUIButton(new Rectangle(0, 00, 100, 20), "Crew", GUI.Style, guiFrame); crewButton.OnClicked = ToggleCrewFrame; + commander = new CrewCommander(this); + money = 10000; } @@ -102,13 +102,19 @@ namespace Barotrauma textBlock.Font = GUI.SmallFont; textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f); - new GUIImage(new Rectangle(-10, -10, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, frame); + new GUIImage(new Rectangle(-10, -5, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, frame); } public void Update(float deltaTime) { guiFrame.Update(deltaTime); + if (PlayerInput.KeyHit(Microsoft.Xna.Framework.Input.Keys.I)) + { + commander.ToggleGUIFrame(); + } + + if (commander.Frame != null) commander.Frame.Update(deltaTime); if (crewFrameOpen) crewFrame.Update(deltaTime); } @@ -235,9 +241,15 @@ namespace Barotrauma public void Draw(SpriteBatch spriteBatch) { - guiFrame.Draw(spriteBatch); - - if (crewFrameOpen) crewFrame.Draw(spriteBatch); + if (commander.IsOpen) + { + commander.Draw(spriteBatch); + } + else + { + guiFrame.Draw(spriteBatch); + if (crewFrameOpen) crewFrame.Draw(spriteBatch); + } } public void Save(XElement parentElement) diff --git a/Subsurface/Source/Items/Inventory.cs b/Subsurface/Source/Items/Inventory.cs index 249f0cfae..d492816ec 100644 --- a/Subsurface/Source/Items/Inventory.cs +++ b/Subsurface/Source/Items/Inventory.cs @@ -229,10 +229,10 @@ namespace Barotrauma Vector2 textSize = GUI.Font.MeasureString(toolTip); Vector2 rectSize = textSize * 1.2f; - Vector2 pos = new Vector2(highlightedSlot.Center.X, highlightedSlot.Bottom); + Vector2 pos = new Vector2(highlightedSlot.Center.X, highlightedSlot.Y-rectSize.Y); pos.X = (int)pos.X; pos.Y = (int)pos.Y; - + GUI.DrawRectangle(spriteBatch, pos, rectSize, Color.Black * 0.8f, true); spriteBatch.DrawString(GUI.Font, toolTip, new Vector2((int)pos.X + rectSize.X * 0.5f, (int)pos.Y + rectSize.Y * 0.5f), diff --git a/Subsurface/Source/Map/WayPoint.cs b/Subsurface/Source/Map/WayPoint.cs index b34ba97af..1b2df74a1 100644 --- a/Subsurface/Source/Map/WayPoint.cs +++ b/Subsurface/Source/Map/WayPoint.cs @@ -89,9 +89,8 @@ namespace Barotrauma Color clr = (isSelected) ? Color.Red : Color.LightGreen; GUI.DrawRectangle(spriteBatch, new Rectangle(pos.X - rect.Width / 2, -pos.Y - rect.Height / 2, rect.Width, rect.Height), clr, true); - - - spriteBatch.DrawString(GUI.SmallFont, Position.ToString(), new Vector2(Position.X, -Position.Y), Color.White); + + //spriteBatch.DrawString(GUI.SmallFont, Position.ToString(), new Vector2(Position.X, -Position.Y), Color.White); foreach (MapEntity e in linkedTo) { diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index 57f3bbb49..9226cf21d 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ