C# Class Epigene.UI.UIManager

User interface manager. This class will manage the UI.
Afficher le fichier Open project: fi-content2-games-platform/FIcontent.Gaming.Enabler.phenomobilecharactermanager Class Usage Examples

Méthodes publiques

Méthode Description
ActivateScreen ( string screenName ) : Epigene.UI.UIScreen

Activate a screen by name. This function will deactivat old screen and activate the new one. It will also send a notification to screenChanged(old, new) if any delegates is set.

Add ( UIType type, GameObject obj, string fileName, Sprite spr = null ) : UIObject

Adds a UI button.

AddDialog ( Epigene.UI.UIDialog dialog ) : void

Add a dialog to available list

AddScreen ( Epigene.UI.UIScreen screen ) : void

Add a new screen.

BlinkImage ( UIImage image, int numberOfblinks = 2, double speedInMs = 200 ) : void

Blink an image by numberOfBlinks times. The speed of blinks depends on the speedInMs parameter.

BlinkToggle ( UIImage image ) : void

Helper for processing blinking of an image. It will toggle the visible flag based on the preset values

ChangeLayers ( GameObject obj, string name ) : void

Change layers in game objet and in all of it's children

CheckTooltipVisibility ( GameObject obj ) : bool

Check if the tooltip can be visible at the moment or should be hidden

Clear ( bool force = false ) : void

Free up memory with dropping all ui objects. Clears UI elements with removing them from internal lists and destroys them.

ClearHuds ( ) : void

Remove all registered screens.

ClearModels ( ) : void
ClearPopups ( ) : void
ClearScreens ( ) : void

Remove all registered screens.

ClearUI ( UIType type ) : void

Remove all registered UIImages, where type is match

ContainsButton ( int id ) : bool

Check if the button already exist.

ContainsHud ( string id ) : bool

Check if the Hud already exist.

ContainsModel ( string id ) : bool

Check if the Model already exist.

ContainsPopup ( string id ) : bool

Check if the Popup already exist.

ContainsScreen ( string name ) : bool

Check if the button already exist.

CreateGameObject ( string prefab ) : GameObject

Helper to create a gameobject from a prefab.

CreateImage ( string id, string filename, GameObject parent, GameObject obj = null ) : UIImage

Create a new push or toggle button

CreateTexture ( GameObject obj, Rect rect, float orthSize ) : Texture2D

Create a texture from game object. It will clone the object and the camera, create a screenshot of the camera and save it. Set rect to the size of the new image.

DisableButton ( Epigene.UI.UIButton b ) : void
DisableHuds ( ) : void

Disable all the huds

EnableButton ( Epigene.UI.UIButton b ) : void
Get ( int id ) : UIObject
Get ( string name ) : UIObject
GetDialog ( string id ) : Epigene.UI.UIDialog

Get a dialog from available list by id

GetHud ( string id, string prefab = null ) : GameObject

Helper to get the game object for a hud. TODOstatic??

GetHudNames ( object>.Dictionary dict ) : List

Get name of used huds.

GetModel ( string id, string prefab = null ) : GameObject

Helper to get the game object for a hud. TODOstatic??

GetPopup ( string id, string prefab = null ) : GameObject

Helper to get the game object for a popup. TODOstatic??

GetPopupNames ( object>.Dictionary dict ) : List

Get name of used popups.

GetScreen ( string name ) : Epigene.UI.UIScreen
GetScreenId ( ) : string

Return the active screen Id

GetVirtualCamera ( float orthSize ) : Camera

Get a virtual camera, which can render the object alone. The new camera cloned from the current main camera or from a it's prefab in case of no main camera.

InitUI ( GameObject parent ) : void

Helper to reset/recreate the ui parent objects

IsLayerVisible ( string layerName ) : bool

Return if a layer is visible or not

LoadPrefab ( string prefab, string name, GameObject parent ) : GameObject

Helper to load a prefab by name under specific parent

LoadResources ( object>.Dictionary dict, GameObject gameObject = null ) : UIObject>.Dictionary

Load object resources from dictionary TODO make more generic helpers and way of parse similar stuff. ie. transform parameter should be one parser for all

LoadResources ( string fileName, GameObject gameObject = null ) : void

Create a screen from a json file including all ui elements

LoadSprite ( string fileName ) : UnityEngine.Sprite[]

Loads a sprite and return a list of textures. If the sprite is in multi mode, the list will contains each sprites. If the sprite is single mode, the list will contains only one item.

Remove ( int id ) : void

Remove an image type

RemoveAllDialog ( ) : void

Remove ALL dialogs

RemoveDialog ( string id ) : void

Remove a dialog by id

RemoveModal ( ) : void
SaveTextureToFile ( Texture2D texture, string fileName ) : void

Save a texture into a file as png

Screenshot ( Camera camera, Rect rect ) : Texture2D

Save the rectangle from the camera view as a texture.

SetResolution ( int w, int h, bool fullScreen ) : void

Helper to notify when screen is resizes.

ShowLayer ( string layerName, bool flag ) : void

Show and hide a layer by name If flag is set to true, it will show the layer if flag is false, it will hide the layer

ShowModal ( GameObject obj ) : void

Use this function to show (activate) an object in modal mode. While the object is active, it will capture all user inputs and gets all focus. Deactivating the object will trigger the uimanager to go back to normal mode (hide and forget).

SlideScreen ( string screenName ) : Epigene.UI.UIScreen
ToggleLayer ( string layerName ) : void

Togle a layer by name

UIManager ( ) : UnityEngine

Initializes a new instance of the UIManager class.

Update ( ) : void

Process inputs and update state of ui element.

Private Methods

Méthode Description
GetObjectUnderCursor ( ) : GameObject

Get an object under the cursor

GetUIButtonFromObject ( GameObject obj ) : Epigene.UI.UIButton

Internal helper to get a uiButton from an object

InternalInit ( ) : void

Method Details

ActivateScreen() public méthode

Activate a screen by name. This function will deactivat old screen and activate the new one. It will also send a notification to screenChanged(old, new) if any delegates is set.
public ActivateScreen ( string screenName ) : Epigene.UI.UIScreen
screenName string The name of the screen.
Résultat Epigene.UI.UIScreen

Add() public méthode

Adds a UI button.
public Add ( UIType type, GameObject obj, string fileName, Sprite spr = null ) : UIObject
type UIType
obj UnityEngine.GameObject Parent game object.
fileName string Resource file name with path, relative to Rersources folder.
spr UnityEngine.Sprite
Résultat UIObject

AddDialog() public méthode

Add a dialog to available list
public AddDialog ( Epigene.UI.UIDialog dialog ) : void
dialog Epigene.UI.UIDialog
Résultat void

AddScreen() public méthode

Add a new screen.
public AddScreen ( Epigene.UI.UIScreen screen ) : void
screen Epigene.UI.UIScreen
Résultat void

BlinkImage() public méthode

Blink an image by numberOfBlinks times. The speed of blinks depends on the speedInMs parameter.
public BlinkImage ( UIImage image, int numberOfblinks = 2, double speedInMs = 200 ) : void
image UIImage
numberOfblinks int
speedInMs double
Résultat void

BlinkToggle() public méthode

Helper for processing blinking of an image. It will toggle the visible flag based on the preset values
public BlinkToggle ( UIImage image ) : void
image UIImage
Résultat void

ChangeLayers() public static méthode

Change layers in game objet and in all of it's children
public static ChangeLayers ( GameObject obj, string name ) : void
obj UnityEngine.GameObject
name string
Résultat void

CheckTooltipVisibility() public méthode

Check if the tooltip can be visible at the moment or should be hidden
public CheckTooltipVisibility ( GameObject obj ) : bool
obj UnityEngine.GameObject
Résultat bool

Clear() public méthode

Free up memory with dropping all ui objects. Clears UI elements with removing them from internal lists and destroys them.
public Clear ( bool force = false ) : void
force bool
Résultat void

ClearHuds() public méthode

Remove all registered screens.
public ClearHuds ( ) : void
Résultat void

ClearModels() public méthode

public ClearModels ( ) : void
Résultat void

ClearPopups() public méthode

public ClearPopups ( ) : void
Résultat void

ClearScreens() public méthode

Remove all registered screens.
public ClearScreens ( ) : void
Résultat void

ClearUI() public méthode

Remove all registered UIImages, where type is match
public ClearUI ( UIType type ) : void
type UIType
Résultat void

ContainsButton() public méthode

Check if the button already exist.
public ContainsButton ( int id ) : bool
id int
Résultat bool

ContainsHud() public méthode

Check if the Hud already exist.
public ContainsHud ( string id ) : bool
id string
Résultat bool

ContainsModel() public méthode

Check if the Model already exist.
public ContainsModel ( string id ) : bool
id string
Résultat bool

ContainsPopup() public méthode

Check if the Popup already exist.
public ContainsPopup ( string id ) : bool
id string
Résultat bool

ContainsScreen() public méthode

Check if the button already exist.
public ContainsScreen ( string name ) : bool
name string
Résultat bool

CreateGameObject() public static méthode

Helper to create a gameobject from a prefab.
public static CreateGameObject ( string prefab ) : GameObject
prefab string
Résultat UnityEngine.GameObject

CreateImage() public méthode

Create a new push or toggle button
public CreateImage ( string id, string filename, GameObject parent, GameObject obj = null ) : UIImage
id string
filename string
parent UnityEngine.GameObject
obj UnityEngine.GameObject
Résultat UIImage

CreateTexture() public static méthode

Create a texture from game object. It will clone the object and the camera, create a screenshot of the camera and save it. Set rect to the size of the new image.
public static CreateTexture ( GameObject obj, Rect rect, float orthSize ) : Texture2D
obj UnityEngine.GameObject
rect UnityEngine.Rect
orthSize float
Résultat UnityEngine.Texture2D

DisableButton() public static méthode

public static DisableButton ( Epigene.UI.UIButton b ) : void
b Epigene.UI.UIButton
Résultat void

DisableHuds() public méthode

Disable all the huds
public DisableHuds ( ) : void
Résultat void

EnableButton() public static méthode

public static EnableButton ( Epigene.UI.UIButton b ) : void
b Epigene.UI.UIButton
Résultat void

Get() public méthode

public Get ( int id ) : UIObject
id int
Résultat UIObject

Get() public méthode

public Get ( string name ) : UIObject
name string
Résultat UIObject

GetDialog() public méthode

Get a dialog from available list by id
public GetDialog ( string id ) : Epigene.UI.UIDialog
id string
Résultat Epigene.UI.UIDialog

GetHud() public méthode

Helper to get the game object for a hud. TODOstatic??
public GetHud ( string id, string prefab = null ) : GameObject
id string
prefab string
Résultat UnityEngine.GameObject

GetHudNames() public méthode

Get name of used huds.
public GetHudNames ( object>.Dictionary dict ) : List
dict object>.Dictionary
Résultat List

GetModel() public méthode

Helper to get the game object for a hud. TODOstatic??
public GetModel ( string id, string prefab = null ) : GameObject
id string
prefab string
Résultat UnityEngine.GameObject

GetPopup() public méthode

Helper to get the game object for a popup. TODOstatic??
public GetPopup ( string id, string prefab = null ) : GameObject
id string
prefab string
Résultat UnityEngine.GameObject

GetPopupNames() public méthode

Get name of used popups.
public GetPopupNames ( object>.Dictionary dict ) : List
dict object>.Dictionary
Résultat List

GetScreen() public méthode

public GetScreen ( string name ) : Epigene.UI.UIScreen
name string
Résultat Epigene.UI.UIScreen

GetScreenId() public méthode

Return the active screen Id
public GetScreenId ( ) : string
Résultat string

GetVirtualCamera() public static méthode

Get a virtual camera, which can render the object alone. The new camera cloned from the current main camera or from a it's prefab in case of no main camera.
public static GetVirtualCamera ( float orthSize ) : Camera
orthSize float
Résultat UnityEngine.Camera

InitUI() public méthode

Helper to reset/recreate the ui parent objects
public InitUI ( GameObject parent ) : void
parent UnityEngine.GameObject
Résultat void

IsLayerVisible() public static méthode

Return if a layer is visible or not
public static IsLayerVisible ( string layerName ) : bool
layerName string
Résultat bool

LoadPrefab() public méthode

Helper to load a prefab by name under specific parent
public LoadPrefab ( string prefab, string name, GameObject parent ) : GameObject
prefab string
name string
parent UnityEngine.GameObject
Résultat UnityEngine.GameObject

LoadResources() public méthode

Load object resources from dictionary TODO make more generic helpers and way of parse similar stuff. ie. transform parameter should be one parser for all
public LoadResources ( object>.Dictionary dict, GameObject gameObject = null ) : UIObject>.Dictionary
dict object>.Dictionary
gameObject UnityEngine.GameObject
Résultat UIObject>.Dictionary

LoadResources() public méthode

Create a screen from a json file including all ui elements
public LoadResources ( string fileName, GameObject gameObject = null ) : void
fileName string
gameObject UnityEngine.GameObject
Résultat void

LoadSprite() public static méthode

Loads a sprite and return a list of textures. If the sprite is in multi mode, the list will contains each sprites. If the sprite is single mode, the list will contains only one item.
public static LoadSprite ( string fileName ) : UnityEngine.Sprite[]
fileName string file name with path relative to Resource folder.
Résultat UnityEngine.Sprite[]

Remove() public méthode

Remove an image type
public Remove ( int id ) : void
id int
Résultat void

RemoveAllDialog() public méthode

Remove ALL dialogs
public RemoveAllDialog ( ) : void
Résultat void

RemoveDialog() public méthode

Remove a dialog by id
public RemoveDialog ( string id ) : void
id string
Résultat void

RemoveModal() public méthode

public RemoveModal ( ) : void
Résultat void

SaveTextureToFile() public static méthode

Save a texture into a file as png
public static SaveTextureToFile ( Texture2D texture, string fileName ) : void
texture UnityEngine.Texture2D
fileName string
Résultat void

Screenshot() public static méthode

Save the rectangle from the camera view as a texture.
public static Screenshot ( Camera camera, Rect rect ) : Texture2D
camera UnityEngine.Camera
rect UnityEngine.Rect
Résultat UnityEngine.Texture2D

SetResolution() public méthode

Helper to notify when screen is resizes.
public SetResolution ( int w, int h, bool fullScreen ) : void
w int The new width.
h int The new height.
fullScreen bool
Résultat void

ShowLayer() public static méthode

Show and hide a layer by name If flag is set to true, it will show the layer if flag is false, it will hide the layer
public static ShowLayer ( string layerName, bool flag ) : void
layerName string
flag bool
Résultat void

ShowModal() public méthode

Use this function to show (activate) an object in modal mode. While the object is active, it will capture all user inputs and gets all focus. Deactivating the object will trigger the uimanager to go back to normal mode (hide and forget).
public ShowModal ( GameObject obj ) : void
obj UnityEngine.GameObject
Résultat void

SlideScreen() public méthode

public SlideScreen ( string screenName ) : Epigene.UI.UIScreen
screenName string
Résultat Epigene.UI.UIScreen

ToggleLayer() public static méthode

Togle a layer by name
public static ToggleLayer ( string layerName ) : void
layerName string
Résultat void

UIManager() public méthode

Initializes a new instance of the UIManager class.
public UIManager ( ) : UnityEngine
Résultat UnityEngine

Update() public méthode

Process inputs and update state of ui element.
public Update ( ) : void
Résultat void