"Suicide button" is also usable in single player, unconscious characters can't be selected in sp, fixed resizing textblocks with wrapped text

This commit is contained in:
Regalis
2016-04-23 17:26:56 +03:00
parent 99072592bc
commit 14ef736176
7 changed files with 32 additions and 23 deletions

View File

@@ -38,7 +38,7 @@ namespace Barotrauma
if (cprButton != null && cprButton.Visible) cprButton.Update(deltaTime);
if (GameMain.NetworkMember != null && suicideButton != null && suicideButton.Visible) suicideButton.Update(deltaTime);
if (suicideButton != null && suicideButton.Visible) suicideButton.Update(deltaTime);
if (damageOverlayTimer > 0.0f) damageOverlayTimer -= deltaTime;
}
@@ -174,7 +174,7 @@ namespace Barotrauma
new Vector2(GameMain.GraphicsWidth / damageOverlay.size.X, GameMain.GraphicsHeight / damageOverlay.size.Y));
}
if (character.IsUnconscious && GameMain.NetworkMember!=null)
if (character.IsUnconscious)
{
if (suicideButton == null)
{

View File

@@ -58,9 +58,9 @@ namespace Barotrauma
frame.Color = Color.White * 0.4f;
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
listBox = new GUIListBox(new Rectangle(0,0,0, frame.Rect.Height-40), Color.Black*0.9f, null, frame);
listBox = new GUIListBox(new Rectangle(0,0,0, frame.Rect.Height-40), Color.Black*0.9f, GUI.Style, frame);
textBox = new GUITextBox(new Rectangle(0,0,0,20), Color.Black*0.6f, Color.White, Alignment.BottomLeft, Alignment.Left, null, frame);
textBox = new GUITextBox(new Rectangle(0,0,0,20), Color.Black*0.6f, Color.White, Alignment.BottomLeft, Alignment.Left, GUI.Style, frame);
NewMessage("Press F3 to open/close the debug console", Color.Cyan);
NewMessage("Enter ''help'' for a list of available console commands", Color.Cyan);
@@ -513,6 +513,8 @@ namespace Barotrauma
DebugConsole.NewMessage("Resolution set to 0 x 0 (screen resolution will be used)", Color.Green);
DebugConsole.NewMessage("Fullscreen enabled", Color.Green);
GameSettings.VerboseLogging = false;
if (GameMain.Config.MasterServerUrl != "http://www.undertowgames.com/baromaster")
{
DebugConsole.ThrowError("MasterServerUrl ''"+GameMain.Config.MasterServerUrl+"''!");
@@ -590,7 +592,7 @@ namespace Barotrauma
try
{
var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 15), msg, GUI.Style, Alignment.TopLeft, Alignment.Left, null, true, GUI.SmallFont);
var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), msg, GUI.Style, Alignment.TopLeft, Alignment.Left, null, true, GUI.SmallFont);
textBlock.CanBeFocused = false;
textBlock.TextColor = color;

View File

@@ -70,6 +70,8 @@ namespace Barotrauma
LargeFont = ToolBox.TryLoadFont("LargeFont", content);
cursor = new Sprite("Content/UI/cursor.png", Vector2.Zero);
Style = new GUIStyle("Content/UI/style.xml");
}
public static bool PauseMenuOpen
@@ -107,8 +109,6 @@ namespace Barotrauma
SpeechBubbleIcon = new Sprite("Content/UI/uiIcons.png", new Rectangle(0, 129, 65, 61), null);
SpeechBubbleIcon.Origin = SpeechBubbleIcon.size / 2;
Style = new GUIStyle("Content/UI/style.xml");
}
public static void TogglePauseMenu()

View File

@@ -230,8 +230,8 @@ namespace Barotrauma
}
scrollBar.BarSize = scrollBar.IsHorizontal ?
Math.Min((float)rect.Width / (float)totalSize, 1.0f) :
Math.Min((float)rect.Height / (float)totalSize, 1.0f);
Math.Max(Math.Min((float)rect.Width / (float)totalSize, 1.0f), 5.0f / rect.Width) :
Math.Max(Math.Min((float)rect.Height / (float)totalSize, 1.0f), 5.0f / rect.Height);
if (scrollBar.BarSize < 1.0f && scrollBarHidden) ShowScrollBar();
if (scrollBar.BarSize >= 1.0f && !scrollBarHidden) HideScrollBar();

View File

@@ -159,7 +159,7 @@ namespace Barotrauma
if (rect.Height == 0 && !string.IsNullOrWhiteSpace(Text))
{
this.rect.Height = (int)Font.MeasureString(Text).Y;
this.rect.Height = (int)Font.MeasureString(wrappedText).Y;
}
}

View File

@@ -68,7 +68,7 @@ namespace Barotrauma
//listBox.Select(selection);
Character character = selection as Character;
if (character == null || character.IsDead) return false;
if (character == null || character.IsDead || character.IsUnconscious) return false;
if (characters.Contains(character))
{
@@ -242,7 +242,7 @@ namespace Barotrauma
protected virtual bool SelectCrewCharacter(GUIComponent component, object obj)
{
Character character = obj as Character;
if (character == null) return false;
if (character == null || character.IsDead || character.IsUnconscious) return false;
var crewFrame = component.Parent;
while (crewFrame.Parent!=null)

View File

@@ -67,7 +67,7 @@ namespace Barotrauma
{
if (hasInGameEditableProperties==null)
{
hasInGameEditableProperties = GetProperties<InGameEditable>().Count>0;
hasInGameEditableProperties = GetProperties<InGameEditable>().Any();
}
return (bool)hasInGameEditableProperties;
}
@@ -882,6 +882,20 @@ namespace Barotrauma
}
}
public void DrawInGameEditing(SpriteBatch spriteBatch)
{
if (editingHUD == null || editingHUD.UserData as Item != this)
{
editingHUD = CreateEditingHUD(true);
}
if (editingHUD.Rect.Height > 60)
{
editingHUD.Update((float)Physics.step);
editingHUD.Draw(spriteBatch);
}
}
private GUIComponent CreateEditingHUD(bool inGame=false)
{
int width = 450;
@@ -949,6 +963,8 @@ namespace Barotrauma
GUITickBox propertyTickBox = new GUITickBox(new Rectangle(10, y, 20, 20), objectProperty.Name,
Alignment.Left, editingHUD);
propertyTickBox.Selected = (bool)value;
propertyTickBox.UserData = objectProperty;
propertyTickBox.OnSelected = EnterProperty;
}
@@ -994,16 +1010,7 @@ namespace Barotrauma
if (HasInGameEditableProperties)
{
if (editingHUD == null || editingHUD.UserData as Item != this)
{
editingHUD = CreateEditingHUD(true);
}
if (editingHUD.Rect.Height > 60)
{
editingHUD.Update((float)Physics.step);
editingHUD.Draw(spriteBatch);
}
DrawInGameEditing(spriteBatch);
}
foreach (ItemComponent ic in components)