From cca0b96651b447724c7fabd8e761503ea6587a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Nordstr=C3=B6m?= Date: Sat, 13 May 2017 05:02:28 +0200 Subject: [PATCH] Fixes long names in citystate panel (#520) Fixes #506 Also switched places for Suzerain and second place to match up against background. Tried to change the background texture around but no luck. --- Assets/UI/PartialScreens/citystates.lua | 12 ++++++++++-- Assets/UI/PartialScreens/citystates.xml | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Assets/UI/PartialScreens/citystates.lua b/Assets/UI/PartialScreens/citystates.lua index c36a672..5652c8b 100644 --- a/Assets/UI/PartialScreens/citystates.lua +++ b/Assets/UI/PartialScreens/citystates.lua @@ -796,7 +796,7 @@ function AddCityStateRow( kCityState:table ) kInst.BonusTextSuzerain:SetText( kCityState.SuzerainTokensNeeded ); kInst.SuzerainLabel:SetColor( kCityState.isBonusSuzerain and kCityState.ColorSecondary or COLOR_ICON_BONUS_OFF ); kInst.Suzerain:SetColor( kCityState.isBonusSuzerain and kCityState.ColorSecondary or COLOR_ICON_BONUS_OFF ); - kInst.Suzerain:SetText( kCityState.SuzerainName ); + kInst.Suzerain:SetText( CQUI_TruncateSuzerainName(kCityState.SuzerainName) ); -- Begin CQUI Changes Marker local localPlayerID = Game.GetLocalPlayer(); @@ -836,7 +836,7 @@ function AddCityStateRow( kCityState:table ) -- CQUI Note: SecondHighestLabel needs to be localized, but is hard coded for now kInst.SecondHighestLabel:SetText( "2nd" ); kInst.SecondHighestName:SetColor( secondHighestIsPlayer and kCityState.ColorSecondary or COLOR_ICON_BONUS_OFF ); - kInst.SecondHighestName:SetText( secondHighestName ); + kInst.SecondHighestName:SetText( CQUI_TruncateSuzerainName(secondHighestName) ); kInst.SecondHighestEnvoys:SetColor( secondHighestIsPlayer and kCityState.ColorSecondary or COLOR_ICON_BONUS_OFF ); kInst.SecondHighestEnvoys:SetText( secondHighestEnvoys ); -- End CQUI Changes Marker @@ -852,6 +852,14 @@ function AddCityStateRow( kCityState:table ) return kInst; end +function CQUI_TruncateSuzerainName( name:string ) + if(name:len() >= 12) then + return string.sub(name, 0, 10) .. "..."; + else + return name; + end +end + -- =========================================================================== -- View a list of all the City States that are alive and have been met. -- =========================================================================== diff --git a/Assets/UI/PartialScreens/citystates.xml b/Assets/UI/PartialScreens/citystates.xml index 5d2039b..f399d96 100644 --- a/Assets/UI/PartialScreens/citystates.xml +++ b/Assets/UI/PartialScreens/citystates.xml @@ -188,16 +188,16 @@ - - - -