Skip to content
This repository was archived by the owner on Dec 18, 2017. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all 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
15 changes: 15 additions & 0 deletions Assets/Text/cqui_text_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,21 @@
<Row Tag="LOC_CQUI_SETTINGS_REMINDER" Language="en_US">
<Text>Remember: CQUI settings are attached to individual saves![NEWLINE]If you'd like to change a setting by default, please read the info in cqui_settings.sql file within the [MOD INSTALL DIRECTORY]/CQUI/Assets directory</Text>
</Row>
<Row Tag="LOC_CQUI_TUTORIALS" Language="en_US">
<Text>Tutorials</Text>
</Row>
<Row Tag="LOC_CQUI_TUTORIALS_IMPROVEMENTS" Language="en_US">
<Text>Show improvement recommendations</Text>
</Row>
<Row Tag="LOC_CQUI_TUTORIALS_TECHS" Language="en_US">
<Text>Show tech recommendations</Text>
</Row>
<Row Tag="LOC_CQUI_TUTORIALS_PRODUCTION" Language="en_US">
<Text>Show production recommendations</Text>
</Row>
<Row Tag="LOC_CQUI_TUTORIALS_CITY" Language="en_US">
<Text>Show tutorial info in the city panel</Text>
</Row>
<Row Tag="LOC_CQUI_UNITS" Language="en_US">
<Text>Units</Text>
</Row>
Expand Down
12 changes: 10 additions & 2 deletions Assets/UI/Panels/citypaneloverview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ local m_isShowingPanel :boolean = false;

-- ====================CQUI Cityview==========================================

local CQUI_Tutorial = false; --When true, shows tutorial UI

function CQUI_OnCityviewEnabled()
OnShowOverviewPanel(true)
end
Expand All @@ -82,6 +84,9 @@ local m_isShowingPanel :boolean = false;
OnShowOverviewPanel(false);
end

function CQUI_OnSettingsUpdate()
CQUI_Tutorial = GameConfiguration.GetValue("CQUI_CityTutorial");
end
LuaEvents.CQUI_CityPanelOverview_CityviewEnable.Add( CQUI_OnCityviewEnabled);
LuaEvents.CQUI_CityPanelOverview_CityviewDisable.Add( CQUI_OnCityviewDisabled);

Expand Down Expand Up @@ -428,7 +433,7 @@ end

function ViewPanelAmenities( data:table )
-- Only show the advisor bubbles during the tutorial
Controls.AmenitiesAdvisorBubble:SetHide( IsTutorialRunning() == false );
Controls.AmenitiesAdvisorBubble:SetHide( not CQUI_Tutorial );

local colorName:string = GetHappinessColor(data.Happiness);
Controls.AmenitiesConstructedLabel:SetText( Locale.Lookup( "LOC_HUD_CITY_AMENITY", data.AmenitiesNum) );
Expand Down Expand Up @@ -488,7 +493,7 @@ end
-- ===========================================================================
function ViewPanelHousing( data:table )
-- Only show the advisor bubbles during the tutorial
Controls.HousingAdvisorBubble:SetHide( IsTutorialRunning() == false );
Controls.HousingAdvisorBubble:SetHide( not CQUI_Tutorial );

m_kHousingIM:ResetInstances();

Expand Down Expand Up @@ -919,5 +924,8 @@ function Initialize()
Events.ResearchCompleted.Add( OnResearchCompleted );
Events.GovernmentPolicyChanged.Add( OnPolicyChanged );
Events.GovernmentPolicyObsoleted.Add( OnPolicyChanged );

LuaEvents.CQUI_SettingsUpdate.Add(CQUI_OnSettingsUpdate);
LuaEvents.CQUI_SettingsInitialized.Add(CQUI_OnSettingsUpdate);
end
Initialize();
19 changes: 16 additions & 3 deletions Assets/UI/Panels/unitpanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ local pSpyInfo = GameInfo.Units["UNIT_SPY"];
local m_AttackHotkeyId = Input.GetActionId("Attack");
local m_DeleteHotkeyId = Input.GetActionId("DeleteUnit");


--CQUI Members
local CQUI_ImprovementTutorial = true;
local CQUI_AutoExpandUnitActions = false;

function CQUI_OnSettingsUpdate()
CQUI_AutoExpandUnitActions = GameConfiguration.GetValue("CQUI_AutoExpandUnitActions");
CQUI_ImprovementTutorial = GameConfiguration.GetValue("CQUI_ImprovementTutorial");
OnRefresh();
end

-- ===========================================================================
-- FUNCTIONS
-- ===========================================================================
Expand Down Expand Up @@ -786,9 +797,8 @@ function View(data)
Controls.RecommendedActionButton:ReprocessAnchoring();
Controls.RecommendedActionIcon:ReprocessAnchoring();

bestBuildAction = nil;
Controls.RecommendedActionFrame:SetHide( bestBuildAction == nil );
if ( bestBuildAction ~= nil ) then
if ( bestBuildAction ~= nil and CQUI_ImprovementTutorial) then
Controls.RecommendedActionButton:SetHide(false);
Controls.BuildActionsPanel:SetSizeY( buildStackHeight + 20 + BUILD_PANEL_ART_PADDING_Y);
Controls.BuildActionsStack:SetOffsetY(26);
Expand Down Expand Up @@ -2085,7 +2095,7 @@ function Refresh(player, unitId)
if(unit ~= nil) then
ReadUnitData( unit, numUnits );
--CQUI auto-expando
if(GameConfiguration.GetValue("CQUI_AutoExpandUnitActions")) then
if(CQUI_AutoExpandUnitActions) then
local isHidden:boolean = Controls.SecondaryActionsStack:IsHidden();
if isHidden then
Controls.SecondaryActionsStack:SetHide(false);
Expand Down Expand Up @@ -3719,6 +3729,9 @@ function Initialize()
LuaEvents.UnitFlagManager_PointerExited.Add( OnUnitFlagPointerExited );
LuaEvents.PlayerChange_Close.Add( OnPlayerChangeClose );

--CQUI Events
LuaEvents.CQUI_SettingsUpdate.Add(CQUI_OnSettingsUpdate);

-- Popup setup
m_kPopupDialog = PopupDialog:new( "UnitPanelPopup" );

Expand Down
5 changes: 5 additions & 0 deletions Assets/cqui_settingselement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ function Initialize()
{Controls.CityviewTab, Controls.CityviewOptions},
{Controls.LensesTab, Controls.LensesOptions},
{Controls.UnitsTab, Controls.UnitsOptions},
{Controls.TutorialsTab, Controls.TutorialsOptions},
{Controls.HiddenTab, Controls.HiddenOptions}
};
for i, tab in ipairs(m_tabs) do
Expand Down Expand Up @@ -304,6 +305,10 @@ function Initialize()
PopulateCheckBox(Controls.AutoExpandUnitActionsCheckbox, "CQUI_AutoExpandUnitActions");
PopulateCheckBox(Controls.AlwaysOpenTechTreesCheckbox, "CQUI_AlwaysOpenTechTrees");
PopulateCheckBox(Controls.SmartWorkIconCheckbox, "CQUI_SmartWorkIcon", Locale.Lookup("LOC_CQUI_CITYVIEW_SMARTWORKICON_TOOLTIP"));
PopulateCheckBox(Controls.ImprovementTutorialCheckbox, "CQUI_ImprovementTutorial");
PopulateCheckBox(Controls.TechTutorialCheckbox, "CQUI_TechTutorial");
PopulateCheckBox(Controls.ProductionTutorialCheckbox, "CQUI_ProductionTutorial");
PopulateCheckBox(Controls.CityTutorialCheckbox, "CQUI_CityTutorial");

PopulateSlider(Controls.ProductionItemHeightSlider, Controls.ProductionItemHeightText, "CQUI_ProductionItemHeight", ProductionItemHeightConverter);
PopulateSlider(Controls.MinimapSizeSlider, Controls.MinimapSizeText, "CQUI_MinimapSize", MinimapSizeConverter);
Expand Down
17 changes: 17 additions & 0 deletions Assets/cqui_settingselement.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<GridButton ID="BindingsTab" Style="ShellTabSmall" String="{LOC_CQUI_BINDINGS:upper}" Size="200,32"/>
<GridButton ID="GossipTab" Style="ShellTabSmall" String="{LOC_CQUI_GOSSIP:upper}" Size="200,32"/>
<GridButton ID="LensesTab" Style="ShellTabSmall" String="{LOC_CQUI_LENSES:upper}" Size="200,32"/>
<GridButton ID="TutorialsTab" Style="ShellTabSmall" String="{LOC_CQUI_TUTORIALS:upper}" Size="200,32"/>
<GridButton ID="HiddenTab" Style="ShellTabSmall" String="{LOC_CQUI_GENERAL_HIDDEN:upper}" Size="200,32" Hidden="1"/>
</Stack>
</Grid>
Expand Down Expand Up @@ -384,6 +385,22 @@
</Stack>
</Stack>
</Container>
<Container ID="TutorialsOptions" Size="parent,parent" Hidden="1">
<Stack Anchor="C,T" StackGrowth="Down" Padding="5" Offset="0,50">
<Stack Anchor="R,T" StackGrowth="Left" Padding="5">
<GridButton ID="ImprovementTutorialCheckbox" Anchor="L,C" Offset="0,0" Size="300,24" Style="CheckBoxControl" String="LOC_CQUI_TUTORIALS_IMPROVEMENTS"/>
</Stack>
<Stack Anchor="R,T" StackGrowth="Left" Padding="5">
<GridButton ID="TechTutorialCheckbox" Anchor="L,C" Offset="0,0" Size="300,24" Style="CheckBoxControl" String="LOC_CQUI_TUTORIALS_TECHS"/>
</Stack>
<Stack Anchor="R,T" StackGrowth="Left" Padding="5">
<GridButton ID="ProductionTutorialCheckbox" Anchor="L,C" Offset="0,0" Size="300,24" Style="CheckBoxControl" String="LOC_CQUI_TUTORIALS_PRODUCTION"/>
</Stack>
<Stack Anchor="R,T" StackGrowth="Left" Padding="5">
<GridButton ID="CityTutorialCheckbox" Anchor="L,C" Offset="0,0" Size="300,24" Style="CheckBoxControl" String="LOC_CQUI_TUTORIALS_CITY"/>
</Stack>
</Stack>
</Container>
<Container ID="HiddenOptions" Size="parent,parent" Hidden="1">
<Stack Anchor="C,T" StackGrowth="Down" Padding="5" Offset="0,50">
<Stack Anchor="R,T" StackGrowth="Down" Padding="5">
Expand Down