make PanelOpenedOrClosed method extendable in DisplayPanelManager.cs

Another enhancement:
- add two UnityEvent for “On Menu Panel Open" and "On Menu Panel Close", so that we could use it directly
1657532033076.png
 
For this I would recommend using this event:
Code:
EventHandler.RegisterEvent<bool>(m_DisplayManager.PanelOwner, EventNames.c_GameObject_OnGameplayPanelSelected_Bool, HandleGameplayPanelSelected);

There is a good and simple example of using this event in the "PreventSelectableDeselection" script.

This event will let you know when the gameplay panel is selected. This panel is selected when no other panels are opened.
There are other events you might be interested in:
Code:
//The panel was opened or closed. The target game object is the panel owner assigned in the PanelManager.
public const string c_GameObject_OnPanelOpenClose_PanelEventData = "GameObject_OnPanelOpenClose_PanelEventData";
//Similar to the OpenClose event but only happens if the selected panel is different. Used to know when the panel manager selects a new panel. The target game object is the panel owner assigned in the PanelManager.
public const string c_GameObject_OnNewPanelSelected_PanelEventData = "GameObject_OnNewPanelSelected_PanelEventData";
//The gameplay panel was selected or unselected, this event is particularly useful to enable disable character/UI input. The target game object is the panel owner assigned in the PanelManager.
public const string c_GameObject_OnGameplayPanelSelected_Bool = "GameObject_OnGameplayPanelSelected_Bool";

You can find all events, in the EventNames.cs file
 
Okay.
But this time could you please help to change `SetPanelOwner` to `public virtual`
1657593858338.png
and change `OnDestroy` to `protected virtual`
1657593912124.png
 
What about the "OnPanelOwnerAssigned" C# event, can you not use that?
I could use a EventHandler event on the panel owner when it is assigned too such that you don't need a reference to the DisplayPanelManager. But in any case you can access it easily so you could do

InventorySystemManager.GetDisplayPanelManager().OnPanelOwnerAssigned += HandleNewPanelOwner;
 
Top