Doloro GDK 22 .1.0 Beta
by Tauri Interactive
Virtual UI Hub

About

The Doloro UI Engine II's module that provides event forwarding features. That module could be useful in case if you need to bind standalone UI elements to virtual events network.

Has compatibility with the Workspaces features.
Works in virtual chained hierarchies provided with layout bonds in auto way. So, the network would consider all chained element as solid hierarchy.

Explore API:

Getting started

Auto network

  1. Put VirtualUIHub component (or component derived from it) on some GameObject that you consider as network root.
  2. Put UIHubEventRelay (or component derived from it) on child object with AGUIElement that should forward its events to another network connected elements. Select events that will be shared to the hub.
  3. Put UIHubListener (or component derived from it) on an object that is a virtual (supplied with the VirtualHierarchyLinker) or actual child of the VirtualUIHub hosting game object from the first step.
    Get it with you event destination component and subscribe you event handler with the UIHubListener.SetEventHandler(string, VirtualUIHub.SharedEvent) or on of predefined by API events.
  4. Release handler from the network with the UIHubListener.ReleaseEventHanler(string, VirtualUIHub.SharedEvent) as soon as it's unnecessary.

Manual network

You could define AHubAgent.hub manually. Using this you could connect some AGUIElement outside of virtual hierarchy chain to the network.

Note that by default all the placed handlers up to the moment will be released. To prevent this, you have to set UIHubListener.DropHandlerWithHub property to false.

You could implement your own logic with defining a custom OnHubPreChange and OnHubPostChange handler at your custom AHubAgent.

Custom events

As has been mentioned above you could set handler to network with not predefined API by using UIHubListener.SetEventHandler(string, VirtualUIHub.SharedEvent) method.

  1. Put your handler with the UIHubListener.SetEventHandler(string, VirtualUIHub.SharedEvent) by using custom eventCode.
  2. Put UIHubEventRelay derived component to the AGUIElement that will share the custom event. When event occurs call UIHubEventRelay.hub.ShareEvent(this, YOUR_EVENT_CODE, ARGS_ARRAY) at the re-translator instance and it will share it to each network's UIHubListener with a handler subscribed of YOUR_EVENT_CODE.

Custom Hub's agent

Create a new class derived from abstract AHubAgent or from a class derived from it. It will provide you integration with virtual hierarchy hub.

In the created hub you may implement your own logic according with component proposes.
Look on UIHubListener and UIHubEventRelay implementation as on AHubAgent example.