(3ac5065f5) Fixed: Rendering order for Bugreporter window, OK button position

This commit is contained in:
Joonas Rikkonen
2019-05-18 17:42:41 +03:00
parent da693c20fa
commit 3a2310e547
52 changed files with 278 additions and 458 deletions
+14 -18
View File
@@ -36,16 +36,6 @@ namespace Barotrauma
get { return (GameMain.GraphicsWidth / 1920.0f + GameMain.GraphicsHeight / 1080.0f) / 2.0f * GameSettings.HUDScale; }
}
public static float xScale
{
get { return GameMain.GraphicsWidth / 1920.0f * GameSettings.HUDScale; }
}
public static float yScale
{
get { return GameMain.GraphicsHeight / 1080.0f * GameSettings.HUDScale; }
}
public static GUIStyle Style;
private static Texture2D t;
@@ -396,11 +386,8 @@ namespace Barotrauma
{
MouseOn.DrawToolTip(spriteBatch);
}
if (GameMain.WindowActive)
{
Cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition, 0, Scale / 2f);
}
Cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition);
}
public static void DrawBackgroundSprite(SpriteBatch spriteBatch, Sprite backgroundSprite, float blurAmount = 1.0f, float aberrationStrength = 1.0f)
@@ -570,7 +557,7 @@ namespace Barotrauma
private static void HandlePersistingElements(float deltaTime)
{
if (GUIMessageBox.VisibleBox != null && GUIMessageBox.VisibleBox.UserData as string != "verificationprompt")
if (GUIMessageBox.VisibleBox != null && GUIMessageBox.VisibleBox.UserData as string != "verificationprompt" && GUIMessageBox.VisibleBox.UserData as string != "bugreporter")
{
GUIMessageBox.VisibleBox.AddToGUIUpdateList();
}
@@ -585,7 +572,7 @@ namespace Barotrauma
}
//the "are you sure you want to quit" prompts are drawn on top of everything else
if (GUIMessageBox.VisibleBox?.UserData as string == "verificationprompt")
if (GUIMessageBox.VisibleBox?.UserData as string == "verificationprompt" || GUIMessageBox.VisibleBox?.UserData as string == "bugreporter")
{
GUIMessageBox.VisibleBox.AddToGUIUpdateList();
}
@@ -1447,7 +1434,16 @@ namespace Barotrauma
RelativeSpacing = 0.05f
};
var button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonContainer.RectTransform), TextManager.Get("PauseMenuResume"), style: "GUIButtonLarge")
var button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonContainer.RectTransform), TextManager.Get("bugreportbutton"), style: "GUIButtonLarge")
{
Color = Color.Red,
HoverColor = Color.DarkRed,
PressedColor = Color.White,
OnClicked = (btn, userdata) => { GameMain.Instance.ShowBugReporter(); return true; }
};
button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonContainer.RectTransform), TextManager.Get("PauseMenuResume"), style: "GUIButtonLarge")
{
OnClicked = TogglePauseMenu
};
@@ -471,8 +471,6 @@ namespace Barotrauma
public static void DrawToolTip(SpriteBatch spriteBatch, string toolTip, Rectangle targetElement)
{
if (Tutorials.Tutorial.ContentRunning) return;
int width = (int)(400 * GUI.Scale);
int height = (int)(18 * GUI.Scale);
Point padding = new Point((int)(20 * GUI.Scale), (int)(7 * GUI.Scale));
@@ -91,7 +91,7 @@ namespace Barotrauma
}
InnerFrame.RectTransform.NonScaledSize =
new Point(InnerFrame.Rect.Width, (int)Math.Max(height / Content.RectTransform.RelativeSize.Y, height + (int)(50 * GUI.yScale)));
new Point(InnerFrame.Rect.Width, (int)Math.Max(height / Content.RectTransform.RelativeSize.Y, height + 50));
Content.RectTransform.NonScaledSize =
new Point(Content.Rect.Width, height);
}
@@ -99,7 +99,7 @@ namespace Barotrauma
Buttons = new List<GUIButton>(buttons.Length);
for (int i = 0; i < buttons.Length; i++)
{
var button = new GUIButton(new RectTransform(new Vector2(Math.Min(0.9f / buttons.Length, 0.5f), 1.0f), buttonContainer.RectTransform), buttons[i], style: "GUIButtonLarge");
var button = new GUIButton(new RectTransform(new Vector2(Math.Min(0.9f / buttons.Length, 0.5f), 1.0f), buttonContainer.RectTransform, maxSize: new Point(300, 35)), buttons[i], style: "GUIButtonLarge");
Buttons.Add(button);
}
@@ -339,7 +339,7 @@ namespace Barotrauma
Font.DrawString(spriteBatch,
Wrap ? wrappedText : text,
pos,
rect.Location.ToVector2() + textPos + TextOffset,
textColor * (textColor.A / 255.0f),
0.0f, origin, TextScale,
SpriteEffects.None, textDepth);
@@ -208,7 +208,7 @@ namespace Barotrauma
for (int i = 0; i < lines.Length; i++)
{
GUI.Font.DrawString(spriteBatch, lines[i],
new Vector2((int)(GameMain.GraphicsWidth / 2.0f - GUI.Font.MeasureString(lines[i]).X / 2.0f), (int)(GameMain.GraphicsHeight * 0.78f + i * lineHeight)), Color.White);
new Vector2(GameMain.GraphicsWidth / 2.0f - GUI.Font.MeasureString(lines[i]).X / 2.0f, GameMain.GraphicsHeight * 0.78f + i * lineHeight), Color.White);
}
}
@@ -242,10 +242,6 @@ namespace Barotrauma
if (hover && PlayerInput.LeftButtonClicked())
{
GameMain.Config.Language = language;
//reload tip in the selected language
selectedTip = TextManager.Get("LoadingScreenTip", true);
GameMain.Config.SetDefaultBindings(legacy: false);
GameMain.Config.CheckBindings(useDefaults: true);
WaitForLanguageSelection = false;
}
@@ -356,7 +356,7 @@ namespace Barotrauma
Point? minSize = null, maxSize = null;
if (element.Attribute("minsize") != null) minSize = element.GetAttributePoint("minsize", Point.Zero);
//if (element.Attribute("maxsize") != null) maxSize = element.GetAttributePoint("maxsize", new Point(1000, 1000));
if (element.Attribute("maxsize") != null) maxSize = element.GetAttributePoint("maxsize", new Point(1000, 1000));
RectTransform rectTransform;
if (element.Attribute("relativesize") != null)