public static void Authenticate(string releaseVersion, string appId, string region, string userId, string authCookie, string encryptionKey) { Dictionary <byte, object> parameters = new Dictionary <byte, object> { [ParameterCodes.AppVersion] = releaseVersion, [ParameterCodes.AppId] = appId, [ParameterCodes.Region] = "usw", [ParameterCodes.ClientAuthenticationType] = 0, [ParameterCodes.ClientAuthenticationParameters] = string.Concat(new object[] { "token=", authCookie, "&user", userId }), //TODO: Figure out how encryption key is generated [ParameterCodes.EncryptionKey] = "??" }; PhotonReflections.SendOperation(230, parameters, new SendOptions() { Reliability = true, Encrypt = true }); }
public static void RaiseEvent(byte eventCode, object eventData, SendOptions options, RaiseEventOptions eventOptions = null) { Dictionary <byte, object> parameters = new Dictionary <byte, object>(); parameters[ParameterCodes.EventCode] = eventCode; //check for correct type for eventdata relative to eventcode or else dont send (due to bans) if (eventData != null && CheckForCorrectType(eventCode, eventData)) { parameters[ParameterCodes.CustomData] = eventData; } else { //print expected type for eventcode Console.WriteLine(string.Concat(new object[] { "Invalid CustomData type for eventCode: ", eventCode, " Expected: ", GetCorrectType(eventCode) })); return; } if (eventOptions != null && eventOptions.TargetActors != null) { parameters[ParameterCodes.Targets] = eventOptions.TargetActors; } PhotonReflections.SendOperation(OpCodes.RaiseEvent, parameters, options); }
public static void SetProperties(int actor, KeyValuePair <object, object>[] pair) { Dictionary <byte, object> parameters = new Dictionary <byte, object>(); Hashtable properties = new Hashtable(); //add each array element to hashtable to send as properties foreach (KeyValuePair <object, object> kp in pair) { properties.Add(kp.Key, kp.Value); } parameters[ParameterCodes.Properties] = properties; parameters[ParameterCodes.Broadcast] = true; parameters[ParameterCodes.TargetActor] = actor; PhotonReflections.SendOperation(OpCodes.SetProperties, parameters, SendOptions.SendReliable); }