cohtml.CohtmlUISystem

A component allowing you to create CohtmlView components and control their behavior.

Inherits from MonoBehaviour

Public Functions

Name
ViewCreateView(ViewSettings settings)
Creates a native View object with the given settings.
voidCreateNativeUISystem(CohtmlSystemSettings systemSettings)
Creates the native equivalent of the CohtmlUISystem component.
CohtmlUISystemGetUISystem(bool forceCreate =false)
Returns a System object found in the scene. If no System object is found it will create one and return it.

Protected Functions

Name
virtual voidAwake()
virtual voidStart()
virtual voidUpdate()
virtual voidOnRenderObject()
virtual voidOnDestroy()
When destroying Cohtml components, it must follow a specific order - firstly Views then Systems then Library. Each component is responsible for destroying the component attached before it. For example, the System destroys the attached Views. Each component should first destroy its native Cohtml reference. Each component should first destroy its rendering, if it exists. Each component should also destroy all referenced components attached and depends to it. For example, the DefaultSystem destroys the TextInputHandler.

Public Properties

Name
IUISystemSystemNative
Returns the native object of the CohtmlUISystem.
uintId
Id of registered UISystem reference in Cohtml native library.
UserImagesManagerUserImagesManager
Returns the instance of the UserImageManger.
CohtmlSystemSettingsSettings
Returns the settings used to create the CohtmlUISystem.

Public Attributes

Name
const stringCohtmlDefaultUISystemName
The name of the default CohtmlUISystem.
Func< CohtmlSystemSettings, CohtmlSystemSettings >OnSystemCreate
Change the CohtmlSystemSettings component’s values programmatically upon subscription, just before the system is created with these settings in Native Cohtml.
IResourceHandlerResourceHandler
Gets the resource handler.
ILocalizationManagerLocalizationManager
Gets the localization manager.
boolIsReady
Determines whether this instance is ready.
ReadOnlyCollection< CohtmlView >UIViews
Returns a List with the view components that belong to the UI system.
stringDataPath
Returns the path to the game data folder on the target device.
stringStreamingAssetsPath
Returns the path to the StreamingAssets folder.
List< CohtmlUISystem >CreatedSystems

Public Functions Documentation

function CreateView

View CreateView(
    ViewSettings settings
)

Creates a native View object with the given settings.

Parameters:

  • settings The setting used to create the View.

Return: Returns the native View object.

function CreateNativeUISystem

void CreateNativeUISystem(
    CohtmlSystemSettings systemSettings
)

Creates the native equivalent of the CohtmlUISystem component.

Parameters:

  • systemSettings The settings used to create the native object.

function GetUISystem

static CohtmlUISystem GetUISystem(
    bool forceCreate =false
)

Returns a System object found in the scene. If no System object is found it will create one and return it.

Parameters:

  • forceCreate Forces the creation of a game object with a System component if such doesn’t exist in the scene.

Exceptions:

  • SystemException When more than one system exists on the scene, it is unclear which system should be returned as a result to the caller. To avoid this exception, you should always reference the System in relation to CohtmlView, which requires a system for its creation.

Return: Found System or null when have multiple systems.

When multiple systems are found on the current scene, it returns null, as it is undefined which system the caller intends to reference with this method.

Protected Functions Documentation

function Awake

virtual void Awake()

function Start

virtual void Start()

function Update

virtual void Update()

function OnRenderObject

virtual void OnRenderObject()

function OnDestroy

virtual void OnDestroy()

When destroying Cohtml components, it must follow a specific order - firstly Views then Systems then Library. Each component is responsible for destroying the component attached before it. For example, the System destroys the attached Views. Each component should first destroy its native Cohtml reference. Each component should first destroy its rendering, if it exists. Each component should also destroy all referenced components attached and depends to it. For example, the DefaultSystem destroys the TextInputHandler.

Public Property Documentation

property SystemNative

IUISystem SystemNative;

Returns the native object of the CohtmlUISystem.

property Id

uint Id;

Id of registered UISystem reference in Cohtml native library.

property UserImagesManager

UserImagesManager UserImagesManager;

Returns the instance of the UserImageManger.

property Settings

CohtmlSystemSettings Settings;

Returns the settings used to create the CohtmlUISystem.

Public Attributes Documentation

variable CohtmlDefaultUISystemName

const string CohtmlDefaultUISystemName = "CohtmlDefaultUISystem";

The name of the default CohtmlUISystem.

variable OnSystemCreate

Func< CohtmlSystemSettings, CohtmlSystemSettings > OnSystemCreate;

Change the CohtmlSystemSettings component’s values programmatically upon subscription, just before the system is created with these settings in Native Cohtml.

variable ResourceHandler

IResourceHandler ResourceHandler => Settings.ResourceHandler;

Gets the resource handler.

The resource handler.

variable LocalizationManager

ILocalizationManager LocalizationManager => Settings.LocalizationManager;

Gets the localization manager.

The localization manager.

variable IsReady

bool IsReady => SystemNative != null;

Determines whether this instance is ready.

Return: true if this instance is ready; otherwise, false.

variable UIViews

ReadOnlyCollection< CohtmlView > UIViews => m_Views.AsReadOnly();

Returns a List with the view components that belong to the UI system.

List with CohtmlView components.

variable DataPath

static string DataPath => Application.dataPath;

Returns the path to the game data folder on the target device.

variable StreamingAssetsPath

static string StreamingAssetsPath => Application.streamingAssetsPath;

Returns the path to the StreamingAssets folder.

variable CreatedSystems

static List< CohtmlUISystem > CreatedSystems = new List<CohtmlUISystem>();