Encrypt









How do I use Encrypt
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: LoadbalancingPeer.cs Copy
358         public virtual bool OpAuthenticate(string appId, string appVersion, string userId, AuthenticationValues authValues, string regionCode)
359         {
360             if (this.DebugOut >= DebugLevel.INFO)
361             {
362                 this.Listener.DebugReturn(DebugLevel.INFO, "OpAuthenticate()");
363             }
364
365             Dictionary opParameters = new Dictionary();
366             if (authValues != null && authValues.Secret != null)
367             {
368                 opParameters[ParameterCode.Secret] = authValues.Secret;
369                 return this.OpCustom(OperationCode.Authenticate, opParameters, true, (byte)0, false);
370             }
371
372             opParameters[ParameterCode.AppVersion] = appVersion;
373             opParameters[ParameterCode.ApplicationId] = appId;
374
375             if (!string.IsNullOrEmpty(regionCode))
376             {
377                 opParameters[ParameterCode.Region] = regionCode;
378             }
379
380             if (!string.IsNullOrEmpty(userId))
381             {
382                 opParameters[ParameterCode.UserId] = userId;
383             }
384
385
386             if (authValues != null && authValues.AuthType != CustomAuthenticationType.None)
387             {
388                 if (!this.IsEncryptionAvailable)
389                 {
390                     this.Listener.DebugReturn(DebugLevel.ERROR, "OpAuthenticate() failed. When you want Custom Authentication encryption is mandatory.");
391                     return false;
392                 }
393
394                 opParameters[ParameterCode.ClientAuthenticationType] = (byte)authValues.AuthType;
395                 if (!string.IsNullOrEmpty(authValues.Secret))
396                 {
397                     opParameters[ParameterCode.Secret] = authValues.Secret;
398                 }
399                 //else
400                 //{
401                     if (!string.IsNullOrEmpty(authValues.AuthParameters))
402                     {
403                         opParameters[ParameterCode.ClientAuthenticationParams] = authValues.AuthParameters;
404                     }
405                     if (authValues.AuthPostData != null)
406                     {
407                         opParameters[ParameterCode.ClientAuthenticationData] = authValues.AuthPostData;
408                     }
409                 //}
410             }
411
412             bool sent = this.OpCustom(OperationCode.Authenticate, opParameters, true, (byte)0, this.IsEncryptionAvailable);
413             if (!sent)
414             {
415                 this.Listener.DebugReturn(DebugLevel.ERROR, "Error calling OpAuthenticate! Did not work. Check log output, CustomAuthenticationValues and if you're connected.");
416             }
417             return sent;
418         }
File name: LoadbalancingPeer.cs Copy
463         public virtual bool OpRaiseEvent(byte eventCode, object customEventContent, bool sendReliable, RaiseEventOptions raiseEventOptions)
464         {
465             opParameters.Clear(); // re-used private variable to avoid many new Dictionary() calls (garbage collection)
466             opParameters[(byte)LiteOpKey.Code] = (byte)eventCode;
467             if (customEventContent != null)
468             {
469                 opParameters[(byte) LiteOpKey.Data] = customEventContent;
470             }
471
472             if (raiseEventOptions == null)
473             {
474                 raiseEventOptions = RaiseEventOptions.Default;
475             }
476             else
477             {
478                 if (raiseEventOptions.CachingOption != EventCaching.DoNotCache)
479                 {
480                     opParameters[(byte) LiteOpKey.Cache] = (byte) raiseEventOptions.CachingOption;
481                 }
482                 if (raiseEventOptions.Receivers != ReceiverGroup.Others)
483                 {
484                     opParameters[(byte) LiteOpKey.ReceiverGroup] = (byte) raiseEventOptions.Receivers;
485                 }
486                 if (raiseEventOptions.InterestGroup != 0)
487                 {
488                     opParameters[(byte) LiteOpKey.Group] = (byte) raiseEventOptions.InterestGroup;
489                 }
490                 if (raiseEventOptions.TargetActors != null)
491                 {
492                     opParameters[(byte) LiteOpKey.ActorList] = raiseEventOptions.TargetActors;
493                 }
494                 if (raiseEventOptions.ForwardToWebhook)
495                 {
496                     opParameters[(byte) ParameterCode.EventForward] = true; //TURNBASED
497                 }
498             }
499
500             return this.OpCustom((byte)LiteOpCode.RaiseEvent, opParameters, sendReliable, raiseEventOptions.SequenceChannel, raiseEventOptions.Encrypt);
501         }
File name: NetworkingPeer.cs Copy
1411     public void OnStatusChanged(StatusCode statusCode)
1412     {
1413         if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
1414             Debug.Log(string.Format("OnStatusChanged: {0}", statusCode.ToString()));
1415
1416         switch (statusCode)
1417         {
1418             case StatusCode.Connect:
1419                 if (this.State == global::PeerState.ConnectingToNameServer)
1420                 {
1421                     if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
1422                         Debug.Log("Connected to NameServer.");
1423
1424                     this.server = ServerConnection.NameServer;
1425                     if (this.CustomAuthenticationValues != null)
1426                     {
1427                         this.CustomAuthenticationValues.Secret = null; // when connecting to NameServer, invalidate any auth values
1428                     }
1429                 }
1430
1431                 if (this.State == global::PeerState.ConnectingToGameserver)
1432                 {
1433                     if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
1434                         Debug.Log("Connected to gameserver.");
1435
1436                     this.server = ServerConnection.GameServer;
1437                     this.State = global::PeerState.ConnectedToGameserver;
1438                 }
1439
1440                 if (this.State == global::PeerState.ConnectingToMasterserver)
1441                 {
1442                     if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
1443                         Debug.Log("Connected to masterserver.");
1444
1445                     this.server = ServerConnection.MasterServer;
1446                     this.State = global::PeerState.ConnectedToMaster;
1447
1448                     if (this.IsInitialConnect)
1449                     {
1450                         this.IsInitialConnect = false; // after handling potential initial-connect issues with special messages, we are now sure we can reach a server
1451                         SendMonoMessage(PhotonNetworkingMessage.OnConnectedToPhoton);
1452                     }
1453                 }
1454
1455                 this.EstablishEncryption(); // always enable encryption
1456
1457                 if (this.IsAuthorizeSecretAvailable)
1458                 {
1459                     // if we have a token we don't have to wait for encryption (it is encrypted anyways, so encryption is just optional later on)
1460                     this.didAuthenticate = this.OpAuthenticate(this.mAppId, this.mAppVersionPun, this.PlayerName, this.CustomAuthenticationValues, this.CloudRegion.ToString());
1461                     if (this.didAuthenticate)
1462                     {
1463                         this.State = global::PeerState.Authenticating;
1464                     }
1465                 }
1466                 break;
1467
1468             case StatusCode.EncryptionEstablished:
1469                 // on nameserver, the "process" is stopped here, so the developer/game can either get regions or authenticate with a specific region
1470                 if (this.server == ServerConnection.NameServer)
1471                 {
1472                     this.State = global::PeerState.ConnectedToNameServer;
1473
1474                     if (!this.didAuthenticate && this.CloudRegion == CloudRegionCode.none)
1475                     {
1476                         // this client is not setup to connect to a default region. find out which regions there are!
1477                         this.OpGetRegions(this.mAppId);
1478                     }
1479                 }
1480
1481                 // we might need to authenticate automatically now, so the client can do anything at all
1482                 if (!this.didAuthenticate && (!this.IsUsingNameServer || this.CloudRegion != CloudRegionCode.none))
1483                 {
1484                     // once encryption is availble, the client should send one (secure) authenticate. it includes the AppId (which identifies your app on the Photon Cloud)
1485                     this.didAuthenticate = this.OpAuthenticate(this.mAppId, this.mAppVersionPun, this.PlayerName, this.CustomAuthenticationValues, this.CloudRegion.ToString());
1486                     if (this.didAuthenticate)
1487                     {
1488                         this.State = global::PeerState.Authenticating;
1489                     }
1490                 }
1491                 break;
1492
1493             case StatusCode.EncryptionFailedToEstablish:
1494                 Debug.LogError("Encryption wasn't established: " + statusCode + ". Going to authenticate anyways.");
1495                 this.OpAuthenticate(this.mAppId, this.mAppVersionPun, this.PlayerName, this.CustomAuthenticationValues, this.CloudRegion.ToString()); // TODO: check if there are alternatives
1496                 break;
1497
1498             case StatusCode.Disconnect:
1499                 this.didAuthenticate = false;
1500                 this.isFetchingFriends = false;
1501                 if (server == ServerConnection.GameServer) this.LeftRoomCleanup();
1502                 if (server == ServerConnection.MasterServer) this.LeftLobbyCleanup();
1503
1504                 if (this.State == global::PeerState.DisconnectingFromMasterserver)
1505                 {
1506                     if (this.Connect(this.mGameserver, ServerConnection.GameServer))
1507                     {
1508                         this.State = global::PeerState.ConnectingToGameserver;
1509                     }
1510                 }
1511                 else if (this.State == global::PeerState.DisconnectingFromGameserver || this.State == global::PeerState.DisconnectingFromNameServer)
1512                 {
1513                     if (this.Connect(this.MasterServerAddress, ServerConnection.MasterServer))
1514                     {
1515                         this.State = global::PeerState.ConnectingToMasterserver;
1516                     }
1517                 }
1518                 else
1519                 {
1520                     if (this.CustomAuthenticationValues != null)
1521                     {
1522                         this.CustomAuthenticationValues.Secret = null; // invalidate any custom auth secrets
1523                     }
1524
1525                     this.State = global::PeerState.PeerCreated; // if we set another state here, we could keep clients from connecting in OnDisconnectedFromPhoton right here.
1526                     SendMonoMessage(PhotonNetworkingMessage.OnDisconnectedFromPhoton);
1527                 }
1528                 break;
1529
1530             case StatusCode.SecurityExceptionOnConnect:
1531             case StatusCode.ExceptionOnConnect:
1532                 this.State = global::PeerState.PeerCreated;
1533                 if (this.CustomAuthenticationValues != null)
1534                 {
1535                     this.CustomAuthenticationValues.Secret = null; // invalidate any custom auth secrets
1536                 }
1537
1538                 DisconnectCause cause = (DisconnectCause)statusCode;
1539                 SendMonoMessage(PhotonNetworkingMessage.OnFailedToConnectToPhoton, cause);
1540                 break;
1541
1542             case StatusCode.Exception:
1543                 if (this.IsInitialConnect)
1544                 {
1545                     Debug.LogError("Exception while connecting to: " + this.ServerAddress + ". Check if the server is available.");
1546                     if (this.ServerAddress == null || this.ServerAddress.StartsWith("127.0.0.1"))
1547                     {
1548                         Debug.LogWarning("The server address is 127.0.0.1 (localhost): Make sure the server is running on this machine. Android and iOS emulators have their own localhost.");
1549                         if (this.ServerAddress == this.mGameserver)
1550                         {
1551                             Debug.LogWarning("This might be a misconfiguration in the game server config. You need to edit it to a (public) address.");
1552                         }
1553                     }
1554
1555                     this.State = global::PeerState.PeerCreated;
1556                     cause = (DisconnectCause)statusCode;
1557                     SendMonoMessage(PhotonNetworkingMessage.OnFailedToConnectToPhoton, cause);
1558                 }
1559                 else
1560                 {
1561                     this.State = global::PeerState.PeerCreated;
1562
1563                     cause = (DisconnectCause)statusCode;
1564                     SendMonoMessage(PhotonNetworkingMessage.OnConnectionFail, cause);
1565                 }
1566
1567                 this.Disconnect();
1568                 break;
1569
1570             case StatusCode.TimeoutDisconnect:
1571             case StatusCode.ExceptionOnReceive:
1572             case StatusCode.DisconnectByServer:
1573             case StatusCode.DisconnectByServerLogic:
1574             case StatusCode.DisconnectByServerUserLimit:
1575                 if (this.IsInitialConnect)
1576                 {
1577                     Debug.LogWarning(statusCode + " while connecting to: " + this.ServerAddress + ". Check if the server is available.");
1578
1579                     cause = (DisconnectCause)statusCode;
1580                     SendMonoMessage(PhotonNetworkingMessage.OnFailedToConnectToPhoton, cause);
1581                 }
1582                 else
1583                 {
1584                     cause = (DisconnectCause)statusCode;
1585                     SendMonoMessage(PhotonNetworkingMessage.OnConnectionFail, cause);
1586                 }
1587                 if (this.CustomAuthenticationValues != null)
1588                 {
1589                     this.CustomAuthenticationValues.Secret = null; // invalidate any custom auth secrets
1590                 }
1591
1592                 this.Disconnect();
1593                 break;
1594
1595             case StatusCode.SendError:
1596                 // this.mListener.clientErrorReturn(statusCode);
1597                 break;
1598
1599             case StatusCode.QueueOutgoingReliableWarning:
1600             case StatusCode.QueueOutgoingUnreliableWarning:
1601             case StatusCode.QueueOutgoingAcksWarning:
1602             case StatusCode.QueueSentWarning:
1603                 // this.mListener.warningReturn(statusCode);
1604                 break;
1605
1606             case StatusCode.QueueIncomingReliableWarning:
1607             case StatusCode.QueueIncomingUnreliableWarning:
1608                 Debug.Log(statusCode + ". This client buffers many incoming messages. This is OK temporarily. With lots of these warnings, check if you send too much or execute messages too slow. " + (PhotonNetwork.isMessageQueueRunning? "":"Your isMessageQueueRunning is false. This can cause the issue temporarily.") );
1609                 break;
1610
1611             // // TCP "routing" is an option of Photon that's not currently needed (or supported) by PUN
1612             //case StatusCode.TcpRouterResponseOk:
1613             // break;
1614             //case StatusCode.TcpRouterResponseEndpointUnknown:
1615             //case StatusCode.TcpRouterResponseNodeIdUnknown:
1616             //case StatusCode.TcpRouterResponseNodeNotReady:
1617
1618             // this.DebugReturn(DebugLevel.ERROR, "Unexpected router response: " + statusCode);
1619             // break;
1620
1621             default:
1622
1623                 // this.mListener.serverErrorReturn(statusCode.value());
1624                 Debug.LogError("Received unknown status code: " + statusCode);
1625                 break;
1626         }
1627
1628         this.externalListener.OnStatusChanged(statusCode);
1629     }
File name: NetworkingPeer.cs Copy
2835     internal void RPC(PhotonView view, string methodName, PhotonPlayer player, bool encrypt, params object[] parameters)
2836     {
2837         if (this.blockSendingGroups.Contains(view.group))
2838         {
2839             return; // Block sending on this group
2840         }
2841
2842         if (view.viewID < 1) //TODO: check why 0 should be illegal
2843         {
2844             Debug.LogError("Illegal view ID:" + view.viewID + " method: " + methodName + " GO:" + view.gameObject.name);
2845         }
2846
2847         if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
2848         {
2849             Debug.Log("Sending RPC \"" + methodName + "\" to player[" + player + "]");
2850         }
2851
2852
2853         //ts: changed RPCs to a one-level hashtable as described in internal.txt
2854         Hashtable rpcEvent = new Hashtable();
2855         rpcEvent[(byte)0] = (int)view.viewID; // LIMITS PHOTONVIEWS&PLAYERS
2856         if (view.prefix > 0)
2857         {
2858             rpcEvent[(byte)1] = (short)view.prefix;
2859         }
2860         rpcEvent[(byte)2] = this.ServerTimeInMilliSeconds;
2861
2862         // send name or shortcut (if available)
2863         int shortcut = 0;
2864         if (rpcShortcuts.TryGetValue(methodName, out shortcut))
2865         {
2866             rpcEvent[(byte)5] = (byte)shortcut; // LIMITS RPC COUNT
2867         }
2868         else
2869         {
2870             rpcEvent[(byte)3] = methodName;
2871         }
2872
2873         if (parameters != null && parameters.Length > 0)
2874         {
2875             rpcEvent[(byte) 4] = (object[]) parameters;
2876         }
2877
2878         if (this.mLocalActor == player)
2879         {
2880             this.ExecuteRPC(rpcEvent, player);
2881         }
2882         else
2883         {
2884             RaiseEventOptions options = new RaiseEventOptions() { TargetActors = new int[] { player.ID }, Encrypt = encrypt };
2885             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2886         }
2887     }
File name: NetworkingPeer.cs Copy
2890     /// (byte)0 -> (int) ViewId (combined from actorNr and actor-unique-id)
2891     /// (byte)1 -> (short) prefix (level)
2895     /// (byte)5 -> (byte) method shortcut (alternative to name)
2899     internal void RPC(PhotonView view, string methodName, PhotonTargets target, bool encrypt, params object[] parameters)
2900     {
2901         if (this.blockSendingGroups.Contains(view.group))
2902         {
2903             return; // Block sending on this group
2904         }
2905
2906         if (view.viewID < 1)
2907         {
2908             Debug.LogError("Illegal view ID:" + view.viewID + " method: " + methodName + " GO:" + view.gameObject.name);
2909         }
2910
2911         if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
2912             Debug.Log("Sending RPC \"" + methodName + "\" to " + target);
2913
2914
2915         //ts: changed RPCs to a one-level hashtable as described in internal.txt
2916         Hashtable rpcEvent = new Hashtable();
2917         rpcEvent[(byte)0] = (int)view.viewID; // LIMITS NETWORKVIEWS&PLAYERS
2918         if (view.prefix > 0)
2919         {
2920             rpcEvent[(byte)1] = (short)view.prefix;
2921         }
2922         rpcEvent[(byte)2] = this.ServerTimeInMilliSeconds;
2923
2924
2925         // send name or shortcut (if available)
2926         int shortcut = 0;
2927         if (rpcShortcuts.TryGetValue(methodName, out shortcut))
2928         {
2929             rpcEvent[(byte)5] = (byte)shortcut; // LIMITS RPC COUNT
2930         }
2931         else
2932         {
2933             rpcEvent[(byte)3] = methodName;
2934         }
2935
2936         if (parameters != null && parameters.Length > 0)
2937         {
2938             rpcEvent[(byte)4] = (object[])parameters;
2939         }
2940
2941         // Check scoping
2942         if (target == PhotonTargets.All)
2943         {
2944             RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group, Encrypt = encrypt };
2945             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2946
2947             // Execute local
2948             this.ExecuteRPC(rpcEvent, this.mLocalActor);
2949         }
2950         else if (target == PhotonTargets.Others)
2951         {
2952             RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group, Encrypt = encrypt };
2953             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2954         }
2955         else if (target == PhotonTargets.AllBuffered)
2956         {
2957             RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.AddToRoomCache, Encrypt = encrypt };
2958             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2959
2960             // Execute local
2961             this.ExecuteRPC(rpcEvent, this.mLocalActor);
2962         }
2963         else if (target == PhotonTargets.OthersBuffered)
2964         {
2965             RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.AddToRoomCache, Encrypt = encrypt };
2966             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2967         }
2968         else if (target == PhotonTargets.MasterClient)
2969         {
2970             if (this.mMasterClient == this.mLocalActor)
2971             {
2972                 this.ExecuteRPC(rpcEvent, this.mLocalActor);
2973             }
2974             else
2975             {
2976                 RaiseEventOptions options = new RaiseEventOptions() { Receivers = ReceiverGroup.MasterClient, Encrypt = encrypt };
2977                 this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2978             }
2979         }
2980         else if (target == PhotonTargets.AllViaServer)
2981         {
2982             RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group, Receivers = ReceiverGroup.All, Encrypt = encrypt };
2983             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2984             if (PhotonNetwork.offlineMode)
2985             {
2986                 this.ExecuteRPC(rpcEvent, this.mLocalActor);
2987             }
2988         }
2989         else if (target == PhotonTargets.AllBufferedViaServer)
2990         {
2991             RaiseEventOptions options = new RaiseEventOptions() { InterestGroup = (byte)view.group, Receivers = ReceiverGroup.All, CachingOption = EventCaching.AddToRoomCache, Encrypt = encrypt };
2992             this.OpRaiseEvent(PunEvent.RPC, rpcEvent, true, options);
2993             if (PhotonNetwork.offlineMode)
2994             {
2995                 this.ExecuteRPC(rpcEvent, this.mLocalActor);
2996             }
2997         }
2998         else
2999         {
3000             Debug.LogError("Unsupported target enum: " + target);
3001         }
3002     }
File name: PhotonNetwork.cs Copy
2479     internal static void RPC(PhotonView view, string methodName, PhotonTargets target, bool encrypt, params object[] parameters)
2480     {
2481         if (!VerifyCanUseNetwork())
2482         {
2483             return;
2484         }
2485
2486         if (room == null)
2487         {
2488             Debug.LogWarning("Cannot send RPCs in Lobby! RPC dropped.");
2489             return;
2490         }
2491
2492         if (networkingPeer != null)
2493         {
2494             networkingPeer.RPC(view, methodName, target, encrypt, parameters);
2495         }
2496         else
2497         {
2498             Debug.LogWarning("Could not execute RPC " + methodName + ". Possible scene loading in progress?");
2499         }
2500     }
File name: PhotonView.cs Copy
578     public void RpcSecure(string methodName, PhotonTargets target, bool encrypt, params object[] parameters)
579     {
580         if(PhotonNetwork.networkingPeer.hasSwitchedMC && target == PhotonTargets.MasterClient)
581         {
582             PhotonNetwork.RPC(this, methodName, PhotonNetwork.masterClient, encrypt, parameters);
583         }
584         else
585         {
586             PhotonNetwork.RPC(this, methodName, target, encrypt, parameters);
587         }
588     }
File name: PhotonView.cs Copy
632     public void RpcSecure(string methodName, PhotonPlayer targetPlayer, bool encrypt, params object[] parameters)
633     {
634         PhotonNetwork.RPC(this, methodName, targetPlayer, encrypt, parameters);
635     }
File name: ChatClient.cs Copy
311         public bool SendPrivateMessage(string target, object message, bool encrypt)
312         {
313             if (!this.CanChat)
314             {
315                 // TODO: log error
316                 return false;
317             }
318
319             if (string.IsNullOrEmpty(target) || message == null)
320             {
321                 this.LogWarning("SendPrivateMessage parameters must be non-null and not empty.");
322                 return false;
323             }
324
325             Dictionary parameters = new Dictionary
326                 {
327                     { ChatParameterCode.UserId, target },
328                     { ChatParameterCode.Message, message }
329                 };
330
331             bool sent = this.chatPeer.OpCustom((byte)ChatOperationCode.SendPrivate, parameters, true, 0, encrypt);
332             return sent;
333         }
File name: ChatClient.cs Copy
620         void IPhotonPeerListener.OnStatusChanged(StatusCode statusCode)
621         {
622             switch (statusCode)
623             {
624                 case StatusCode.Connect:
625                     this.chatPeer.EstablishEncryption();
626                     if (this.State == ChatState.ConnectingToNameServer)
627                     {
628                         this.State = ChatState.ConnectedToNameServer;
629                         this.listener.OnChatStateChange(this.State);
630                     }
631                     else if (this.State == ChatState.ConnectingToFrontEnd)
632                     {
633                         this.AuthenticateOnFrontEnd();
634                     }
635                     break;
636                 case StatusCode.EncryptionEstablished:
637                     // once encryption is availble, the client should send one (secure) authenticate. it includes the AppId (which identifies your app on the Photon Cloud)
638                     if (!this.didAuthenticate)
639                     {
640                         this.didAuthenticate = this.chatPeer.AuthenticateOnNameServer(this.AppId, this.AppVersion, this.chatRegion, this.UserId, this.CustomAuthenticationValues);
641                         if (!this.didAuthenticate)
642                         {
643                             ((IPhotonPeerListener) this).DebugReturn(DebugLevel.ERROR, "Error calling OpAuthenticate! Did not work. Check log output, CustomAuthenticationValues and if you're connected. State: " + this.State);
644                         }
645                     }
646                     break;
647                 case StatusCode.EncryptionFailedToEstablish:
648                     this.State = ChatState.Disconnecting;
649                     this.chatPeer.Disconnect();
650                     break;
651                 case StatusCode.Disconnect:
652                     if (this.State == ChatState.Authenticated)
653                     {
654                         this.ConnectToFrontEnd();
655                     }
656                     else
657                     {
658                         this.State = ChatState.Disconnected;
659                         this.listener.OnChatStateChange(ChatState.Disconnected);
660                         this.listener.OnDisconnected();
661                     }
662                     break;
663             }
664         }

Encrypt 119 lượt xem

Gõ tìm kiếm nhanh...