private void btn_initTCP_Click(object sender, EventArgs e) { Network.ConnectionPort = Int32.Parse(txt_conPort.Text); tcp = Network.getNetwork(); txt_output.AppendText(tcp.tcp_initialiseServer()); btn_initTCP.Enabled = false; btn_listenTCP.Enabled = true; decoder = new Messages(ConnectedClients); }
public GameSession(Client player1, Client player2, Messages decoder) { noOfSessions++; gameID = noOfSessions; Server.gameSessions.Add(this); p1ready = p2ready = false; this.players = new List <Client>(); this.players.Add(player1); this.players.Add(player2); sessionDecoder = new GSMessages(this.players[0], this.players[1], gameID); tcp = Network.getNetwork(); //Assign first turn //0 = false - p2 turn //1= true - p1 turn Random random = new Random(); int turn = random.Next(2); p1Turn = Convert.ToBoolean(turn); //Generate Seed //populate List with available symbols List <String> icons = new List <string>() { "!", "!", "N", "N", ",", ",", "k", "k", "b", "b", "v", "v", "w", "w", "z", "z" }; //assign random icon to each label card string seed = ""; for (int i = 0; i < 16; i++) { int iconIndex = random.Next(icons.Count); seed = seed + icons[iconIndex]; icons.RemoveAt(iconIndex); } sessionDecoder.gameInitialisation(p1Turn, seed); }
public Messages() { this.tcp = Network.getNetwork(); }
public Messages(List <Client> connectedClients) { this.tcp = Network.getNetwork(); this.ConnectedClients = connectedClients; }