Online quest mode, fixed bug when swimming from hull to another, monitors with editable text, choosing exe in content package, monster quests, misc bugfixes

This commit is contained in:
Regalis
2015-07-30 18:52:20 +03:00
parent 5d0a453e23
commit c7dd6e55f0
53 changed files with 3477 additions and 219 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ namespace Subsurface
y += 60;
if (Screen.Selected == Game1.GameScreen)
if (Screen.Selected == Game1.GameScreen && Game1.GameSession !=null)
{
SinglePlayerMode spMode = Game1.GameSession.gameMode as SinglePlayerMode;
if (spMode!=null)
+9 -3
View File
@@ -21,8 +21,14 @@ namespace Subsurface
this.Buttons[0].OnClicked = Close;
}
public GUIMessageBox(string header, string text, string[] buttons, Alignment textAlignment = Alignment.TopLeft)
: base(new Rectangle(0,0, DefaultWidth, DefaultHeight),
public GUIMessageBox(string header, string text, int width, int height)
: this(header, text, new string[] { "OK" }, width, height)
{
this.Buttons[0].OnClicked = Close;
}
public GUIMessageBox(string header, string text, string[] buttons, int width=DefaultWidth, int height=DefaultHeight, Alignment textAlignment = Alignment.TopLeft)
: base(new Rectangle(0,0, width, height),
null, Alignment.Center, GUI.style, null)
{
//Padding = GUI.style.smallPadding;
@@ -34,7 +40,7 @@ namespace Subsurface
//}
new GUITextBlock(new Rectangle(0, 0, 0, 30), header, Color.Transparent, Color.White, textAlignment, GUI.style, this, true);
new GUITextBlock(new Rectangle(0, 30, 0, DefaultHeight - 70), text, Color.Transparent, Color.White, textAlignment, GUI.style, this, true);
new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text, Color.Transparent, Color.White, textAlignment, GUI.style, this, true);
int x = 0;
this.Buttons = new GUIButton[buttons.Length];
+26 -4
View File
@@ -43,6 +43,12 @@ namespace Subsurface
}
}
public bool LimitText
{
get;
set;
}
public Vector2 TextPos
{
get { return textPos; }
@@ -124,14 +130,14 @@ namespace Subsurface
{
if (text==null) return;
Vector2 size = MeasureText();
Vector2 size = MeasureText(text);
if (Wrap && rect.Width>0)
{
//text = text.Replace("\n"," ");
text = ToolBox.WrapText(text, rect.Width, Font);
Vector2 newSize = MeasureText();
Vector2 newSize = MeasureText(text);
//Rectangle newRect = rect;
@@ -141,6 +147,12 @@ namespace Subsurface
//Rect = newRect;
size = newSize;
}
if (LimitText && text.Length>1 && size.Y > rect.Height)
{
string[] lines = text.Split('\n');
text = string.Join("\n", lines, 0, lines.Length-1);
}
textPos = new Vector2(rect.Width / 2.0f, rect.Height / 2.0f);
origin = size * 0.5f;
@@ -163,10 +175,20 @@ namespace Subsurface
textPos.X = (int)textPos.X;
textPos.Y = (int)textPos.Y;
caretPos = new Vector2(rect.X + size.X, rect.Y) + textPos - origin;
if (text.Contains("\n"))
{
string[] lines = text.Split('\n');
Vector2 lastLineSize = MeasureText(lines[lines.Length-1]);
caretPos = new Vector2(rect.X + lastLineSize.X, rect.Y + size.Y - lastLineSize.Y) + textPos - origin;
}
else
{
caretPos = new Vector2(rect.X + size.X, rect.Y) + textPos - origin;
}
}
private Vector2 MeasureText()
private Vector2 MeasureText(string text)
{
Vector2 size = Vector2.Zero;
while (size == Vector2.Zero)
+6 -2
View File
@@ -36,6 +36,12 @@ namespace Subsurface
set { textBlock.Wrap = value; }
}
public bool LimitText
{
get { return textBlock.LimitText; }
set { textBlock.LimitText = value; }
}
public bool Enabled
{
get;
@@ -187,10 +193,8 @@ namespace Subsurface
new Vector2((int)caretPos.X + 2, caretPos.Y + Font.MeasureString("I").Y - 3),
textBlock.TextColor * (textBlock.TextColor.A / 255.0f));
}
}
public void ReceiveTextInput(char inputChar)
{
Text = Text + inputChar;