Adding New Notification with Callback

sman1975

Emperor
Joined
Aug 27, 2016
Messages
1,370
Location
Dallas, TX
Does anyone know how to make a custom UI unhide by clicking on a Notification button, like the generic "City State" UI does (i.e. the basic popup that asks "What business do you have here?" at the top)?

Looking over the NotificationPanel.lua (UI), I see 14 notifications (e.g. Found Pantheon/Religion, Enhance Religion, Choose Archaeology, Choose Ideology, Steal Tech, etc.) that have callbacks attached - that generate popups of some kind. The callbacks look like this:

Controls["FreeTechButton"]:RegisterCallback(Mouse.eLClick, GenericLeftClick); Controls["FreeTechButton"]:RegisterCallback(Mouse.eRClick, GenericRightClick);

Each of these notifications have a corresponding callback function/popup that performs some meaningful work when the notification button is tickled by the mouse.

However, the NOTIFICATION_MINOR notification (q.v.) is not one of the 14 notifications in NotificationPanel.lua. This implies there might some way to add a callback to a notification, even if it is defined in a different address space. This approach is counter-intuitive to me (as is much of the UI code), so I'm not following what's going on down in the weeds.


What I'm looking for is a way to add a notification w/ callback, hopefully without replacing the NotificationPanel.lua if at all possible. Appreciate it if anyone has a suggestion or knows of a mod that already manages this.

Thanks!

sman
 
Thanks @whoward69 - @Troller0001 recommended that one to me on Discord. I took a cursory look at the code, and it looks pretty straightforward, but for the functionality I need, it's kind of like swatting a fly with a sledgehammer... :lol:

I suppose it could just strip out the primary functions of the mod (the selectivity of notification visibility), and keep the parts that deal directly with already shown notifications and their callbacks. OTOH, the mod in its entirety is only 17 KB...

Do you mind if I absorb the contents of "UI - Notification Options" into a reusable icon callback library I can incorporate into some of my mods?

Thanks!


EDIT: (question removed - I couldn't fine the entry point type called "CustomNotificationAddin" in the Type drop down menu, but then playing around with the Add Content popup, I realized I could paste the text in the Type entry. So, I created a "Custom" entry point, then simply pasted the text on top of it, and it stayed...)
 
Last edited:
Do you mind if I absorb the contents of "UI - Notification Options" into a reusable icon callback library I can incorporate into some of my mods?

Answer is in sig ;)
 
Top Bottom