コード例 #1
0
    private void LoginRequest(int cnnId, int channelId, int recHostId, Net_LoginRequest lr)
    {
        // Debug.Log(string.Format("{0},{1}",lr.UsernameOrEmail,lr.Password));

        string             randomToken = Utility.GenerateRandom(4); //Change to 256 on production
        Model_Account      account     = db.LoginAccount(lr.UsernameOrEmail, lr.Password, cnnId, randomToken);
        Net_OnLoginRequest olr         = new Net_OnLoginRequest();

        if (account != null)
        {
            olr.Success     = 1;
            olr.Information = "You have been logged in as" + account.Username;

            olr.Username      = account.Username;
            olr.Discriminator = account.Username;
            olr.Token         = account.Token;
            olr.ConnectionId  = cnnId;
        }
        else
        {
            olr.Success = 0;
        }


        SendClient(recHostId, cnnId, olr);
    }
コード例 #2
0
ファイル: Client.cs プロジェクト: cxz5309/Multiplayer-Lobby
    private void OnLoginRequest(Net_OnLoginRequest olr)
    {
        LobbyScene.instance.ChangeAuthenticationMessage(olr.Infomation);

        if (olr.Success != 1)
        {
            LobbyScene.instance.EnableInputs();
        }
        else
        {
        }
    }
コード例 #3
0
 private void OnLoginRequest(Net_OnLoginRequest olr)
 {
     LobbyScene.Instance.ChangeAuthenticationMessage(olr.Information);
     if (olr.Success != 1)
     {
         //Unable to login
         LobbyScene.Instance.EnableInputs();
     }
     else
     {
         //Successful Login
     }
 }
コード例 #4
0
ファイル: Server.cs プロジェクト: Troy517545/AvalonServer
    private void LoginRequest(int connectionId, int channelId, int recHostId, Net_LoginRequest lr)
    {
        Debug.Log(string.Format("{0}, {1}", lr.UsernameOrEmail, lr.Password));

        Net_OnLoginRequest olr = new Net_OnLoginRequest();

        olr.Success       = 1;
        olr.Information   = "Logged in!";
        olr.Username      = "******";
        olr.Discriminator = "0000";
        olr.Token         = "Token";

        SendClient(recHostId, connectionId, olr);
    }
コード例 #5
0
    private void LoginRequest(int connectionId, int channelId, int recHostId, Net_LoginRequest lr)
    {
        Debug.Log(string.Format("{0}", lr.Username));

        Net_OnLoginRequest olr = new Net_OnLoginRequest();

        olr.Success       = 0;
        olr.Information   = "Login succeeded";
        olr.Username      = lr.Username;
        olr.Discriminator = "0001";
        olr.Token         = "TOKEN";

        SendClient(recHostId, connectionId, olr);
    }
コード例 #6
0
    private void LoginRequest(int cnnId, int channelId, int recHosteId, Net_LoginRequest lr)
    {
        Debug.Log(string.Format("{0},{1}", lr.UsernameOrEmail, lr.Password));

        Net_OnLoginRequest olr = new Net_OnLoginRequest();

        olr.Success       = 0;
        olr.Information   = "Everything is good";
        olr.Username      = "******";
        olr.Discriminator = "0000";
        olr.Token         = "Token";

        SendClient(recHosteId, cnnId, olr);
    }
コード例 #7
0
    public void LoginRequest(int cnnId, int channelId, int recHostId, Net_LoginRequest Lr)
    {
        Debug.Log(string.Format("{0}, {1}", Lr.UserEmailorName, Lr.Password));

        Net_OnLoginRequest olr = new Net_OnLoginRequest();

        olr.Success       = 0;
        olr.Infomation    = "Everythig is good";
        olr.Username      = "******";
        olr.Discriminator = "0000";
        olr.Token         = "TOKEN";

        SendClient(recHostId, cnnId, olr);
    }
コード例 #8
0
    private void LoginRequest(int cnnId, int channelId, int recHostId, Net_LoginRequest lr)
    {
        // Debug.Log(string.Format("{0},{1}",lr.UsernameOrEmail,lr.Password));

        string             randomToken = Utility.GenerateRandom(4); //Change to 256 on production
        Model_Account      account     = db.LoginAccount(lr.UsernameOrEmail, lr.Password, cnnId, randomToken);
        Net_OnLoginRequest olr         = new Net_OnLoginRequest();

        if (account != null)
        {
            olr.Success     = 1;
            olr.Information = "You have been logged in as" + account.Username;

            olr.Username      = account.Username;
            olr.Discriminator = account.Discriminator;
            olr.Token         = account.Token;
            olr.ConnectionId  = cnnId;

            // Here

            // Prepare and send update message
            Net_UpdateFollow fu = new Net_UpdateFollow();
            fu.Follow = account.GetAccount();

            foreach (var f in db.FindAllFollowBy(account.Email))
            {
                if (f.ActiveConnection == 0)
                {
                    continue;
                }

                SendClient(recHostId, f.ActiveConnection, fu);
            }
        }
        else
        {
            olr.Success = 0;
        }


        SendClient(recHostId, cnnId, olr);
    }
コード例 #9
0
    private void OnLoginRequest(Net_OnLoginRequest olr)
    {
        if (olr.Success != 0)
        {
            Debug.Log("Connection issue, unable to connect.");
        }
        else
        {
            // Successfull login
            Debug.Log(string.Format("{0}, {1}", olr.Information, olr.Username));

            // Saves the data about the client
            self = new Account();
            self.ActiveConnection = olr.ConnectionId;
            self.Username         = olr.Username;
            self.Discriminator    = olr.Discriminator;

            ConnectionScene.Instance.GoToLobbyScene();
        }
    }
コード例 #10
0
ファイル: Server.cs プロジェクト: straelok/MinusStationServer
    private void LoginRequest(int connectionId, int channelId, int receiveHostId, Net_LoginRequest loginRequest)
    {
        string             randomToken    = Utility.GenerateRandom(256);
        Model_Account      modelAccount   = dataBase.LoginAccount(loginRequest.UsernameOrEmail, loginRequest.Password, connectionId, randomToken);
        Net_OnLoginRequest onLoginRequest = new Net_OnLoginRequest();

        if (modelAccount != null)
        {
            onLoginRequest.Success      = 1;
            onLoginRequest.Information  = "You've been logged in as " + modelAccount.Username;
            onLoginRequest.Username     = modelAccount.Username;
            onLoginRequest.Token        = randomToken;
            onLoginRequest.ConnectionId = connectionId;
        }
        else
        {
            onLoginRequest.Success     = 0;
            onLoginRequest.Information = "Fail login";
        }
        SendClient(receiveHostId, connectionId, onLoginRequest);
    }
コード例 #11
0
    private void OnLoginRequest(int connectionID, Net_OnLoginRequest olr)
    {
        if (olr.response == 0)
        {
            //not successful
            LoginScene.Instance.EnableInputs();
            LoginScene.Instance.ChangeAuthenticationText("Invalid Login");
        }
        else
        {
            //successful
            LoginScene.Instance.ChangeAuthenticationText("Successful Login");

            //load sector hub
            SceneManager.LoadScene("Sector_Hub", LoadSceneMode.Single);

            //get login token from message
            token = olr.token;

            //disconnect from login server
            ShutdownNetwork();

            //connect to sector server
            SERVER_IP = olr.sectorIP;
            PORT      = 27989; //TODO: change & delete me
            Connect();

            if (!isStarted)
            {
                //failed to connect to sector server
                Debug.Log("[Network Client]: Failed to connect to sector server.");
                return;
            }

            //*now connected to sector server*

            //request info to init player game object
            SendInitPlayerDataRequest(token);
        }
    }
コード例 #12
0
    private void OnLoginRequest(Net_OnLoginRequest olr)
    {
        LobbyScene.Instance.ChangeAuthenticationMessage(olr.Information);
        if (olr.Success != 1)
        {
            //Unable to login
            LobbyScene.Instance.EnableInputs();
        }
        else
        {
            //Successful Login
            // This is where we are going to save data about ourself
            Debug.Log(olr.Discriminator);
            self = new Account();
            self.ActiveConnection = olr.ConnectionId;
            self.Username         = olr.Username;
            self.Discriminator    = olr.Discriminator;

            token = olr.Token;

            UnityEngine.SceneManagement.SceneManager.LoadScene("LabHubScene");
        }
    }
コード例 #13
0
    private void LoginRequest(int connectionId, int channelId, int recievingHostId, Net_LoginRequest msg)
    {
        string             randomToken = Utility.GenerateRandom(64);
        AccountModel       dbAccount   = db.LoginAccount(msg.UsernameOrEmail, msg.Password, connectionId, randomToken);
        Net_OnLoginRequest rmsg        = new Net_OnLoginRequest();

        if (dbAccount != null)
        {
            rmsg.Success       = 1;
            rmsg.Information   = "You've been logged in as " + dbAccount.Username;
            rmsg.Username      = dbAccount.Username;
            rmsg.Discriminator = dbAccount.Discriminator;
            rmsg.Token         = randomToken;
            rmsg.ConnectionId  = connectionId;

            // Prepare and send our update message
            Net_FollowUpdate fu = new Net_FollowUpdate();
            fu.Follow = dbAccount.GetAccount();

            foreach (var f in db.FindAllFollowBy(dbAccount.Email))
            {
                if (f.ActiveConnection == 0)
                {
                    continue;
                }

                SendClient(recievingHostId, f.ActiveConnection, fu);
            }
        }
        else
        {
            rmsg.Success = 0;
        }

        SendClient(recievingHostId, connectionId, rmsg);
    }