Panel Hook (beta) for modders

If you liked this item, please rate it up on Steam Workshop page.

Author: vpoteryaev

Last revision: 11 Jul, 2019 at 03:46 UTC

File size: 20.48 KB

On Steam Workshop

Description:
Panel Hook (beta) for modders

This mod is designed for modders. If you are not a modder, just subscribe to this mod and allow it in the game if it is stated as the dependency in another mod. Only read the Uninstall section at the bottom of the page, if you are using this mod and are going to remove it.

Forewords

When writing your own mod, too many time is spent on placing and precise positioning, let’s say, buttons on the building information panel.
Then may happens that another mod also places something in the same panel, overlapping your changes … or the developers have changed something … etc.
As an example, several mods are hooking to the same element. By mouse click all mods will perform their actions, but the user wants exactly only one action from a certain mod to be performed…

This mod will allow you to minimize your time-wasting, and unify the interaction of users with different mods, without changing anything in the panels.

Purpose

With this mod, although called PanelHook, you’ll be able to attach your own mouse click handler to any element derived from the UIComponent.
You just have to define the element you are interested and provide the PanelHook with the following:

  1. Your handler – it’s standard ColossalFramework.UI.MouseEventHandler.
  2. Element itself (mod accepts ‘object’ class type).
  3. The description that will be displayed to the user in the drop-down list for selection when clicking on an element.

As a result, when you click on an element, the panel will appear with the drop-down list of actions and the handler will be called accordingly after choosing action.
One handler can be hooked to different elements, also several different handlers can be attached to one element.
Only full duplication the pair handler-element is not allowed.
Also exists the ability to filter handler calls.
For example, the handler is hooked to the service building panel’s element, but should not be called for all buildings of this type, but only for those that suits the certain criteria.

Uninstall

Just in case. To be sure that before uninstalling the mod data will not remain in the game save, before saving you should press the "Clean Data" button in the mod options, save, exit and delete the mod

More detailed information is available on GitHub[github.com]

Feedbacks, esp. bug-reports, are welcome. In any form, both here and on GitHub.

Want to encourage? PayPal[www.paypal.me]. THANKS in advance!!! 😉

Sorry for my English.