Exemple #1
0
    void HandleReturnedMessage(int packetNum, byte[] data)
    {
        //Send  the Message for the Sever back to the Unity Console
        int packetnum;

        FLI.ByteBuffer buffer = new FLI.ByteBuffer();
        buffer.WriteBytes(data);
        packetnum = buffer.ReadInt();
        String mes = buffer.ReadString();

        //Send to Unity console for now
        Debug.Log(mes);
        alert.text = mes;

        Debug.Log("Loading...");
        Thread.Sleep(1);



        LoginCtrl lc = new LoginCtrl();

        if (mes == "Access Granted!")
        {
            lc.loadMainMenu();
        }
    }
 public void SendDataToServer(byte[] data)
 {
     //Using custom FourLeafInteractive library as a buffer
     FLI.ByteBuffer buffer = new FLI.ByteBuffer();
     buffer.WriteBytes(data);
     network.myStream.Write(buffer.toArray(), 0, buffer.toArray().Length);
     buffer = null;
 }
    //On Click Send to Server
    //Sends new Account Info to Database
    public void SendNewAcc()
    {
        FLI.ByteBuffer buffer = new FLI.ByteBuffer();
        buffer.WriteInt(1);
        buffer.WriteString(username.text);
        buffer.WriteString(password.text);

        SendDataToServer(buffer.toArray());
        buffer = null;
    }
    //On click send to server
    //Sending Login Data to the Databse
    public void SendLogin()
    {
        FLI.ByteBuffer buffer = new FLI.ByteBuffer();
        //Changed to second packet
        buffer.WriteInt(2);
        buffer.WriteString(userLogin.text);
        buffer.WriteString(passLogin.text);
        SendDataToServer(buffer.toArray());

        setUsername(userLogin.text);

        buffer = null;
    }
Exemple #5
0
    public void HandleData(byte[] data)
    {
        int packetnum;

        FLI.ByteBuffer buffer = new FLI.ByteBuffer();
        buffer.WriteBytes(data);
        packetnum = buffer.ReadInt();
        buffer    = null;
        if (packetnum == 0)
        {
            return;
        }

        HandleMessages(packetnum, data);
    }