Пример #1
0
        void clientStarter2_Started(object sender)
        {
            if(opponentData2 != null)
              {
            PlayerInfo[] players = new PlayerInfo[] { clientPlayer2, clientPlayer1, serverPlayer };
            DeckItem[] decks = new DeckItem[] { clientDeck2, clientDeck1, serverDeck };

            StartGame(Enumerable.Repeat(new PlayerConnection() { NetClient = opponentData2.Channel }, 1).ToList(), players.ToList(), decks.ToList(),
              new string[] { string.Empty, string.Empty, string.Empty}, GameType.Client, false);
              }
        }
Пример #2
0
        void listener_PlayerConnected(object sender, ServiceNetClient client, PlayerAccountData connectedPlayer)
        {
            if(++playerCounter < 2)
            return;

              if(InvokeRequired)
            Invoke(new Action<object, ServiceNetClient, PlayerAccountData>(listener_PlayerConnected), sender, client, connectedPlayer);
              else
              {
            ServerListener listener = (ServerListener)sender;
            if(listener.PlayerConnections != null)
            {
              listener.Dispose();
              clientStarter1.Start(null);
              clientStarter2.Start(null);

              PlayerInfo[] players = new PlayerInfo[] { serverPlayer, clientPlayer2, clientPlayer1 };
              DeckItem[] decks = new DeckItem[] { serverDeck, clientDeck2, clientDeck1 };
              Thread.Sleep(1000);
              StartGame(listener.PlayerConnections, players.ToList(), decks.ToList(),
            new string[] { string.Empty, string.Empty, string.Empty }, GameType.Host, false);
            }
              }
        }
Пример #3
0
        private void btnStartSolitaire_Click(object sender, EventArgs e)
        {
            PlayerInfo[] players = new PlayerInfo[] { serverPlayer, clientPlayer2, clientPlayer1 };
              DeckItem[] decks = new DeckItem[] { serverDeck, clientDeck2, clientDeck1 };

              StartGame(new List<PlayerConnection>(), players.ToList(), decks.ToList(),
            new string[] { string.Empty, string.Empty, string.Empty }, GameType.Solitaire, true);
        }