Ejemplo n.º 1
0
        override public void OnConnectedToMaster()
        {
            base.OnConnectedToMaster();
            Debug.Log("Connected.");

            OnConnectionToServer?.Invoke();
            PhotonNetwork.JoinLobby();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Подключиться к серверу
 /// </summary>
 public void Connect()
 {
     if (!PhotonNetwork.IsConnected)
     {
         PhotonNetwork.ConnectUsingSettings();
     }
     else
     {
         OnConnectionToServer?.Invoke();
     }
 }
Ejemplo n.º 3
0
 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");
     }
 }