Beispiel #1
0
        /// <summary>
        /// we hebben genoeg spelers en alle informatie die we nodig hebben, we gaan starten.
        /// </summary>
        /// <param name="tcpClient">De client.</param>
        /// <param name="oX">Het Spel.</param>
        public void Start(TcpClient tcpClient, GameOX oX)
        {
            string bord;
            string msg = string.Empty;

            // maak een bord, met de jusite dimension
            Bord huidigeBord = new Bord(oX.Dimension);

            huidigeBord.ResetBord();

            bord = huidigeBord.TekenBord();
            if (oX.TcpClients.Count == 1)
            {
                msg = string.Format("{0}&{1}", EventHelper.CreateEvents(Events.SpelerGestart), bord);
                this.ProcessStream(msg, tcpClient);
            }
            else
            {
                // hoe bepaal je wie mag beginnen?
                foreach (Speler speler in this.Spelers)
                {
                    if (speler.TcpClient == tcpClient)
                    {
                        msg = string.Format("{0}&{1}", EventHelper.CreateWachtenOpEenAndereDeelnemenEvent(), bord);
                        this.ProcessStream(msg, speler.TcpClient);
                    }
                    else
                    {
                        msg = string.Format("{0}&{1}", EventHelper.CreateEvents(Events.SpelerGestart), bord);
                        this.ProcessStream(msg, speler.TcpClient);
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Als de spelers willen een nieuw rondje doen.
        /// </summary>
        /// <param name="tcpClient">Deze client.</param>
        /// <param name="oX">Het Spel.</param>
        public void StartNieuwRondje(TcpClient tcpClient, GameOX oX)
        {
            string bord;
            string msg        = string.Empty;
            Bord   huidigBord = oX.bords.First();

            huidigBord.ResetBord();
            bord = huidigBord.TekenBord();

            foreach (Speler speler in this.Spelers)
            {
                if (speler.TcpClient == tcpClient)
                {
                    msg = string.Format("{0}&{1}", EventHelper.CreateEvents(Events.YourTurn), bord);

                    this.ProcessStream(msg, speler.TcpClient);
                }
            }
        }