• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Badibado

Recruit
Mar 11, 2015
5
0
Hi,

I'm trying to code a mod, to add an option in the car panel (when you click on a vehicle). But I don't understand how I "get" this component though the API. Because I think that it is necessary to check after each click, if I clicked on a car, and then display my panel through a overloaded class.
But it seems a little too heavy only for that.
Further, I don't know how I can manage this kind of event, because the loadingExtension, handles only the "level" and not of all the logic throughout the game.

Could anyone help me?
Thx :)
 
So far, what I was able to do is to list all panels and access their data :

Code:
            var UIPanels = uiView.GetComponentsInChildren<UIPanel>();
            for (var i = 0; i < UIPanels.Length; i++ )
            {
                DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Message, "UIPanels: " + UIPanels[i].name);       
            }

I didn't find so far a way to access them by their name without going into this madness of a loop on all the panels.
But it should be here somewhere and as it's Unity getters from Component, I'm pretty sure there must be something.