Merge branch 'master' into new-netcode
Conflicts: Subsurface/Properties/AssemblyInfo.cs Subsurface/Source/Characters/Animation/HumanoidAnimController.cs Subsurface/Source/Characters/Character.cs Subsurface/Source/Items/Components/Door.cs Subsurface/Source/Items/Components/Power/PowerContainer.cs Subsurface/Source/Items/Components/Signal/Wire.cs Subsurface/Source/Items/Item.cs Subsurface/Source/Networking/ChatMessage.cs Subsurface/Source/Networking/GameClient.cs Subsurface/Source/Networking/GameServer.cs Subsurface/Source/Networking/GameServerLogin.cs Subsurface/Source/Networking/GameServerSettings.cs Subsurface/Source/Networking/NetworkMember.cs
This commit is contained in:
@@ -200,6 +200,8 @@ namespace Barotrauma
|
||||
GameMain.NetworkMember = null;
|
||||
}
|
||||
|
||||
CoroutineManager.StopCoroutines("EndCinematic");
|
||||
|
||||
GameMain.GameSession = null;
|
||||
|
||||
GameMain.MainMenuScreen.Select();
|
||||
@@ -272,16 +274,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawRectangle(SpriteBatch sb, Rectangle rect, Color clr, int thickness, float depth = 0.0f)
|
||||
{
|
||||
DrawLine(sb, new Vector2(rect.X, rect.Y), new Vector2(rect.Right, rect.Y), clr, depth, thickness);
|
||||
DrawLine(sb, new Vector2(rect.X, rect.Bottom-thickness), new Vector2(rect.Right, rect.Bottom-thickness), clr, depth, thickness);
|
||||
|
||||
DrawLine(sb, new Vector2(rect.X+thickness, rect.Y+thickness), new Vector2(rect.X+thickness, rect.Bottom-thickness), clr, depth, thickness);
|
||||
|
||||
DrawLine(sb, new Vector2(rect.Right, rect.Y + thickness), new Vector2(rect.Right, rect.Bottom - thickness), clr, depth, thickness);
|
||||
}
|
||||
|
||||
public static void DrawProgressBar(SpriteBatch sb, Vector2 start, Vector2 size, float progress, Color clr, float depth = 0.0f)
|
||||
{
|
||||
DrawProgressBar(sb, start, size, progress, clr, new Color(0.5f, 0.57f, 0.6f, 1.0f), depth);
|
||||
@@ -428,27 +420,30 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
spriteBatch.DrawString(SmallFont,
|
||||
DrawString(spriteBatch, new Vector2(10, 10),
|
||||
"FPS: " + (int)GameMain.FrameCounter.AverageFramesPerSecond,
|
||||
new Vector2(10, 10), Color.White);
|
||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||
|
||||
spriteBatch.DrawString(SmallFont,
|
||||
DrawString(spriteBatch, new Vector2(10, 20),
|
||||
"Physics: " + GameMain.World.UpdateTime,
|
||||
new Vector2(10, 20), Color.White);
|
||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||
|
||||
spriteBatch.DrawString(SmallFont,
|
||||
DrawString(spriteBatch, new Vector2(10, 30),
|
||||
"Bodies: " + GameMain.World.BodyList.Count + " (" + GameMain.World.BodyList.FindAll(b => b.Awake && b.Enabled).Count + " awake)",
|
||||
new Vector2(10, 30), Color.White);
|
||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||
|
||||
spriteBatch.DrawString(SmallFont,
|
||||
"Camera pos: " + GameMain.GameScreen.Cam.Position.ToPoint(),
|
||||
new Vector2(10, 40), Color.White);
|
||||
if (Screen.Selected.Cam != null)
|
||||
{
|
||||
DrawString(spriteBatch, new Vector2(10, 40),
|
||||
"Camera pos: " + Screen.Selected.Cam.Position.ToPoint(),
|
||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||
}
|
||||
|
||||
if (Submarine.MainSub != null)
|
||||
{
|
||||
spriteBatch.DrawString(SmallFont,
|
||||
DrawString(spriteBatch, new Vector2(10, 50),
|
||||
"Sub pos: " + Submarine.MainSub.Position.ToPoint(),
|
||||
new Vector2(10, 50), Color.White);
|
||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||
}
|
||||
|
||||
for (int i = 1; i < Sounds.SoundManager.DefaultSourceCount; i++)
|
||||
@@ -506,6 +501,28 @@ namespace Barotrauma
|
||||
cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition);
|
||||
}
|
||||
|
||||
public static void AddToGUIUpdateList()
|
||||
{
|
||||
if (pauseMenuOpen)
|
||||
{
|
||||
pauseMenu.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
if (settingsMenuOpen)
|
||||
{
|
||||
GameMain.Config.SettingsFrame.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
if (GUIMessageBox.MessageBoxes.Count > 0)
|
||||
{
|
||||
var messageBox = GUIMessageBox.MessageBoxes.Peek();
|
||||
if (messageBox != null)
|
||||
{
|
||||
messageBox.AddToGUIUpdateList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Update(float deltaTime)
|
||||
{
|
||||
if (pauseMenuOpen)
|
||||
@@ -523,7 +540,6 @@ namespace Barotrauma
|
||||
var messageBox = GUIMessageBox.MessageBoxes.Peek();
|
||||
if (messageBox != null)
|
||||
{
|
||||
GUIComponent.MouseOn = messageBox;
|
||||
messageBox.Update(deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,47 @@ namespace Barotrauma
|
||||
public abstract class GUIComponent
|
||||
{
|
||||
const float FlashDuration = 1.5f;
|
||||
|
||||
public static GUIComponent MouseOn;
|
||||
|
||||
public static GUIComponent MouseOn
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public static void ForceMouseOn(GUIComponent c)
|
||||
{
|
||||
MouseOn = c;
|
||||
}
|
||||
|
||||
protected static List<GUIComponent> ComponentsToUpdate = new List<GUIComponent>();
|
||||
|
||||
public virtual void AddToGUIUpdateList()
|
||||
{
|
||||
if (!Visible) return;
|
||||
if (ComponentsToUpdate.Contains(this)) return;
|
||||
ComponentsToUpdate.Add(this);
|
||||
children.ForEach(c => c.AddToGUIUpdateList());
|
||||
}
|
||||
|
||||
public static void ClearUpdateList()
|
||||
{
|
||||
ComponentsToUpdate.Clear();
|
||||
}
|
||||
|
||||
public static GUIComponent UpdateMouseOn()
|
||||
{
|
||||
MouseOn = null;
|
||||
for (int i=ComponentsToUpdate.Count-1;i>=0;i--)
|
||||
{
|
||||
GUIComponent c = ComponentsToUpdate[i];
|
||||
if (c.MouseRect.Contains(PlayerInput.MousePosition))
|
||||
{
|
||||
MouseOn = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return MouseOn;
|
||||
}
|
||||
|
||||
protected static KeyboardDispatcher keyboardDispatcher;
|
||||
|
||||
public enum ComponentState { None, Hover, Selected};
|
||||
@@ -97,6 +135,11 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Rectangle MouseRect
|
||||
{
|
||||
get { return CanBeFocused ? rect : Rectangle.Empty; }
|
||||
}
|
||||
|
||||
public List<UISprite> sprites;
|
||||
//public Alignment SpriteAlignment { get; set; }
|
||||
@@ -304,7 +347,7 @@ namespace Barotrauma
|
||||
|
||||
if (flashTimer>0.0f) flashTimer -= deltaTime;
|
||||
|
||||
if (CanBeFocused)
|
||||
/*if (CanBeFocused)
|
||||
{
|
||||
if (rect.Contains(PlayerInput.MousePosition))
|
||||
{
|
||||
@@ -315,7 +358,7 @@ namespace Barotrauma
|
||||
if (MouseOn == this) MouseOn = null;
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
//use a fixed list since children can change their order in the main children list
|
||||
//TODO: maybe find a more efficient way of handling changes in list order
|
||||
|
||||
@@ -166,6 +166,13 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
base.AddToGUIUpdateList();
|
||||
button.AddToGUIUpdateList();
|
||||
if (Dropped) listBox.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
if (!Visible) return;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Barotrauma
|
||||
|
||||
//if (style != null) ApplyStyle(style);
|
||||
}
|
||||
|
||||
|
||||
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
|
||||
{
|
||||
if (!Visible) return;
|
||||
|
||||
@@ -264,6 +264,20 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
base.AddToGUIUpdateList();
|
||||
if (scrollBarEnabled && !scrollBarHidden) scrollBar.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override Rectangle MouseRect
|
||||
{
|
||||
get
|
||||
{
|
||||
return Rectangle.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
if (!Visible) return;
|
||||
|
||||
@@ -14,7 +14,11 @@ namespace Barotrauma
|
||||
componentStyles = new Dictionary<string, GUIComponentStyle>();
|
||||
|
||||
XDocument doc;
|
||||
try { doc = XDocument.Load(file); }
|
||||
try
|
||||
{
|
||||
ToolBox.IsProperFilenameCase(file);
|
||||
doc = XDocument.Load(file);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("Loading style \"" + file + "\" failed", e);
|
||||
|
||||
@@ -55,6 +55,11 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public override Rectangle MouseRect
|
||||
{
|
||||
get { return box.Rect; }
|
||||
}
|
||||
|
||||
public GUITickBox(Rectangle rect, string label, Alignment alignment, GUIComponent parent)
|
||||
: this(rect, label, alignment, GUI.Font, parent)
|
||||
{
|
||||
@@ -69,6 +74,7 @@ namespace Barotrauma
|
||||
box = new GUIFrame(rect, Color.DarkGray, null, this);
|
||||
box.HoverColor = Color.Gray;
|
||||
box.SelectedColor = Color.DarkGray;
|
||||
box.CanBeFocused = false;
|
||||
|
||||
text = new GUITextBlock(new Rectangle(rect.Right + 10, rect.Y+2, 20, rect.Height), label, GUI.Style, this, font);
|
||||
|
||||
@@ -76,19 +82,19 @@ namespace Barotrauma
|
||||
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
if (!Visible || !Enabled) return;
|
||||
|
||||
if (MouseOn != null && MouseOn != this && !MouseOn.IsParentOf(this)) return;
|
||||
//if (MouseOn != null && MouseOn != this && !MouseOn.IsParentOf(this)) return;
|
||||
|
||||
if (text.Rect.Contains(PlayerInput.MousePosition)) MouseOn = this;
|
||||
//if (text.Rect.Contains(PlayerInput.MousePosition)) MouseOn = this;
|
||||
|
||||
if (box.Rect.Contains(PlayerInput.MousePosition))
|
||||
if (MouseOn==this)//box.Rect.Contains(PlayerInput.MousePosition))
|
||||
{
|
||||
//ToolTip = this.ToolTip;
|
||||
MouseOn = this;
|
||||
//MouseOn = this;
|
||||
|
||||
box.State = ComponentState.Hover;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user