Skip to content

Commit

Permalink
Fixes long names in citystate panel (CQUI-Org#520)
Browse files Browse the repository at this point in the history
Fixes CQUI-Org#506

Also switched places for Suzerain and second place to match up against
background. Tried to change the background texture around but no luck.
  • Loading branch information
SpaceOgre authored and chaorace committed May 13, 2017
1 parent 622ffec commit cca0b96
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
12 changes: 10 additions & 2 deletions Assets/UI/PartialScreens/citystates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand All @@ -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.
-- ===========================================================================
Expand Down
20 changes: 10 additions & 10 deletions Assets/UI/PartialScreens/citystates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,16 @@
<Image ID="BonusIcon6" Anchor="C,B" Size="26,26" Texture="EnvoyBonuses26" TextureOffset="104,0" />
</Image>
<!-- CQUI Note: The size of the container below was changed from 108 to 120 in order to fix a spacing issue. -->
<Container Anchor="L,C" Offset="346,0" Size="120,42">
<Grid ID="BonusImageSuzerainOff" Size="parent,parent" Texture="CityState_BonusSlotBigOff" SliceCorner="31,21" SliceTextureSize="34,42" />
<Grid ID="BonusImageSuzerainOn" Size="parent,parent" Texture="CityState_BonusSlotBigOn" SliceCorner="31,21" SliceTextureSize="34,42" />
<Label ID="BonusTextSuzerain" Anchor="R,T" Offset="4,2" Style="FontNormal12" String="4" />
<Image ID="BonusIconSuzerain" Anchor="L,T" Offset="2,0" Size="26,26" Texture="EnvoyBonuses26" TextureOffset="156,0" />
<Label ID="SecondHighestLabel" Anchor="L,B" Offset="3,0" Style="FontNormal12" />
<Label ID="SuzerainLabel" Anchor="L,T" Offset="32,14" Style="FontNormal12" String="LOC_CITY_STATES_SUZERAIN" />
<Label ID="Suzerain" Anchor="L,T" Offset="32,2" Style="FontNormal12" String="LOC_CITY_STATES_NONE" />
<Label ID="SecondHighestName" Anchor="L,B" Offset="32,0" Style="FontNormal12" />
<Label ID="SecondHighestEnvoys" Anchor="R,B" Offset="4,0" Style="FontNormal12" />
<Container Anchor="L,C" Offset="346,0" Size="120,42">
<Grid ID="BonusImageSuzerainOff" Size="parent,parent" Texture="CityState_BonusSlotBigOff" SliceCorner="31,21" SliceTextureSize="34,42" />
<Grid ID="BonusImageSuzerainOn" Size="parent,parent" Texture="CityState_BonusSlotBigOn" SliceCorner="31,21" SliceTextureSize="34,42" />
<Label ID="BonusTextSuzerain" Anchor="R,B" Offset="4,2" Style="FontNormal12" String="4" />
<Image ID="BonusIconSuzerain" Anchor="L,B" Offset="2,0" Size="26,26" Texture="EnvoyBonuses26" TextureOffset="156,0" />
<Label ID="SecondHighestLabel" Anchor="L,T" Offset="3,0" Style="FontNormal12" />
<Label ID="SuzerainLabel" Anchor="L,B" Offset="32,14" Style="FontNormal12" String="LOC_CITY_STATES_SUZERAIN" />
<Label ID="Suzerain" Anchor="L,B" Offset="32,2" Style="FontNormal12" String="LOC_CITY_STATES_NONE" />
<Label ID="SecondHighestName" Anchor="L,T" Offset="32,0" Style="FontNormal12" />
<Label ID="SecondHighestEnvoys" Anchor="R,T" Offset="4,0" Style="FontNormal12" />
</Container>

<Button ID="LookAtButton" Anchor="R,C" Offset="3,-7" Size="23,31" Texture="Controls_ShowMe" StateOffsetIncrement="0,0" ToolTip="LOC_CITY_STATES_LOOK_AT" />
Expand Down

0 comments on commit cca0b96

Please sign in to comment.