UI primary class. All colliders that need to response to touch/mouse events need to have this attached. This will then handle and dispatch events. More...
Public Member Functions | |
void | UpdateParent () |
If you change the parent (in hierarchy) call this. If isChildOfAnotherUIItem is false, will act as if it is true. | |
void | ManuallySetParent (tk2dUIItem newParentUIItem) |
Manually setting specific UIItem parent. | |
void | RemoveParent () |
Will remove parent and act as if isChildOfAnotherUIItem is false. | |
bool | Press (tk2dUITouch touch) |
Touch press down (only call manually, if you need to simulate a touch) | |
bool | Press (tk2dUITouch touch, tk2dUIItem sentFromChild) |
Touch press down (only call manually, if you need to simulate a touch). SentFromChild is the UIItem child it was sent from. If sentFromChild is null that means it wasn't sent from a child. | |
void | UpdateTouch (tk2dUITouch touch) |
Fired every frame this touch is still down, regardless if button is down. Only call manually if you need to simulate a touch. | |
void | Release () |
Touch is released, if called without Exit being called means that it was released on top of button without leaving it. Only call manually if you need to simulate a touch. | |
void | CurrentOverUIItem (tk2dUIItem overUIItem) |
Touch/mouse currently over UIItem. If exitting this button, but still overtop of another Button, this might be a parent. Checks if parent and does not exit. Only call manually if you need to simulate touch. | |
bool | CheckIsUIItemChildOfMe (tk2dUIItem uiItem) |
Is uiItem a child of this current tk2dUIItem Only call manually if you need to simulate touch. | |
void | Exit () |
Exit uiItem. Does not cascade (need to manually call on all children if needed) Only call manually if you need to simulate touch. | |
bool | HoverOver (tk2dUIItem prevHover) |
Hover over item. Return true if this was prevHover. Only call manually if you need to simulate touch. | |
void | HoverOut (tk2dUIItem currHoverButton) |
Hover out item. Only call manually if you need to simulate touch. | |
void | SimulateClick () |
Simluates a click event Only call manually if you need to simulate touch. | |
void | InternalSetIsChildOfAnotherUIItem (bool state) |
Internal do not call. | |
Public Attributes | |
GameObject | sendMessageTarget = null |
Target GameObject to SendMessage to. Use only if you want to use SendMessage, recommend using events instead if possble. | |
string | SendMessageOnDownMethodName = "" |
Function name to SendMessage OnDown. | |
string | SendMessageOnUpMethodName = "" |
Function name to SendMessage OnUp. | |
string | SendMessageOnClickMethodName = "" |
Function name to SendMessage OnClick. | |
string | SendMessageOnReleaseMethodName = "" |
Function name to SendMessage OnRelease. | |
bool | registerPressFromChildren = false |
If this UIItem is a hierarchy parent of another UIItem that is marked as isChildOfAnotherUIItem, and you wish to receive touch/click/hover events from child. | |
bool | isHoverEnabled = false |
If this UIItem should receive hover events (if hover enabled(tk2dUIManager.areHoverEventsTracked), mouse is being used and multi-touch is diabled(tk2dUIManager.useMultiTouch)) | |
Properties | |
bool | IsPressed [get] |
If currently pressed (down) | |
tk2dUITouch | Touch [get] |
If pressed active touch event. | |
tk2dUIItem | ParentUIItem [get] |
If set as child of another UIItem, this is that parentUIItem. | |
Events | |
System.Action | OnDown |
Pressed. | |
System.Action | OnUp |
Unpressed, possibly on exit of collider area without releasing. | |
System.Action | OnClick |
Click - down and up while not leaving collider area. | |
System.Action | OnRelease |
After on down, when touch/click is released (this could be anywhere) | |
System.Action | OnHoverOver |
On mouse hover over (only if using mouse, hover is enabled(tk2dUIManager.areHoverEventsTracked) and if multi-touch is disabled(tk2dUIManager.useMultiTouch)) | |
System.Action | OnHoverOut |
On mouse hover leaving collider (only if using mouse, hover is enabled(tk2dUIManager.areHoverEventsTracked) and if multi-touch is disabled(tk2dUIManager.useMultiTouch)) | |
System.Action< tk2dUIItem > | OnDownUIItem |
Same as OnDown above, except returns this tk2dUIItem. | |
System.Action< tk2dUIItem > | OnUpUIItem |
Same as OnUp above, except returns this tk2dUIItem. | |
System.Action< tk2dUIItem > | OnClickUIItem |
Same as OnClick above, except returns this tk2dUIItem. | |
System.Action< tk2dUIItem > | OnReleaseUIItem |
Same as OnRelease above, except returns this tk2dUIItem. | |
System.Action< tk2dUIItem > | OnHoverOverUIItem |
Same as OnHoverOver above, except returns this tk2dUIItem. | |
System.Action< tk2dUIItem > | OnHoverOutUIItem |
Same as OnHoverOut above, except returns this tk2dUIItem. |
UI primary class. All colliders that need to response to touch/mouse events need to have this attached. This will then handle and dispatch events.
bool tk2dUIItem.CheckIsUIItemChildOfMe | ( | tk2dUIItem | uiItem | ) |
Is uiItem a child of this current tk2dUIItem Only call manually if you need to simulate touch.
void tk2dUIItem.CurrentOverUIItem | ( | tk2dUIItem | overUIItem | ) |
Touch/mouse currently over UIItem. If exitting this button, but still overtop of another Button, this might be a parent. Checks if parent and does not exit. Only call manually if you need to simulate touch.
void tk2dUIItem.Exit | ( | ) |
Exit uiItem. Does not cascade (need to manually call on all children if needed) Only call manually if you need to simulate touch.
void tk2dUIItem.HoverOut | ( | tk2dUIItem | currHoverButton | ) |
Hover out item. Only call manually if you need to simulate touch.
bool tk2dUIItem.HoverOver | ( | tk2dUIItem | prevHover | ) |
Hover over item. Return true if this was prevHover. Only call manually if you need to simulate touch.
void tk2dUIItem.InternalSetIsChildOfAnotherUIItem | ( | bool | state | ) |
Internal do not call.
void tk2dUIItem.ManuallySetParent | ( | tk2dUIItem | newParentUIItem | ) |
Manually setting specific UIItem parent.
bool tk2dUIItem.Press | ( | tk2dUITouch | touch | ) |
Touch press down (only call manually, if you need to simulate a touch)
bool tk2dUIItem.Press | ( | tk2dUITouch | touch, |
tk2dUIItem | sentFromChild | ||
) |
Touch press down (only call manually, if you need to simulate a touch). SentFromChild is the UIItem child it was sent from. If sentFromChild is null that means it wasn't sent from a child.
///
return true if newly pressed
void tk2dUIItem.Release | ( | ) |
Touch is released, if called without Exit being called means that it was released on top of button without leaving it. Only call manually if you need to simulate a touch.
void tk2dUIItem.RemoveParent | ( | ) |
Will remove parent and act as if isChildOfAnotherUIItem is false.
void tk2dUIItem.SimulateClick | ( | ) |
Simluates a click event Only call manually if you need to simulate touch.
void tk2dUIItem.UpdateParent | ( | ) |
If you change the parent (in hierarchy) call this. If isChildOfAnotherUIItem is false, will act as if it is true.
void tk2dUIItem.UpdateTouch | ( | tk2dUITouch | touch | ) |
Fired every frame this touch is still down, regardless if button is down. Only call manually if you need to simulate a touch.
bool tk2dUIItem.isHoverEnabled = false |
If this UIItem should receive hover events (if hover enabled(tk2dUIManager.areHoverEventsTracked), mouse is being used and multi-touch is diabled(tk2dUIManager.useMultiTouch))
bool tk2dUIItem.registerPressFromChildren = false |
If this UIItem is a hierarchy parent of another UIItem that is marked as isChildOfAnotherUIItem, and you wish to receive touch/click/hover events from child.
string tk2dUIItem.SendMessageOnClickMethodName = "" |
Function name to SendMessage OnClick.
string tk2dUIItem.SendMessageOnDownMethodName = "" |
Function name to SendMessage OnDown.
string tk2dUIItem.SendMessageOnReleaseMethodName = "" |
Function name to SendMessage OnRelease.
string tk2dUIItem.SendMessageOnUpMethodName = "" |
Function name to SendMessage OnUp.
GameObject tk2dUIItem.sendMessageTarget = null |
Target GameObject to SendMessage to. Use only if you want to use SendMessage, recommend using events instead if possble.
bool tk2dUIItem.IsPressed [get] |
If currently pressed (down)
If set as child of another UIItem, this is that parentUIItem.
tk2dUITouch tk2dUIItem.Touch [get] |
If pressed active touch event.
System.Action tk2dUIItem.OnClick |
Click - down and up while not leaving collider area.
System.Action<tk2dUIItem> tk2dUIItem.OnClickUIItem |
Same as OnClick above, except returns this tk2dUIItem.
System.Action tk2dUIItem.OnDown |
Pressed.
System.Action<tk2dUIItem> tk2dUIItem.OnDownUIItem |
Same as OnDown above, except returns this tk2dUIItem.
System.Action tk2dUIItem.OnHoverOut |
On mouse hover leaving collider (only if using mouse, hover is enabled(tk2dUIManager.areHoverEventsTracked) and if multi-touch is disabled(tk2dUIManager.useMultiTouch))
System.Action<tk2dUIItem> tk2dUIItem.OnHoverOutUIItem |
Same as OnHoverOut above, except returns this tk2dUIItem.
System.Action tk2dUIItem.OnHoverOver |
On mouse hover over (only if using mouse, hover is enabled(tk2dUIManager.areHoverEventsTracked) and if multi-touch is disabled(tk2dUIManager.useMultiTouch))
System.Action<tk2dUIItem> tk2dUIItem.OnHoverOverUIItem |
Same as OnHoverOver above, except returns this tk2dUIItem.
System.Action tk2dUIItem.OnRelease |
After on down, when touch/click is released (this could be anywhere)
System.Action<tk2dUIItem> tk2dUIItem.OnReleaseUIItem |
Same as OnRelease above, except returns this tk2dUIItem.
System.Action tk2dUIItem.OnUp |
Unpressed, possibly on exit of collider area without releasing.
System.Action<tk2dUIItem> tk2dUIItem.OnUpUIItem |
Same as OnUp above, except returns this tk2dUIItem.