public static void SendLoginGirisCevap(int connectionID, int cevap) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Int_Yaz((int)ServerPackets.SLogin_Giris_Cevap); //Paket Numarası buffer.Int_Yaz(cevap); ClientManager.SendDataTo(connectionID, buffer.ToArray()); buffer.Dispose(); }
public static void SendDataTo(int connectionID, byte[] data) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Int_Yaz((data.GetUpperBound(0) - data.GetLowerBound(0)) + 1); buffer.Bytes_Yaz(data); Sabitler.bagli_client[connectionID].stream.BeginWrite(buffer.ToArray(), 0, buffer.ToArray().Length, null, null); buffer.Dispose(); }
public static void SendOyuncuOyundanCikti(int connectionID) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Int_Yaz((int)ServerPackets.SOyuncuOyundanCikti); //Paket Numarası buffer.Int_Yaz(connectionID); ClientManager.SendDataToInGameAll(connectionID, buffer.ToArray()); buffer.Dispose(); }
public static void SendHosGeldinMesaji(int connectionID) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Int_Yaz((int)ServerPackets.SHosGeldinMesaji); // Paket numarası buffer.Int_Yaz(connectionID); //ConnectionID yani port numarası buffer.String_Yaz("Merhaba, Sunucuya Hos Geldin.."); ClientManager.SendDataTo(connectionID, buffer.ToArray()); buffer.Dispose(); }
public static void Sendmesaj(int connectionID, string msj) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Int_Yaz((int)ServerPackets.SMesaj); // Paket numarası buffer.Int_Yaz(connectionID); //ConnectionID yani port numarası buffer.String_Yaz(connectionID.ToString() + " : " + msj); ClientManager.SendDataTo(connectionID, buffer.ToArray()); buffer.Dispose(); }
public static void SendAnimGonder(int connectionID, string animasyon_kimde_oynayacak, string anim_adi, int akitflik) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Int_Yaz((int)ServerPackets.SAnim_Gonder); //Paket Numarası buffer.Int_Yaz(connectionID); buffer.String_Yaz(animasyon_kimde_oynayacak); buffer.String_Yaz(anim_adi); buffer.Int_Yaz(akitflik); ClientManager.SendDataToInGameAll(connectionID, buffer.ToArray()); buffer.Dispose(); }
public static void SendKendiBilgilerimiOyuncularaGonder(int connectionID) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Int_Yaz((int)ServerPackets.SKendiBilgilerimiOyuncularaGonder); //Paket Numarası buffer.Int_Yaz(connectionID); // ConnectionID Numarası Yani Port Numarası,,, buffer.Float_Yaz(Sabitler.bagli_client[connectionID].xCord); buffer.Float_Yaz(Sabitler.bagli_client[connectionID].yCord); buffer.Float_Yaz(Sabitler.bagli_client[connectionID].zCord); ClientManager.SendDataToInGameAll(connectionID, buffer.ToArray()); buffer.Dispose(); }
public static void HandleMerhabaServer(int connectionID, byte[] data) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Bytes_Yaz(data); int packetID = buffer.Int_Oku(); string msg = buffer.String_Oku(); buffer.Dispose(); Yazi.Gelen_Mesaj(connectionID + " " + msg); DataSender.SendHodsgeldinMesaji(connectionID); }
private static void HandleDataPackets(int connetiocID, byte[] data) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Bytes_Yaz(data); int packetID = buffer.Int_Oku(); buffer.Dispose(); if (Packets.TryGetValue(packetID, out Packet packet)) { packet.Invoke(connetiocID, data); } }
public static void HandleMesajal(int connectionID, byte[] data) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Bytes_Yaz(data); int packetID = buffer.Int_Oku(); string msg2 = buffer.String_Oku(); Yazi.Gelen_Mesaj(connectionID + " " + msg2); DataSender.Sendmesaj(connectionID, msg2); buffer.Dispose(); }
public static void Handle_Anim_Al(int connectionID, byte[] data) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Bytes_Yaz(data); int packetID = buffer.Int_Oku(); string animasyon_kimde_oynayacak = buffer.String_Oku(); string anim_Adi = buffer.String_Oku(); int akiflik = buffer.Int_Oku(); DataSender.SendAnimGonder(connectionID, animasyon_kimde_oynayacak, anim_Adi, akiflik); buffer.Dispose(); }
public static void SendHodsgeldinMesaji(int connectionID) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Int_Yaz((int)ServerPackets.SHosgeldinMesaji); //Paket Numarası buffer.Int_Yaz(connectionID); // ConnectionID Numarası Yani Port Numarası,,, buffer.String_Yaz("Merhaba , Sunucuya Hoş Geldin.."); buffer.Float_Yaz(Sabitler.bagli_client[connectionID].xCord); buffer.Float_Yaz(Sabitler.bagli_client[connectionID].yCord); buffer.Float_Yaz(Sabitler.bagli_client[connectionID].zCord); ClientManager.SendDataTo(connectionID, buffer.ToArray()); SendOyundakiler(connectionID); SendKendiBilgilerimiOyuncularaGonder(connectionID); buffer.Dispose(); Sabitler.bagli_client[connectionID].oyunda_mi = true; }
public static void SendOyundakiler(int connectionID) { foreach (Client oyuncu in Sabitler.bagli_client.Values) { if (oyuncu != null && oyuncu.oyunda_mi == true && oyuncu.connectionID != connectionID) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Int_Yaz((int)ServerPackets.SOyundakiler); //Paket Numarası buffer.Int_Yaz(oyuncu.connectionID); // ConnectionID Numarası Yani Port Numarası,,, buffer.Float_Yaz(oyuncu.xCord); buffer.Float_Yaz(oyuncu.yCord); buffer.Float_Yaz(oyuncu.zCord); ClientManager.SendDataTo(connectionID, buffer.ToArray()); buffer.Dispose(); } } }
public static void SendDataToAll(int connectionID, byte[] data) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Int_Yaz((data.GetUpperBound(0) - data.GetLowerBound(0)) + 1); buffer.Bytes_Yaz(data); foreach (Client oyuncu in Sabitler.bagli_client.Values) { if (oyuncu != null && oyuncu.connectionID != connectionID) { Sabitler.bagli_client[oyuncu.connectionID].stream.BeginWrite(buffer.ToArray(), 0, buffer.ToArray().Length, null, null); } } buffer.Dispose(); }
public static void SendDataToAll(int connectionId, byte[] data) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Int_Yaz(data.GetUpperBound(0) - data.GetLowerBound(0) + 1); buffer.Bytes_Yaz(data); foreach (var player in Sabitler.bagliClient.Values) { if (player != null && player.connectionId != connectionId) { Sabitler.bagliClient[player.connectionId].stream .BeginWrite(buffer.ToArray(), 0, buffer.ToArray().Length, null, null); } } buffer.Dispose(); }
public static void SendKordinatBilgileriniGonder(int connectionID, float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float rotW) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Int_Yaz((int)ServerPackets.SKordinatBilgileriniGonder); //Paket Numarası buffer.Int_Yaz(connectionID); // ConnectionID Numarası Yani Port Numarası,,, buffer.Float_Yaz(posX); buffer.Float_Yaz(posY); buffer.Float_Yaz(posZ); buffer.Float_Yaz(rotX); buffer.Float_Yaz(rotY); buffer.Float_Yaz(rotZ); buffer.Float_Yaz(rotW); ClientManager.SendDataToInGameAll(connectionID, buffer.ToArray()); buffer.Dispose(); }
public static void HandleLoginGiris(int connectionID, byte[] data) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Bytes_Yaz(data); int packetID = buffer.Int_Oku(); string kullanici_adi = buffer.String_Oku(); string sifre = buffer.String_Oku(); ArrayList Ara = new ArrayList(); Ara.Add("kullanici_adi='" + kullanici_adi + "'"); Ara.Add("sifre='" + sifre + "'"); MySqlCommand cmd = Sabitler.Mysql_Data.MySql_Veri_Cek(Sabitler.bagli_client[connectionID].baglanti, null, "Select * From tum_kullanicilar", Ara); if (cmd != null) { MySqlDataReader oku = cmd.ExecuteReader(); int id = 0; while (oku.Read()) { ////// id = (int)oku["id"]; Yazi.Log_yaz("Bağlanan Kullanıcın Kullancı ID si : " + id.ToString()); } oku.Close(); /// DataSender.SendLoginGirisCevap(connectionID, 1); } else { DataSender.SendLoginGirisCevap(connectionID, 0); } buffer.Dispose(); }
public static void HandleCordinatBilgileriniGonder(int connectionID, byte[] data) { Kaan_ByteBuffer buffer = new Kaan_ByteBuffer(); buffer.Bytes_Yaz(data); int packetID = buffer.Int_Oku(); //Oyuncu Pozisyonları float posx = buffer.Float_Oku(); float posy = buffer.Float_Oku(); float posz = buffer.Float_Oku(); //Oyuncu Rotasyonlarımız float rotx = buffer.Float_Oku(); float roty = buffer.Float_Oku(); float rotz = buffer.Float_Oku(); float rotw = buffer.Float_Oku(); Sabitler.bagli_client[connectionID].xCord = posx; Sabitler.bagli_client[connectionID].yCord = posy; Sabitler.bagli_client[connectionID].zCord = posz; DataSender.SendKordinatBilgileriniGonder(connectionID, posx, posy, posz, rotx, roty, rotz, rotw); buffer.Dispose(); }