/// <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()); }
/// <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); } }
/// <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()); }