本文整理汇总了C#中System.Collections.Hashtable.StripToStringKeys方法的典型用法代码示例。如果您正苦于以下问题:C# Hashtable.StripToStringKeys方法的具体用法?C# Hashtable.StripToStringKeys怎么用?C# Hashtable.StripToStringKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Hashtable
的用法示例。
在下文中一共展示了Hashtable.StripToStringKeys方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpSetCustomPropertiesOfRoom
/// <summary>
/// Sets custom properties of a room (only passing string-typed keys in the Hashtable).
/// Internally this uses OpSetProperties, which can be used to either set room or player properties.
/// </summary>
/// <param name="gameProperties"></param>
/// <returns>If the operation could be sent (has to be connected).</returns>
public bool OpSetCustomPropertiesOfRoom(Hashtable gameProperties)
{
return this.OpSetPropertiesOfRoom(gameProperties.StripToStringKeys());
}
示例2: SetCustomProperties
/// <summary>
/// Updates and synchronizes the named properties of this Player with the values of propertiesToSet.
/// </summary>
/// <remarks>
/// Any player's properties are available in a Room only and only until the player disconnect or leaves.
/// Access any player's properties by: Player.CustomProperties (read-only!) but don't modify that hashtable.
///
/// New properties are added, existing values are updated.
/// Other values will not be changed, so only provide values that changed or are new.
/// To delete a named (custom) property of this player, use null as value.
/// Only string-typed keys are applied (everything else is ignored).
///
/// Local cache is updated immediately, other players are updated through Photon with a fitting operation.
/// To reduce network traffic, set only values that actually changed.
/// </remarks>
/// <param name="propertiesToSet">Hashtable of props to udpate, set and sync. See description.</param>
public void SetCustomProperties(Hashtable propertiesToSet)
{
Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;
// merge (delete null-values)
this.CustomProperties.Merge(customProps);
this.CustomProperties.StripKeysWithNullValues();
// send (sync) these new values if in room
if (this.RoomReference != null && this.RoomReference.IsLocalClientInside)
{
this.RoomReference.LoadBalancingClient.OpSetCustomPropertiesOfActor(this.actorID, customProps);
}
}
示例3: OpSetCustomPropertiesOfActor
/// <summary>
/// Sets custom properties of a player / actor (only passing on the string-typed custom properties).
/// Internally this uses OpSetProperties, which can be used to either set room or player properties.
/// </summary>
/// <param name="actorNr">The player ID (a.k.a. actorNumber) of the player to attach these properties to.</param>
/// <param name="actorProperties">The custom properties to add or update.</param>
/// <returns>If the operation could be sent (requires connection).</returns>
public bool OpSetCustomPropertiesOfActor(int actorNr, Hashtable actorProperties)
{
return this.OpSetPropertiesOfActor(actorNr, actorProperties.StripToStringKeys());
}