Doloro GDK 22 .1.0 Beta
by Tauri Interactive
Item GUI control

Table of Contents

About

The module provides you with ItemGUIElement, a main content inspector suitable for Item content display. The component receives StoragesDatabase.ItemContainer as content and loads its key properties to configurated GUI layout.

Explore API:


Extensions

The inspector can be extended with AItemGUIElementExtension derived components.
The class proofs components configuration on target game object that simplifies development comparing to manual implementation of AContentInspectorExtension<StoragesDatabase.ItemContainer> class.

The extension follows ItemGUIControl events and updates bonded GUI layout elements along with extension internal logic.

Explore API:


Development

To create a custom GUI extension, it’s enough to create a new class derived from AItemGUIElementExtension. By overriding provided handlers you may follow common ItemGUIControl events and implement feedback on them.

Following example shows common template of GUI extension class.

using Doloro.InvetorySystem;
using Doloro.InvetorySystem.UI.Controls;
using Doloro.InvetorySystem.UI.Extension;
public class CUSTOM_ITEM_GUI_EXTENSION : AItemGUIElementExtension
{
protected override void OnItemNotSelected()
{
// Handler that calls when inspector content is `null`.
// Clear the GUI elements here.
}
protected override void OnItemModified(StoragesDatabase.ItemContainer source)
{
// Handler that calls when source item data container data has been modified.
// Load data to GUI elements here.
}
protected override void OnItemRelease(StoragesDatabase.ItemContainer toRelease)
{
// Occurs before new Item apply and allows to release
// data bonded with previously used instance.
// Release events subscriptions here.
}
}

You also may find useful deriving the component from the AItemFeatureGUIExtension{FeatureType} instead of regular AItemGUIElementExtension. Such a component bonds with a certain AItemFeature over the Item instance and follows its internal events and messages encapsulating objects management demands.

public class CUSTOM_ITEM_FEATURE_GUI_EXTENSION :
AItemFeatureGUIExtension<FEATURE_TYPE>
{
... THE SAME MEMBERS MAP ...
protected virtual void OnFeatureModified(FEATURE_TYPE feature)
{
// Handler that will be called as soon as
// bonded feature invoked `AEntityFeature.Modified` event.
// Implement GUI update here.
}
}

Where FEATURE_TYPE is AItemFeature derived feature's type.

Using of the component allows dynamically change a GUI along with the feature's state change.

Warning
The AItemFeatureGUIExtension derived component calls Item resource instance. Such an instance has a bond with data base entry and must be destroyed manually in case you need. You may want to do this in case some of custom features takes performance leak, by default such an instance is static and not damage gameplay experience while it stays in on-scene items registry.

Explore API: Doloro.InvetorySystem.UI.Extension.AItemFeatureGUIExtension{ FeatureType }