C# 클래스 NGUIMath, TheUnseen

Helper class containing generic functions used throughout the UI library.
파일 보기 프로젝트 열기: henryj41043/TheUnseen 1 사용 예제들

공개 메소드들

메소드 설명
AdjustWidget ( UIWidget, w, float left, float bottom, float right, float top ) : void

Adjust the widget's rectangle based on the specified modifier values.

AdjustWidget ( UIWidget, w, float left, float bottom, float right, float top, int minWidth, int minHeight ) : void

Adjust the widget's rectangle based on the specified modifier values.

AdjustWidget ( UIWidget, w, float left, float bottom, float right, float top, int minWidth, int minHeight, int maxWidth, int maxHeight ) : void

Adjust the widget's rectangle based on the specified modifier values.

CalculateAbsoluteWidgetBounds ( Transform trans ) : Bounds

Calculate the combined bounds of all widgets attached to the specified game object or its children (in world space).

CalculateRelativeWidgetBounds ( Transform trans ) : Bounds

Calculate the combined bounds of all widgets attached to the specified game object or its children (in relative-to-object space).

CalculateRelativeWidgetBounds ( Transform root, Transform child ) : Bounds

Calculate the combined bounds of all widgets attached to the specified game object or its children (in relative-to-object space).

CalculateRelativeWidgetBounds ( Transform root, Transform child, bool considerInactive ) : Bounds

Calculate the combined bounds of all widgets attached to the specified game object or its children (in relative-to-object space).

CalculateRelativeWidgetBounds ( Transform trans, bool considerInactive ) : Bounds

Calculate the combined bounds of all widgets attached to the specified game object or its children (in relative-to-object space).

ConstrainRect ( Vector2 minRect, Vector2 maxRect, Vector2 minArea, Vector2 maxArea ) : Vector2

Constrain 'rect' to be within 'area' as much as possible, returning the Vector2 offset necessary for this to happen. This function is useful when trying to restrict one area (window) to always be within another (viewport).

ConvertToPixels ( Rect rect, int width, int height, bool round ) : Rect

Convert from bottom-left based UV coordinates to top-left based pixel coordinates.

ConvertToTexCoords ( Rect rect, int width, int height ) : Rect

Convert from top-left based pixel coordinates to bottom-left based UV coordinates.

DistanceToRectangle ( Vector2 screenPoints, Vector2 mousePos ) : float

Determine the distance from the mouse position to the screen space rectangle specified by the 4 points.

DistanceToRectangle ( Vector3 worldPoints, Vector2 mousePos, Camera cam ) : float

Determine the distance from the mouse position to the world rectangle specified by the 4 points.

GetPivot ( Vector2 offset ) : UIWidget.Pivot

Helper function that converts the pivot offset to a pivot point.

GetPivotOffset ( UIWidget, pv ) : Vector2

Helper function that converts the widget's pivot enum into a 0-1 range vector.

MakePixelPerfect ( Rect rect ) : Rect

Round the pixel rectangle's dimensions.

MakePixelPerfect ( Rect rect, int width, int height ) : Rect

Round the texture coordinate rectangle's dimensions.

MoveRect ( UIRect, rect, float x, float y ) : void

Adjust the rectangle's position using the specified local delta coordinates.

MoveWidget ( UIRect, w, float x, float y ) : void

Adjust the widget's position using the specified local delta coordinates.

ResizeWidget ( UIWidget, w, UIWidget, pivot, float x, float y, int minWidth, int minHeight ) : void

Given the specified dragged pivot point, adjust the widget's dimensions.

ResizeWidget ( UIWidget, w, UIWidget, pivot, float x, float y, int minWidth, int minHeight, int maxWidth, int maxHeight ) : void

Given the specified dragged pivot point, adjust the widget's dimensions.

RotateTowards ( float from, float to, float maxAngle ) : float

Since there is no Mathf.RotateTowards...

SpringDampen ( Vector2 &velocity, float strength, float deltaTime ) : Vector2

Same as the Vector3 version, it's a framerate-independent Lerp.

SpringDampen ( Vector3 &velocity, float strength, float deltaTime ) : Vector3

This code is not framerate-independent: target.position += velocity; velocity = Vector3.Lerp(velocity, Vector3.zero, Time.deltaTime * 9f); But this code is: target.position += NGUIMath.SpringDampen(ref velocity, 9f, Time.deltaTime);

SpringLerp ( Quaternion from, Quaternion to, float strength, float deltaTime ) : Quaternion

Quaternion.Slerp(from, to, Time.deltaTime * strength) is not framerate-independent. This function is.

SpringLerp ( Vector2 from, Vector2 to, float strength, float deltaTime ) : Vector2

Vector2.Lerp(from, to, Time.deltaTime * strength) is not framerate-independent. This function is.

SpringLerp ( Vector3 from, Vector3 to, float strength, float deltaTime ) : Vector3

Vector3.Lerp(from, to, Time.deltaTime * strength) is not framerate-independent. This function is.

SpringLerp ( float strength, float deltaTime ) : float

Calculate how much to interpolate by.

SpringLerp ( float from, float to, float strength, float deltaTime ) : float

Mathf.Lerp(from, to, Time.deltaTime * strength) is not framerate-independent. This function is.

비공개 메소드들

메소드 설명
ClampIndex ( int val, int max ) : int
ColorToInt ( Color c ) : int
DecimalToHex ( int num ) : string
DecimalToHexChar ( int num ) : char
DistancePointToLineSegment ( Vector2 point, Vector2 a, Vector2 b ) : float

Determine the distance from the specified point to the line segment.

HexToColor ( uint val ) : Color
HexToDecimal ( char ch ) : int
IntToBinary ( int val, int bits ) : string
IntToColor ( int val ) : Color
Lerp ( float from, float to, float factor ) : float
RepeatIndex ( int val, int max ) : int
Wrap01 ( float val ) : float
WrapAngle ( float angle ) : float

메소드 상세

AdjustWidget() 정적인 공개 메소드

Adjust the widget's rectangle based on the specified modifier values.
static public AdjustWidget ( UIWidget, w, float left, float bottom, float right, float top ) : void
w UIWidget,
left float
bottom float
right float
top float
리턴 void

AdjustWidget() 정적인 공개 메소드

Adjust the widget's rectangle based on the specified modifier values.
static public AdjustWidget ( UIWidget, w, float left, float bottom, float right, float top, int minWidth, int minHeight ) : void
w UIWidget,
left float
bottom float
right float
top float
minWidth int
minHeight int
리턴 void

AdjustWidget() 정적인 공개 메소드

Adjust the widget's rectangle based on the specified modifier values.
static public AdjustWidget ( UIWidget, w, float left, float bottom, float right, float top, int minWidth, int minHeight, int maxWidth, int maxHeight ) : void
w UIWidget,
left float
bottom float
right float
top float
minWidth int
minHeight int
maxWidth int
maxHeight int
리턴 void

CalculateAbsoluteWidgetBounds() 정적인 공개 메소드

Calculate the combined bounds of all widgets attached to the specified game object or its children (in world space).
static public CalculateAbsoluteWidgetBounds ( Transform trans ) : Bounds
trans Transform
리턴 Bounds

CalculateRelativeWidgetBounds() 정적인 공개 메소드

Calculate the combined bounds of all widgets attached to the specified game object or its children (in relative-to-object space).
static public CalculateRelativeWidgetBounds ( Transform trans ) : Bounds
trans Transform
리턴 Bounds

CalculateRelativeWidgetBounds() 정적인 공개 메소드

Calculate the combined bounds of all widgets attached to the specified game object or its children (in relative-to-object space).
static public CalculateRelativeWidgetBounds ( Transform root, Transform child ) : Bounds
root Transform
child Transform
리턴 Bounds

CalculateRelativeWidgetBounds() 정적인 공개 메소드

Calculate the combined bounds of all widgets attached to the specified game object or its children (in relative-to-object space).
static public CalculateRelativeWidgetBounds ( Transform root, Transform child, bool considerInactive ) : Bounds
root Transform
child Transform
considerInactive bool
리턴 Bounds

CalculateRelativeWidgetBounds() 정적인 공개 메소드

Calculate the combined bounds of all widgets attached to the specified game object or its children (in relative-to-object space).
static public CalculateRelativeWidgetBounds ( Transform trans, bool considerInactive ) : Bounds
trans Transform
considerInactive bool
리턴 Bounds

ConstrainRect() 정적인 공개 메소드

Constrain 'rect' to be within 'area' as much as possible, returning the Vector2 offset necessary for this to happen. This function is useful when trying to restrict one area (window) to always be within another (viewport).
static public ConstrainRect ( Vector2 minRect, Vector2 maxRect, Vector2 minArea, Vector2 maxArea ) : Vector2
minRect Vector2
maxRect Vector2
minArea Vector2
maxArea Vector2
리턴 Vector2

ConvertToPixels() 정적인 공개 메소드

Convert from bottom-left based UV coordinates to top-left based pixel coordinates.
static public ConvertToPixels ( Rect rect, int width, int height, bool round ) : Rect
rect Rect
width int
height int
round bool
리턴 Rect

ConvertToTexCoords() 정적인 공개 메소드

Convert from top-left based pixel coordinates to bottom-left based UV coordinates.
static public ConvertToTexCoords ( Rect rect, int width, int height ) : Rect
rect Rect
width int
height int
리턴 Rect

DistanceToRectangle() 정적인 공개 메소드

Determine the distance from the mouse position to the screen space rectangle specified by the 4 points.
static public DistanceToRectangle ( Vector2 screenPoints, Vector2 mousePos ) : float
screenPoints Vector2
mousePos Vector2
리턴 float

DistanceToRectangle() 정적인 공개 메소드

Determine the distance from the mouse position to the world rectangle specified by the 4 points.
static public DistanceToRectangle ( Vector3 worldPoints, Vector2 mousePos, Camera cam ) : float
worldPoints Vector3
mousePos Vector2
cam Camera
리턴 float

GetPivot() 정적인 공개 메소드

Helper function that converts the pivot offset to a pivot point.
static public GetPivot ( Vector2 offset ) : UIWidget.Pivot
offset Vector2
리턴 UIWidget.Pivot

GetPivotOffset() 정적인 공개 메소드

Helper function that converts the widget's pivot enum into a 0-1 range vector.
static public GetPivotOffset ( UIWidget, pv ) : Vector2
pv UIWidget,
리턴 Vector2

MakePixelPerfect() 정적인 공개 메소드

Round the pixel rectangle's dimensions.
static public MakePixelPerfect ( Rect rect ) : Rect
rect Rect
리턴 Rect

MakePixelPerfect() 정적인 공개 메소드

Round the texture coordinate rectangle's dimensions.
static public MakePixelPerfect ( Rect rect, int width, int height ) : Rect
rect Rect
width int
height int
리턴 Rect

MoveRect() 정적인 공개 메소드

Adjust the rectangle's position using the specified local delta coordinates.
static public MoveRect ( UIRect, rect, float x, float y ) : void
rect UIRect,
x float
y float
리턴 void

MoveWidget() 정적인 공개 메소드

Adjust the widget's position using the specified local delta coordinates.
static public MoveWidget ( UIRect, w, float x, float y ) : void
w UIRect,
x float
y float
리턴 void

ResizeWidget() 정적인 공개 메소드

Given the specified dragged pivot point, adjust the widget's dimensions.
static public ResizeWidget ( UIWidget, w, UIWidget, pivot, float x, float y, int minWidth, int minHeight ) : void
w UIWidget,
pivot UIWidget,
x float
y float
minWidth int
minHeight int
리턴 void

ResizeWidget() 정적인 공개 메소드

Given the specified dragged pivot point, adjust the widget's dimensions.
static public ResizeWidget ( UIWidget, w, UIWidget, pivot, float x, float y, int minWidth, int minHeight, int maxWidth, int maxHeight ) : void
w UIWidget,
pivot UIWidget,
x float
y float
minWidth int
minHeight int
maxWidth int
maxHeight int
리턴 void

RotateTowards() 정적인 공개 메소드

Since there is no Mathf.RotateTowards...
static public RotateTowards ( float from, float to, float maxAngle ) : float
from float
to float
maxAngle float
리턴 float

SpringDampen() 정적인 공개 메소드

Same as the Vector3 version, it's a framerate-independent Lerp.
static public SpringDampen ( Vector2 &velocity, float strength, float deltaTime ) : Vector2
velocity Vector2
strength float
deltaTime float
리턴 Vector2

SpringDampen() 정적인 공개 메소드

This code is not framerate-independent: target.position += velocity; velocity = Vector3.Lerp(velocity, Vector3.zero, Time.deltaTime * 9f); But this code is: target.position += NGUIMath.SpringDampen(ref velocity, 9f, Time.deltaTime);
static public SpringDampen ( Vector3 &velocity, float strength, float deltaTime ) : Vector3
velocity Vector3
strength float
deltaTime float
리턴 Vector3

SpringLerp() 정적인 공개 메소드

Quaternion.Slerp(from, to, Time.deltaTime * strength) is not framerate-independent. This function is.
static public SpringLerp ( Quaternion from, Quaternion to, float strength, float deltaTime ) : Quaternion
from Quaternion
to Quaternion
strength float
deltaTime float
리턴 Quaternion

SpringLerp() 정적인 공개 메소드

Vector2.Lerp(from, to, Time.deltaTime * strength) is not framerate-independent. This function is.
static public SpringLerp ( Vector2 from, Vector2 to, float strength, float deltaTime ) : Vector2
from Vector2
to Vector2
strength float
deltaTime float
리턴 Vector2

SpringLerp() 정적인 공개 메소드

Vector3.Lerp(from, to, Time.deltaTime * strength) is not framerate-independent. This function is.
static public SpringLerp ( Vector3 from, Vector3 to, float strength, float deltaTime ) : Vector3
from Vector3
to Vector3
strength float
deltaTime float
리턴 Vector3

SpringLerp() 정적인 공개 메소드

Calculate how much to interpolate by.
static public SpringLerp ( float strength, float deltaTime ) : float
strength float
deltaTime float
리턴 float

SpringLerp() 정적인 공개 메소드

Mathf.Lerp(from, to, Time.deltaTime * strength) is not framerate-independent. This function is.
static public SpringLerp ( float from, float to, float strength, float deltaTime ) : float
from float
to float
strength float
deltaTime float
리턴 float