Beispiel #1
0
		public void RegisterToBoardGameControlItem( BoardGameControlItem boardgamecontrolitem, Point3D offset )
		{
			BoardGameControlItem = boardgamecontrolitem;
			Offset = offset;
			
			UpdatePosition();
		}
		public SelectBombermanStyleGump( Mobile owner, BoardGameControlItem controlitem ) : base( owner, controlitem )
		{
			AddLabel( 20, 14, 1152, "Bomberman Board Style" );

			AddButton( Width - 15, 0, 3, 4, 0, GumpButtonType.Reply, 0 );	
			
			string[] stylenames = Enum.GetNames( typeof( BombermanStyle ) );
			
			foreach( string stylename in stylenames )
			{
				int index = (int)Enum.Parse( typeof( BombermanStyle ), stylename );
				int buttonid = ( (int)((BombermanControlItem)_ControlItem).Style == index ? 0x2C92 : 0x2C88 );
				
				AddButton( _X, _Y += 20, buttonid, buttonid, index + 1, GumpButtonType.Reply, 0 );
				AddLabel( _X + 20, _Y - 2, 1152, stylename );
			}
			
			AddLabel( _X, _Y += 30, 1152, "Width:" );
			AddTextField( _X + 50, _Y, 30, 20, 0, _ControlItem.BoardWidth.ToString() );
			AddLabel( _X + 90, _Y, 1152, "Height:" );
			AddTextField( _X + 140, _Y, 30, 20, 1, _ControlItem.BoardHeight.ToString() );
			
			AddButton( _X + 20, _Y += 40, 0xEE, 0xEF, 100, GumpButtonType.Reply, 0 );
			AddButton( _X + 100, _Y, 0xF7, 0xF8, 1000, GumpButtonType.Reply, 0 );
		}
        public SelectStyleGump( Mobile owner, BoardGameControlItem controlitem )
            : base(450, 80)
        {
            Closable = false;

            owner.CloseGump( typeof( SelectStyleGump ) );

            _ControlItem = controlitem;

            if( _ControlItem.Players.IndexOf( owner ) == -1 )
            {
                return;
            }

            AddPage( 0 );
            AddBackground( 0, 0, Width, Height, 0x1400 );

            AddLabel( 20, 60, 1152, "# of players (" + _ControlItem.MinPlayers.ToString() + "-" + _ControlItem.MaxPlayers.ToString() + "):" );

            int minplayers = Math.Max( _ControlItem.MinPlayers, _ControlItem.Players.Count );

            if( _ControlItem.MaxPlayers != _ControlItem.MinPlayers && !_ControlItem.SettingsReady )
            {
                AddLabel( 20, 40, 1172, "Pick the number of players" );
                AddTextField( 150, 60, 30, 20, 0, _ControlItem.CurrentMaxPlayers.ToString() );
                AddButton( 182, 62, 0x4B9, 0x4BA, 500, GumpButtonType.Reply, 0 );
            }
            else
            {
                AddLabel( 150, 60, 1152, _ControlItem.CurrentMaxPlayers.ToString() );
            }

            //AddButton( Width - 15, 0, 3, 4, 0, GumpButtonType.Reply, 0 );
        }
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch( version )
            {
                default:
                case 1:
                {
                    _Blocker = (LOSBlocker)reader.ReadItem();
                    goto case 0;
                }
                case 0:
                {

                    BoardGameControlItem = (BoardGameControlItem)reader.ReadItem();

                    Offset.X = reader.ReadInt();
                    Offset.Y = reader.ReadInt();
                    Offset.Z = reader.ReadInt();
                    break;
                }
            }
        }
        public BoardGameGump( Mobile owner, BoardGameControlItem controlitem )
            : base(50, 50)
        {
            _Owner = owner;
            _ControlItem = controlitem;

            _Owner.CloseGump( typeof( BoardGameGump ) );

            DrawBackground();
        }
        public BoardGameLostGump(Mobile owner, BoardGameControlItem controlitem) : base(owner, controlitem)
        {
            AddLabel(40, 20, 1152, "Game:");

            AddLabel(140, 20, 1172, _ControlItem.GameName);

            AddLabel(40, 50, 1152, "You've lost the game!");

            //TODO: add info about points earned?

            AddButton(100, 80, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0);
        }
		public ConfirmResetGameScoreGump( Mobile owner, BoardGameControlItem controlitem ) : base( owner, controlitem )
		{
			AddLabel( 40, 20, 1152, "Game:" );
			
			AddLabel( 140, 20, 1172, _ControlItem.GameName );
			
			AddHtml( 40, 50, Width - 80, 80, "You are about to reset all the score data for " + _ControlItem.GameName + ".  Once you do this, it cannot be undone.  Are you sure you wish to do this?", true, false );
			
			AddButton( 30, 160, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0 );
			
			AddButton( 160, 160, 0xF1, 0xF2, 0, GumpButtonType.Reply, 0 );
		}
        public BoardGameScoresGump( Mobile owner, BoardGameControlItem controlitem, int page )
            : base(owner, controlitem)
        {
            _Page = page;

            AddLabel( 40, 20, 1152, "Game:" );

            AddLabel( 140, 20, 1172, _ControlItem.GameName );

            AddLabel( 40, 50, 1152, "Scores" );

            _PlayerScores = BoardGameData.GetScores( controlitem.GameName );

            if( _PlayerScores == null || _PlayerScores.Count == 0 )
            {
                AddLabel( 40, 80, 1152, "- NO SCORES SET YET -" );
                return;
            }

            _PlayerScores.Sort();

            _X = 20;
            _Y = 80;

            _MaxPages = _PlayerScores.Count / ENTRIES_PER_PAGE + 1;

            if( _PlayerScores.Count % ENTRIES_PER_PAGE == 0 )
            {
                _MaxPages -= 1;
            }

            _Page = Math.Max( 0, Math.Min( _Page, _MaxPages ) );

            int listingstart = _Page * ENTRIES_PER_PAGE;
            int listingend = Math.Min( _PlayerScores.Count, (_Page + 1 ) * ENTRIES_PER_PAGE );

            AddLabel( _X, _Y, 1152, "Name" );
            AddLabel( _X + 150, _Y, 1152, "Score" );
            AddLabel( _X+ 200, _Y, 1152, "Wins" );
            AddLabel( _X + 250, _Y, 1152, "Losses" );

            for( int i = listingstart; i < listingend; i++ )
            {
                AddLabel( _X, _Y += 20, 1152, _PlayerScores[i].Player.Name );
                AddLabel( _X + 150, _Y, 1152, _PlayerScores[i].Score.ToString() );
                AddLabel( _X + 200, _Y, 1152, _PlayerScores[i].Wins.ToString() );
                AddLabel( _X + 250, _Y, 1152, _PlayerScores[i].Losses.ToString() );
            }

            AddPageButtons();

            AddButton( 60, Height - 40, 0xF7, 0xF8, 0, GumpButtonType.Reply, 0 );
        }
		public AwaitRecruitmentGump( Mobile owner, BoardGameControlItem controlitem ) : base( owner, controlitem )
		{
			//force it so players can't close this gump
			Closable = false;
			
			AddLabel( 40, 20, 1152, "Game:" );
			
			AddLabel( 140, 20, 1172, _ControlItem.GameName );
			
			AddHtml( 40, 50, Width - 80, 80, "You are waiting for more players to join this game.  When there are enough, this window will automatically close and the game will start.  If you wish to cancel waiting, click the Cancel button.", true, false );
			
			AddButton( 160, 160, 0xF1, 0xF2, 1, GumpButtonType.Reply, 0 );
		}
		public SelectBombermanStyleGump( Mobile owner, BoardGameControlItem controlitem ) : base( owner, controlitem )
		{
			if( _ControlItem.Players.IndexOf( owner ) == -1 )
			{
				return;
			}
			
			AddLabel( 20, 14, 1152, "Bomberman Board Style" );

			//AddButton( Width - 15, 0, 3, 4, 0, GumpButtonType.Reply, 0 );	
			
			string[] stylenames = Enum.GetNames( typeof( BombermanStyle ) );
			
			_Y += 50;
			
			foreach( string stylename in stylenames )
			{
				int index = (int)Enum.Parse( typeof( BombermanStyle ), stylename );
				int buttonid = ( (int)((BombermanControlItem)_ControlItem).Style == index ? 0x2C92 : 0x2C88 );
				
				AddButton( _X, _Y += 20, buttonid, buttonid, index + 1, GumpButtonType.Reply, 0 );
				AddLabel( _X + 20, _Y - 2, 1152, stylename );
			}
			
			//AddLabel( _X, _Y += 30, 1152, "Width:" );
			//AddLabel( _X + 90, _Y, 1152, "Height:" );
			
			//if( !_ControlItem.SettingsReady )
			//{
			//	AddTextField( _X + 50, _Y, 30, 20, 1, _ControlItem.BoardWidth.ToString() );
			//	AddTextField( _X + 140, _Y, 30, 20, 2, _ControlItem.BoardHeight.ToString() );
			//}
			//else
			//{
			//	AddLabel( _X + 50, _Y, 1152, _ControlItem.BoardWidth.ToString() );
			//	AddLabel( _X + 140, _Y, 1152, _ControlItem.BoardHeight.ToString() );
			//}
			
			
			
			AddLabel( _X, _Y += 40, 1152, "Ready to start:" );
			
			int startgamebuttonid = _ControlItem.SettingsReady ? 0xD3: 0xD2;
			
			AddButton( _X + 120, _Y, startgamebuttonid, startgamebuttonid, 1000, GumpButtonType.Reply, 0 );
		}
        public OfferNewGameGump(Mobile owner, BoardGameControlItem controlitem, bool controlnumberofplayers)
            : base(owner, controlitem)
        {
            _ControlNumberOfPlayers = controlnumberofplayers;

            AddLabel(40, 20, 1152, "Game:");

            AddLabel(140, 20, 1172, _ControlItem.GameName);

            AddLabel(40, 50, 1152, "Description:");

            AddHtml(40, 70, 300, 100, _ControlItem.GameDescription, true, true);

            AddLabel(40, 180, 1152, "Rules:");

            AddHtml(40, 200, 300, 150, _ControlItem.GameRules, true, true);

            if (_ControlItem.CostToPlay > 0)
            {
                AddLabel(40, 370, 1152, "Cost to play:");
                AddLabel(240, 370, 1172, _ControlItem.CostToPlay + " gold");
            }

            if (_ControlItem.MaxPlayers != _ControlItem.MinPlayers)
            {
                AddLabel(40, 430, 1152,
                    "# of players (" + _ControlItem.MinPlayers + "-" + _ControlItem.MaxPlayers +
                    "):");

                if (_ControlNumberOfPlayers)
                {
                    AddLabel(60, 410, 1172, "Pick the number of players");
                    AddTextField(240, 430, 30, 20, 0, _ControlItem.CurrentMaxPlayers.ToString(CultureInfo.InvariantCulture));
                }
                else
                {
                    AddLabel(240, 430, 1152, _ControlItem.CurrentMaxPlayers.ToString(CultureInfo.InvariantCulture));
                }
            }

            AddLabel(40, 470, 1152, "Play this game?");

            AddButton(200, 460, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0);
            AddButton(300, 460, 0xF1, 0xF2, 0, GumpButtonType.Reply, 0);
        }
		public SelectStyleGump( Mobile owner, BoardGameControlItem controlitem ) : base( 450, 80 )
		{
			Closable = false;
			
			owner.CloseGump( typeof( SelectStyleGump ) );
			
			_ControlItem = controlitem;
			
			if( _ControlItem.Players.IndexOf( owner ) != 0 )
			{
				return;
			}
			
			AddPage( 0 );
			AddBackground( 0, 0, Width, Height, 0x1400 );

			AddButton( Width - 15, 0, 3, 4, 0, GumpButtonType.Reply, 0 );	
		}
 public WinnerTimer(BoardGameControlItem controlitem, TimeSpan delay) : base(delay, TimeSpan.FromSeconds(1.0))
 {
     _ControlItem = controlitem;
 }
 public static string GetUniqueName( BoardGameControlItem controlitem )
 {
     return controlitem.GameName + " " + ( _RegionIndex++ ).ToString();
 }
 public BoardGameRegion( BoardGameControlItem controlitem )
     : base(GetUniqueName( controlitem ), controlitem.Map, 255, controlitem.GameZone)
 {
     Disabled = true;
     _BoardGameControlItem = controlitem;
 }
		public BoardGameScoresGump( Mobile owner, BoardGameControlItem controlitem ) : this( owner, controlitem, 0 )
		{
		}
		//3006239 = "View events"
		public ViewBoardGameScoresEntry( Mobile from, BoardGameControlItem controlitem, int index ) : base( 6239, index )
		{
			_From = from;
			_ControlItem = controlitem;
		}
			public WinnerTimer( BoardGameControlItem controlitem, TimeSpan delay ) : base( delay, TimeSpan.FromSeconds( 1.0 ) )
			{
				_ControlItem = controlitem;
			}
		//3006162 = "Reset Game"
		public ResetBoardGameScoresEntry( Mobile from, BoardGameControlItem controlitem, int index ) : base( 6162, index )
		{
			_From = from;
			_ControlItem = controlitem;
		}