C# Class JCSUnity.JCS_Util

All the utility function put here.
Afficher le fichier Open project: MapleStoryUnity/MapleStoryUnity Class Usage Examples

Méthodes publiques

Méthode Description
AddEventTriggerEvent ( EventTrigger te, EventTriggerType type, EventTriggerEvent func ) : void

Add Event to Unity's Event Trigger(Script)

AddEventTriggerEvent ( EventTrigger te, EventTriggerType type, EventTriggerEventButtonSelection func, JCSUnity.JCS_ButtonSelection selection ) : void

Add Event to Unity's Event Trigger(Script)

ApplyRandVector3 ( Vector3 trans, Vector3 randVec, JCS_Bool3 checks ) : Vector3

Add random value to Vector3

AttachChildren ( RectTransform trans, List childs ) : void
AttachChildren ( Transform trans, List childs ) : void

Attach all childs to this transform.

BytesToString ( Array data, JCS_CharsetType charset ) : string

Convert byte array to string by charset type.

CopyByteArray ( Array inBuf, int start, int len ) : byte[]

Copy byte array to another byte array memory space.

DeleteAllFilesFromDir ( string dirPath ) : void

Delete all files in directory.

DestroyAllTypeObjectInScene ( ) : void

Destroy all the 'TYPE' object in the scene.

DestroyImmediateAllTypeObjectInScene ( ) : void

Destroy all the 'TYPE' object in the scene.

DetachChildren ( RectTransform trans ) : List
DetachChildren ( Transform trans ) : List

Detttach all the child from one transform.

EnumSize ( ) : int

Return the length of an enumerator.

EscapeURL ( string url ) : string

Simple version of escape url.

FillSlot ( List inList, int len, with ) : List
FillSlot ( Array inArray, int len, with ) : T[]

Fill slots with initialize value type by length.

FindCloneObjectsOfTypeAll ( ) : T[]

Find all the objects that are clone in the scene by type.

FindNotCloneObjectsOfTypeAll ( ) : T[]

Find all the objects that are not clone in the scene by type.

FindObjectsOfTypeAllInHierarchy ( ) : T[]

Find all objects that only ACTIVE in hierarchy.

ForceDetachChildren ( RectTransform trans ) : List
ForceDetachChildren ( Transform trans ) : List

Force to clean all the children, this will make sure the transform have 0 children transform.

ForceGetComponent ( MonoBehaviour mb ) : T

Force to get a component, if not found we will add one then.

GetEasing ( JCS_TweenType type ) : TweenDelegate

Return the easing function pointer base on tweener type.

GetFinalLocalEulerAngles ( Transform trans, Vector3 &inEulerAngles ) : Vector3

Multiply all the parent localEulerAngles to get the correct description of the transform information. ATTENTION(jenchieh): This will cause some performance, use it wisely.

GetImageRect ( Image img ) : Vector2

Returns the size of the image.

GetSpriteRendererRect ( SpriteRenderer sr ) : Vector2

Returns the size of the sprite renderer.

GetSpriteRendererRectWithNoScale ( SpriteRenderer sr ) : Vector2

Returns the size of the sprite renderer without the scale value multiply.

GetValues ( ) : IEnumerable

Enum typed version casting. Source: http://stackoverflow.com/questions/972307/can-you-loop-through-all-enum-values

HasChild ( RectTransform trans ) : bool
HasChild ( Transform trans ) : bool

Return true, if transform has at least one children.

IncVec3 ( Vector3 val, float x, float y, float z ) : Vector3
IncVecX ( Vector3 val, float x ) : Vector3

Add the vector value.

IncVecY ( Vector3 val, float y ) : Vector3
IncVecZ ( Vector3 val, float z ) : Vector3
IsArrayEmpty ( Array list ) : bool

Check if the list empty.

IsNumberString ( string str ) : bool

Is the string the valid number to parse.

IsOverGUI ( ) : bool

Check if mosue is over any UI element.

IsSameTribe ( JCS_2DLiveObject liveObj1, JCS_2DLiveObject liveObj2 ) : bool

Check if the object are the same tribe.

IsScene ( string name ) : bool

Check current scene's with NAME.

LastFileIndex ( string path, string prefixStr, string ext ) : int

Method to do search directory and get the last file index.

ListPopBack ( List list ) : T

Pop the last value from the list.

ListPopFront ( List list ) : T

Pop the last value from the list.

LoopInArray ( int index, Array arr ) : int

Loop in an array. (Array)

LoopInArray ( int index, List arr ) : int

Loop in an array. (List)

MergeArrays ( ) : T[]

Merge multiple arrays into one array.

MergeArrays2 ( Array arr1, Array arr2 ) : T[]

Merging two array and return the new array.

MergeList ( ) : List

Merging two list and return the new list.

MouseOverGUI ( RectTransform imageRect, RectTransform rootPanel = null ) : bool

Solve the flash problem! (JCS_CheckableObject) Check if the mouse still on top of the image! ATTENTIOIN(jenchieh): this will not work on the resizable window.

MoveToTheLastChild ( Transform trans ) : void

Move the object to the last child of the Unty's tree system(Hierarchy) transform.

ReattachSelf ( RectTransform trans, ReattachCallback callback ) : void
ReattachSelf ( Transform trans, ReattachCallback callback ) : void

Execution callback after detach and reattach.

RemoveEmptySlot ( List inList ) : List
RemoveEmptySlot ( Array inArray ) : T[]

Remove the empty slot in the array.

RemoveEmptySlotIncludeMissing ( List inList ) : List
RemoveEmptySlotIncludeMissing ( Array inArray ) : T[]

Remove the empty slot in the list including remove the missing gameobject too. I guess Unity do the CG collection later a while when you call 'Destory()' function. Before scripting layer acknowledge this game object is destory might be too late in some situation. This will avoid this type of issue/circumstance.

SetActiveToAllChildren ( Transform trans, bool act ) : void

Active all the child in a transform.

SetEnableAllComponents ( Transform trans, bool act ) : void

Set eabled/disabled to all component in a transform.

SetParentWithoutLosingInfo ( Transform trans, Transform parent ) : void

Set the transform to onther transform in the hierarchy and without losing the info. Info: position, rotation, scale, etc.

SetVec3 ( Vector3 &val, float x, float y, float z ) : Vector3
SetVecX ( Vector3 &val, float x ) : Vector3

Set the vector value.

SetVecY ( Vector3 &val, float y ) : Vector3
SetVecZ ( Vector3 &val, float z ) : Vector3
SpawnAnimateObject ( RuntimeAnimatorController anim, int orderLayer = 15 ) : GameObject

Spawn an animate object.

SpawnAnimateObjectDeathEvent ( RuntimeAnimatorController anim, int orderLayer = 15, int loopTimes = 1 ) : GameObject

Spawn a animate object with the death event, so after the animate was played serval loop times the object will be destroyed.

SpawnGameObject ( string objectPath, Vector3 position = newVector3(), Quaternion rotation = newQuaternion() ) : GameObject

Spawn a gmae object.

SpawnGameObject ( Object trans, Vector3 position = newVector3(), Quaternion rotation = newQuaternion() ) : Object

Spawn a gmae object.

StringToBytes ( string data, JCS_CharsetType charset ) : byte[]

Convert string to byte array by charset type.

ToJson ( obj ) : string

Return JSON by passing serializable object.

VectorDirection ( JCS_Vector3Direction direction ) : Vector3

Return direction of Unity's Vector system.

WithInAcceptRange ( float range, float acceptRange, float currentVal ) : bool

Check the value within the range plus acceptable range.

WithInArrayRange ( int index, Array arr ) : bool

With in array range. (Array)

WithInArrayRange ( int index, List arr ) : bool

With in array range. (List)

WithInRange ( float minRange, float maxRange, float currentVal ) : bool

Check the value within the range.

Method Details

AddEventTriggerEvent() public static méthode

Add Event to Unity's Event Trigger(Script)
public static AddEventTriggerEvent ( EventTrigger te, EventTriggerType type, EventTriggerEvent func ) : void
te EventTrigger
type EventTriggerType
func EventTriggerEvent
Résultat void

AddEventTriggerEvent() public static méthode

Add Event to Unity's Event Trigger(Script)
public static AddEventTriggerEvent ( EventTrigger te, EventTriggerType type, EventTriggerEventButtonSelection func, JCSUnity.JCS_ButtonSelection selection ) : void
te EventTrigger
type EventTriggerType
func EventTriggerEventButtonSelection
selection JCSUnity.JCS_ButtonSelection
Résultat void

ApplyRandVector3() public static méthode

Add random value to Vector3
public static ApplyRandVector3 ( Vector3 trans, Vector3 randVec, JCS_Bool3 checks ) : Vector3
trans Vector3 transfrorm u want to apply.
randVec Vector3 value for each axis.
checks JCS_Bool3 check for eaxh axis.
Résultat Vector3

AttachChildren() public static méthode

public static AttachChildren ( RectTransform trans, List childs ) : void
trans RectTransform
childs List
Résultat void

AttachChildren() public static méthode

Attach all childs to this transform.
public static AttachChildren ( Transform trans, List childs ) : void
trans Transform transform we want to add the childs to.
childs List childs we want to add to transform.
Résultat void

BytesToString() public static méthode

Convert byte array to string by charset type.
public static BytesToString ( Array data, JCS_CharsetType charset ) : string
data Array Byte array data to convert to string data.
charset JCS_CharsetType Target charset type.
Résultat string

CopyByteArray() public static méthode

Copy byte array to another byte array memory space.
public static CopyByteArray ( Array inBuf, int start, int len ) : byte[]
inBuf Array byte array to copy.
start int Starting index to copy.
len int Length to copy.
Résultat byte[]

DeleteAllFilesFromDir() public static méthode

Delete all files in directory.
public static DeleteAllFilesFromDir ( string dirPath ) : void
dirPath string Target delete directory.
Résultat void

DestroyAllTypeObjectInScene() public static méthode

Destroy all the 'TYPE' object in the scene.
public static DestroyAllTypeObjectInScene ( ) : void
Résultat void

DestroyImmediateAllTypeObjectInScene() public static méthode

Destroy all the 'TYPE' object in the scene.
public static DestroyImmediateAllTypeObjectInScene ( ) : void
Résultat void

DetachChildren() public static méthode

public static DetachChildren ( RectTransform trans ) : List
trans RectTransform
Résultat List

DetachChildren() public static méthode

Detttach all the child from one transform.
public static DetachChildren ( Transform trans ) : List
trans Transform transform you want to remove all /// the children under.
Résultat List

EnumSize() public static méthode

Return the length of an enumerator.
public static EnumSize ( ) : int
Résultat int

EscapeURL() public static méthode

Simple version of escape url.
public static EscapeURL ( string url ) : string
url string Url you want to escape.
Résultat string

FillSlot() public static méthode

public static FillSlot ( List inList, int len, with ) : List
inList List
len int
Résultat List

FillSlot() public static méthode

Fill slots with initialize value type by length.
public static FillSlot ( Array inArray, int len, with ) : T[]
inArray Array Array you would like to fill out.
len int Target length to initialize.
with Initialize object type.
Résultat T[]

FindCloneObjectsOfTypeAll() public static méthode

Find all the objects that are clone in the scene by type.
public static FindCloneObjectsOfTypeAll ( ) : T[]
Résultat T[]

FindNotCloneObjectsOfTypeAll() public static méthode

Find all the objects that are not clone in the scene by type.
public static FindNotCloneObjectsOfTypeAll ( ) : T[]
Résultat T[]

FindObjectsOfTypeAllInHierarchy() public static méthode

Find all objects that only ACTIVE in hierarchy.
public static FindObjectsOfTypeAllInHierarchy ( ) : T[]
Résultat T[]

ForceDetachChildren() public static méthode

public static ForceDetachChildren ( RectTransform trans ) : List
trans RectTransform
Résultat List

ForceDetachChildren() public static méthode

Force to clean all the children, this will make sure the transform have 0 children transform.
public static ForceDetachChildren ( Transform trans ) : List
trans Transform transform you want to remove all /// the children under.
Résultat List

ForceGetComponent() public static méthode

Force to get a component, if not found we will add one then.
public static ForceGetComponent ( MonoBehaviour mb ) : T
mb MonoBehaviour Any MonoBehaviour.
Résultat T

GetEasing() public static méthode

Return the easing function pointer base on tweener type.
public static GetEasing ( JCS_TweenType type ) : TweenDelegate
type JCS_TweenType type of the tween formula
Résultat TweenDelegate

GetFinalLocalEulerAngles() public static méthode

Multiply all the parent localEulerAngles to get the correct description of the transform information. ATTENTION(jenchieh): This will cause some performance, use it wisely.
public static GetFinalLocalEulerAngles ( Transform trans, Vector3 &inEulerAngles ) : Vector3
trans Transform transform we want to get from and use /// it for parent.
inEulerAngles Vector3 use to store the result.
Résultat Vector3

GetImageRect() public static méthode

Returns the size of the image.
public static GetImageRect ( Image img ) : Vector2
img Image
Résultat Vector2

GetSpriteRendererRect() public static méthode

Returns the size of the sprite renderer.
public static GetSpriteRendererRect ( SpriteRenderer sr ) : Vector2
sr SpriteRenderer
Résultat Vector2

GetSpriteRendererRectWithNoScale() public static méthode

Returns the size of the sprite renderer without the scale value multiply.
public static GetSpriteRendererRectWithNoScale ( SpriteRenderer sr ) : Vector2
sr SpriteRenderer
Résultat Vector2

GetValues() public static méthode

Enum typed version casting. Source: http://stackoverflow.com/questions/972307/can-you-loop-through-all-enum-values
public static GetValues ( ) : IEnumerable
Résultat IEnumerable

HasChild() public static méthode

public static HasChild ( RectTransform trans ) : bool
trans RectTransform
Résultat bool

HasChild() public static méthode

Return true, if transform has at least one children.
public static HasChild ( Transform trans ) : bool
trans Transform
Résultat bool

IncVec3() public static méthode

public static IncVec3 ( Vector3 val, float x, float y, float z ) : Vector3
val Vector3
x float
y float
z float
Résultat Vector3

IncVecX() public static méthode

Add the vector value.
public static IncVecX ( Vector3 val, float x ) : Vector3
val Vector3
x float
Résultat Vector3

IncVecY() public static méthode

public static IncVecY ( Vector3 val, float y ) : Vector3
val Vector3
y float
Résultat Vector3

IncVecZ() public static méthode

public static IncVecZ ( Vector3 val, float z ) : Vector3
val Vector3
z float
Résultat Vector3

IsArrayEmpty() public static méthode

Check if the list empty.
public static IsArrayEmpty ( Array list ) : bool
list Array
Résultat bool

IsNumberString() public static méthode

Is the string the valid number to parse.
public static IsNumberString ( string str ) : bool
str string
Résultat bool

IsOverGUI() public static méthode

Check if mosue is over any UI element.
public static IsOverGUI ( ) : bool
Résultat bool

IsSameTribe() public static méthode

Check if the object are the same tribe.
public static IsSameTribe ( JCS_2DLiveObject liveObj1, JCS_2DLiveObject liveObj2 ) : bool
liveObj1 JCS_2DLiveObject obj one
liveObj2 JCS_2DLiveObject obj two
Résultat bool

IsScene() public static méthode

Check current scene's with NAME.
public static IsScene ( string name ) : bool
name string Name of the scene.
Résultat bool

LastFileIndex() public static méthode

Method to do search directory and get the last file index.
public static LastFileIndex ( string path, string prefixStr, string ext ) : int
path string path to search index.
prefixStr string Filen name prefix.
ext string Filen name extension.
Résultat int

ListPopBack() public static méthode

Pop the last value from the list.
public static ListPopBack ( List list ) : T
list List
Résultat T

ListPopFront() public static méthode

Pop the last value from the list.
public static ListPopFront ( List list ) : T
list List
Résultat T

LoopInArray() public static méthode

Loop in an array. (Array)
public static LoopInArray ( int index, Array arr ) : int
index int Index
arr Array Array.
Résultat int

LoopInArray() public static méthode

Loop in an array. (List)
public static LoopInArray ( int index, List arr ) : int
index int Index
arr List List.
Résultat int

MergeArrays() public static méthode

Merge multiple arrays into one array.
public static MergeArrays ( ) : T[]
Résultat T[]

MergeArrays2() public static méthode

Merging two array and return the new array.
public static MergeArrays2 ( Array arr1, Array arr2 ) : T[]
arr1 Array First array.
arr2 Array Second array.
Résultat T[]

MergeList() public static méthode

Merging two list and return the new list.
public static MergeList ( ) : List
Résultat List

MouseOverGUI() public static méthode

Solve the flash problem! (JCS_CheckableObject) Check if the mouse still on top of the image! ATTENTIOIN(jenchieh): this will not work on the resizable window.
public static MouseOverGUI ( RectTransform imageRect, RectTransform rootPanel = null ) : bool
imageRect RectTransform
rootPanel RectTransform
Résultat bool

MoveToTheLastChild() public static méthode

Move the object to the last child of the Unty's tree system(Hierarchy) transform.
public static MoveToTheLastChild ( Transform trans ) : void
trans Transform
Résultat void

ReattachSelf() public static méthode

public static ReattachSelf ( RectTransform trans, ReattachCallback callback ) : void
trans RectTransform
callback ReattachCallback
Résultat void

ReattachSelf() public static méthode

Execution callback after detach and reattach.
public static ReattachSelf ( Transform trans, ReattachCallback callback ) : void
trans Transform Transform you want to detach and reattach after callback.
callback ReattachCallback Callback after detach and before reattach.
Résultat void

RemoveEmptySlot() public static méthode

public static RemoveEmptySlot ( List inList ) : List
inList List
Résultat List

RemoveEmptySlot() public static méthode

Remove the empty slot in the array.
public static RemoveEmptySlot ( Array inArray ) : T[]
inArray Array Array list.
Résultat T[]

RemoveEmptySlotIncludeMissing() public static méthode

public static RemoveEmptySlotIncludeMissing ( List inList ) : List
inList List
Résultat List

RemoveEmptySlotIncludeMissing() public static méthode

Remove the empty slot in the list including remove the missing gameobject too. I guess Unity do the CG collection later a while when you call 'Destory()' function. Before scripting layer acknowledge this game object is destory might be too late in some situation. This will avoid this type of issue/circumstance.
public static RemoveEmptySlotIncludeMissing ( Array inArray ) : T[]
inArray Array
Résultat T[]

SetActiveToAllChildren() public static méthode

Active all the child in a transform.
public static SetActiveToAllChildren ( Transform trans, bool act ) : void
trans Transform transform to do the effect.
act bool action to the effect
Résultat void

SetEnableAllComponents() public static méthode

Set eabled/disabled to all component in a transform.
public static SetEnableAllComponents ( Transform trans, bool act ) : void
trans Transform transform to apply the effect.
act bool enable or disable?
Résultat void

SetParentWithoutLosingInfo() public static méthode

Set the transform to onther transform in the hierarchy and without losing the info. Info: position, rotation, scale, etc.
public static SetParentWithoutLosingInfo ( Transform trans, Transform parent ) : void
trans Transform transform to set to parent transform
parent Transform parent transform
Résultat void

SetVec3() public static méthode

public static SetVec3 ( Vector3 &val, float x, float y, float z ) : Vector3
val Vector3
x float
y float
z float
Résultat Vector3

SetVecX() public static méthode

Set the vector value.
public static SetVecX ( Vector3 &val, float x ) : Vector3
val Vector3
x float
Résultat Vector3

SetVecY() public static méthode

public static SetVecY ( Vector3 &val, float y ) : Vector3
val Vector3
y float
Résultat Vector3

SetVecZ() public static méthode

public static SetVecZ ( Vector3 &val, float z ) : Vector3
val Vector3
z float
Résultat Vector3

SpawnAnimateObject() public static méthode

Spawn an animate object.
public static SpawnAnimateObject ( RuntimeAnimatorController anim, int orderLayer = 15 ) : GameObject
anim RuntimeAnimatorController anim assign
orderLayer int sorting order
Résultat GameObject

SpawnAnimateObjectDeathEvent() public static méthode

Spawn a animate object with the death event, so after the animate was played serval loop times the object will be destroyed.
public static SpawnAnimateObjectDeathEvent ( RuntimeAnimatorController anim, int orderLayer = 15, int loopTimes = 1 ) : GameObject
anim RuntimeAnimatorController animation u want to play
orderLayer int sorting order
loopTimes int loop times
Résultat GameObject

SpawnGameObject() public static méthode

Spawn a gmae object.
public static SpawnGameObject ( string objectPath, Vector3 position = newVector3(), Quaternion rotation = newQuaternion() ) : GameObject
objectPath string path of the game object
position Vector3 position of the game object spawn
rotation Quaternion rotation of the game object spawn
Résultat GameObject

SpawnGameObject() public static méthode

Spawn a gmae object.
public static SpawnGameObject ( Object trans, Vector3 position = newVector3(), Quaternion rotation = newQuaternion() ) : Object
trans UnityEngine.Object
position Vector3
rotation Quaternion
Résultat UnityEngine.Object

StringToBytes() public static méthode

Convert string to byte array by charset type.
public static StringToBytes ( string data, JCS_CharsetType charset ) : byte[]
data string String data to convert to byte array.
charset JCS_CharsetType Target charset type.
Résultat byte[]

ToJson() public static méthode

Return JSON by passing serializable object.
public static ToJson ( obj ) : string
obj Object that are serializable.
Résultat string

VectorDirection() public static méthode

Return direction of Unity's Vector system.
public static VectorDirection ( JCS_Vector3Direction direction ) : Vector3
direction JCS_Vector3Direction direction u wants.
Résultat Vector3

WithInAcceptRange() public static méthode

Check the value within the range plus acceptable range.
public static WithInAcceptRange ( float range, float acceptRange, float currentVal ) : bool
range float
acceptRange float
currentVal float
Résultat bool

WithInArrayRange() public static méthode

With in array range. (Array)
public static WithInArrayRange ( int index, Array arr ) : bool
index int
arr Array
Résultat bool

WithInArrayRange() public static méthode

With in array range. (List)
public static WithInArrayRange ( int index, List arr ) : bool
index int
arr List
Résultat bool

WithInRange() public static méthode

Check the value within the range.
public static WithInRange ( float minRange, float maxRange, float currentVal ) : bool
minRange float
maxRange float
currentVal float
Résultat bool