Beispiel #1
0
        /// <summary>
        /// The guest accepted the game
        /// </summary>
        /// <param name="guest">The player accepting the game</param>
        public void AcceptGame(Mobile guest)
        {
            if (Owner == null)
            {
                guest.SendMessage(0x40, "Your partner canceled the game");
                return;
            }

            m_GameStart = DateTime.Now;
            m_Timer.OnGameStart();

            m_Status = GameStatus.WhiteToMove;

            Guest = guest;

            Owner.CloseGump(typeof(Arya.Chess.StartGameGump));

            m_Board = new BChessboard(m_Black, m_White, m_Z, m_Bounds, this, m_Parent.ChessSet, m_Parent.WhiteHue, m_Parent.BlackHue, m_Parent.WhiteMinorHue, m_Parent.BlackMinorHue, m_Parent.OverrideMinorHue);

            m_MoveTime = DateTime.Now;

            // Create the region
            m_Region = new ChessRegion(m_Parent.Map, this, m_AllowSpectators, m_Bounds, m_Z);
            m_Region.Register();

            SendAllGumps(null, null);
        }
        /// <summary>
        /// Cleans up the resources used by this game
        /// </summary>
        public void Cleanup()
        {
            EventSink.Disconnected -= new DisconnectedEventHandler(OnPlayerDisconnected);
            EventSink.Login        -= new LoginEventHandler(OnPlayerLogin);

            if (m_Board != null)
            {
                m_Board.Delete();
            }

            if (m_Timer != null)
            {
                m_Timer.Stop();
                m_Timer = null;
            }

            if (m_Black != null && m_Black.Target != null && m_Black.Target is ChessTarget)
            {
                (m_Black.Target as ChessTarget).Remove(m_Black);
            }

            if (m_White != null && m_White.Target != null && m_White.Target is ChessTarget)
            {
                (m_White.Target as ChessTarget).Remove(m_White);
            }

            if (m_Black != null && m_Black.NetState != null)
            {
                m_Black.CloseGump(typeof(StartGameGump));
                m_Black.CloseGump(typeof(GameGump));
                m_Black.CloseGump(typeof(EndGameGump));
                m_Black.CloseGump(typeof(PawnPromotionGump));
                m_Black.CloseGump(typeof(ScoreGump));
                m_Black.CloseGump(typeof(ChessSetGump));
            }

            if (m_White != null && m_White.NetState != null)
            {
                m_White.CloseGump(typeof(StartGameGump));
                m_White.CloseGump(typeof(GameGump));
                m_White.CloseGump(typeof(EndGameGump));
                m_White.CloseGump(typeof(PawnPromotionGump));
                m_White.CloseGump(typeof(ScoreGump));
                m_White.CloseGump(typeof(ChessSetGump));
            }

            if (m_Region != null)
            {
                m_Region.Unregister();
                m_Region = null;
            }

            ParentCleanup();
        }
Beispiel #3
0
        /// <summary>
        /// The guest accepted the game
        /// </summary>
        /// <param name="guest">The player accepting the game</param>
        public void AcceptGame(Mobile guest)
        {
            if (guest == null)
            {
                return;
            }

            if (Owner == null)
            {
                guest.SendMessage(0x40, "Your partner canceled the game");
                return;
            }

            if (m_Timer == null)
            {
                return;
            }

            m_GameStart = DateTime.Now;

            m_Timer.OnGameStart();

            m_Status = GameStatus.WhiteToMove;

            Guest = guest;

            Owner.CloseGump(typeof(Arya.Chess.StartGameGump));

            m_Board = new BChessboard(m_Black, m_White, m_Z, m_Bounds, this, m_Parent.ChessSet, m_Parent.WhiteHue, m_Parent.BlackHue, m_Parent.WhiteMinorHue, m_Parent.BlackMinorHue, m_Parent.OverrideMinorHue);

            m_MoveTime = DateTime.Now;

            Rectangle3D m_NewBounds = Server.Region.ConvertTo3D(m_Bounds);

            Point3D start = m_NewBounds.Start;
            Point3D end   = m_NewBounds.End;

            start.Z = m_Z - 5;
            end.Z   = m_Z + 5;

            m_NewBounds = new Rectangle3D(start, end);

            // Create the region
            m_Region = new ChessRegion(m_Parent.Map, this, m_AllowSpectators, m_Parent.SafeZone, m_NewBounds, m_Z);
            m_Region.Register();

            SendAllGumps(null, null);
        }
Beispiel #4
0
		/// <summary>
		/// Cleans up the resources used by this game
		/// </summary>
		public void Cleanup()
		{
			EventSink.Disconnected -= OnPlayerDisconnected;
			EventSink.Login -= OnPlayerLogin;

			if ( m_Board != null )
			{
				m_Board.Delete();
			}

			if ( m_Timer != null )
			{
				m_Timer.Stop();
				m_Timer = null;
			}

			if ( m_Black != null && m_Black.Target != null && m_Black.Target is ChessTarget )
				( m_Black.Target as ChessTarget ).Remove( m_Black );

			if ( m_White != null && m_White.Target != null && m_White.Target is ChessTarget )
				( m_White.Target as ChessTarget ).Remove( m_White );

			if ( m_Black != null && m_Black.NetState != null )
			{
				m_Black.CloseGump( typeof( StartGameGump ) );
				m_Black.CloseGump( typeof( GameGump ) );
				m_Black.CloseGump( typeof( EndGameGump ) );
				m_Black.CloseGump( typeof( PawnPromotionGump ) );
				m_Black.CloseGump( typeof( ScoreGump ) );
			}

			if ( m_White != null && m_White.NetState != null )
			{
				m_White.CloseGump( typeof( StartGameGump ) );
				m_White.CloseGump( typeof( GameGump ) );
				m_White.CloseGump( typeof( EndGameGump ) );
				m_White.CloseGump( typeof( PawnPromotionGump ) );
				m_White.CloseGump( typeof( ScoreGump ) );
			}

			if ( m_Region != null )
			{
				m_Region.Unregister();
				m_Region = null;
			}

			ParentCleanup();
		}
Beispiel #5
0
		/// <summary>
		/// The guest accepted the game
		/// </summary>
		/// <param name="guest">The player accepting the game</param>
		public void AcceptGame( Mobile guest )
		{
            if ( guest == null )
                return;

			if ( Owner == null )
			{
				guest.SendMessage( 0x40, "Your partner canceled the game" );
				return;
			}

            if (m_Timer == null)
                return;

			m_GameStart = DateTime.Now;

    	    m_Timer.OnGameStart();

			m_Status = GameStatus.WhiteToMove;

			Guest = guest;

			Owner.CloseGump( typeof( Arya.Chess.StartGameGump ) );

			m_Board = new BChessboard( m_Black, m_White, m_Z, m_Bounds, this, m_Parent.ChessSet, m_Parent.WhiteHue, m_Parent.BlackHue, m_Parent.WhiteMinorHue, m_Parent.BlackMinorHue, m_Parent.OverrideMinorHue );

			m_MoveTime = DateTime.Now;

            Rectangle3D m_NewBounds = Server.Region.ConvertTo3D(m_Bounds);

		    Point3D start = m_NewBounds.Start;
		    Point3D end = m_NewBounds.End;

            start.Z = m_Z - 5;
            end.Z = m_Z + 5;

            m_NewBounds = new Rectangle3D(start, end);

			// Create the region
            m_Region = new ChessRegion(m_Parent.Map, this, m_AllowSpectators, m_Parent.SafeZone, m_NewBounds, m_Z);
			m_Region.Register();

			SendAllGumps( null, null );
		}
Beispiel #6
0
		/// <summary>
		/// The guest accepted the game
		/// </summary>
		/// <param name="guest">The player accepting the game</param>
		public void AcceptGame( Mobile guest )
		{
			if ( Owner == null )
			{
				guest.SendMessage( 0x40, "Your partner canceled the game" );
				return;
			}

			m_GameStart = DateTime.Now;
			m_Timer.OnGameStart();

			m_Status = GameStatus.WhiteToMove;

			Guest = guest;

			Owner.CloseGump( typeof( Arya.Chess.StartGameGump ) );

			m_Board = new BChessboard( m_Black, m_White, m_Z, m_Bounds, this, m_Parent.ChessSet, m_Parent.WhiteHue, m_Parent.BlackHue, m_Parent.WhiteMinorHue, m_Parent.BlackMinorHue, m_Parent.OverrideMinorHue );

			m_MoveTime = DateTime.Now;

			// Create the region
			m_Region = new ChessRegion( m_Parent.Map, this, m_AllowSpectators, m_Bounds, m_Z );
			m_Region.Register();

			SendAllGumps( null, null );
		}