From 5e173c0e5d3ff0efa3f8b80f941bfa04c9912bc0 Mon Sep 17 00:00:00 2001 From: robojumper Date: Mon, 7 Aug 2017 15:54:04 +0200 Subject: [PATCH] Fix Version Text Localize, Align with ticker, fix GC issue, allow to be turned off --- X2CommunityHighlander.XCOM_sln | 10 ++-- X2CommunityHighlander/Config/XComGame.ini | 5 +- .../Localization/X2CommunityHighlander.int | 3 ++ .../X2CH_UIScreenListener_ShellSplash.uc | 53 +++++++++++++------ .../X2CommunityHighlander.x2proj | 3 ++ 5 files changed, 53 insertions(+), 21 deletions(-) create mode 100644 X2CommunityHighlander/Localization/X2CommunityHighlander.int diff --git a/X2CommunityHighlander.XCOM_sln b/X2CommunityHighlander.XCOM_sln index cea4268..8b5a366 100644 --- a/X2CommunityHighlander.XCOM_sln +++ b/X2CommunityHighlander.XCOM_sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # XCOM ModBuddy Solution File, Format Version 11.00 VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{5DAE07AF-E217-45C1-8DE7-FF99D6011E8A}") = "X2CommunityHighlander", "X2CommunityHighlander\X2CommunityHighlander.x2proj", "{4D637F30-1C48-46C7-9C88-48598D80A595}" +Project("{5DAE07AF-E217-45C1-8DE7-FF99D6011E8A}") = "X2CommunityHighlander", "X2CommunityHighlander\X2CommunityHighlander.x2proj", "{6671DE85-5595-469A-9B54-28A003DEFE77}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Default|XCOM 2 = Default|XCOM 2 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4D637F30-1C48-46C7-9C88-48598D80A595}.Debug|XCOM 2.ActiveCfg = Debug|XCOM 2 - {4D637F30-1C48-46C7-9C88-48598D80A595}.Debug|XCOM 2.Build.0 = Debug|XCOM 2 - {4D637F30-1C48-46C7-9C88-48598D80A595}.Default|XCOM 2.ActiveCfg = Debug|XCOM 2 - {4D637F30-1C48-46C7-9C88-48598D80A595}.Default|XCOM 2.Build.0 = Debug|XCOM 2 + {6671DE85-5595-469A-9B54-28A003DEFE77}.Debug|XCOM 2.ActiveCfg = Debug|XCOM 2 + {6671DE85-5595-469A-9B54-28A003DEFE77}.Debug|XCOM 2.Build.0 = Debug|XCOM 2 + {6671DE85-5595-469A-9B54-28A003DEFE77}.Default|XCOM 2.ActiveCfg = Debug|XCOM 2 + {6671DE85-5595-469A-9B54-28A003DEFE77}.Default|XCOM 2.Build.0 = Debug|XCOM 2 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/X2CommunityHighlander/Config/XComGame.ini b/X2CommunityHighlander/Config/XComGame.ini index 253db65..997b24b 100644 --- a/X2CommunityHighlander/Config/XComGame.ini +++ b/X2CommunityHighlander/Config/XComGame.ini @@ -1,2 +1,5 @@ [X2CommunityHighlander.X2DownloadableContentInfo_X2CommunityHighlander] -DLCIdentifier="X2CommunityHighlander" \ No newline at end of file +DLCIdentifier="X2CommunityHighlander" + +[X2CommunityHighlander.X2CH_UIScreenListener_ShellSplash] +bEnableVersionDisplay=true diff --git a/X2CommunityHighlander/Localization/X2CommunityHighlander.int b/X2CommunityHighlander/Localization/X2CommunityHighlander.int new file mode 100644 index 0000000..e6a7417 --- /dev/null +++ b/X2CommunityHighlander/Localization/X2CommunityHighlander.int @@ -0,0 +1,3 @@ +[X2CH_UIScreenListener_ShellSplash] +strLWHLVersion"Long War 2 Highlander v%MAJOR.%MINOR" +strCHLVersion="X2CommunityHighlander v%MAJOR.%MINOR" diff --git a/X2CommunityHighlander/Src/X2CommunityHighlander/Classes/X2CH_UIScreenListener_ShellSplash.uc b/X2CommunityHighlander/Src/X2CommunityHighlander/Classes/X2CH_UIScreenListener_ShellSplash.uc index ca787e1..ff0b316 100644 --- a/X2CommunityHighlander/Src/X2CommunityHighlander/Classes/X2CH_UIScreenListener_ShellSplash.uc +++ b/X2CommunityHighlander/Src/X2CommunityHighlander/Classes/X2CH_UIScreenListener_ShellSplash.uc @@ -1,6 +1,9 @@ -class X2CH_UIScreenListener_ShellSplash extends UIScreenListener; +class X2CH_UIScreenListener_ShellSplash extends UIScreenListener config(Game); -var UIText VersionText; +var config bool bEnableVersionDisplay; + +var localized string strLWHLVersion; +var localized string strCHLVersion; event OnInit(UIScreen Screen) { @@ -9,9 +12,12 @@ event OnInit(UIScreen Screen) local X2StrategyElementTemplate LWElem, CHElem; local CHXComGameVersionTemplate CHVersion; local LWXComGameVersionTemplate LWVersion; - local String VersionString; + local string VersionString; + + local UIText VersionText; + local int iMajor, iMinor; - if(UIShell(Screen) == none) // this captures UIShell and UIFinalShell + if(UIShell(Screen) == none || !bEnableVersionDisplay) // this captures UIShell and UIFinalShell return; ShellScreen = UIShell(Screen); @@ -26,23 +32,40 @@ event OnInit(UIScreen Screen) if (CHElem != none) { CHVersion = CHXComGameVersionTemplate(CHElem); - VersionString = VersionString $ "X2CommunityHighlander Version " $ CHVersion.MajorVersion $ "." $ CHVersion.MinorVersion $ ". "; + VersionString = strCHLVersion; + iMajor = CHVersion.MajorVersion; + iMinor = CHVersion.MinorVersion; } - - if (LWElem != none) + else if (LWElem != none) { LWVersion = LWXComGameVersionTemplate(LWElem); - VersionString = VersionString $ "Long War Highlander Version " $ LWVersion.MajorVersion $ "." $ LWVersion.MinorVersion $ ". "; + VersionString = strLWHLVersion; + iMajor = LWVersion.MajorVersion; + iMinor = LWVersion.MinorVersion; } + VersionString = Repl(VersionString, "%MAJOR", iMajor); + VersionString = Repl(VersionString, "%MINOR", iMinor); - `log("X2CH SCREEN LISTENER ON SPLASH"); + `log("X2CH SCREEN LISTENER ON SPLASH" @ VersionString); VersionText = ShellScreen.Spawn(class'UIText', ShellScreen); - VersionText.InitText(); - VersionText.SetText(VersionString); - VersionText.AnchorTopRight(); - VersionText.SetPosition(10,10); - VersionText.SetSize(400,32); - VersionText.Show(); + VersionText.InitText('theVersionText'); + VersionText.SetText(VersionString, OnTextSizeRealized); + // This code aligns the version text to the Main Menu Ticker + VersionText.AnchorBottomRight(); + VersionText.SetY(-ShellScreen.TickerHeight + 10); +} + +function OnTextSizeRealized() +{ + local UIText VersionText; + local UIShell ShellScreen; + + ShellScreen = UIShell(`SCREENSTACK.GetFirstInstanceOf(class'UIShell')); + VersionText = UIText(ShellScreen.GetChildByName('theVersionText')); + VersionText.SetX(-10 - VersionText.Width); + // this makes the ticker shorter -- if the text gets long enough to interfere, it will automatically scroll + ShellScreen.TickerText.SetWidth(ShellScreen.Movie.m_v2ScaledFullscreenDimension.X - VersionText.Width - 20); + } defaultProperties diff --git a/X2CommunityHighlander/X2CommunityHighlander.x2proj b/X2CommunityHighlander/X2CommunityHighlander.x2proj index 89f50c2..87eb843 100644 --- a/X2CommunityHighlander/X2CommunityHighlander.x2proj +++ b/X2CommunityHighlander/X2CommunityHighlander.x2proj @@ -27,6 +27,9 @@ Content + + Content +