本文整理汇总了C#中ExitGames.Client.Photon.Hashtable.StripToStringKeys方法的典型用法代码示例。如果您正苦于以下问题:C# ExitGames.Client.Photon.Hashtable.StripToStringKeys方法的具体用法?C# ExitGames.Client.Photon.Hashtable.StripToStringKeys怎么用?C# ExitGames.Client.Photon.Hashtable.StripToStringKeys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExitGames.Client.Photon.Hashtable
的用法示例。
在下文中一共展示了ExitGames.Client.Photon.Hashtable.StripToStringKeys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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)
{
if (propertiesToSet == null)
{
return;
}
// merge (delete null-values)
this.customProperties.MergeStringKeys(propertiesToSet); // includes a Equals check (simplifying things)
this.customProperties.StripKeysWithNullValues();
// send (sync) these new values
Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;
if (this.actorID > 0 && !PhotonNetwork.offlineMode)
{
PhotonNetwork.networkingPeer.OpSetCustomPropertiesOfActor(this.actorID, customProps, true, 0);
}
NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnPhotonPlayerPropertiesChanged, this, propertiesToSet);
}