Photon Unity Networking v1.101

Static Public Member Functions | Static Public Attributes | List of all members
Extensions Class Reference

This static class defines some useful extension methods for several existing classes (e.g. Vector3, float and others). More...

Static Public Member Functions

static ParameterInfo[] GetCachedParemeters (this MethodInfo mo)
 
static PhotonView[] GetPhotonViewsInChildren (this UnityEngine.GameObject go)
 
static PhotonView GetPhotonView (this UnityEngine.GameObject go)
 
static bool AlmostEquals (this Vector3 target, Vector3 second, float sqrMagnitudePrecision)
 compares the squared magnitude of target - second to given float value More...
 
static bool AlmostEquals (this Vector2 target, Vector2 second, float sqrMagnitudePrecision)
 compares the squared magnitude of target - second to given float value More...
 
static bool AlmostEquals (this Quaternion target, Quaternion second, float maxAngle)
 compares the angle between target and second to given float value More...
 
static bool AlmostEquals (this float target, float second, float floatDiff)
 compares two floats and returns true of their difference is less than floatDiff More...
 
static void Merge (this IDictionary target, IDictionary addHash)
 Merges all keys from addHash into the target. Adds new keys and updates the values of existing keys in target. More...
 
static void MergeStringKeys (this IDictionary target, IDictionary addHash)
 Merges keys of type string to target Hashtable. More...
 
static string ToStringFull (this IDictionary origin)
 Helper method for debugging of IDictionary content, inlcuding type-information. Using this is not performant. More...
 
static string ToStringFull (this object[] data)
 Helper method for debugging of object[] content. Using this is not performant. More...
 
static Hashtable StripToStringKeys (this IDictionary original)
 This method copies all string-typed keys of the original into a new Hashtable. More...
 
static void StripKeysWithNullValues (this IDictionary original)
 This removes all key-value pairs that have a null-reference as value. Photon properties are removed by setting their value to null. Changes the original passed IDictionary! More...
 
static bool Contains (this int[] target, int nr)
 Checks if a particular integer value is in an int-array. More...
 

Static Public Attributes

static Dictionary< MethodInfo, ParameterInfo[]> ParametersOfMethods = new Dictionary<MethodInfo, ParameterInfo[]>()
 

Detailed Description

This static class defines some useful extension methods for several existing classes (e.g. Vector3, float and others).

Member Function Documentation

◆ AlmostEquals() [1/4]

static bool Extensions.AlmostEquals ( this float  target,
float  second,
float  floatDiff 
)
static

compares two floats and returns true of their difference is less than floatDiff

◆ AlmostEquals() [2/4]

static bool Extensions.AlmostEquals ( this Quaternion  target,
Quaternion  second,
float  maxAngle 
)
static

compares the angle between target and second to given float value

◆ AlmostEquals() [3/4]

static bool Extensions.AlmostEquals ( this Vector2  target,
Vector2  second,
float  sqrMagnitudePrecision 
)
static

compares the squared magnitude of target - second to given float value

◆ AlmostEquals() [4/4]

static bool Extensions.AlmostEquals ( this Vector3  target,
Vector3  second,
float  sqrMagnitudePrecision 
)
static

compares the squared magnitude of target - second to given float value

◆ Contains()

static bool Extensions.Contains ( this int[]  target,
int  nr 
)
static

Checks if a particular integer value is in an int-array.

This might be useful to look up if a particular actorNumber is in the list of players of a room.

Parameters
targetThe array of ints to check.
nrThe number to lookup in target.
Returns
True if nr was found in target.

◆ GetCachedParemeters()

static ParameterInfo [] Extensions.GetCachedParemeters ( this MethodInfo  mo)
static

◆ GetPhotonView()

static PhotonView Extensions.GetPhotonView ( this UnityEngine.GameObject  go)
static

◆ GetPhotonViewsInChildren()

static PhotonView [] Extensions.GetPhotonViewsInChildren ( this UnityEngine.GameObject  go)
static

◆ Merge()

static void Extensions.Merge ( this IDictionary  target,
IDictionary  addHash 
)
static

Merges all keys from addHash into the target. Adds new keys and updates the values of existing keys in target.

Parameters
targetThe IDictionary to update.
addHashThe IDictionary containing data to merge into target.

◆ MergeStringKeys()

static void Extensions.MergeStringKeys ( this IDictionary  target,
IDictionary  addHash 
)
static

Merges keys of type string to target Hashtable.

Does not remove keys from target (so non-string keys CAN be in target if they were before).

Parameters
targetThe target IDicitionary passed in plus all string-typed keys from the addHash.
addHashA IDictionary that should be merged partly into target to update it.

◆ StripKeysWithNullValues()

static void Extensions.StripKeysWithNullValues ( this IDictionary  original)
static

This removes all key-value pairs that have a null-reference as value. Photon properties are removed by setting their value to null. Changes the original passed IDictionary!

Parameters
originalThe IDictionary to strip of keys with null-values.

◆ StripToStringKeys()

static Hashtable Extensions.StripToStringKeys ( this IDictionary  original)
static

This method copies all string-typed keys of the original into a new Hashtable.

Does not recurse (!) into hashes that might be values in the root-hash. This does not modify the original.

Parameters
originalThe original IDictonary to get string-typed keys from.
Returns
New Hashtable containing only string-typed keys of the original.

◆ ToStringFull() [1/2]

static string Extensions.ToStringFull ( this IDictionary  origin)
static

Helper method for debugging of IDictionary content, inlcuding type-information. Using this is not performant.

Should only be used for debugging as necessary.

Parameters
originSome Dictionary or Hashtable.
Returns
String of the content of the IDictionary.

◆ ToStringFull() [2/2]

static string Extensions.ToStringFull ( this object[]  data)
static

Helper method for debugging of object[] content. Using this is not performant.

Should only be used for debugging as necessary.

Parameters
dataAny object[].
Returns
A comma-separated string containing each value's ToString().

Member Data Documentation

◆ ParametersOfMethods

Dictionary<MethodInfo, ParameterInfo[]> Extensions.ParametersOfMethods = new Dictionary<MethodInfo, ParameterInfo[]>()
static