Пример #1
0
 public Roomslist(Player player, Socket socket)
 {
     Control.CheckForIllegalCrossThreadCalls = false;
     InitializeComponent();
     Player = player;
     Player.PlayerSocket = socket;
     recBuffer           = new byte[4048];
     sendBuffer          = new byte[2048];
     thisFrm             = this;
 }
Пример #2
0
 public Roomslist(string playerName, string PId, Socket socket)
 {
     Control.CheckForIllegalCrossThreadCalls = false;
     InitializeComponent();
     PlayerName   = playerName;
     PlayerId     = PId;
     PlayerSocket = socket;
     recBuffer    = new byte[2048];
     sendBuffer   = new byte[2048];
     thisFrm      = this;
 }
Пример #3
0
 public Game(Player player, Room room, Roomslist parentFrm)
 {
     InitializeComponent();
     InGamePlayers = new List <Player>();
     Watchers      = new List <Player>();
     Owner         = player;
     InGamePlayers.Add(Owner);
     Room       = room;
     parentForm = parentFrm;
     recBuffer  = new byte[2048];
     sendBuffer = new byte[2048];
 }
Пример #4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            // checking whether the user entered the data properly or not
            if (!string.IsNullOrEmpty(txtName.Text.Trim()))
            {
                // connecting to the main server
                string name     = txtName.Text;
                string playerId = Guid.NewGuid().ToString("N");
                client_socket.BeginConnect(new IPEndPoint(serverIP, SERVER_PORT), Connecting_Callback, name + "," + playerId);

                this.Hide();
                // showing the next form
                Roomslist roomslist = new Roomslist(name, playerId, client_socket);
                roomslist.Show();
            }
        }