Esempio n. 1
0
        public ChessGame(ChessControl parent, Mobile owner, Rectangle2D bounds, int z)
        {
            m_Parent = parent;
            m_Bounds = bounds;
            m_Z      = z;

            m_BlackOwner = Utility.RandomBool();

            if (m_BlackOwner)
            {
                m_Black = owner;
            }
            else
            {
                m_White = owner;
            }

            m_AllowSpectators = m_Parent.AllowSpectators;

            // Owner.SendGump( new StartGameGump( Owner, this, true, m_AllowSpectators ) );
            Owner.SendGump(new ChessSetGump(Owner, this, true, m_AllowSpectators));

            // Owner.Target = new ChessTarget( this, Owner, "Please select your partner...",
            //	new ChessTargetCallback( ChooseOpponent ) );

            EventSink.Login        += OnPlayerLogin;
            EventSink.Disconnected += OnPlayerDisconnected;

            m_Timer = new ChessTimer(this);
        }
Esempio n. 2
0
		public ChessGame( ChessControl parent, Mobile owner, Rectangle2D bounds, int z )
		{
			m_Parent = parent;
			m_Bounds = bounds;
			m_Z = z;

			m_BlackOwner = Utility.RandomBool();

			if ( m_BlackOwner )
				m_Black = owner;
			else
				m_White = owner;

			m_AllowSpectators = m_Parent.AllowSpectators;

			// Owner.SendGump( new StartGameGump( Owner, this, true, m_AllowSpectators ) );
			Owner.SendGump( new ChessSetGump( Owner, this, true, m_AllowSpectators ) );

			// Owner.Target = new ChessTarget( this, Owner, "Please select your partner...",
			//	new ChessTargetCallback( ChooseOpponent ) );

			EventSink.Login += OnPlayerLogin;
			EventSink.Disconnected += OnPlayerDisconnected;

			m_Timer = new ChessTimer( this );
		}
Esempio n. 3
0
        private void BuildBoard(ChessControl chess, Point3D p, Map map)
        {
            chess.m_BoardHeight        = p.Z + 5;      // Placing stairs on the specified point
            chess.BoardNorthWestCorner = new Point2D(p.X, p.Y);

            #region Board Tiles

            int stairNW = 1909;
            int stairSE = 1910;
            int stairSW = 1911;
            int stairNE = 1912;
            int stairS  = 1901;
            int stairE  = 1902;
            int stairN  = 1903;
            int stairW  = 1904;
            int black   = 1295; //hue = 2406;
            int white   = 1298; //hue = 2101;

            #endregion

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    int tile = 0;

                    if (x % 2 == 0)
                    {
                        if (y % 2 == 0)
                        {
                            tile = white;                            //swapped
                        }
                        else
                        {
                            tile = black;
                        }
                    }
                    else
                    {
                        if (y % 2 == 0)
                        {
                            tile = black;                            //swapped
                        }
                        else
                        {
                            tile = white;
                        }
                    }

                    if (chess.Orientation == BoardOrientation.EastWest)                       // Invert tiles if the orientation is EW
                    {
                        if (tile == black)
                        {
                            tile = white;                            //swapped
                        }
                        else
                        {
                            tile = black;
                        }
                    }

                    for (int kx = 0; kx < chess.m_SquareWidth; kx++)
                    {
                        for (int ky = 0; ky < chess.m_SquareWidth; ky++)
                        {
                            Server.Items.Static s = new Server.Items.Static(tile);
                            if (tile == black)
                            {
                                s.Hue = m_BoardBlackHue;
                                m_BoardBlackTiles.Add(s);
                            }
                            else if (tile == white)
                            {
                                s.Hue = m_BoardWhiteHue;
                                m_BoardWhiteTiles.Add(s);
                            }
                            Point3D target = new Point3D(p.X + x * chess.m_SquareWidth + kx, p.Y + y * chess.m_SquareWidth + ky, chess.m_BoardHeight);
                            s.MoveToWorld(target, map);
                        }
                    }
                }
            }

            Point3D nw = new Point3D(p.X - 1, p.Y - 1, p.Z);
            Point3D ne = new Point3D(p.X + 8 * chess.m_SquareWidth, p.Y - 1, p.Z);
            Point3D se = new Point3D(p.X + 8 * chess.m_SquareWidth, p.Y + 8 * chess.m_SquareWidth, p.Z);
            Point3D sw = new Point3D(p.X - 1, p.Y + 8 * chess.m_SquareWidth, p.Z);

            Server.Items.Static NW = new Server.Items.Static(stairNW)
            {
                Hue = m_BoardStairsHue
            };
            m_BoardStairsTiles.Add(NW);
            NW.MoveToWorld(nw, map);

            Server.Items.Static NE = new Server.Items.Static(stairNE)
            {
                Hue = m_BoardStairsHue
            };
            m_BoardStairsTiles.Add(NE);
            NE.MoveToWorld(ne, map);

            Server.Items.Static SE = new Server.Items.Static(stairSE)
            {
                Hue = m_BoardStairsHue
            };
            m_BoardStairsTiles.Add(SE);
            SE.MoveToWorld(se, map);

            Server.Items.Static SW = new Server.Items.Static(stairSW)
            {
                Hue = m_BoardStairsHue
            };
            m_BoardStairsTiles.Add(SW);
            SW.MoveToWorld(sw, map);

            for (int x = 0; x < 8 * chess.m_SquareWidth; x++)
            {
                Point3D top    = new Point3D(p.X + x, p.Y - 1, p.Z);
                Point3D bottom = new Point3D(p.X + x, p.Y + 8 * chess.m_SquareWidth, p.Z);
                Point3D left   = new Point3D(p.X - 1, p.Y + x, p.Z);
                Point3D right  = new Point3D(p.X + chess.m_SquareWidth * 8, p.Y + x, p.Z);

                Server.Items.Static N = new Server.Items.Static(stairN)
                {
                    Hue = m_BoardStairsHue
                };
                m_BoardStairsTiles.Add(N);
                N.MoveToWorld(top, map);

                Server.Items.Static S = new Server.Items.Static(stairS)
                {
                    Hue = m_BoardStairsHue
                };
                m_BoardStairsTiles.Add(S);
                S.MoveToWorld(bottom, map);

                Server.Items.Static W = new Server.Items.Static(stairW)
                {
                    Hue = m_BoardStairsHue
                };
                m_BoardStairsTiles.Add(W);
                W.MoveToWorld(left, map);

                Server.Items.Static E = new Server.Items.Static(stairE)
                {
                    Hue = m_BoardStairsHue
                };
                m_BoardStairsTiles.Add(E);
                E.MoveToWorld(right, map);
            }
        }
Esempio n. 4
0
        private static void BuildBoard(ChessControl chess, Point3D p, Map map)
        {
            chess.m_BoardHeight        = p.Z + 5;      // Placing stairs on the specified point
            chess.BoardNorthWestCorner = new Point2D(p.X, p.Y);

            #region Board Tiles

            int stairNW = 1909;
            int stairSE = 1910;
            int stairSW = 1911;
            int stairNE = 1912;
            int stairS  = 1901;
            int stairE  = 1902;
            int stairN  = 1903;
            int stairW  = 1904;
            int black   = 1295;
            int white   = 1298;

            #endregion

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    int tile = 0;

                    if (x % 2 == 0)
                    {
                        if (y % 2 == 0)
                        {
                            tile = black;
                        }
                        else
                        {
                            tile = white;
                        }
                    }
                    else
                    {
                        if (y % 2 == 0)
                        {
                            tile = white;
                        }
                        else
                        {
                            tile = black;
                        }
                    }

                    if (chess.Orientation == BoardOrientation.EastWest)                       // Invert tiles if the orientation is EW
                    {
                        if (tile == white)
                        {
                            tile = black;
                        }
                        else
                        {
                            tile = white;
                        }
                    }

                    for (int kx = 0; kx < chess.m_SquareWidth; kx++)
                    {
                        for (int ky = 0; ky < chess.m_SquareWidth; ky++)
                        {
                            Static  s      = new Static(tile);
                            Point3D target = new Point3D(p.X + x * chess.m_SquareWidth + kx, p.Y + y * chess.m_SquareWidth + ky, chess.m_BoardHeight);
                            s.MoveToWorld(target, map);
                        }
                    }
                }
            }

            Point3D nw = new Point3D(p.X - 1, p.Y - 1, p.Z);
            Point3D ne = new Point3D(p.X + 8 * chess.m_SquareWidth, p.Y - 1, p.Z);
            Point3D se = new Point3D(p.X + 8 * chess.m_SquareWidth, p.Y + 8 * chess.m_SquareWidth, p.Z);
            Point3D sw = new Point3D(p.X - 1, p.Y + 8 * chess.m_SquareWidth, p.Z);

            new Static(stairNW).MoveToWorld(nw, map);
            new Static(stairNE).MoveToWorld(ne, map);
            new Static(stairSE).MoveToWorld(se, map);
            new Static(stairSW).MoveToWorld(sw, map);

            for (int x = 0; x < 8 * chess.m_SquareWidth; x++)
            {
                Point3D top    = new Point3D(p.X + x, p.Y - 1, p.Z);
                Point3D bottom = new Point3D(p.X + x, p.Y + 8 * chess.m_SquareWidth, p.Z);
                Point3D left   = new Point3D(p.X - 1, p.Y + x, p.Z);
                Point3D right  = new Point3D(p.X + chess.m_SquareWidth * 8, p.Y + x, p.Z);

                new Static(stairN).MoveToWorld(top, map);
                new Static(stairS).MoveToWorld(bottom, map);
                new Static(stairW).MoveToWorld(left, map);
                new Static(stairE).MoveToWorld(right, map);
            }
        }
Esempio n. 5
0
		private void BuildBoard( ChessControl chess, Point3D p, Map map )
		{
			chess.m_BoardHeight = p.Z + 5; // Placing stairs on the specified point
			chess.BoardNorthWestCorner = new Point2D( p.X, p.Y );

			#region Board Tiles

			int stairNW = 1909;
			int stairSE = 1910;
			int stairSW = 1911;
			int stairNE = 1912;
			int stairS = 1901;
			int stairE = 1902;
			int stairN = 1903;
			int stairW = 1904;
			int black = 1295; //hue = 2406;
            int white = 1298; //hue = 2101;

			#endregion

			for ( int x = 0; x < 8; x++ )
			{
				for ( int y = 0; y < 8; y++ )
				{
					int tile = 0;

					if ( x % 2 == 0 )
					{
						if ( y % 2 == 0 )
							tile = white;//swapped
						else
							tile = black;
					}
					else
					{
						if ( y % 2 == 0 )
							tile = black;//swapped
						else
							tile = white;
					}

					if ( chess.Orientation == BoardOrientation.EastWest ) // Invert tiles if the orientation is EW
					{
						if ( tile == black )
							tile = white;//swapped
						else
							tile = black;
					}

					for ( int kx = 0; kx < chess.m_SquareWidth; kx++ )
					{
						for ( int ky = 0; ky < chess.m_SquareWidth; ky++ )
						{
							Server.Items.Static s = new Server.Items.Static( tile );
                            if (tile == black)
                            {
                                s.Hue = m_BoardBlackHue;
                                m_BoardBlackTiles.Add(s);
                            }
                            else if (tile == white)
                            {
                                s.Hue = m_BoardWhiteHue;
                                m_BoardWhiteTiles.Add(s);
                            }
						    Point3D target = new Point3D( p.X + x * chess.m_SquareWidth + kx, p.Y + y * chess.m_SquareWidth + ky, chess.m_BoardHeight );
							s.MoveToWorld( target, map );
						}
					}
				}
			}

			Point3D nw = new Point3D( p.X - 1, p.Y - 1, p.Z );
			Point3D ne = new Point3D( p.X + 8 * chess.m_SquareWidth, p.Y - 1, p.Z );
			Point3D se = new Point3D( p.X + 8 * chess.m_SquareWidth, p.Y + 8 * chess.m_SquareWidth, p.Z );
			Point3D sw = new Point3D( p.X - 1, p.Y + 8 * chess.m_SquareWidth, p.Z );

		    Server.Items.Static NW = new Server.Items.Static(stairNW) {Hue = m_BoardStairsHue};
            m_BoardStairsTiles.Add(NW);
		    NW.MoveToWorld( nw, map );

            Server.Items.Static NE = new Server.Items.Static(stairNE) { Hue = m_BoardStairsHue };
            m_BoardStairsTiles.Add(NE);
            NE.MoveToWorld(ne, map);

            Server.Items.Static SE = new Server.Items.Static(stairSE) { Hue = m_BoardStairsHue };
            m_BoardStairsTiles.Add(SE);
            SE.MoveToWorld(se, map);

            Server.Items.Static SW = new Server.Items.Static(stairSW) { Hue = m_BoardStairsHue };
            m_BoardStairsTiles.Add(SW);
            SW.MoveToWorld(sw, map);

			for ( int x = 0; x < 8 * chess.m_SquareWidth; x++ )
			{
				Point3D top = new Point3D( p.X + x, p.Y - 1, p.Z );
				Point3D bottom = new Point3D( p.X + x, p.Y + 8 * chess.m_SquareWidth, p.Z );
				Point3D left = new Point3D( p.X - 1, p.Y + x, p.Z );
				Point3D right = new Point3D( p.X + chess.m_SquareWidth * 8, p.Y + x, p.Z );

                Server.Items.Static N = new Server.Items.Static(stairN) { Hue = m_BoardStairsHue };
                m_BoardStairsTiles.Add(N);
                N.MoveToWorld(top, map);

                Server.Items.Static S = new Server.Items.Static(stairS) { Hue = m_BoardStairsHue };
                m_BoardStairsTiles.Add(S);
                S.MoveToWorld(bottom, map);

                Server.Items.Static W = new Server.Items.Static(stairW) { Hue = m_BoardStairsHue };
                m_BoardStairsTiles.Add(W);
                W.MoveToWorld(left, map);

                Server.Items.Static E = new Server.Items.Static(stairE) { Hue = m_BoardStairsHue };
                m_BoardStairsTiles.Add(E);
                E.MoveToWorld(right, map);
			}
		}
Esempio n. 6
0
		private static void BuildBoard( ChessControl chess, Point3D p, Map map )
		{
			chess.m_BoardHeight = p.Z + 5; // Placing stairs on the specified point
			chess.BoardNorthWestCorner = new Point2D( p.X, p.Y );

			#region Board Tiles

			int stairNW = 1909;
			int stairSE = 1910;
			int stairSW = 1911;
			int stairNE = 1912;
			int stairS = 1901;
			int stairE = 1902;
			int stairN = 1903;
			int stairW = 1904;
			int black = 1295;
			int white = 1298;

			#endregion

			for ( int x = 0; x < 8; x++ )
			{
				for ( int y = 0; y < 8; y++ )
				{
					int tile = 0;

					if ( x % 2 == 0 )
					{
						if ( y % 2 == 0 )
							tile = black;
						else
							tile = white;
					}
					else
					{
						if ( y % 2 == 0 )
							tile = white;
						else
							tile = black;
					}

					if ( chess.Orientation == BoardOrientation.EastWest ) // Invert tiles if the orientation is EW
					{
						if ( tile == white )
							tile = black;
						else
							tile = white;
					}

					for ( int kx = 0; kx < chess.m_SquareWidth; kx++ )
					{
						for ( int ky = 0; ky < chess.m_SquareWidth; ky++ )
						{
							Server.Items.Static s = new Server.Items.Static( tile );
							Point3D target = new Point3D( p.X + x * chess.m_SquareWidth + kx, p.Y + y * chess.m_SquareWidth + ky, chess.m_BoardHeight );
							s.MoveToWorld( target, map );
						}
					}
				}
			}

			Point3D nw = new Point3D( p.X - 1, p.Y - 1, p.Z );
			Point3D ne = new Point3D( p.X + 8 * chess.m_SquareWidth, p.Y - 1, p.Z );
			Point3D se = new Point3D( p.X + 8 * chess.m_SquareWidth, p.Y + 8 * chess.m_SquareWidth, p.Z );
			Point3D sw = new Point3D( p.X - 1, p.Y + 8 * chess.m_SquareWidth, p.Z );

			new Server.Items.Static( stairNW ).MoveToWorld( nw, map );
			new Server.Items.Static( stairNE ).MoveToWorld( ne, map );
			new Server.Items.Static( stairSE ).MoveToWorld( se, map );
			new Server.Items.Static( stairSW ).MoveToWorld( sw, map );

			for ( int x = 0; x < 8 * chess.m_SquareWidth; x++ )
			{
				Point3D top = new Point3D( p.X + x, p.Y - 1, p.Z );
				Point3D bottom = new Point3D( p.X + x, p.Y + 8 * chess.m_SquareWidth, p.Z );
				Point3D left = new Point3D( p.X - 1, p.Y + x, p.Z );
				Point3D right = new Point3D( p.X + chess.m_SquareWidth * 8, p.Y + x, p.Z );

				new Server.Items.Static( stairN ).MoveToWorld( top, map );
				new Server.Items.Static( stairS ).MoveToWorld( bottom, map );
				new Server.Items.Static( stairW ).MoveToWorld( left, map );
				new Server.Items.Static( stairE ).MoveToWorld( right, map );
			}
		}