diff --git a/Barotrauma/BarotraumaClient/Source/GameMain.cs b/Barotrauma/BarotraumaClient/Source/GameMain.cs index 51f3c76fb..db53f1903 100644 --- a/Barotrauma/BarotraumaClient/Source/GameMain.cs +++ b/Barotrauma/BarotraumaClient/Source/GameMain.cs @@ -705,6 +705,55 @@ namespace Barotrauma PerformanceCounter.DrawTimeGraph.Update(sw.ElapsedTicks / (float)TimeSpan.TicksPerMillisecond); } + public void ShowCampaignDisclaimer() + { + var msgBox = new GUIMessageBox(TextManager.Get("CampaignDisclaimerTitle"), TextManager.Get("CampaignDisclaimerText"), + new string[] { TextManager.Get("CampaignRoadMapTitle"), TextManager.Get("OK") }); + + msgBox.Buttons[0].OnClicked = (btn, userdata) => + { + var roadMap = new GUIMessageBox(TextManager.Get("CampaignRoadMapTitle"), TextManager.Get("CampaignRoadMapText"), + new string[] { TextManager.Get("Back"), TextManager.Get("OK") }); + roadMap.Buttons[0].OnClicked = (_, __) => { ShowCampaignDisclaimer(); return true; }; + roadMap.Buttons[0].OnClicked += roadMap.Close; + roadMap.Buttons[1].OnClicked += roadMap.Close; + return true; + }; + msgBox.Buttons[0].OnClicked += msgBox.Close; + msgBox.Buttons[1].OnClicked += msgBox.Close; + + Config.CampaignDisclaimerShown = true; + Config.SaveNewPlayerConfig(); + } + public void ShowEditorDisclaimer() + { + var msgBox = new GUIMessageBox(TextManager.Get("EditorDisclaimerTitle"), TextManager.Get("EditorDisclaimerText")); + var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.25f), msgBox.Content.RectTransform)) { Stretch = true, AbsoluteSpacing = 5 }; + List> links = new List>() + { + new Pair(TextManager.Get("EditorDisclaimerWikiLink"),TextManager.Get("EditorDisclaimerWikiUrl")), + new Pair(TextManager.Get("EditorDisclaimerDiscordLink"),TextManager.Get("EditorDisclaimerDiscordUrl")), + new Pair(TextManager.Get("EditorDisclaimerForumLink"),TextManager.Get("EditorDisclaimerForumUrl")), + }; + foreach (var link in links) + { + new GUIButton(new RectTransform(new Vector2(1.0f, 0.2f), linkHolder.RectTransform), link.First, style: "MainMenuGUIButton") + { + UserData = link.Second, + OnClicked = (btn, userdata) => + { + Process.Start(userdata as string); + return true; + } + }; + } + msgBox.Text.RectTransform.MaxSize = new Point(int.MaxValue, msgBox.Text.Rect.Height); + linkHolder.RectTransform.MaxSize = new Point(int.MaxValue, linkHolder.Rect.Height); + msgBox.RectTransform.MinSize = new Point(0, msgBox.Rect.Height + linkHolder.Rect.Height + msgBox.Buttons.First().Rect.Height * 2); + Config.EditorDisclaimerShown = true; + Config.SaveNewPlayerConfig(); + } + static bool waitForKeyHit = true; public CoroutineHandle ShowLoading(IEnumerable loader, bool waitKeyHit = true) { diff --git a/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs index bb865ab01..67aa1ec7b 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs @@ -127,6 +127,14 @@ namespace Barotrauma OpenDoors(); GameMain.Instance.OnResolutionChanged += OnResolutionChanged; instance = this; + + if (!GameMain.Config.EditorDisclaimerShown) + { + GameMain.Instance.ShowEditorDisclaimer(); + } + OpenDoors(); + GameMain.Instance.OnResolutionChanged += OnResolutionChanged; + instance = this; } private void ResetVariables() @@ -1776,8 +1784,20 @@ namespace Barotrauma Vector2 buttonSize = new Vector2(1, 0.04f); Vector2 toggleSize = new Vector2(0.03f, 0.03f); Point margin = new Point(40, 60); - rightPanel = new GUIFrame(new RectTransform(new Vector2(0.15f, 0.95f), parent: Frame.RectTransform, anchor: Anchor.CenterRight) { RelativeOffset = new Vector2(0.01f, 0) }); - var layoutGroup = new GUILayoutGroup(new RectTransform(new Point(rightPanel.Rect.Width - margin.X, rightPanel.Rect.Height - margin.Y), rightPanel.RectTransform, Anchor.Center)); + rightPanel = new GUIFrame(new RectTransform(new Vector2(0.15f, 1.0f), parent: Frame.RectTransform, anchor: Anchor.CenterRight), style: "GUIFrameRight"); + var layoutGroup = new GUILayoutGroup(new RectTransform(new Point(rightPanel.Rect.Width - margin.X, rightPanel.Rect.Height - margin.Y), rightPanel.RectTransform, Anchor.Center)) + { + Stretch = true + }; + + var disclaimerBtnHolder = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.04f), layoutGroup.RectTransform), style: null); + + var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(1.0f, 0.8f), disclaimerBtnHolder.RectTransform, Anchor.TopRight), style: "GUINotificationButton") + { + OnClicked = (btn, userdata) => { GameMain.Instance.ShowEditorDisclaimer(); return true; } + }; + disclaimerBtn.RectTransform.MaxSize = new Point(disclaimerBtn.Rect.Height); + var characterDropDown = new GUIDropDown(new RectTransform(new Vector2(1, 0.04f), layoutGroup.RectTransform), elementCount: 10, style: null); characterDropDown.ListBox.Color = new Color(characterDropDown.ListBox.Color.R, characterDropDown.ListBox.Color.G, characterDropDown.ListBox.Color.B, byte.MaxValue); foreach (var file in AllFiles) @@ -1808,14 +1828,16 @@ namespace Barotrauma return true; }; } - var charButtons = new GUIFrame(new RectTransform(buttonSize, parent: layoutGroup.RectTransform), style: null); - var prevCharacterButton = new GUIButton(new RectTransform(new Vector2(0.5f, 1), charButtons.RectTransform, Anchor.TopLeft), GetCharacterEditorTranslation("PreviousCharacter")); + var charButtons = new GUIFrame(new RectTransform(new Vector2(buttonSize.X, buttonSize.Y * 1.5f), parent: layoutGroup.RectTransform), style: null); + var prevCharacterButton = new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), charButtons.RectTransform, Anchor.TopLeft), GetCharacterEditorTranslation("PreviousCharacter")); + prevCharacterButton.TextBlock.AutoScale = true; prevCharacterButton.OnClicked += (b, obj) => { SpawnCharacter(GetPreviousConfigFile()); return true; }; - var nextCharacterButton = new GUIButton(new RectTransform(new Vector2(0.5f, 1), charButtons.RectTransform, Anchor.TopRight), GetCharacterEditorTranslation("NextCharacter")); + var nextCharacterButton = new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), charButtons.RectTransform, Anchor.TopRight), GetCharacterEditorTranslation("NextCharacter")); + prevCharacterButton.TextBlock.AutoScale = true; nextCharacterButton.OnClicked += (b, obj) => { SpawnCharacter(GetNextConfigFile()); diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs index b941ec8c3..e60e94f64 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs @@ -183,6 +183,12 @@ namespace Barotrauma TextGetter = GetSubName }; + var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(0.1f, 1.0f), paddedTopPanel.RectTransform, Anchor.CenterRight), style: "GUINotificationButton") + { + OnClicked = (btn, userdata) => { GameMain.Instance.ShowEditorDisclaimer(); return true; } + }; + disclaimerBtn.RectTransform.MaxSize = new Point(disclaimerBtn.Rect.Height); + linkedSubBox = new GUIDropDown(new RectTransform(new Vector2(0.15f, 0.9f), paddedTopPanel.RectTransform) { RelativeOffset = new Vector2(0.385f, 0.0f) }, TextManager.Get("AddSubButton"), elementCount: 20) { @@ -627,6 +633,10 @@ namespace Barotrauma cam.UpdateTransform(); GameAnalyticsManager.SetCustomDimension01("editor"); + if (!GameMain.Config.EditorDisclaimerShown) + { + GameMain.Instance.ShowEditorDisclaimer(); + } } public override void Deselect() diff --git a/Barotrauma/BarotraumaShared/Source/GameSettings.cs b/Barotrauma/BarotraumaShared/Source/GameSettings.cs index aadc63b10..e85d877db 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSettings.cs @@ -271,6 +271,8 @@ namespace Barotrauma public static bool VerboseLogging { get; set; } public static bool SaveDebugConsoleLogs { get; set; } + public bool CampaignDisclaimerShown, EditorDisclaimerShown; + private static bool sendUserStatistics; public static bool SendUserStatistics { @@ -853,6 +855,9 @@ namespace Barotrauma CrewMenuOpen = doc.Root.GetAttributeBool("crewmenuopen", CrewMenuOpen); ChatOpen = doc.Root.GetAttributeBool("chatopen", ChatOpen); + CampaignDisclaimerShown = doc.Root.GetAttributeBool("campaigndisclaimershown", false); + EditorDisclaimerShown = doc.Root.GetAttributeBool("editordisclaimershown", false); + foreach (XElement subElement in doc.Root.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) @@ -1043,7 +1048,9 @@ namespace Barotrauma new XAttribute("aimassistamount", aimAssistAmount), new XAttribute("enablemouselook", EnableMouseLook), new XAttribute("chatopen", ChatOpen), - new XAttribute("crewmenuopen", CrewMenuOpen)); + new XAttribute("crewmenuopen", CrewMenuOpen), + new XAttribute("campaigndisclaimershown", CampaignDisclaimerShown), + new XAttribute("editordisclaimershown", EditorDisclaimerShown)); if (!ShowUserStatisticsPrompt) {