From 427526aba2e15dcf3e03710236ea9aa6d0d72930 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Tue, 7 May 2019 18:05:16 +0300 Subject: [PATCH] (d4a475f03) Added text wrapping to pump GUI texts --- .../BarotraumaClient/Source/GUI/VideoPlayer.cs | 2 +- .../GameSession/GameModes/Tutorials/Tutorial.cs | 13 ++++++------- .../Source/Items/Components/Machines/Pump.cs | 8 ++++---- .../Source/Screens/MainMenuScreen.cs | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/GUI/VideoPlayer.cs b/Barotrauma/BarotraumaClient/Source/GUI/VideoPlayer.cs index be069e5da..ea9adc6f3 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/VideoPlayer.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/VideoPlayer.cs @@ -141,7 +141,7 @@ namespace Barotrauma } currentVideo = CreateVideo(scaledVideoResolution); - title.Text = textSettings != null ? TextManager.Get(contentId) : string.Empty; + title.Text = TextManager.Get(contentId); textContent.Text = textSettings != null ? textSettings.Text : string.Empty; objectiveText.Text = objective; diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/Tutorial.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/Tutorial.cs index 442b34a43..5106b9aba 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/Tutorial.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/Tutorial.cs @@ -305,7 +305,7 @@ namespace Barotrauma.Tutorials infoBox = CreateInfoFrame(TextManager.Get(activeContentSegment.Id), tutorialText, activeContentSegment.TextContent.GetAttributeInt("width", 300), activeContentSegment.TextContent.GetAttributeInt("height", 80), - activeContentSegment.TextContent.GetAttributeString("anchor", "Center"), true, StopCurrentContentSegment, () => LoadVideo(activeContentSegment)); + activeContentSegment.TextContent.GetAttributeString("anchor", "Center"), true, StopCurrentContentSegment, () => LoadVideo(activeContentSegment, false)); break; case TutorialContentTypes.TextOnly: infoBox = CreateInfoFrame(TextManager.Get(activeContentSegment.Id), tutorialText, @@ -404,8 +404,7 @@ namespace Barotrauma.Tutorials { if (ContentRunning) return; ContentRunning = true; - LoadVideo(segment); - //videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, callback: () => ContentRunning = false); + videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, callback: () => ContentRunning = false); } private void ShowSegmentText(TutorialSegment segment) @@ -420,7 +419,7 @@ namespace Barotrauma.Tutorials if (segment.ContentType != TutorialContentTypes.TextOnly) { - videoAction = () => LoadVideo(segment); + videoAction = () => LoadVideo(segment, false); } infoBox = CreateInfoFrame(TextManager.Get(segment.Id), tutorialText, @@ -567,16 +566,16 @@ namespace Barotrauma.Tutorials #endregion #region Video - protected void LoadVideo(TutorialSegment segment) + protected void LoadVideo(TutorialSegment segment, bool showText = true) { if (videoPlayer == null) videoPlayer = new VideoPlayer(); - if (segment.ContentType != TutorialContentTypes.ManualVideo) + if (showText) { videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, segment.Objective, StopCurrentContentSegment); } else { - videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), null, segment.Id, true, string.Empty, null); + videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), null, segment.Id, true, segment.Objective, null); } } #endregion diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs index 5ef0e010c..8b885cab9 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Pump.cs @@ -78,8 +78,8 @@ namespace Barotrauma.Items.Components CanBeFocused = false }; - var pumpSpeedText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), rightArea.RectTransform) { RelativeOffset = new Vector2(0.25f, 0.0f) }, - "", textAlignment: Alignment.BottomLeft); + var pumpSpeedText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), rightArea.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.0f) }, + "", textAlignment: Alignment.BottomLeft, wrap: true); string pumpSpeedStr = TextManager.Get("PumpSpeed"); pumpSpeedText.TextGetter = () => { return pumpSpeedStr + ": " + (int)flowPercentage + " %"; }; @@ -90,7 +90,7 @@ namespace Barotrauma.Items.Components }; new GUITextBlock(new RectTransform(new Vector2(0.15f, 1.0f), sliderArea.RectTransform), - TextManager.Get("PumpOut"), textAlignment: Alignment.Center); + TextManager.Get("PumpOut"), textAlignment: Alignment.Center, wrap: true); pumpSpeedSlider = new GUIScrollBar(new RectTransform(new Vector2(0.8f, 1.0f), sliderArea.RectTransform), barSize: 0.25f, style: "GUISlider") { Step = 0.05f, @@ -111,7 +111,7 @@ namespace Barotrauma.Items.Components }; new GUITextBlock(new RectTransform(new Vector2(0.15f, 1.0f), sliderArea.RectTransform), - TextManager.Get("PumpIn"), textAlignment: Alignment.Center); + TextManager.Get("PumpIn"), textAlignment: Alignment.Center, wrap: true); } public override void OnItemLoaded() diff --git a/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs index 7708c9eb8..76ac8bd4f 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs @@ -252,7 +252,7 @@ namespace Barotrauma OnClicked = SelectTab }; //TODO: translate - new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), optionList.RectTransform), TextManager.Get("CreditsButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton") + new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), optionList.RectTransform), "Credits", textAlignment: Alignment.Left, style: "MainMenuGUIButton") { ForceUpperCase = true, UserData = Tab.Credits,