Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

New icon-based ameneties panel #4

Merged
merged 3 commits into from
Oct 29, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions UI/Panels/CityPanelOverview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,75 @@ function GetPercentGrowthColor( percent:number )
return "StatNormalCSGlow";
end

function GetAmenetiesColor( count:number )
if count > 0 then return "StatGoodCSGlow" end
if count < 0 then return "StatBadCSGlow" end
return "StatNormalCSGlow";
end

-- ===========================================================================
function ViewPanelAmenities( data:table )
Controls.AmenitiesAdvisorBubble:SetHide( false );

-- new ameneties section
Controls.AmenityStack:SetHide( true );

Controls.AmenetiesStatusIconContainerLuxuries:SetTextureOffsetVal(0, 100);
Controls.AmenetiesStatusYieldLuxuries:SetText( Locale.ToNumber(data.AmenitiesFromLuxuries) );
Controls.AmenetiesStatusYieldLuxuries:SetColorByName( GetAmenetiesColor(data.AmenitiesFromLuxuries) );
Controls.AmenetiesStatusYieldLuxuries:SetFontSize(24);
Controls.AmenetiesStatusIconLuxuries:SetColor(0x3fffffff);
Controls.AmenetiesStatusLabelLuxuries:SetColor(0xffffffff);

Controls.AmenetiesStatusIconContainerCivics:SetTextureOffsetVal(0, 100);
Controls.AmenetiesStatusYieldCivics:SetText( Locale.ToNumber(data.AmenitiesFromCivics) );
Controls.AmenetiesStatusYieldCivics:SetColorByName( GetAmenetiesColor(data.AmenitiesFromCivics) );
Controls.AmenetiesStatusYieldCivics:SetFontSize(24);
Controls.AmenetiesStatusIconCivics:SetColor(0x3fffffff);
Controls.AmenetiesStatusLabelCivics:SetColor(0xffffffff);

Controls.AmenetiesStatusIconContainerEntertainment:SetTextureOffsetVal(0, 100);
Controls.AmenetiesStatusYieldEntertainment:SetText( Locale.ToNumber(data.AmenitiesFromEntertainment) );
Controls.AmenetiesStatusYieldEntertainment:SetColorByName( GetAmenetiesColor(data.AmenitiesFromEntertainment) );
Controls.AmenetiesStatusYieldEntertainment:SetFontSize(24);
Controls.AmenetiesStatusIconEntertainment:SetColor(0x3fffffff);
Controls.AmenetiesStatusLabelEntertainment:SetColor(0xffffffff);

Controls.AmenetiesStatusIconContainerGreatPeople:SetTextureOffsetVal(0, 100);
Controls.AmenetiesStatusYieldGreatPeople:SetText( Locale.ToNumber(data.AmenitiesFromGreatPeople) );
Controls.AmenetiesStatusYieldGreatPeople:SetColorByName( GetAmenetiesColor(data.AmenitiesFromGreatPeople) );
Controls.AmenetiesStatusYieldGreatPeople:SetFontSize(24);
Controls.AmenetiesStatusIconGreatPeople:SetColor(0x3fffffff);
Controls.AmenetiesStatusLabelGreatPeople:SetColor(0xffffffff);

Controls.AmenetiesStatusIconContainerReligion:SetTextureOffsetVal(0, 100);
Controls.AmenetiesStatusYieldReligion:SetText( Locale.ToNumber(data.AmenitiesFromReligion) );
Controls.AmenetiesStatusYieldReligion:SetColorByName( GetAmenetiesColor(data.AmenitiesFromReligion) );
Controls.AmenetiesStatusYieldReligion:SetFontSize(24);
Controls.AmenetiesStatusIconReligion:SetColor(0x3fffffff);
Controls.AmenetiesStatusLabelReligion:SetColor(0xffffffff);

Controls.AmenetiesStatusIconContainerNationalParks:SetTextureOffsetVal(0, 100);
Controls.AmenetiesStatusYieldNationalParks:SetText( Locale.ToNumber(data.AmenitiesFromNationalParks) );
Controls.AmenetiesStatusYieldNationalParks:SetColorByName( GetAmenetiesColor(data.AmenitiesFromNationalParks) );
Controls.AmenetiesStatusYieldNationalParks:SetFontSize(24);
Controls.AmenetiesStatusIconNationalParks:SetColor(0x3fffffff);
Controls.AmenetiesStatusLabelNationalParks:SetColor(0xffffffff);

Controls.AmenetiesStatusIconContainerWarWeariness:SetTextureOffsetVal(0, 100);
Controls.AmenetiesStatusYieldWarWeariness:SetText( Locale.ToNumber(data.AmenitiesLostFromWarWeariness) );
Controls.AmenetiesStatusYieldWarWeariness:SetColorByName( GetAmenetiesColor(-data.AmenitiesLostFromWarWeariness) );
Controls.AmenetiesStatusYieldWarWeariness:SetFontSize(24);
Controls.AmenetiesStatusIconWarWeariness:SetColor(0x3fffffff);
Controls.AmenetiesStatusLabelWarWeariness:SetColor(0xffffffff);

Controls.AmenetiesStatusIconContainerBankruptcy:SetTextureOffsetVal(0, 100);
Controls.AmenetiesStatusYieldBankruptcy:SetText( Locale.ToNumber(data.AmenitiesLostFromBankruptcy) );
Controls.AmenetiesStatusYieldBankruptcy:SetColorByName( GetAmenetiesColor(-data.AmenitiesLostFromBankruptcy) );
Controls.AmenetiesStatusYieldBankruptcy:SetFontSize(24);
Controls.AmenetiesStatusIconBankruptcy:SetColor(0x3fffffff);
Controls.AmenetiesStatusLabelBankruptcy:SetColor(0xffffffff);
-- end new ameneties section

local colorName:string = GetHappinessColor(data.Happiness);
Controls.AmenitiesConstructedLabel:SetText( Locale.Lookup( "LOC_HUD_CITY_AMENITY", data.AmenitiesNum) );
Expand Down
48 changes: 48 additions & 0 deletions UI/Panels/CityPanelOverview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,54 @@
<Grid Anchor="L,T" Offset="0,0" Size="parent,0" AutoSize="Vertical" Style="CityPanelSubPanelContainer" InnerPadding="0,10" InnerOffset="0,5">
<Stack StackGrowth="Bottom" StackPadding="0">
<Stack ID="AmenityStack" StackGrowth="Bottom" StackPadding="4" />
<Stack StackGrowth="Down" Anchor="C,C">
<Stack StackGrowth="Right" Padding="16">
<Image ID="AmenetiesStatusIconContainerLuxuries" Anchor="C,C" Size="50,50" Texture="CityPanel_StatusIcon">
<Image ID="AmenetiesStatusIconLuxuries" Anchor="C,C" Offset="-2,-3" Size="35,35" Texture="Stats45" Icon="ICON_IMPROVEMENT_PLANTATION" />
Copy link
Member

@chaorace chaorace Oct 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one last thing! Let's replace the irrigation icon for the luxuries bubble with a more appropriate resort icon before we merge this in.

The "Seaside Resort" improvement icon is actually called (confusingly) "ICON_IMPROVEMENT_BEACH_RESORT".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I'm not sure what a resort has to do with luxury resources (AFAIK, it just gives more gold yield and a tourism output), but I agree that there isn't a good icon for luxury resources (all the resource icons are colored) - so I don't mind replacing it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, didn't mean to impose on your agency over your work. Please feel free to say no to me, I won't bite!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, I know. I just don't think there is a good icon, so I don't have a strong opinion. The beach resort icon looks significantly nicer but is less relevant. I think the labels largely mitigate that UX issue though.

<Label ID="AmenetiesStatusYieldLuxuries" Anchor="C,C" Offset="-2,0" Style="CityPanelSubPanelTitle" String="1" />
<Label ID="AmenetiesStatusLabelLuxuries" Anchor="C,C" Offset="0,30" Style="UnitPanelStatLabel" Align="Center" String="Luxury[NEWLINE]Resources" />
</Image>
<Image ID="AmenetiesStatusIconContainerCivics" Anchor="C,C" Size="50,50" Texture="CityPanel_StatusIcon">
<Image ID="AmenetiesStatusIconCivics" Anchor="C,C" Offset="-2,-3" Size="35,35" Texture="Stats45" Icon="ICON_NOTIFICATION_CONSIDER_GOVERNMENT_CHANGE" />
<Label ID="AmenetiesStatusYieldCivics" Anchor="C,C" Offset="-2,0" Style="CityPanelSubPanelTitle" String="1" />
<Label ID="AmenetiesStatusLabelCivics" Anchor="C,C" Offset="0,30" Style="UnitPanelStatLabel" Align="Center" String="Civics" />
</Image>
<Image ID="AmenetiesStatusIconContainerEntertainment" Anchor="C,C" Size="50,50" Texture="CityPanel_StatusIcon">
<Image ID="AmenetiesStatusIconEntertainment" Anchor="C,C" Offset="-2,-3" Size="35,35" Texture="Stats45" Icon="ICON_PROJECT_CARNIVAL" />
<Label ID="AmenetiesStatusYieldEntertainment" Anchor="C,C" Offset="-2,0" Style="CityPanelSubPanelTitle" String="1" />
<Label ID="AmenetiesStatusLabelEntertainment" Anchor="C,C" Offset="0,30" Style="UnitPanelStatLabel" Align="Center" String="Entertainment" />
</Image>
<Image ID="AmenetiesStatusIconContainerGreatPeople" Anchor="C,C" Size="50,50" Texture="CityPanel_StatusIcon">
<Image ID="AmenetiesStatusIconGreatPeople" Anchor="C,C" Offset="-2,-3" Size="35,35" Texture="Stats45" Icon="ICON_NOTIFICATION_CLAIM_GREAT_PERSON" />
<Label ID="AmenetiesStatusYieldGreatPeople" Anchor="C,C" Offset="-2,0" Style="CityPanelSubPanelTitle" String="1" />
<Label ID="AmenetiesStatusLabelGreatPeople" Anchor="C,C" Offset="0,30" Style="UnitPanelStatLabel" Align="Center" String="Great[NEWLINE]People" />
</Image>
</Stack>
<Container Size="1,20" />
<Stack StackGrowth="Right" Padding="16">
<Image ID="AmenetiesStatusIconContainerReligion" Anchor="C,C" Size="50,50" Texture="CityPanel_StatusIcon">
<Image ID="AmenetiesStatusIconReligion" Anchor="C,C" Offset="-2,-3" Size="35,35" Texture="Stats45" Icon="ICON_UNITOPERATION_FOUND_RELIGION" />
<Label ID="AmenetiesStatusYieldReligion" Anchor="C,C" Offset="-2,0" Style="CityPanelSubPanelTitle" String="1" />
<Label ID="AmenetiesStatusLabelReligion" Anchor="C,C" Offset="0,30" Style="UnitPanelStatLabel" Align="Center" String="Religion" />
</Image>
<Image ID="AmenetiesStatusIconContainerNationalParks" Anchor="C,C" Size="50,50" Texture="CityPanel_StatusIcon">
<Image ID="AmenetiesStatusIconNationalParks" Anchor="C,C" Offset="-2,-3" Size="35,35" Texture="Stats45" Icon="ICON_UNITOPERATION_DESIGNATE_PARK" />
<Label ID="AmenetiesStatusYieldNationalParks" Anchor="C,C" Offset="-2,0" Style="CityPanelSubPanelTitle" String="1" />
<Label ID="AmenetiesStatusLabelNationalParks" Anchor="C,C" Offset="0,30" Style="UnitPanelStatLabel" Align="Center" String="National[NEWLINE]Parks" />
</Image>
<Image ID="AmenetiesStatusIconContainerWarWeariness" Anchor="C,C" Size="50,50" Texture="CityPanel_StatusIcon">
<Image ID="AmenetiesStatusIconWarWeariness" Anchor="C,C" Offset="-2,-3" Size="35,35" Texture="Stats45" Icon="ICON_UNITOPERATION_FORTIFY" />
<Label ID="AmenetiesStatusYieldWarWeariness" Anchor="C,C" Offset="-2,0" Style="CityPanelSubPanelTitle" String="1" />
<Label ID="AmenetiesStatusLabelWarWeariness" Anchor="C,C" Offset="0,30" Style="UnitPanelStatLabel" Align="Center" String="War[NEWLINE]Weariness" />
</Image>
<Image ID="AmenetiesStatusIconContainerBankruptcy" Anchor="C,C" Size="50,50" Texture="CityPanel_StatusIcon">
<Image ID="AmenetiesStatusIconBankruptcy" Anchor="C,C" Offset="-2,-3" Size="35,35" Texture="Stats45" Icon="ICON_NOTIFICATION_TREASURY_BANKRUPT" />
<Label ID="AmenetiesStatusYieldBankruptcy" Anchor="C,C" Offset="-2,0" Style="CityPanelSubPanelTitle" String="1" />
<Label ID="AmenetiesStatusLabelBankruptcy" Anchor="C,C" Offset="0,30" Style="UnitPanelStatLabel" Align="Center" String="Bankruptcy" />
</Image>
</Stack>
</Stack>
<Container Size="1,8" />
<Container Size="parent,0" AutoSize="Vertical">
<Label Anchor="L,B" Offset="4,0" Style="CityPanelTextSmall" String="LOC_HUD_CITY_TOTAL_AMENITIES" />
<Label ID="AmenityTotalNum" Anchor="R,B" Offset="5,-2" Style="CityPanelNumLarge" String="-" FontStyle="Glow"/>
Expand Down