Esempio n. 1
0
        //for console game start initialization
        public void Initialize(string ip)
        {
            matrix                 = new CoreMatrix();
            playWindow             = new PlayWindow(this, "Chess", new GuiMatrix(matrix));
            playWindow.FormClosed += new FormClosedEventHandler(PlayWindowClose);

            PlayerClock          = new System.Windows.Forms.Timer();
            PlayerClock.Tick    += new EventHandler(PlayerClock_Tick);
            PlayerClock.Interval = 1000;


            if (ip == "0.0.0.0")
            {
                StartServer();
            }
            else
            {
                StartClient(ip);
            }

            PlayerClock.Start();
            playWindow.Show();

            Debug.NewMessage("play window show");


            Application.Run();
        }
Esempio n. 2
0
        private void ReInitialize()
        {
            runColor               = FigureColor.WHITE;
            matrix                 = new CoreMatrix();
            playWindow             = new PlayWindow(this, "Chess", new GuiMatrix(matrix));
            playWindow.FormClosed += new FormClosedEventHandler(PlayWindowClose);

            inviteWindow           = new InviteWindow(pCollection);
            inviteWindow.OnChoice += new InviteWindow.OnChoiceEventHandler(InviteWindowMessageReceived);
            inviteWindow.Show();
        }
Esempio n. 3
0
        private void Start()
        {
            runColor               = FigureColor.WHITE;
            matrix                 = new CoreMatrix();
            playWindow             = new PlayWindow(this, "Chess", new GuiMatrix(matrix));
            playWindow.FormClosed += new FormClosedEventHandler(PlayWindowClose);

            PlayerClock          = new System.Windows.Forms.Timer();
            PlayerClock.Tick    += new EventHandler(PlayerClock_Tick);
            PlayerClock.Interval = 1000;
            endGameLock          = false;
            PlayerClock.Start();
            playWindow.Show();
        }
Esempio n. 4
0
        public void Initialize()
        {
            matrix                 = new CoreMatrix();
            playWindow             = new PlayWindow(this, "Chess", new GuiMatrix(matrix));
            playWindow.FormClosed += new FormClosedEventHandler(PlayWindowClose);

            PlayerClock          = new System.Windows.Forms.Timer();
            PlayerClock.Tick    += new EventHandler(PlayerClock_Tick);
            PlayerClock.Interval = 1000;

            inviteWindow           = new InviteWindow(pCollection);
            inviteWindow.OnChoice += new InviteWindow.OnChoiceEventHandler(InviteWindowMessageReceived);
            inviteWindow.Show();
            Application.Run();
        }
Esempio n. 5
0
        public Object Clone()
        {
            CoreMatrix clone = new CoreMatrix();

            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    clone.sMatrix[i, j] = sMatrix[i, j];
                }
            }

            clone.KingBlack = KingBlack;
            clone.KingWhite = KingWhite;

            return(clone);
        }
Esempio n. 6
0
        public GuiMatrix(CoreMatrix coreMatrix)
        {
            oldFocused = new Point(int.MaxValue, int.MaxValue);
            oldSelected = new Point(int.MaxValue, int.MaxValue);
            sMatrix = new Spot[8, 8];
            Position pos = new Position();
            for (pos.X = 0; !pos.errorFlag; pos.X++)
            {
                for (pos.Y = 0; !pos.errorFlag; pos.Y++)
                {
                    if ((pos.X + pos.Y) % 2 != 0)
                    {
                        try
                        {
                            sMatrix[pos.X, pos.Y] = new Spot(pos.X, pos.Y, Color.CadetBlue, coreMatrix.FigureAt(pos).image);
                        }
                        catch (System.NullReferenceException)
                        {
                            sMatrix[pos.X, pos.Y] = new Spot(pos.X, pos.Y, Color.CadetBlue, null);
                        }
                    }
                    else
                    {
                        try
                        {
                            sMatrix[pos.X, pos.Y] = new Spot(pos.X, pos.Y, Color.White, coreMatrix.FigureAt(pos).image);
                        }
                        catch (System.NullReferenceException)
                        {
                            sMatrix[pos.X, pos.Y] = new Spot(pos.X, pos.Y, Color.White, null);
                        }

                    }
                }
            }
        }
Esempio n. 7
0
		public Object Clone()
		{
			CoreMatrix clone = new CoreMatrix();

			for(int i=0; i<8; i++)
				for(int j=0; j<8; j++)
					clone.sMatrix[i, j] = sMatrix[i, j];

			clone.KingBlack = KingBlack;
			clone.KingWhite = KingWhite;

			return clone;
		}
Esempio n. 8
0
        public void Initialize()
        {
            matrix = new CoreMatrix();
            playWindow = new PlayWindow(this, "Chess", new GuiMatrix(matrix));
            playWindow.FormClosed += new FormClosedEventHandler(PlayWindowClose);

            PlayerClock = new System.Windows.Forms.Timer();
            PlayerClock.Tick += new EventHandler(PlayerClock_Tick);
            PlayerClock.Interval = 1000;

            inviteWindow = new InviteWindow(pCollection);
            inviteWindow.OnChoice += new InviteWindow.OnChoiceEventHandler(InviteWindowMessageReceived);
            inviteWindow.Show();
            Application.Run();
        }
Esempio n. 9
0
        private void ReInitialize()
        {
            runColor = FigureColor.WHITE;
            matrix = new CoreMatrix();
            playWindow = new PlayWindow(this, "Chess", new GuiMatrix(matrix));
            playWindow.FormClosed += new FormClosedEventHandler(PlayWindowClose);

            inviteWindow = new InviteWindow(pCollection);
            inviteWindow.OnChoice += new InviteWindow.OnChoiceEventHandler(InviteWindowMessageReceived);
            inviteWindow.Show();
        }
Esempio n. 10
0
        //for console game start initialization
        public void Initialize(string ip)
        {
            matrix = new CoreMatrix();
            playWindow = new PlayWindow(this, "Chess", new GuiMatrix(matrix));
            playWindow.FormClosed += new FormClosedEventHandler(PlayWindowClose);

            PlayerClock = new System.Windows.Forms.Timer();
            PlayerClock.Tick += new EventHandler(PlayerClock_Tick);
            PlayerClock.Interval = 1000;

            if (ip == "0.0.0.0")
                StartServer();
            else
                StartClient(ip);

            PlayerClock.Start();
            playWindow.Show();

            Debug.NewMessage("play window show");

            Application.Run();
        }