private void SetupEncryption(Dictionary<byte, object> encryptionData) { // this should not be called when authentication is done per server. this mode does not support the required "key-exchange via token" if (this.AuthMode == AuthModeOption.Auth) { if (DebugOut == DebugLevel.ERROR) { UnityEngine.Debug.LogWarning("SetupEncryption() called but ignored. Not XB1 compiled. EncryptionData: " + encryptionData.ToStringFull()); return; } } // for AuthOnce and AuthOnceWss, we can keep the same secret across machines (for the session, basically) if (DebugOut == DebugLevel.INFO) { UnityEngine.Debug.Log("SetupEncryption() got called. "+encryptionData.ToStringFull()); } var mode = (EncryptionMode)(byte)encryptionData[EncryptionDataParameters.Mode]; switch (mode) { case EncryptionMode.PayloadEncryption: byte[] secret = (byte[])encryptionData[EncryptionDataParameters.Secret1]; this.InitPayloadEncryption(secret); break; case EncryptionMode.DatagramEncryption: { byte[] secret1 = (byte[])encryptionData[EncryptionDataParameters.Secret1]; byte[] secret2 = (byte[])encryptionData[EncryptionDataParameters.Secret2]; this.InitDatagramEncryption(secret1, secret2); } break; default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Sets properties of a player / actor. /// Internally this uses OpSetProperties, which can be used to either set room or player properties. /// </summary> /// <param name="actorNr">The payer ID (a.k.a. actorNumber) of the player to attach these properties to.</param> /// <param name="actorProperties">The properties to add or update.</param> /// <param name="expectedProperties">If set, these must be in the current properties-set (on the server) to set actorProperties: CAS.</param> /// <param name="webForward">Set to true, to forward the set properties to a WebHook, defined for this app (in Dashboard).</param> /// <returns>If the operation could be sent (requires connection).</returns> protected internal bool OpSetPropertiesOfActor(int actorNr, Hashtable actorProperties, Hashtable expectedProperties = null, bool webForward = false) { if (this.DebugOut >= DebugLevel.INFO) { this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfActor()"); } if (actorNr <= 0 || actorProperties == null) { if (this.DebugOut >= DebugLevel.INFO) { this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfActor not sent. ActorNr must be > 0 and actorProperties != null."); } return false; } Dictionary<byte, object> opParameters = new Dictionary<byte, object>(); opParameters.Add(ParameterCode.Properties, actorProperties); opParameters.Add(ParameterCode.ActorNr, actorNr); opParameters.Add(ParameterCode.Broadcast, true); if (expectedProperties != null && expectedProperties.Count != 0) { opParameters.Add(ParameterCode.ExpectedValues, expectedProperties); } if (webForward) { opParameters[ParameterCode.EventForward] = true; } UnityEngine.Debug.Log(opParameters.ToStringFull()); return this.OpCustom((byte)OperationCode.SetProperties, opParameters, true, 0, false); }