From 7715c7e48c0c12fcb425e9140f98114c8bd795ed Mon Sep 17 00:00:00 2001 From: chaorace Date: Wed, 5 Apr 2017 22:35:19 -0400 Subject: [PATCH 01/20] Added UI mockup to cqui_toplayer.xml This creates a framework for placing new elements relative to where the vanilla UI elements appear without being particularly invasive --- Assets/cqui_toplayer.xml | 43 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/Assets/cqui_toplayer.xml b/Assets/cqui_toplayer.xml index 7b4b8c2..9a276d1 100644 --- a/Assets/cqui_toplayer.xml +++ b/Assets/cqui_toplayer.xml @@ -1,7 +1,48 @@  - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 31c2c0d4a7deba5bf65c0212cb27c6f9eb04ae72 Mon Sep 17 00:00:00 2001 From: chaorace Date: Fri, 7 Apr 2017 23:43:53 -0400 Subject: [PATCH 02/20] Added a highly customizable tool for notifications This method is called the paradoxbar. So far only two test notification types exist "debug" and "debug2". Keep in mind that this tool is very flexible and quite capable of both one-off notification types as well as template-based notifications. Custom behavior should be relatively simple to implement and each notification falls into a category with others that fall in the same grouping --- Assets/cqui_toplayer.lua | 109 +++++++++++++++++++++++++++++++++++++++ Assets/cqui_toplayer.xml | 30 +++++++---- 2 files changed, 128 insertions(+), 11 deletions(-) diff --git a/Assets/cqui_toplayer.lua b/Assets/cqui_toplayer.lua index eb2c2dd..6191e7b 100644 --- a/Assets/cqui_toplayer.lua +++ b/Assets/cqui_toplayer.lua @@ -1,6 +1,115 @@ --This is a layer that lives at the very top of the UI. It's an excellent place for catching inputs globally or displaying a custom overlay +-- This layer is the home of the paradox bar +include("InstanceManager"); + +--Members +local groupStackIM = InstanceManager:new("ParadoxBarGroupInstance", "Top", Controls.ParadoxBarStack); -- IM for the groups for the notifications +local groupStackInstances: table = {}; --Instances of the groupings for the notifications +local groupStacks: table = {}; --Instance managers for the individual notifications + +--These following tables define the various behaviors a notification can contain, modifying a given effect will affect ALL notifications which use them. +--Feel free to add new behaviors here as necessary + +--Paradoxbar sound +local paradoxBarSound = { + ["addSound"] = function() UI.PlaySound("NOTIFICATION_MISC_NEUTRAL"); end, + ["removeSound"] = function() UI.PlaySound("Map_Pin_Remove"); end +} + +--Paradoxbar functions +local paradoxBarFuncs = { + ["deleteOnRMB"] = function(instance, group) + instance.Button:RegisterCallback(Mouse.eRClick, function() RemoveNotification(instance, group); end); + end, + ["debugPrint"] = function() print("Debug tooltip created"); end +} + +--Paradoxbar behavior bundles +local paradoxBarBundles = { + ["standard"] = function(instance, group) paradoxBarFuncs["deleteOnRMB"](instance, group); paradoxBarSound["addSound"](); end +} + +--These are the default notification templates +--Feel free to add to this as necessary + +--Paradoxbar stock data +local paradoxBarStock = { + ["debug"] = {"Debug", "Controls_Circle", "This is a debug tooltip", "Dbg", {paradoxBarFuncs["debugPrint"], paradoxBarBundles["standard"]}}, + ["debug2"] = {"Debug2", "Controls_Circle", "This is a debug tooltip", "Dbg2", {paradoxBarFuncs["debugPrint"], paradoxBarBundles["standard"]}} +}; + +-- This function handles adding new notifications to the paradox bar +-- Group is used for the purposes of chunking notifications together and is mandatory +-- If an ID is supplied, paradoxBarStock is checked for a matching ID and loads presets if available. If additional values are supplied, they are used to overwrite the default values +-- text is drawn directly on top of the icon and is meant to be used lightly. It will look ugly if you use any more than a few characters +-- funcs is an array of functions used for adding behavior to the notification. This is where closing behavior and other intricacies are defined +function AddNotification(ID, group, icon, tooltip, text, funcs) + local defaults = paradoxBarStock[ID]; + -- Group must be defined somehow or else we give up here + if(not group) then + group = defaults[1]; + if(not group) then return; end + end + + --Creates a group for a specific notification group if it does not exist + if(groupStackInstances[group] == nil) then + groupStackInstances[group] = groupStackIM:GetInstance(); + groupStacks[group] = InstanceManager:new("ParadoxBarInstance", "Top", groupStackInstances[group].Stack); + end + instance = groupStacks[group]:GetInstance(); + + --Applies defaults where appropriate + if(defaults) then + if(defaults[2]) then + instance.Icon:SetTexture(defaults[2]); + end + if(defaults[3]) then + instance.Button:LocalizeAndSetToolTip(defaults[3]); + end + if(defaults[4]) then + instance.Text:SetText(defaults[4]); + end + if(defaults[5] and not funcs) then + funcs = defaults[5] + end + end + if(icon) then + instance.Icon:SetTexture(icon); + end + if(tooltip) then + instance.Button:LocalizeAndSetToolTip(tooltip); + end + if(text) then + instance.Text:SetText(text); + end + --Invokes functions + if(funcs) then + for _,v in ipairs(funcs) do + v(instance, group, icon, tooltip, text); + end + end + --Reveals completed notification + instance.Top:SetHide(false); +end + +function RemoveNotification(instance, group) + instance.SlideAnimation:Reverse(); + instance.SlideAnimation:RegisterEndCallback(function() + groupStacks[group]:ReleaseInstance(instance); + --This is a hacky workaround since releasing an instance doesn't necessarily actually remove it from a given stack + instance.Top:SetID("Exhausted"); + for _,v in ipairs(groupStackInstances[group].Stack:GetChildren()) do + if(v:GetID() ~= "Exhausted") then return; end + end + --Removes the group stack from the main notification stack + Controls.ParadoxBarStack:ReleaseChild(groupStackInstances[group].Top); + groupStackInstances[group] = nil; + end) +end function Initialize() + groupStackIM:ResetInstances(); + LuaEvents.CQUI_AddNotification.Add(AddNotification); ContextPtr:SetHide(false); end diff --git a/Assets/cqui_toplayer.xml b/Assets/cqui_toplayer.xml index 9a276d1..7c78ff6 100644 --- a/Assets/cqui_toplayer.xml +++ b/Assets/cqui_toplayer.xml @@ -3,15 +3,19 @@ - + - - + + + + + + @@ -29,20 +33,24 @@ - - - - - + + + + + + + From 28e57a25ddf6a8d3ae65c49562bb2175293a5f32 Mon Sep 17 00:00:00 2001 From: chaorace Date: Sun, 30 Apr 2017 12:06:00 -0400 Subject: [PATCH 03/20] Made the "defaults" parameter lists more idiomatic This change should make creating partiallyt defined templates easier and hopefully also make the source easier to understand --- Assets/cqui_toplayer.lua | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Assets/cqui_toplayer.lua b/Assets/cqui_toplayer.lua index 6191e7b..c67c332 100644 --- a/Assets/cqui_toplayer.lua +++ b/Assets/cqui_toplayer.lua @@ -34,8 +34,12 @@ local paradoxBarBundles = { --Paradoxbar stock data local paradoxBarStock = { - ["debug"] = {"Debug", "Controls_Circle", "This is a debug tooltip", "Dbg", {paradoxBarFuncs["debugPrint"], paradoxBarBundles["standard"]}}, - ["debug2"] = {"Debug2", "Controls_Circle", "This is a debug tooltip", "Dbg2", {paradoxBarFuncs["debugPrint"], paradoxBarBundles["standard"]}} + ["debug"] = { + ["group"] = "Debug", ["icon"] = "Controls_Circle", ["tooltip"] = "This is a debug tooltip", ["text"] = "Dbg", ["funcs"] = {paradoxBarFuncs["debugPrint"], paradoxBarBundles["standard"]} + }, + ["debug2"] = { + ["group"] = "Debug2", ["icon"] = "Controls_Circle", ["tooltip"] = "This is a debug tooltip", ["text"] = "Dbg2", ["funcs"] = {paradoxBarFuncs["debugPrint"], paradoxBarBundles["standard"]} + } }; -- This function handles adding new notifications to the paradox bar @@ -47,7 +51,7 @@ function AddNotification(ID, group, icon, tooltip, text, funcs) local defaults = paradoxBarStock[ID]; -- Group must be defined somehow or else we give up here if(not group) then - group = defaults[1]; + group = defaults["group"]; if(not group) then return; end end @@ -60,17 +64,17 @@ function AddNotification(ID, group, icon, tooltip, text, funcs) --Applies defaults where appropriate if(defaults) then - if(defaults[2]) then - instance.Icon:SetTexture(defaults[2]); + if(defaults["icon"]) then + instance.Icon:SetTexture(defaults["icon"]); end - if(defaults[3]) then - instance.Button:LocalizeAndSetToolTip(defaults[3]); + if(defaults["tooltip"]) then + instance.Button:LocalizeAndSetToolTip(defaults["tooltip"]); end - if(defaults[4]) then - instance.Text:SetText(defaults[4]); + if(defaults["text"]) then + instance.Text:SetText(defaults["text"]); end - if(defaults[5] and not funcs) then - funcs = defaults[5] + if(defaults["funcs"] and not funcs) then + funcs = defaults["funcs"] end end if(icon) then From b83aa1b3f4853509ae089956e45c3641d1da98e2 Mon Sep 17 00:00:00 2001 From: chaorace Date: Sun, 30 Apr 2017 12:38:55 -0400 Subject: [PATCH 04/20] Prevented redundant application of defaults This commit prevents unnecessary use of the default values whenever an overriding value is present, improving efficiency somewhat --- Assets/cqui_toplayer.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/cqui_toplayer.lua b/Assets/cqui_toplayer.lua index c67c332..150d48a 100644 --- a/Assets/cqui_toplayer.lua +++ b/Assets/cqui_toplayer.lua @@ -64,13 +64,13 @@ function AddNotification(ID, group, icon, tooltip, text, funcs) --Applies defaults where appropriate if(defaults) then - if(defaults["icon"]) then + if(defaults["icon"] and not icon) then instance.Icon:SetTexture(defaults["icon"]); end - if(defaults["tooltip"]) then + if(defaults["tooltip"] and not tooltip) then instance.Button:LocalizeAndSetToolTip(defaults["tooltip"]); end - if(defaults["text"]) then + if(defaults["text"] and not text) then instance.Text:SetText(defaults["text"]); end if(defaults["funcs"] and not funcs) then From 1d9482917ffc34d4f62bcca0cdc35d85231a9928 Mon Sep 17 00:00:00 2001 From: chaorace Date: Sun, 30 Apr 2017 22:53:11 -0400 Subject: [PATCH 05/20] Added notifications LOC file --- Assets/Text/cqui_text_notify.xml | 9 +++++++++ cqui.modinfo | 1 + 2 files changed, 10 insertions(+) create mode 100644 Assets/Text/cqui_text_notify.xml diff --git a/Assets/Text/cqui_text_notify.xml b/Assets/Text/cqui_text_notify.xml new file mode 100644 index 0000000..a59c187 --- /dev/null +++ b/Assets/Text/cqui_text_notify.xml @@ -0,0 +1,9 @@ + + + + + + {1_cityname} has grown! + + + diff --git a/cqui.modinfo b/cqui.modinfo index c482054..1840b48 100644 --- a/cqui.modinfo +++ b/cqui.modinfo @@ -298,6 +298,7 @@ Assets/Text/cqui_text_general_pl.xml Assets/Text/cqui_text_general_ru.xml Assets/Text/cqui_text_general_zh.xml + Assets/Text/cqui_text_notify.xml Assets/Text/cqui_text_settings.xml Assets/Text/cqui_text_settings_de.xml Assets/Text/cqui_text_settings_fr.xml From f0613f7afc909d6f0886ced10d4bd73d3344ecde Mon Sep 17 00:00:00 2001 From: chaorace Date: Sun, 30 Apr 2017 22:55:14 -0400 Subject: [PATCH 06/20] Restructured AddNotification method This change bundles all properties into a single "props" table. The goal of this change is to make the method somewhat more wieldy while also preventing future changes from breaking existing method calls, since this new structure isn't strictly dependant upon the order of the property --- Assets/cqui_toplayer.lua | 55 ++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/Assets/cqui_toplayer.lua b/Assets/cqui_toplayer.lua index 150d48a..7c452d0 100644 --- a/Assets/cqui_toplayer.lua +++ b/Assets/cqui_toplayer.lua @@ -43,11 +43,15 @@ local paradoxBarStock = { }; -- This function handles adding new notifications to the paradox bar --- Group is used for the purposes of chunking notifications together and is mandatory -- If an ID is supplied, paradoxBarStock is checked for a matching ID and loads presets if available. If additional values are supplied, they are used to overwrite the default values --- text is drawn directly on top of the icon and is meant to be used lightly. It will look ugly if you use any more than a few characters --- funcs is an array of functions used for adding behavior to the notification. This is where closing behavior and other intricacies are defined -function AddNotification(ID, group, icon, tooltip, text, funcs) +-- group is used for the purposes of chunking notifications together and is mandatory +-- props is a table containing properties for overriding the defaults supplied by the template selected using the ID + -- icon is the texture name of the image to be used. Not defining this will leave only a background portrait texture + -- tooltip is the string to be used describing the notification in detail. Please add an LOC string to cqui_text_notify if you need to employ a new string + -- ttprops is a table of additional values to be injected into the LOC string. Limit of 5 parameters. See cqui_text_notify for examples concerning working with inserting into LOCs + -- text is drawn directly on top of the icon and is meant to be used lightly. It will look ugly if you use any more than a few characters +-- funcs is an array of functions used for adding behavior to the notification. This is where closing behavior and other intricacies, like sound, are defined +function AddNotification(ID, group, props, funcs) local defaults = paradoxBarStock[ID]; -- Group must be defined somehow or else we give up here if(not group) then @@ -62,34 +66,47 @@ function AddNotification(ID, group, icon, tooltip, text, funcs) end instance = groupStacks[group]:GetInstance(); + --If no property table was provided at all, create an empty one + if(not props) then + props = {}; + end + --Applies defaults where appropriate if(defaults) then - if(defaults["icon"] and not icon) then - instance.Icon:SetTexture(defaults["icon"]); + if(defaults["icon"] and not props["icon"]) then + props["icon"] = defaults["icon"]; + end + if(defaults["ttprops"] and not props["ttprops"]) then + props["ttprops"] = defaults["ttprops"]; end - if(defaults["tooltip"] and not tooltip) then - instance.Button:LocalizeAndSetToolTip(defaults["tooltip"]); + if(defaults["tooltip"] and not props["tooltip"]) then + props["tooltip"] = defaults["tooltip"]; end - if(defaults["text"] and not text) then - instance.Text:SetText(defaults["text"]); + if(defaults["text"] and not props["text"]) then + props["text"] = defaults["text"]; end - if(defaults["funcs"] and not funcs) then - funcs = defaults["funcs"] + if(defaults["funcs"] and not props["funcs"]) then + funcs = defaults["funcs"]; end end - if(icon) then - instance.Icon:SetTexture(icon); + + --Applies properties + if(props["icon"]) then + instance.Icon:SetTexture(props["icon"]); end - if(tooltip) then - instance.Button:LocalizeAndSetToolTip(tooltip); + if(props["tooltip"]) then + if(not props["ttprops"]) then + props["ttprops"] = {}; + end + instance.Button:LocalizeAndSetToolTip(props["tooltip"], props["ttprops"][1] or "X", props["ttprops"][2] or "X", props["ttprops"][3] or "X", props["ttprops"][4] or "X", props["ttprops"][5] or "X"); end - if(text) then - instance.Text:SetText(text); + if(props["text"]) then + instance.Text:LocalizeAndSetText(props["text"]); end --Invokes functions if(funcs) then for _,v in ipairs(funcs) do - v(instance, group, icon, tooltip, text); + v(instance, group, props); end end --Reveals completed notification From 5414202e03b62adb6372015589512b0c717faba7 Mon Sep 17 00:00:00 2001 From: chaorace Date: Sun, 30 Apr 2017 22:55:57 -0400 Subject: [PATCH 07/20] Fixed incorrect strings This resolves an issue where the debug log printout was incorrect, as well as preventing "Blah" from appearing in a notification if no string is specified --- Assets/cqui_toplayer.lua | 2 +- Assets/cqui_toplayer.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/cqui_toplayer.lua b/Assets/cqui_toplayer.lua index 7c452d0..cd3095b 100644 --- a/Assets/cqui_toplayer.lua +++ b/Assets/cqui_toplayer.lua @@ -21,7 +21,7 @@ local paradoxBarFuncs = { ["deleteOnRMB"] = function(instance, group) instance.Button:RegisterCallback(Mouse.eRClick, function() RemoveNotification(instance, group); end); end, - ["debugPrint"] = function() print("Debug tooltip created"); end + ["debugPrint"] = function() print("Debug notification created"); end } --Paradoxbar behavior bundles diff --git a/Assets/cqui_toplayer.xml b/Assets/cqui_toplayer.xml index 7c78ff6..03e8d55 100644 --- a/Assets/cqui_toplayer.xml +++ b/Assets/cqui_toplayer.xml @@ -41,7 +41,7 @@ From ae9bc468e1917244e2ee221e154fd38f639ce008 Mon Sep 17 00:00:00 2001 From: chaorace Date: Mon, 1 May 2017 23:32:18 -0400 Subject: [PATCH 08/20] Fixed multiple visual issues This commit switches the sliding animation to a simpler alpha animation, as well as fixing a bug related to mutable states persisting with newly summoned notification instances. This commit also fixes a minor issue which could cause the notification overlay to overlap with the worldtracker checkbox --- Assets/cqui_toplayer.lua | 13 ++++++++++--- Assets/cqui_toplayer.xml | 8 ++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Assets/cqui_toplayer.lua b/Assets/cqui_toplayer.lua index cd3095b..fee8103 100644 --- a/Assets/cqui_toplayer.lua +++ b/Assets/cqui_toplayer.lua @@ -45,7 +45,7 @@ local paradoxBarStock = { -- This function handles adding new notifications to the paradox bar -- If an ID is supplied, paradoxBarStock is checked for a matching ID and loads presets if available. If additional values are supplied, they are used to overwrite the default values -- group is used for the purposes of chunking notifications together and is mandatory --- props is a table containing properties for overriding the defaults supplied by the template selected using the ID +-- props is a table containing properties for overriding the defaults supplied by the template selected using the ID, you can also use this table for defining arbitrary parameters for use with attatched functions -- icon is the texture name of the image to be used. Not defining this will leave only a background portrait texture -- tooltip is the string to be used describing the notification in detail. Please add an LOC string to cqui_text_notify if you need to employ a new string -- ttprops is a table of additional values to be injected into the LOC string. Limit of 5 parameters. See cqui_text_notify for examples concerning working with inserting into LOCs @@ -109,13 +109,19 @@ function AddNotification(ID, group, props, funcs) v(instance, group, props); end end + --Check if this asset has been used before and, if so, fix any mutable states that may have persisted + if(instance.Top:GetID() == "Exhausted") then + instance.Top:SetID("NotExhausted"); + instance.AlphaAnimation:RegisterEndCallback(function() end); + instance.AlphaAnimation:SetToBeginning(); + end --Reveals completed notification instance.Top:SetHide(false); + instance.AlphaAnimation:Play(); end function RemoveNotification(instance, group) - instance.SlideAnimation:Reverse(); - instance.SlideAnimation:RegisterEndCallback(function() + instance.AlphaAnimation:RegisterEndCallback(function() groupStacks[group]:ReleaseInstance(instance); --This is a hacky workaround since releasing an instance doesn't necessarily actually remove it from a given stack instance.Top:SetID("Exhausted"); @@ -126,6 +132,7 @@ function RemoveNotification(instance, group) Controls.ParadoxBarStack:ReleaseChild(groupStackInstances[group].Top); groupStackInstances[group] = nil; end) + instance.AlphaAnimation:Reverse(); end function Initialize() diff --git a/Assets/cqui_toplayer.xml b/Assets/cqui_toplayer.xml index 03e8d55..01d42f4 100644 --- a/Assets/cqui_toplayer.xml +++ b/Assets/cqui_toplayer.xml @@ -12,7 +12,7 @@ - + @@ -37,7 +37,7 @@ - + From a9887d612a543e4dbaa354079ca1fe1eda365401 Mon Sep 17 00:00:00 2001 From: chaorace Date: Thu, 11 May 2017 00:44:07 -0400 Subject: [PATCH 16/20] Implemented CityGrowth and CityShrink notifications The game doesn't actually have separate events for these two happenings, so I've implemented a hacky heuristic that does the job in almost all cases (hopefully) --- Assets/Text/cqui_text_notify.xml | 3 +++ Assets/cqui_toplayer.lua | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/Assets/Text/cqui_text_notify.xml b/Assets/Text/cqui_text_notify.xml index a59c187..7d7b591 100644 --- a/Assets/Text/cqui_text_notify.xml +++ b/Assets/Text/cqui_text_notify.xml @@ -5,5 +5,8 @@ {1_cityname} has grown! + + {1_cityname} has shrunk! + diff --git a/Assets/cqui_toplayer.lua b/Assets/cqui_toplayer.lua index e54bd79..056d5dc 100644 --- a/Assets/cqui_toplayer.lua +++ b/Assets/cqui_toplayer.lua @@ -22,6 +22,13 @@ local paradoxBarFuncs = { ["deleteOnRMB"] = function(instance, group) instance.Button:RegisterCallback(Mouse.eRClick, function() RemoveNotification(instance, group); end); end, + ["goToCity"] = function(instance, _, props) + instance.Button:RegisterCallback(Mouse.eLClick, function() + local city = props["city"]; + UI:SelectCityID(city:GetID()); + UI.LookAtPlotScreenPosition( city:GetX(), city:GetY(), 0.5, 0.5 ); + end); + end, ["debugPrint"] = function() print("Debug notification created"); end } @@ -50,6 +57,12 @@ NewTemplate("debug", { NewTemplate("debug2", { ["group"] = "Debug2", ["text"] = "Dbg2" }, "debug"); +NewTemplate("cityGrowth", { + ["group"] = "CityGrowth", ["icon"] = "ICON_CITIZEN", ["iconColor"] = "Green", ["tooltip"] = "LOC_CQUI_CITYGROWTH", ["funcs"] = {paradoxBarBundles["standard"], paradoxBarFuncs["goToCity"]} +}); +NewTemplate("cityShrink", { + ["iconColor"] = "Red", ["tooltip"] = "LOC_CQUI_CITYSHRINK" +}, "cityGrowth"); -- This function handles adding new notifications to the paradox bar -- If an ID is supplied, paradoxBarStock is checked for a matching ID and loads presets if available. If additional values are supplied, they are used to overwrite the default values @@ -165,6 +178,22 @@ function Initialize() groupStackIM:ResetInstances(); LuaEvents.CQUI_AddNotification.Add(AddNotification); ContextPtr:SetHide(false); + + --Implementing city population change + Events.CityPopulationChanged.Add( + function(playerID : number, cityID : number, newPopulation : number) + if(not Game:GetLocalPlayer()) then return end + if(playerID == Game:GetLocalPlayer()) then + local city = Players[playerID]:GetCities():FindID(cityID); + print(city:GetGrowth():GetFoodSurplus()); + if(city:GetGrowth():GetFoodSurplus() < 0) then --This isn't a perfect heuristic, but the game doesn't make it easy to tell between a city that just grew and a city that just shrunk + AddNotification("cityShrink", {["ttprops"] = {city:GetName()}, ["city"] = city}); + else + AddNotification("cityGrowth", {["ttprops"] = {city:GetName()}, ["city"] = city}); + end + end + end + ) end Initialize(); From d6c877c9c3b9395c15ae48d6af642d68d43297a8 Mon Sep 17 00:00:00 2001 From: chaorace Date: Sat, 13 May 2017 15:22:30 -0400 Subject: [PATCH 17/20] Removed unnecessary print statement --- Assets/cqui_toplayer.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/Assets/cqui_toplayer.lua b/Assets/cqui_toplayer.lua index 056d5dc..66aa224 100644 --- a/Assets/cqui_toplayer.lua +++ b/Assets/cqui_toplayer.lua @@ -185,7 +185,6 @@ function Initialize() if(not Game:GetLocalPlayer()) then return end if(playerID == Game:GetLocalPlayer()) then local city = Players[playerID]:GetCities():FindID(cityID); - print(city:GetGrowth():GetFoodSurplus()); if(city:GetGrowth():GetFoodSurplus() < 0) then --This isn't a perfect heuristic, but the game doesn't make it easy to tell between a city that just grew and a city that just shrunk AddNotification("cityShrink", {["ttprops"] = {city:GetName()}, ["city"] = city}); else From 010da234d2056f23753297a4f04a2d6f5a8cf35b Mon Sep 17 00:00:00 2001 From: chaorace Date: Sun, 14 May 2017 19:32:43 -0400 Subject: [PATCH 18/20] Fixed incorrectly closed animation tag --- Assets/cqui_toplayer.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/cqui_toplayer.xml b/Assets/cqui_toplayer.xml index 4cc40be..95c70a4 100644 --- a/Assets/cqui_toplayer.xml +++ b/Assets/cqui_toplayer.xml @@ -44,7 +44,7 @@ From ccb61dee428156741af0fc713086d8068a9d490d Mon Sep 17 00:00:00 2001 From: chaorace Date: Sat, 1 Jul 2017 16:11:31 -0400 Subject: [PATCH 19/20] Added notification options slideout to groups TODO: Create an interface for this button to link to --- Assets/cqui_toplayer.lua | 15 +++++++++++++-- Assets/cqui_toplayer.xml | 5 ++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Assets/cqui_toplayer.lua b/Assets/cqui_toplayer.lua index 66aa224..fc75db6 100644 --- a/Assets/cqui_toplayer.lua +++ b/Assets/cqui_toplayer.lua @@ -103,8 +103,19 @@ function AddNotification(ID, props, funcs) if(groupStackInstances[group] == nil) then groupStackInstances[group] = groupStackIM:GetInstance(); groupStacks[group] = InstanceManager:new("ParadoxBarInstance", "Top", groupStackInstances[group].Stack); + --Binds the edit slideout button + local button = groupStackInstances[group].EditButton + local anim = groupStackInstances[group].EditAnim + button:RegisterCallback(Mouse.eMouseExit, function() + anim:Reverse(); + end); + button:RegisterCallback(Mouse.eMouseEnter, function() + if(not anim:IsReversing()) then + anim:Reverse(); + end + end); end - instance = groupStacks[group]:GetInstance(); + local instance = groupStacks[group]:GetInstance(); --Applies properties. @@ -171,7 +182,7 @@ function RemoveNotification(instance, group) Controls.ParadoxBarStack:ReleaseChild(groupStackInstances[group].Top); groupStackInstances[group] = nil; end) - instance.AlphaAnimation:Reverse(); + instance.AlphaAnimation:Play(); end function Initialize() diff --git a/Assets/cqui_toplayer.xml b/Assets/cqui_toplayer.xml index 95c70a4..406c4fa 100644 --- a/Assets/cqui_toplayer.xml +++ b/Assets/cqui_toplayer.xml @@ -14,7 +14,7 @@ - + @@ -49,6 +49,9 @@ + +