UIManager Class Reference

List of all members.

Public Types

enum  POINTER_TYPE {
  MOUSE, TOUCHPAD, AUTO_TOUCHPAD, RAY,
  MOUSE_AND_RAY, TOUCHPAD_AND_RAY
}
enum  RAY_ACTIVE_STATE { Inactive, Momentary, Constant }
enum  OUTSIDE_VIEWPORT { Process_All, Ignore, Move_Off }

Public Member Functions

void SetNonUIHitDelegate (PointerInfoDelegate del)
 NOTE: Not recommended unless you intend to replace any and all other non-UI hit delegates. Otherwise, use AddNonUIHitDelegate()AddNonUIHitDelegate This method sets the delegate to be called when a raycast is performed on an input event which hits a non-UI object. Use this when your game uses raycasts for non-UI game purposes but you don't want to waste performance with a redundant set of raycasts. IMPORTANT NOTE: This will replace any previously registered delegates.
void AddNonUIHitDelegate (PointerInfoDelegate del)
 Adds a delegate to be called when a raycast is performed on an input event which hits a non-UI object. Use this when your game uses raycasts for non-UI game purposes but you don't want to waste performance with a redundant set of raycasts.
void RemoveNonUIHitDelegate (PointerInfoDelegate del)
 Removes a delegate previously added with SetNonUIHitDelegate() or AddNonUIHitDelegate().
void AddMouseTouchPtrListener (PointerInfoDelegate del)
 Registers a delegate to be called with all mouse and touchpad pointer input. Use this when you want to "listen" to all mouse or touchpad input.
void AddRayPtrListener (PointerInfoDelegate del)
 Registers a delegate to be called with all ray pointer input. Use this when you want to "listen" to all ray input.
void RemoveMouseTouchPtrListener (PointerInfoDelegate del)
 Removes a mouse/touchpad pointer listener.
void RemoveRayPtrListener (PointerInfoDelegate del)
 Removes a mouse/touchpad pointer listener.
bool DidPointerHitUI (int id)
 Returns whether the specified pointer (designated by ID) hit a UI element during the current frame.
bool DidAnyPointerHitUI ()
 Returns whether any pointer hit a UI element during the current frame.
void AddCamera (Camera cam, LayerMask mask, float depth, int index)
 Adds the specified camera to the UI Cameras list at the specified index.
void RemoveCamera (int index)
 Removes the camera at the specified index from the UI Cameras array.
void ReplaceCamera (int index, Camera cam)
 Replaces the camera at the specified index with the specified camera.
void Detarget (IUIObject obj)
 Scans all active pointers and if any are found to be targeting the specified object, their targetObj field is set to null.
void Detarget (int pointerID)
 Detargets the specified pointer from any object it may be presently targetting.
void DetargetAllExcept (int pointerID)
 Detargets all pointers except the one with the specified ID.
void Retarget (IUIObject oldObj, IUIObject newObj)
 Scans all active pointers and if any are found to be targeting the specified object, their targetObj field will instead be set to reference the object specified by newObj.
bool GetPointer (IUIObject obj, out POINTER_INFO ptr)
 Attempts to retrieve the pointer that is currently targeting the specified object.
void LockInput ()
 Adds a lock to the input. As long as there is at least one lock on input, input will not be processed. Use UnlockInput() to release a lock. It is important to call UnlockInput() as many times as LockInput() for input processing to resume.
void UnlockInput ()
 Removes a lock on input. Input will not be processed until all locks placed by LockInput() have been removed. There must be as many calls to UnlockInput() as there were LockInput() for input processing to resume.

Public Attributes

POINTER_TYPE pointerType = POINTER_TYPE.AUTO_TOUCHPAD
 The type of pointing device to be used.
float dragThreshold = 8f
 The number of pixels a device must be dragged from its original click/touch location to cause the click/touch event not to be considered to be a "tap" (click) but rather just a drag action.
float rayDragThreshold = 2f
 This is similar to dragThreshold except instead of a distance in pixels, it is the world-distance between the endpoint of the ray (based on rayDepth) when the ray went active to the endpoint of the ray in successive frames.
float rayDepth = Mathf.Infinity
 Depth into the scene from the camera that a ray pointer should extend.
LayerMask rayMask = -1
 Layer mask to use for casting the Ray pointer type into the scene.
bool focusWithRay = false
 Sets whether the ray pointer (if any) should be used to set the keyboard focus, at the exclusion of the mouse/touchpad pointer(s). Set this to false if you want to use the touchpad or mouse to set the keyboard focus, and set it to true if you instead want to set the focus using the ray pointer.
string actionAxis = "Fire1"
 Name of the virtual axis that is used when the input ray is to be active. NOTE: See the "Input" section of the Unity User Guide. Set this value to an empty string ("") if you will not be using an axis setup in Player Settings->Input and instead will use a UIActionBtn or call RayActive(). Failure to do so will result in an exception being raised.
OUTSIDE_VIEWPORT inputOutsideViewport = OUTSIDE_VIEWPORT.Move_Off
 Determines how input events that occur outside the game's viewport will be handled. Defaults to Move_Off. Move_Off.
bool warnOnNonUiHits = true
 When set to true, a warning will be logged to the console whenever a non-UI object is hit by an EZ GUI input raycast (either from mouse, touchpad, or ray pointer types).
EZCameraSettings[] uiCameras = new EZCameraSettings[1]
 The cameras to use for raycasts and the like for mouse and touchpad input.
Camera rayCamera
 The camera to use for casting the Ray pointer type.
bool blockInput = false
 Input will not be processed while true.
float defaultDragOffset = 1f
 The default distance, in world units, a dragged control should be offset toward the camera so as to ensure it hovers above other objects and controls in the scene.
EZAnimation.EASING_TYPE cancelDragEasing = EZAnimation.EASING_TYPE.ExponentialOut
 The default easing for when a drag and drop is canceled.
float cancelDragDuration = 1f
 The duration of a canceled drag's easing animation.
TextAsset defaultFont
 The default font definition to use for control text.
Material defaultFontMaterial
 The material to use for the default font.

Properties

RAY_ACTIVE_STATE RayActive [get, set]
 Used to set the active status of the ray. When set to Momentary or Constant, this is analogous to having the mouse button down.
IUIObject FocusObject [get, set]
 Accessor for the object which has the keyboard focus.
int InsertionPoint [get, set]
 Accessor for the text input insertion point.
int PointerCount [get]
 Returns the number of pointers currently supported.

Detailed Description

UIManager polls for input, and dispatches input events to controls in the scene. Exactly one UIManager object should be in each scene that contains EZ GUI controls.


Member Enumeration Documentation

How input that occurs outside the viewport should be treated.

Enumerator:
Process_All 

Process all input that occurs outside the game's viewport.

Ignore 

Ignore all input that occurs outside the game's viewport. NOTE: This may lead to missing events, such as a pointer release that occurs outside the viewport.

Move_Off 

If any pointer that moves outside the game's viewport has a current target object, that object is sent a MOVE_OFF or RELEASE_OFF (as appropriate) event. Otherwise, it is ignored.

Identifiers for different types of pointing devices.

Enumerator:
MOUSE 

A mouse pointer

TOUCHPAD 

Multi-touch touchpad (iPhone/iPod/iPad finger touches)

AUTO_TOUCHPAD 

Same as using TOUCHPAD when on-device, but supports both mouse and touchpad input in-editor.

RAY 

A ray cast in world space

MOUSE_AND_RAY 

Mouse pointer and ray supported simultaneously.

TOUCHPAD_AND_RAY 

Touchpad and ray supported simultaneously.

Type of ray active state

Enumerator:
Inactive 

The ray is not active.

Momentary 

The ray is active for a single frame only.

Constant 

The ray is active until released.


Member Function Documentation

void UIManager.AddCamera ( Camera  cam,
LayerMask  mask,
float  depth,
int  index 
)

Adds the specified camera to the UI Cameras list at the specified index.

Parameters:
cam The camera to be added.
mask The layer mask for the camera.
depth The depth into the scene the pointer should reach.
index The index in the list where the camera should be added. Note that cameras higher on the list (at a lower index value) process input before cameras later in the list.
void UIManager.AddMouseTouchPtrListener ( PointerInfoDelegate  del  ) 

Registers a delegate to be called with all mouse and touchpad pointer input. Use this when you want to "listen" to all mouse or touchpad input.

Parameters:
del Delegate to be called.
void UIManager.AddNonUIHitDelegate ( PointerInfoDelegate  del  ) 

Adds a delegate to be called when a raycast is performed on an input event which hits a non-UI object. Use this when your game uses raycasts for non-UI game purposes but you don't want to waste performance with a redundant set of raycasts.

Parameters:
del Delegate to be called.
void UIManager.AddRayPtrListener ( PointerInfoDelegate  del  ) 

Registers a delegate to be called with all ray pointer input. Use this when you want to "listen" to all ray input.

Parameters:
del Delegate to be called.
void UIManager.Detarget ( int  pointerID  ) 

Detargets the specified pointer from any object it may be presently targetting.

Parameters:
pointerID The ID of the pointer to be detargetted.
void UIManager.Detarget ( IUIObject  obj  ) 

Scans all active pointers and if any are found to be targeting the specified object, their targetObj field is set to null.

Parameters:
obj A reference to the object to be de-targeted.
void UIManager.DetargetAllExcept ( int  pointerID  ) 

Detargets all pointers except the one with the specified ID.

Parameters:
pointerID The pointer to leave targetted.
bool UIManager.DidAnyPointerHitUI (  ) 

Returns whether any pointer hit a UI element during the current frame.

Returns:
True if a pointer hit a UI element, false otherwise.
bool UIManager.DidPointerHitUI ( int  id  ) 

Returns whether the specified pointer (designated by ID) hit a UI element during the current frame.

Parameters:
id ID of the pointer. NOTE: On touchpad devices, this value should correspond to the fingerID of the touch. When using a MOUSE pointer type, the mouse's ID is 0. When using any of the pointer types that include the RAY type, the ray ID is -1. When using MOUSE with touchpad in-editor, the mouse ID is equal to the max supported touchpad touches. This is usually 11 touches, so the mouse ID in such a situation is normally 11.
Returns:
True if the pointer hit a UI element, false otherwise.
bool UIManager.GetPointer ( IUIObject  obj,
out POINTER_INFO  ptr 
)

Attempts to retrieve the pointer that is currently targeting the specified object.

Parameters:
obj The object for which a targeting pointer is being sought.
ptr A variable that will hold the POINTER_INFO of the pointer that is targeting the object, should one be found.
Returns:
True if the ptr argument has been populated with the information of the targeting pointer, false if no targeting pointer was found.
void UIManager.LockInput (  ) 

Adds a lock to the input. As long as there is at least one lock on input, input will not be processed. Use UnlockInput() to release a lock. It is important to call UnlockInput() as many times as LockInput() for input processing to resume.

void UIManager.RemoveCamera ( int  index  ) 

Removes the camera at the specified index from the UI Cameras array.

Parameters:
index The index of the camera that should be removed.
void UIManager.RemoveMouseTouchPtrListener ( PointerInfoDelegate  del  ) 

Removes a mouse/touchpad pointer listener.

Parameters:
del Delegate to be removed.
void UIManager.RemoveNonUIHitDelegate ( PointerInfoDelegate  del  ) 

Removes a delegate previously added with SetNonUIHitDelegate() or AddNonUIHitDelegate().

Parameters:
del 
void UIManager.RemoveRayPtrListener ( PointerInfoDelegate  del  ) 

Removes a mouse/touchpad pointer listener.

Parameters:
del Delegate to be removed.
void UIManager.ReplaceCamera ( int  index,
Camera  cam 
)

Replaces the camera at the specified index with the specified camera.

Parameters:
index The index of the camera to be replaced.
cam The new camera that will replace the existing camera.
void UIManager.Retarget ( IUIObject  oldObj,
IUIObject  newObj 
)

Scans all active pointers and if any are found to be targeting the specified object, their targetObj field will instead be set to reference the object specified by newObj.

Parameters:
obj A reference to the object to be re-targeted.
newObj The new object that should replace the old.
void UIManager.SetNonUIHitDelegate ( PointerInfoDelegate  del  ) 

NOTE: Not recommended unless you intend to replace any and all other non-UI hit delegates. Otherwise, use AddNonUIHitDelegate()AddNonUIHitDelegate This method sets the delegate to be called when a raycast is performed on an input event which hits a non-UI object. Use this when your game uses raycasts for non-UI game purposes but you don't want to waste performance with a redundant set of raycasts. IMPORTANT NOTE: This will replace any previously registered delegates.

Parameters:
del Delegate to be called.
void UIManager.UnlockInput (  ) 

Removes a lock on input. Input will not be processed until all locks placed by LockInput() have been removed. There must be as many calls to UnlockInput() as there were LockInput() for input processing to resume.


Member Data Documentation

string UIManager.actionAxis = "Fire1"

Name of the virtual axis that is used when the input ray is to be active. NOTE: See the "Input" section of the Unity User Guide. Set this value to an empty string ("") if you will not be using an axis setup in Player Settings->Input and instead will use a UIActionBtn or call RayActive(). Failure to do so will result in an exception being raised.

bool UIManager.blockInput = false

Input will not be processed while true.

The duration of a canceled drag's easing animation.

EZAnimation.EASING_TYPE UIManager.cancelDragEasing = EZAnimation.EASING_TYPE.ExponentialOut

The default easing for when a drag and drop is canceled.

The default distance, in world units, a dragged control should be offset toward the camera so as to ensure it hovers above other objects and controls in the scene.

The default font definition to use for control text.

The material to use for the default font.

The number of pixels a device must be dragged from its original click/touch location to cause the click/touch event not to be considered to be a "tap" (click) but rather just a drag action.

bool UIManager.focusWithRay = false

Sets whether the ray pointer (if any) should be used to set the keyboard focus, at the exclusion of the mouse/touchpad pointer(s). Set this to false if you want to use the touchpad or mouse to set the keyboard focus, and set it to true if you instead want to set the focus using the ray pointer.

OUTSIDE_VIEWPORT UIManager.inputOutsideViewport = OUTSIDE_VIEWPORT.Move_Off

Determines how input events that occur outside the game's viewport will be handled. Defaults to Move_Off. Move_Off.

POINTER_TYPE UIManager.pointerType = POINTER_TYPE.AUTO_TOUCHPAD

The type of pointing device to be used.

The camera to use for casting the Ray pointer type.

float UIManager.rayDepth = Mathf.Infinity

Depth into the scene from the camera that a ray pointer should extend.

This is similar to dragThreshold except instead of a distance in pixels, it is the world-distance between the endpoint of the ray (based on rayDepth) when the ray went active to the endpoint of the ray in successive frames.

LayerMask UIManager.rayMask = -1

Layer mask to use for casting the Ray pointer type into the scene.

The cameras to use for raycasts and the like for mouse and touchpad input.

When set to true, a warning will be logged to the console whenever a non-UI object is hit by an EZ GUI input raycast (either from mouse, touchpad, or ray pointer types).


Property Documentation

IUIObject UIManager.FocusObject [get, set]

Accessor for the object which has the keyboard focus.

int UIManager.InsertionPoint [get, set]

Accessor for the text input insertion point.

int UIManager.PointerCount [get]

Returns the number of pointers currently supported.

RAY_ACTIVE_STATE UIManager.RayActive [get, set]

Used to set the active status of the ray. When set to Momentary or Constant, this is analogous to having the mouse button down.


The documentation for this class was generated from the following file:

Generated on Thu Sep 8 16:31:19 2011 for EZ GUI by  doxygen 1.6.1