Exemplo n.º 1
0
 void SendGameRegistrationToGameManager()
 {
     logger.Log("[GameRegistration] - registering with master");
     client.Send(new RegisterGameMsg()
     {
         NetworkAddress = NetworkAddress,
         NetworkPort    = NetworkPort,
         UniqueID       = UniqueID,
         SceneName      = GameScene,
         MaxPlayers     = MaxPlayers,
         CurrentPlayers = CurrentPlayers
     });
 }
Exemplo n.º 2
0
        public void SendLoginMsg(string username, string password)
        {
            client.Send(new LoginMsg()
            {
                AccountName = username, AccountPassword = password
            }, (reader) =>
            {
                LoginResponseMsg msg = reader.ReadMessage <LoginResponseMsg>();

                if (msg.Status == CallbackStatus.Success)
                {
                    uniqueID       = msg.UniqueID;
                    loginSucessful = true;
                    loginResponse  = "Login Successful!";
                    logger.Log("[ClientAuthentication] - Login Successful!");
                }
                if (msg.Status == CallbackStatus.Error)
                {
                    logger.LogError("[ClientAuthentication] - Callback Error: Login error");
                }
                if (msg.Status == CallbackStatus.Timeout)
                {
                    logger.LogError("[ClientAuthentication] - Callback Error: Login attempt timed out");
                }
            });
        }
Exemplo n.º 3
0
 public void SendLoginMsg(string username, string password)
 {
     client.Send((short)MsgId.Login, new LoginMsg()
     {
         AccountName = username, AccountPassword = password
     }, (callbackStatus, reader) =>
     {
         if (callbackStatus == CallbackStatus.Ok)
         {
             LoginResponseMsg msg = reader.ReadMessage <LoginResponseMsg>();
             loginSucessful       = msg.Authenticated; //This will always be true for prototyping
             if (loginSucessful)
             {
                 uniqueID      = msg.UniqueID;
                 loginResponse = "Login Successful!";
             }
             else
             {
                 loginResponse = "Login Failed!";
             }
         }
         if (callbackStatus == CallbackStatus.Error)
         {
             Debug.LogError("Callback Error: Login error");
         }
         if (callbackStatus == CallbackStatus.Timeout)
         {
             Debug.LogError("Callback Error: Login attempt timed out");
         }
     });
 }
Exemplo n.º 4
0
 void RegisterToMaster()
 {
     //Used only if acting as a ChildSpawner under a MasterServer
     if (client && !registrationComplete)
     {
         if (client.isConnected)
         {
             UnityEngine.Debug.LogWarning("[ProcessSpawner] - Registering to Master");
             client.Send((short)MsgId.RegisterSpawner, new RegisterSpawnerMsg()
             {
                 UniqueID   = "", //Can provide a password to authenticate to the master as a trusted spawner
                 MaxThreads = MaximumProcesses
             });
             registrationComplete = true;
         }
     }
 }
Exemplo n.º 5
0
 protected virtual bool TransportSend(byte[] bytes)
 {
     if (client != null)
     {
         client.Send(bytes);
         return(true);
     }
     else if (server != null)
     {
         return(server.SendToClient(connectionId, bytes));
     }
     return(false);
 }
Exemplo n.º 6
0
 public virtual bool TransportSend(byte[] bytes, out byte error)
 {
     error = 0;
     if (client != null)
     {
         client.Send(bytes);
         return(true);
     }
     else if (server != null)
     {
         server.Send(connectionId, bytes);
         return(true);
     }
     return(false);
 }
Exemplo n.º 7
0
 public void SendRequestSpawnStart(RequestSpawnStartMsg requestSpawnStartMsg)
 {
     client.Send(requestSpawnStartMsg);
 }
Exemplo n.º 8
0
 public void SendStartMatchMaking(StartMatchMakingMsg startMatchMakingMsg)
 {
     client.Send((short)MsgId.StartMatchMaking, startMatchMakingMsg);
 }
Exemplo n.º 9
0
 public void SendRequestSpawnStart(RequestSpawnStartMsg requestSpawnStartMsg)
 {
     client.Send((short)MsgId.RequestSpawnStart, requestSpawnStartMsg);
 }
Exemplo n.º 10
0
 public void SendStartMatchMaking(StartMatchMakingMsg startMatchMakingMsg)
 {
     client.Send(startMatchMakingMsg);
 }