public Form1(bool srv, Player p, Point loc, Form2 f2) { server = srv; InitializeComponent(); plData = new playersData(); F2 = f2; buttonsLook(p.getIpAddress(), p.PlayerID); this.Show(); this.StartPosition = FormStartPosition.Manual; this.Location = loc; pl = p; plData.AddToPlayerList(p); if (server) { thread = new Thread(new ThreadStart(serverStart1)); // wyrzucamy serwer do innego wątku } else { sendMsg = preparesMSG(msgType.addPlayer); thread = new Thread(new ThreadStart(clientStart1)); // wyrzucamy serwer do innego wątku } thread.Start(); // waitForPushGame.WaitOne(); // czekamy aż spełnione zostaną warunki // runForm3(); }
private void MSGAddPlayers(PlayerL ppppp2)//updatuje playersData o otrzymaną listę graczy { if (ppppp2 != null) { if (ppppp2.lista != null) { if (ppppp2.lista.Count > 0) { foreach (Player p in ppppp2.lista) { if (p.iPadd != pl.iPadd) { //trzeba zrobic logike dodawania plData.AddToPlayerList(p); } } // updatePlayerList2(ppp.lista); } } } }
public void addPlayer(Player pl) { playersList.AddToPlayerList(pl); }
public Game(Player pl) { playersList = new playersData(); playersList.AddToPlayerList(pl); gameIP = pl.getIpAddress(); }