This static class defines some useful extension methods for several existing classes (e.g. Vector3, float and others).
More...
|
| static bool | Contains (this int[] target, int nr) |
| | Checks if a particular integer value is in an int-array. More...
|
| |
| static bool | CustomPropKeyTypesValid (this object[] array, bool NullOrZeroAccepted=false) |
| | Checks if the given object[] only contains keys of type string (to be acceptable as Custom Properties in lobby). More...
|
| |
| static bool | CustomPropKeyTypesValid (this PhotonHashtable original, bool NullOrZeroAccepted=false) |
| | Checks if the given IDictionary only contains keys of type string (to be acceptable as Custom Properties). More...
|
| |
| static int | GetStableHashCode (this string str) |
| | Used to get a "stable" hashcode for strings. More...
|
| |
| static void | Merge (this PhotonHashtable target, PhotonHashtable 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 PhotonHashtable target, PhotonHashtable addHash) |
| | Merges keys of type string to target PhotonHashtable. More...
|
| |
| static void | MergeValidCustomProperties (this PhotonHashtable target, PhotonHashtable addHash) |
| | Merges keys of type string and int to target PhotonHashtable. More...
|
| |
| static void | StripKeysWithNullValues (this PhotonHashtable original) |
| | Removes all keys with null values. More...
|
| |
| static string | ToStringFull (this ArraySegment< byte > segment, int count=-1) |
| | Converts an ArraySegment<byte> to string (useful as debugging output). Uses BitConverter.ToString(segment) internally. More...
|
| |
| static string | ToStringFull (this byte[] list, int count=-1) |
| | Converts a byte-array to string (useful as debugging output). Uses BitConverter.ToString(list) internally after a null-check of list. More...
|
| |
| static string | ToStringFull (this object[] data) |
| | Helper method for debugging of object[] content. Using this is not performant. More...
|
| |
| static string | ToStringFull (this PhotonHashtable origin) |
| | Helper method for debugging of IDictionary content, including type-information. Using this is not performant. More...
|
| |
| static string | ToStringFull< T > (this List< T > data) |
| | Helper method for debugging of List<T> content. Using this is not performant. More...
|
| |
This static class defines some useful extension methods for several existing classes (e.g. Vector3, float and others).
◆ GetStableHashCode()
| static int Photon.Realtime.Extensions.GetStableHashCode |
( |
this string |
str | ) |
|
|
inlinestatic |
Used to get a "stable" hashcode for strings.
Used by RealtimeClient.GetMatchmakingHash for matchmaking debugging.
- Parameters
-
| str | String to create hashcode for. |
- Returns
- Hashcode of string.
◆ ToStringFull() [1/4]
| static string Photon.Realtime.Extensions.ToStringFull |
( |
this PhotonHashtable |
origin | ) |
|
|
inlinestatic |
Helper method for debugging of IDictionary content, including type-information. Using this is not performant.
Should only be used for debugging as necessary.
- Parameters
-
- Returns
- String of the content of the IDictionary.
◆ ToStringFull< T >()
Helper method for debugging of List<T> content. Using this is not performant.
Should only be used for debugging as necessary.
- Parameters
-
| data | Any List<T> where T implements .ToString(). |
- Returns
- A comma-separated string containing each value's ToString().
◆ ToStringFull() [2/4]
| static string Photon.Realtime.Extensions.ToStringFull |
( |
this byte[] |
list, |
|
|
int |
count = -1 |
|
) |
| |
|
inlinestatic |
Converts a byte-array to string (useful as debugging output). Uses BitConverter.ToString(list) internally after a null-check of list.
- Parameters
-
| list | Byte-array to convert to string. |
| count | Count of bytes to convert to string. If negative, list.Length is used. Optional. Default: -1. |
- Returns
- List of bytes as string.
◆ ToStringFull() [3/4]
| static string Photon.Realtime.Extensions.ToStringFull |
( |
this ArraySegment< byte > |
segment, |
|
|
int |
count = -1 |
|
) |
| |
|
inlinestatic |
Converts an ArraySegment<byte> to string (useful as debugging output). Uses BitConverter.ToString(segment) internally.
- Parameters
-
| segment | ArraySegment<byte> to convert to string. |
| count | Count of bytes to convert to string. If negative segment.Count is used. Optional. Default: -1. |
- Returns
- List of bytes as string.
◆ ToStringFull() [4/4]
| static string Photon.Realtime.Extensions.ToStringFull |
( |
this object[] |
data | ) |
|
|
inlinestatic |
Helper method for debugging of object[] content. Using this is not performant.
Should only be used for debugging as necessary.
- Parameters
-
- Returns
- A comma-separated string containing each value's ToString().
◆ CustomPropKeyTypesValid() [1/2]
| static bool Photon.Realtime.Extensions.CustomPropKeyTypesValid |
( |
this PhotonHashtable |
original, |
|
|
bool |
NullOrZeroAccepted = false |
|
) |
| |
|
inlinestatic |
Checks if the given IDictionary only contains keys of type string (to be acceptable as Custom Properties).
- Parameters
-
| original | Collection to check. |
| NullOrZeroAccepted | If it's ok that the hashtable is null or empty. Defines the return value for those cases. |
- Returns
- NullOrZeroAccepted if the original is null or empty. True if existing keys are of type string or int.
◆ CustomPropKeyTypesValid() [2/2]
| static bool Photon.Realtime.Extensions.CustomPropKeyTypesValid |
( |
this object[] |
array, |
|
|
bool |
NullOrZeroAccepted = false |
|
) |
| |
|
inlinestatic |
Checks if the given object[] only contains keys of type string (to be acceptable as Custom Properties in lobby).
◆ StripKeysWithNullValues()
| static void Photon.Realtime.Extensions.StripKeysWithNullValues |
( |
this PhotonHashtable |
original | ) |
|
|
inlinestatic |
Removes all keys with null values.
Photon properties are removed by setting their value to null. Changes the original IDictionary! Uses lock(keysWithNullValue), which should be no problem in expected use cases.
- Parameters
-
| original | The IDictionary to strip of keys with null value. |
◆ Merge()
| static void Photon.Realtime.Extensions.Merge |
( |
this PhotonHashtable |
target, |
|
|
PhotonHashtable |
addHash |
|
) |
| |
|
inlinestatic |
Merges all keys from addHash into the target. Adds new keys and updates the values of existing keys in target.
- Parameters
-
| target | The IDictionary to update. |
| addHash | The IDictionary containing data to merge into target. |
◆ MergeStringKeys()
| static void Photon.Realtime.Extensions.MergeStringKeys |
( |
this PhotonHashtable |
target, |
|
|
PhotonHashtable |
addHash |
|
) |
| |
|
inlinestatic |
Merges keys of type string to target PhotonHashtable.
Does not remove keys from target (so non-string keys CAN be in target if they were before).
- Parameters
-
| target | The target IDictionary passed in plus all string-typed keys from the addHash. |
| addHash | A IDictionary that should be merged partly into target to update it. |
◆ MergeValidCustomProperties()
| static void Photon.Realtime.Extensions.MergeValidCustomProperties |
( |
this PhotonHashtable |
target, |
|
|
PhotonHashtable |
addHash |
|
) |
| |
|
inlinestatic |
Merges keys of type string and int to target PhotonHashtable.
Does not remove keys from target (so non-string keys CAN be in target if they were before).
- Parameters
-
| target | The target PhotonHashtable passed in plus all string- or int-typed keys from the addHash. |
| addHash | A IDictionary that should be merged partly into target to update it. |
◆ Contains()
| static bool Photon.Realtime.Extensions.Contains |
( |
this int[] |
target, |
|
|
int |
nr |
|
) |
| |
|
inlinestatic |
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
-
| target | The array of ints to check. |
| nr | The number to lookup in target. |
- Returns
- True if nr was found in target.