Example #1
0
        override public void OnConnectedToMaster()
        {
            base.OnConnectedToMaster();
            Debug.Log("Connected.");

            OnConnectionToServer?.Invoke();
            PhotonNetwork.JoinLobby();
        }
Example #2
0
 /// <summary>
 /// Подключиться к серверу
 /// </summary>
 public void Connect()
 {
     if (!PhotonNetwork.IsConnected)
     {
         PhotonNetwork.ConnectUsingSettings();
     }
     else
     {
         OnConnectionToServer?.Invoke();
     }
 }
 void ConnectToHub()
 {
     if (!string.IsNullOrEmpty(endPoint) && !string.IsNullOrEmpty(hubName))
     {
         connection = new HubConnection(endPoint);
         proxy      = connection.CreateHubProxy(hubName);
         proxy.On("RecievePlayerData", new Action <PlayerData>(OnRecievePlayerData));
         connection.Start().Wait();
         isConnected = true;
         OnConnectionToServer?.Invoke();
         Debug.Log("Connection");
     }
 }