Пример #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);
        }
Пример #2
0
        /// <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();
        }
Пример #3
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();
		}
Пример #4
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 );
		}
Пример #5
0
 public InternalTimer(ChessTimer parent) : base(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15))
 {
     Priority = TimerPriority.FiveSeconds;
     m_Parent = parent;
 }
Пример #6
0
			public InternalTimer( ChessTimer parent ) : base( TimeSpan.FromSeconds( 15 ), TimeSpan.FromSeconds( 15 ) )
			{
				Priority = TimerPriority.FiveSeconds;
				m_Parent = parent;
			}