NGUI: Next-Gen UI kit
3.7.2
|
Abstract UI rectangle containing functionality common to both panels and widgets. A UI rectangle contains 4 anchor points (one for each side), and it ensures that they are updated in the proper order. More...
Classes | |
class | AnchorPoint |
Public Types | |
enum | AnchorUpdate { AnchorUpdate.OnEnable, AnchorUpdate.OnUpdate, AnchorUpdate.OnStart } |
Public Member Functions | |
abstract float | CalculateFinalAlpha (int frameID) |
Get the final cumulative alpha. More... | |
virtual void | Invalidate (bool includeChildren) |
Sets the local 'changed' flag, indicating that some parent value(s) are now be different, such as alpha for example. More... | |
virtual Vector3[] | GetSides (Transform relativeTo) |
Get the sides of the rectangle relative to the specified transform. The order is left, top, right, bottom. More... | |
void | Update () |
Rectangles need to update in a specific order – parents before children. When deriving from this class, override its OnUpdate() function instead. More... | |
void | UpdateAnchors () |
Manually update anchored sides. More... | |
void | SetAnchor (Transform t) |
Anchor this rectangle to the specified transform. Note that this function will not keep the rectangle's current dimensions, but will instead assume the target's dimensions. More... | |
void | SetAnchor (GameObject go) |
Anchor this rectangle to the specified transform. Note that this function will not keep the rectangle's current dimensions, but will instead assume the target's dimensions. More... | |
void | SetAnchor (GameObject go, int left, int bottom, int right, int top) |
Anchor this rectangle to the specified transform. More... | |
void | ResetAnchors () |
Ensure that all rect references are set correctly on the anchors. More... | |
void | ResetAndUpdateAnchors () |
Convenience method that resets and updates the anchors, all at once. More... | |
abstract void | SetRect (float x, float y, float width, float height) |
Set the rectangle manually. More... | |
virtual void | ParentHasChanged () |
Call this function when the rectangle's parent has changed. More... | |
Public Attributes | |
AnchorPoint | leftAnchor = new AnchorPoint() |
Left side anchor. More... | |
AnchorPoint | rightAnchor = new AnchorPoint(1f) |
Right side anchor. More... | |
AnchorPoint | bottomAnchor = new AnchorPoint() |
Bottom side anchor. More... | |
AnchorPoint | topAnchor = new AnchorPoint(1f) |
Top side anchor. More... | |
AnchorUpdate | updateAnchors = AnchorUpdate.OnUpdate |
Whether anchors will be recalculated on every update. More... | |
float | finalAlpha = 1f |
Final calculated alpha. More... | |
Protected Member Functions | |
Vector3 | GetLocalPos (AnchorPoint ac, Transform trans) |
Helper function that gets the specified anchor's position relative to the chosen transform. More... | |
virtual void | OnEnable () |
Automatically find the parent rectangle. More... | |
virtual void | OnInit () |
Automatically find the parent rectangle. More... | |
virtual void | OnDisable () |
Clear the parent rectangle reference. More... | |
void | Start () |
Set anchor rect references on start. More... | |
abstract void | OnAnchor () |
Update the dimensions of the rectangle using anchor points. More... | |
abstract void | OnStart () |
Abstract start functionality, ensured to happen after the anchor rect references have been set. More... | |
virtual void | OnUpdate () |
Abstract update functionality, ensured to happen after the targeting anchors have been updated. More... | |
Protected Attributes | |
GameObject | mGo |
Transform | mTrans |
BetterList< UIRect > | mChildren = new BetterList<UIRect>() |
bool | mChanged = true |
bool | mStarted = false |
bool | mParentFound = false |
Camera | mCam |
Static Protected Attributes | |
static Vector3[] | mSides = new Vector3[4] |
Properties | |
GameObject | cachedGameObject [get] |
Game object gets cached for speed. Can't simply return 'mGo' set in Awake because this function may be called on a prefab. More... | |
Transform | cachedTransform [get] |
Transform gets cached for speed. Can't simply return 'mTrans' set in Awake because this function may be called on a prefab. More... | |
Camera | anchorCamera [get] |
Camera used by anchors. More... | |
bool | isFullyAnchored [get] |
Whether the rectangle is currently anchored fully on all sides. More... | |
virtual bool | isAnchoredHorizontally [get] |
Whether the rectangle is anchored horizontally. More... | |
virtual bool | isAnchoredVertically [get] |
Whether the rectangle is anchored vertically. More... | |
virtual bool | canBeAnchored [get] |
Whether the rectangle can be anchored. More... | |
UIRect | parent [get] |
Get the rectangle's parent, if any. More... | |
UIRoot | root [get] |
Get the root object, if any. More... | |
bool | isAnchored [get] |
Returns 'true' if the widget is currently anchored on any side. More... | |
abstract float | alpha [get, set] |
Local alpha, not relative to anything. More... | |
abstract Vector3[] | localCorners [get] |
Local-space corners of the UI rectangle. The order is bottom-left, top-left, top-right, bottom-right. More... | |
abstract Vector3[] | worldCorners [get] |
World-space corners of the UI rectangle. The order is bottom-left, top-left, top-right, bottom-right. More... | |
float | cameraRayDistance [get] |
Helper function that returns the distance to the camera's directional vector hitting the panel's plane. More... | |
Abstract UI rectangle containing functionality common to both panels and widgets. A UI rectangle contains 4 anchor points (one for each side), and it ensures that they are updated in the proper order.
enum UIRect.AnchorUpdate |
|
pure virtual |
|
protected |
Helper function that gets the specified anchor's position relative to the chosen transform.
|
virtual |
|
virtual |
|
protectedpure virtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedpure virtual |
|
protectedvirtual |
Abstract update functionality, ensured to happen after the targeting anchors have been updated.
Reimplemented in UIWidget, UISprite, and UI2DSprite.
|
virtual |
void UIRect.ResetAnchors | ( | ) |
Ensure that all rect references are set correctly on the anchors.
void UIRect.ResetAndUpdateAnchors | ( | ) |
Convenience method that resets and updates the anchors, all at once.
void UIRect.SetAnchor | ( | Transform | t | ) |
Anchor this rectangle to the specified transform. Note that this function will not keep the rectangle's current dimensions, but will instead assume the target's dimensions.
void UIRect.SetAnchor | ( | GameObject | go | ) |
Anchor this rectangle to the specified transform. Note that this function will not keep the rectangle's current dimensions, but will instead assume the target's dimensions.
void UIRect.SetAnchor | ( | GameObject | go, |
int | left, | ||
int | bottom, | ||
int | right, | ||
int | top | ||
) |
Anchor this rectangle to the specified transform.
|
pure virtual |
|
protected |
Set anchor rect references on start.
void UIRect.Update | ( | ) |
Rectangles need to update in a specific order – parents before children. When deriving from this class, override its OnUpdate() function instead.
void UIRect.UpdateAnchors | ( | ) |
Manually update anchored sides.
AnchorPoint UIRect.bottomAnchor = new AnchorPoint() |
Bottom side anchor.
float UIRect.finalAlpha = 1f |
Final calculated alpha.
AnchorPoint UIRect.leftAnchor = new AnchorPoint() |
Left side anchor.
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
AnchorPoint UIRect.rightAnchor = new AnchorPoint(1f) |
Right side anchor.
AnchorPoint UIRect.topAnchor = new AnchorPoint(1f) |
Top side anchor.
AnchorUpdate UIRect.updateAnchors = AnchorUpdate.OnUpdate |
Whether anchors will be recalculated on every update.
|
getset |
Local alpha, not relative to anything.
|
get |
Camera used by anchors.
|
get |
Game object gets cached for speed. Can't simply return 'mGo' set in Awake because this function may be called on a prefab.
|
get |
Transform gets cached for speed. Can't simply return 'mTrans' set in Awake because this function may be called on a prefab.
|
getprotected |
Helper function that returns the distance to the camera's directional vector hitting the panel's plane.
|
get |
Whether the rectangle can be anchored.
|
get |
Returns 'true' if the widget is currently anchored on any side.
|
get |
Whether the rectangle is anchored horizontally.
|
get |
Whether the rectangle is anchored vertically.
|
get |
Whether the rectangle is currently anchored fully on all sides.
|
get |
Local-space corners of the UI rectangle. The order is bottom-left, top-left, top-right, bottom-right.
|
get |
Get the rectangle's parent, if any.
|
get |
Get the root object, if any.
|
get |
World-space corners of the UI rectangle. The order is bottom-left, top-left, top-right, bottom-right.