Example #1
0
 public void SendDataTo(int index, byte[] data)
 {
     KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
     buffer.WriteBytes(data);
     Network.Clients[index].myStream.BeginWrite(buffer.ToArray(), 0, buffer.ToArray().Length, null, null);
     buffer = null;
 }
 public void SendDataToServer(byte[] data)
 {
     KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
     buffer.WriteBytes(data);
     network.myStream.Write(buffer.ToArray(), 0, buffer.ToArray().Length);
     buffer = null;
 }
 public void SendCancelMatch()
 {
     KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
     buffer.WriteInteger(4);
     SendDataToServer(buffer.ToArray());
     buffer = null;
 }
    public void SendAccount()
    {
        KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
        buffer.WriteInteger(1);

        if (_username.text == string.Empty)
        {
            Debug.Log("Please insert a username.");
            return;
        }

        if (_password.text == string.Empty)
        {
            Debug.Log("Please insert a password.");
            return;
        }

        if (_password2.text != _password.text)
        {
            Debug.Log("Your password do not match.");
            return;
        }

        buffer.WriteString(_username.text);
        buffer.WriteString(_password.text);

        SendDataToServer(buffer.ToArray());
        buffer = null;
    }
Example #5
0
 public  void SendDisconnect(int index,int connected)
 {
     KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
     buffer.WriteInteger((int)Enumerations.ServerPackets.SPlayerDisconnect);
     buffer.WriteInteger(connected);
     buffer.WriteInteger(index);
     SendDataToAll(buffer.ToArray());
 }
Example #6
0
        public void SendAlertMsg(int index, string alertMsg)
        {
            KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
            buffer.WriteInteger((int)Enumerations.ServerPackets.SAlertMsg);
            buffer.WriteString(alertMsg);

            SendDataTo(index, buffer.ToArray());
        }
Example #7
0
 public void SendRefreshBar(int index)
 {
     KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
     buffer.WriteInteger(4);
     buffer.WriteInteger(Network.TempPlayer[index].Castbar);
     SendDataTo(index, buffer.ToArray());
     buffer = null;
 }
 public void SendDisconnect()
 {
     KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
     buffer.WriteInteger((int)Enumerations.ClientPackets.CHandleDisconnect);
     buffer.WriteInteger(_index);
     buffer.WriteInteger(_connected);
     SendDataToServer(buffer.ToArray());
     buffer = null;
 }
 public void SendLogin()
 {
     KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
     buffer.WriteInteger((int)Enumerations.ClientPackets.CHandleLogin);
     buffer.WriteString(_loginUser.text);
     buffer.WriteString(_loginPass.text);
     SendDataToServer(buffer.ToArray());
     buffer = null;
 }
 public void SendNewAccount()
 {
     KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
     buffer.WriteInteger((int)Enumerations.ClientPackets.CNewAccount);
     buffer.WriteString(_username.text);
     buffer.WriteString(_password.text);
     SendDataToServer(buffer.ToArray());
     buffer = null;
 }
Example #11
0
        public void SendAlertMsg(int index, string alertMsg)
        {
            KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();

            buffer.WriteInteger(1);
            buffer.WriteString(alertMsg);

            SendDataTo(index, buffer.ToArray());
        }
    public void SendLookingForMatch()
    {
        KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
        buffer.WriteInteger(3);
        SendDataToServer(buffer.ToArray());
        LFG.SetActive(true);
        inMenu.SetActive(false);

        buffer = null;
    }
    public void SendNewAccount()
    {
        KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();

        buffer.WriteInteger(1);
        buffer.WriteString(_username.text);
        buffer.WriteString(_password.text);

        SendDataToServer(buffer.ToArray());
        buffer = null;
    }
    public void SendLogin()
    {
        KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();

        buffer.WriteInteger(2);
        buffer.WriteString(_loginUser.text);
        buffer.WriteString(_loginPass.text);

        SendDataToServer(buffer.ToArray());
        buffer = null;
    }
Example #15
0
        public void SendMatchMaking(int room)
        {
            KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
            buffer.WriteInteger(3);
            buffer.WriteString(Network.Player[RoomInstance._room[room].player[0]].Username);
            buffer.WriteString(Network.Player[RoomInstance._room[room].player[1]].Username);
            SendDataToRoom(room, buffer.ToArray());
            buffer = null;

            Network.TempPlayer[RoomInstance._room[room].player[0]].inMatch = true;
            Network.TempPlayer[RoomInstance._room[room].player[1]].inMatch = true;
        }
Example #16
0
        public void SendIngame(int index)
        {
            KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
            buffer.WriteInteger(1);

            //Player Data
            buffer.WriteString(Network.Player[index].Username);
            buffer.WriteString(Network.Player[index].Password);
            buffer.WriteInteger(Network.Player[index].Level);
            buffer.WriteByte(Network.Player[index].Access);
            buffer.WriteByte(Network.Player[index].FirstTime);

            SendDataTo(index, buffer.ToArray());
            buffer = null;
        }
Example #17
0
        public byte[] PlayerData(int index)
        {
            KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();

            // prevent out of bounds
            if (index > Constants.MAX_PLAYERS)
                return null;

            buffer.WriteInteger((int)Enumerations.ServerPackets.SPlayerData);
            buffer.WriteInteger(index);
            buffer.WriteFloat(Globals.general.GetPlayerX(index));
            buffer.WriteFloat(Globals.general.GetPlayerY(index));
            buffer.WriteFloat(Globals.general.GetPlayerZ(index));

            buffer.WriteString(Globals.player[index].Username);
            return buffer.ToArray();
        }
    public void SendMovement(float x, float y, float z, float rotX, float rotY, float rotZ, float rotW)
    {
        KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
        buffer.WriteInteger((int)Enumerations.ClientPackets.CHandleMovement);

        // Send position and rotation

        buffer.WriteFloat(x);
        buffer.WriteFloat(y);
        buffer.WriteFloat(z);

        buffer.WriteFloat(rotX);
        buffer.WriteFloat(rotY);
        buffer.WriteFloat(rotZ);
        buffer.WriteFloat(rotW);

        SendDataToServer(buffer.ToArray());
        buffer = null;
    }
Example #19
0
        public void SendPlayerMovement(int index, float x, float y, float z, float rotX, float rotY, float rotZ, float rotW)
        {
            KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
            buffer.WriteInteger((int)Enumerations.ServerPackets.SPlayersMovement);

            //Player Info

            buffer.WriteInteger(index);

            // Player Position

            buffer.WriteFloat(x);
            buffer.WriteFloat(y);
            buffer.WriteFloat(z);

            buffer.WriteFloat(rotX);
            buffer.WriteFloat(rotY);
            buffer.WriteFloat(rotZ);
            buffer.WriteFloat(rotW);

            SendDataToAllBut(index, buffer.ToArray());
        }
    public void SendLogin()
    {
        KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
        buffer.WriteInteger(2);

        if (_loginUsername.text == string.Empty)
        {
            Debug.Log("Please insert a username.");
            return;
        }

        if (_loginPassword.text == string.Empty)
        {
            Debug.Log("Please insert a password.");
            return;
        }

        buffer.WriteString(_loginUsername.text);
        buffer.WriteString(_loginPassword.text);

        SendDataToServer(buffer.ToArray());
        buffer = null;
    }