示例#1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form1       gui         = new Form1();
            ServerLogic serverLogic = new ServerLogic(gui);

            gui.serverLogic = serverLogic;
            Application.Run(gui);
        }
示例#2
0
        public void NotifyPlayMade()
        {
            if (Player1.CurrentMove != 0 && Player2.CurrentMove != 0)
            {
                switch (Player1.CurrentMove)
                {
                case (Move)1:
                    if (Player2.CurrentMove == (Move)1)
                    {
                    }
                    else if (Player2.CurrentMove == (Move)2)
                    {
                        Player2.Points++;
                    }
                    else if (Player2.CurrentMove == (Move)3)
                    {
                        Player1.Points++;
                    }
                    break;


                case (Move)2:
                    if (Player2.CurrentMove == (Move)1)
                    {
                        Player1.Points++;
                    }
                    else if (Player2.CurrentMove == (Move)2)
                    {
                    }
                    else if (Player2.CurrentMove == (Move)3)
                    {
                        Player2.Points++;
                    }
                    break;


                case (Move)3:
                    if (Player2.CurrentMove == (Move)1)
                    {
                        Player2.Points++;
                    }
                    else if (Player2.CurrentMove == (Move)2)
                    {
                        Player1.Points++;
                    }
                    else if (Player2.CurrentMove == (Move)3)
                    {
                    }
                    break;
                }

                string points1 = "points-" + Player1.Points.ToString() + "+" + Player2.Points.ToString() + "";
                string points2 = "points-" + Player2.Points.ToString() + "+" + Player1.Points.ToString() + "";
                Player1.SendMessageToClient(points1);
                Player2.SendMessageToClient(points2);

                if (Player1.Points > 2)
                {
                    Player1.SendMessageToClient("gamewon");
                    Player2.SendMessageToClient("gamelost");
                    ServerLogic.RemoveMatchFromList(this);
                }

                else if (Player2.Points > 2)
                {
                    Player2.SendMessageToClient("gamewon");
                    Player1.SendMessageToClient("gamelost");
                    ServerLogic.RemoveMatchFromList(this);
                }

                Player1.CurrentMove = 0;
                Player2.CurrentMove = 0;
            }
        }