Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 2.25 KB

File metadata and controls

63 lines (45 loc) · 2.25 KB

Importing the package

Add this scoped registry.

"scopedRegistries": [
    {
      "name": "Mr. Watts UPM Registry",
      "url": "https://gitlab.com/api/v4/projects/27157125/packages/npm/",
      "scopes": [
        "io.mrwatts"
      ]
    }
  ]

Add the following dependency in the manifest.json file in the "Packages" folder.

"io.mrwatts.messageboxes": "1.0.0"

The version number should be the latest version of the package (unless you want to target an older version on purpose).

Dependencies

This package depends on

  • io.mrwatts.fuelinject
  • io.mrwatts.extensions

Package Usage

To setup any MessageBox, first create 2 prefabs:

  • The first prefab ('messageBoxPrefab') will function as the MessageBox itself, it should contain a MessageBox component. Make sure it has a textfield and a container for buttons. These need to be assigned to the labelMessage and panelButtons fields respectively in the MessageBox component.
  • The second prefab is a button of the MessageBox and should have a MessageBoxButton component. Make sure the button also has a textfield of his own, as well as a Button component. Both need to be assigned in the MessageBoxButton component. Assign the button prefab to the buttonPrefab field in the MessageBox component of the 'messageBoxPrefab'.

Single MessageBox

If you need one MessageBox to be instantiated at a time, add the following in any ContainerModule, where builder is of type ContainerBuilder:

builder.RegisterSingleMessageBoxFactory(messageBoxPrefab);

If you want the MessageBox to be instantiated in a specific parent Transform parentContainer, you can add it as follows:

builder.RegisterSingleMessageBoxFactory(messageBoxPrefab, parentContainer);

Multiple MessageBoxes

If you have multiple messageboxes, eg. one as a floating window in XR and another on a flat surface like a virtual desktop, add the following in any ContainerModule, where builder is of type ContainerBuilder:

List<(GameObject messageBoxPrefab, Transform? parentContainer)> messageBoxSettings = new()
{
    (messageBoxPrefab1, parentContainer1),
    (messageBoxPrefab2, parentContainer2),
};

builder.RegisterAggregatedMessageBoxFactory(messageBoxSettings);