Overview #
The IReferenceProvider
interface is a central component in the WorldBuilder plugin system. It serves as a comprehensive provider for various systems, services, UI components, and tools that are necessary for extending the WorldBuilder-base application. This interface allows access to settings, localization, asset management, UI elements, and other core systems that are usefull.
The IReferenceProvider
interface aggregates a range of essential functionalities including asset importing, project and location loading, UI management, and camera control, enabling other systems or plugins to interact with these resources efficiently.
Properties and Events #
Events #
OnProjectLoaded
:
Triggered when a project has been loaded into the system. This event provides theIProject
instance representing the loaded project.OnLocationLoaded
:
Triggered when a location (a scene or level) is loaded. This event provides theILocation
instance representing the loaded location.
General Properties #
LoadProcessHooks
:
Provides hooks for the loading process, allowing custom actions or extensions to be triggered during project or location loading.SaveProcessHooks
:
Provides hooks for the saving process, allowing custom actions or extensions during project or location saving.BuilderSettings
:
Access to the
, which stores and manages user preferences, configuration settings, and builder-related configurations.BuilderSettings
LocalizationSystem
:
Provides access to theILocalizationSystem
responsible for managing localization and language resources within the application.GlobalParameters
:
Provides access to theIParameterSystem
, which handles global parameters to allow accessing them in other plugins or as triggers in an event driven architecture.PluginProvider
:
Provides access to theIPluginProvider
, enabling interaction with installed plugins and their associated functionality.AssetDatabase
:
Provides access to theIAssetDatabase
, which manages the assets within the application, such as models, textures, and other resources.AssetImporter
:
Provides access to theIAssetImporter
, responsible for importing new assets into the project.Project
:
The current project loaded into the system, represented by anIProject
instance.LoadedLocation
:
The currently loaded location (e.g., scene or level) represented by anILocation
instance.HiddenVisualObjectsParent
:
ATransform
that holds hidden visual objects in the scene, used for managing objects that should not be directly visible to the user.MouseHandler
:
Access to theIMouseHandler
, which handles mouse input and interactions within the World Builder.WorldEditor
:
Provides access to theIWorldEditor
, which is responsible for editing a location, such as translating, rotating an scaling of objects.CommandMapper
:
Provides access to theICommandMapper
, a system that maps input commands to keyboard keys.HopperReference
:
Provides access to theIHopperReference
, it’s a reference provider for all Portal Hopper related functionality.HopperParameters
:
A dictionary containing string key-value pairs representing parameters related to the Portal Hopper.PlacingManager
:
Provides access to theIPlacingManager
, responsible for managing the placement of objects within the world editor (e.g., placing buildings, characters, etc.).
UI Properties #
ThemeLoader
:
Provides access to theIUIThemeLoader
, responsible for loading and managing UI themes.ElementFactory
:
Provides access to theIUIElementFactory
, which is responsible for creating UI elements dynamically.IconProvider
:
Provides access to theIIconProvider
, responsible for getting access to included icons.ProgressScreen
:
Provides access to theIUIProgressScreen
, which displays a progress screen to the user during lengthy operations (e.g., loading, saving, or exporting).UIAnimator
:
Provides access to theIUIAnimator
, responsible for animating UI elements, such as transitions or visual effects.PopupSystem
:
Provides access to theIPopupSystem
, responsible for displaying popup dialogs and notifications to the user.MainMenu
:
Provides access to theIMenu
representing the main menu UI.SettingsMenu
:
Provides access to theISubMenu
for the settings UI, where users can adjust configuration options.WorldMenu
:
Provides access to theISubMenu
for the world-specific settings and options menu.StartUIRoot
:
AVisualElement
that represents the root UI element for the start screen, the initial UI visible to the user when the application launches.HUD_UIRoot
:
AVisualElement
that represents the root UI element for the world builder after a world is loaded.ReferenceResolution
:
AVector2Int
defining the reference resolution used for UI layout, ensuring consistency across different screen sizes and aspect ratios.ProjectsScreenController
:
Provides access to theIUIProjectsScreenController
, responsible for managing the UI and interactions related to the projects screen.CreateProjectScreenController
:
Provides access to theIUICreateProjectScreenController
, responsible for managing the UI and interactions related to the project creation screen.AssetManagerController
:
Provides access to theIUIAssetManagerController
, which controls the asset management UI.ExportPageController
:
Provides access to theIUIExportPageController
, which controls the UI for exporting the project or world.InspectorController
:
Provides access to theIUIInspectorController
, which handles the inspector UI for viewing and editing properties of selected objects.AssetDataProvider
:
Provides access to theIUIAssetDataProvider
, which provides data related to assets for use within the UI (e.g., displaying asset properties).CursorController
:
Provides access to theICursorController
, which manages the cursor behavior.CameraController
:
Provides access to theICameraController
, which manages the camera’s movement and positioning in the location view.LocationViewToolbar
:
Provides access to theILocationViewToolbar
, a UI toolbar specific to managing views of the current location (scene or level).
Usage Example #
public class MyCustomPlugin : PluginBase
{
// A method called when the plugin is initialized
public override void CreateSetupProcess()
{
base.CreateSetupProcess();
// Subscribe to project and location loading events
ReferenceProvider.OnProjectLoaded += OnProjectLoaded;
ReferenceProvider.OnLocationLoaded += OnLocationLoaded;
}
// Event handler for when a project is loaded
private void OnProjectLoaded(IProject project)
{
Debug.Log($"Project Loaded: {project.Name}");
}
// Event handler for when a location is loaded
private void OnLocationLoaded(ILocation location)
{
Debug.Log($"Location Loaded: {location.Name}");
}
}
Conclusion #
The IReferenceProvider
interface centralizes key systems, tools, and services required to build and manage worlds within the WorldBuilder environment. It simplifies interaction with various subsystems and provides structured access to the underlying functionality needed for tasks like asset management, project and location handling, UI management, and more.