(89b895e0a) Added bug report buttons to game settings and pause menu

This commit is contained in:
Joonas Rikkonen
2019-05-18 17:17:03 +03:00
parent f605651966
commit efb9dcd0f0
3 changed files with 25 additions and 13 deletions
+10 -1
View File
@@ -1434,7 +1434,16 @@ namespace Barotrauma
RelativeSpacing = 0.05f 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 OnClicked = TogglePauseMenu
}; };
@@ -812,17 +812,18 @@ namespace Barotrauma
// ToDo: Move texts/links to localization, when possible. // ToDo: Move texts/links to localization, when possible.
public void ShowBugReporter() public void ShowBugReporter()
{ {
var msgBox = new GUIMessageBox("", ""); var msgBox = new GUIMessageBox(TextManager.Get("bugreportbutton"), "");
var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), msgBox.Content.RectTransform)) { Stretch = true, RelativeSpacing = 0.05f }; var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), msgBox.Content.RectTransform)) { Stretch = true, RelativeSpacing = 0.025f };
linkHolder.RectTransform.MaxSize = new Point(int.MaxValue, linkHolder.Rect.Height);
List<Pair<string, string>> links = new List<Pair<string, string>>() List<Pair<string, string>> links = new List<Pair<string, string>>()
{ {
new Pair<string, string>("Barotrauma Feedback Form","https://barotraumagame.com/feedback"), new Pair<string, string>(TextManager.Get("bugreportfeedbackform"),"https://barotraumagame.com/feedback"),
new Pair<string, string>("Github Issue Form (Needs account)","https://github.com/Regalis11/Barotrauma/issues/new?template=bug_report.md") new Pair<string, string>(TextManager.Get("bugreportgithubform"),"https://github.com/Regalis11/Barotrauma/issues/new?template=bug_report.md")
}; };
foreach (var link in links) foreach (var link in links)
{ {
new GUIButton(new RectTransform(new Vector2(1.0f, 0.2f), linkHolder.RectTransform), link.First, style: "MainMenuGUIButton", textAlignment: Alignment.Left) new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), linkHolder.RectTransform), link.First, style: "MainMenuGUIButton", textAlignment: Alignment.Left)
{ {
UserData = link.Second, UserData = link.Second,
OnClicked = (btn, userdata) => OnClicked = (btn, userdata) =>
@@ -833,6 +834,9 @@ namespace Barotrauma
} }
}; };
} }
msgBox.InnerFrame.RectTransform.MinSize = new Point(0,
msgBox.InnerFrame.Rect.Height + linkHolder.Rect.Height + msgBox.Content.AbsoluteSpacing * 2 + 10);
} }
static bool waitForKeyHit = true; static bool waitForKeyHit = true;
@@ -85,13 +85,6 @@ namespace Barotrauma
TextManager.Get("Settings"), textAlignment: Alignment.TopLeft, font: GUI.LargeFont) TextManager.Get("Settings"), textAlignment: Alignment.TopLeft, font: GUI.LargeFont)
{ ForceUpperCase = true }; { ForceUpperCase = true };
//TODO: enable when new texts can be added
/*new GUIButton(new RectTransform(new Vector2(1.0f, 0.75f), settingsTitle.RectTransform, Anchor.CenterRight), style: "GUIBugButton")
{
ToolTip = "Bug Reporter",
OnClicked = (btn, userdata) => { GameMain.Instance.ShowBugReporter(); return true; }
};*/
var generalLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), leftPanel.RectTransform, Anchor.TopLeft)); var generalLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), leftPanel.RectTransform, Anchor.TopLeft));
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), generalLayoutGroup.RectTransform), TextManager.Get("ContentPackages")); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), generalLayoutGroup.RectTransform), TextManager.Get("ContentPackages"));
@@ -178,6 +171,12 @@ namespace Barotrauma
}; };
} }
new GUIButton(new RectTransform(new Vector2(0.05f, 0.75f), tabButtonHolder.RectTransform, Anchor.BottomRight) { RelativeOffset = new Vector2(0.0f, 0.2f) }, style: "GUIBugButton")
{
ToolTip = TextManager.Get("bugreportbutton"),
OnClicked = (btn, userdata) => { GameMain.Instance.ShowBugReporter(); return true; }
};
var buttonArea = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.08f), paddedFrame.RectTransform, Anchor.BottomCenter), style: null); var buttonArea = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.08f), paddedFrame.RectTransform, Anchor.BottomCenter), style: null);
/// Graphics tab -------------------------------------------------------------- /// Graphics tab --------------------------------------------------------------