/// <summary>
        /// Constructs the basic minor mode and sets up the internal
        /// structures.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="prayer"></param>
        public PrayerCompletedMinorMode(int x, int y, Prayer prayer)
            : base()
        {
            // Save the values
            X = x;
            Y = y;

            // Set up the prayer board
            Prayer = prayer;
            Prayer.Board.MaximumPosition = 5;
            Prayer.Board.MinimumPosition = -2;

            // Create the block viewport
            blockViewport =
                new BlockViewport(Prayer.Board, AssetLoader.Instance);
            blockViewport.Size         = blockViewport.Extents.Size;
            blockViewport.ClipContents = false;
            Viewport.Add(blockViewport);

            // We modify the prayer to simulate a drop by raising
            // everything but the bottommost one.
            for (int i = 0; i < prayer.Board.Columns; i++)
            {
                // Get the stack
                IList <BlockStack> stacks = prayer.Board[i];

                // Go through the stack
                for (int j = 0; j < stacks.Count; j++)
                {
                    // Get the stack
                    BlockStack stack = stacks[j];
                    stack.IsInInitialPlacement = false;

                    // Go through the blocks
                    foreach (Block block in stack)
                    {
                        // Mark this as unusable
                        block.Data = false;

                        // Figure out the position
                        if (block.BottomPosition != 0)
                        {
                            // For the top blocks
                            block.BottomPosition *=
                                Constants.PrayerDroppingMultiplier;
                            block.BottomPosition +=
                                Entropy.NextFloat(-0.5f, 0.5f);
                            block.IsMoving = true;
                            block.Mass     = Constants.PrayerBlockMass;
                            block.Vector   = Constants.PrayerDroppedVector;
                        }
                        else
                        {
                            // For the bottom blocks
                            block.IsMoving = false;
                            block.Vector   = 0;
                            block.Mass     = 0;
                        }
                    }
                }
            }

            // Attack some new events
            prayer.Board.BlockMovingChanged += OnBlockMovingChanged;
            prayer.Board.MovingChanged      += OnMovingChanged;
        }
예제 #2
0
        /// <summary>
        /// Indicates to the game mode that it is activated.
        /// </summary>
        public void Activate()
        {
            // If we don't have a game state, kick this over to the
            // new game state as an error condition.
            if (Game.State == null)
                Game.GameMode = new NewGameMode();

            // Create the sprite manager
            sprites = new SpriteViewport();
            sprites.IsMouseSensitive = true;
            sprites.ClipContents = true;
            Game.SpriteManager.Add(sprites);

            // Create the board viewport
            blockViewport =
                new BlockViewport(Game.State.Board, AssetLoader.Instance);
            blockViewport.ClipContents = true;
            blockViewport.IsMouseSensitive = true;
            blockViewport.MousePosition = 8;
            blockViewport.FocusPosition = Constants.FocusPosition;
            sprites.Add(blockViewport);

            // Create the top-down vertical explorer
            vertViewport = new VerticalViewport(Game.State.Board);
            vertViewport.Z = 50;
            vertViewport.BackgroundColor = Color.FromArgb(32, Color.Black);
            vertViewport.Padding = 2;
            vertViewport.BlockWidth = vertViewport.BlockHeight = 16;
            vertViewport.MaximumHeight = vertViewport.MinimumHeight = 4;
            vertViewport.Size = vertViewport.Extents.Size;
            vertViewport.Visible = false;
            vertViewport.Opacity = 0.75f;
            sprites.Add(vertViewport);

            // Speeches and overlays
            speeches = new SpriteViewport();
            speeches.Z = 100;
            speeches.IsMouseSensitive = true;
            sprites.Add(speeches);

            // Connect our events for selectors
            blockViewport.StackMouseEnter += OnStackMouseEnter;
            blockViewport.StackMouseExit += OnStackMouseExit;

            // Create the scroller on the viewport
            scroller = new MouseEdgeScroller();
            scroller.Register(blockViewport);

            // Create our selector icon
            selector = AssetLoader.Instance.CreateBlock("Selector");
            selector.Height = 0;
            selector.CastsShadows = false;

            // Create the scores and other indicators
            CreateIndicators();

            // Connect the events
            Game.State.Board.MovingChanged += OnMovingChanged;
            Game.State.Board.BlockMovingChanged += OnBlockMovingChanged;
            Game.State.Board.BlockMovingChanged += Game.Sound.BlockLanded;
        }
예제 #3
0
        /// <summary>
        /// Indicates to the game mode that it is activated.
        /// </summary>
        public void Activate()
        {
            // If we don't have a game state, kick this over to the
            // new game state as an error condition.
            if (Game.State == null)
            {
                Game.GameMode = new NewGameMode();
            }

            // Create the sprite manager
            sprites = new SpriteViewport();
            sprites.IsMouseSensitive = true;
            sprites.ClipContents     = true;
            Game.SpriteManager.Add(sprites);

            // Create the board viewport
            blockViewport =
                new BlockViewport(Game.State.Board, AssetLoader.Instance);
            blockViewport.ClipContents     = true;
            blockViewport.IsMouseSensitive = true;
            blockViewport.MousePosition    = 8;
            blockViewport.FocusPosition    = Constants.FocusPosition;
            sprites.Add(blockViewport);

            // Create the top-down vertical explorer
            vertViewport   = new VerticalViewport(Game.State.Board);
            vertViewport.Z = 50;
            vertViewport.BackgroundColor = Color.FromArgb(32, Color.Black);
            vertViewport.Padding         = 2;
            vertViewport.BlockWidth      = vertViewport.BlockHeight = 16;
            vertViewport.MaximumHeight   = vertViewport.MinimumHeight = 4;
            vertViewport.Size            = vertViewport.Extents.Size;
            vertViewport.Visible         = false;
            vertViewport.Opacity         = 0.75f;
            sprites.Add(vertViewport);

            // Speeches and overlays
            speeches   = new SpriteViewport();
            speeches.Z = 100;
            speeches.IsMouseSensitive = true;
            sprites.Add(speeches);

            // Connect our events for selectors
            blockViewport.StackMouseEnter += OnStackMouseEnter;
            blockViewport.StackMouseExit  += OnStackMouseExit;

            // Create the scroller on the viewport
            scroller = new MouseEdgeScroller();
            scroller.Register(blockViewport);

            // Create our selector icon
            selector              = AssetLoader.Instance.CreateBlock("Selector");
            selector.Height       = 0;
            selector.CastsShadows = false;

            // Create the scores and other indicators
            CreateIndicators();

            // Connect the events
            Game.State.Board.MovingChanged      += OnMovingChanged;
            Game.State.Board.BlockMovingChanged += OnBlockMovingChanged;
            Game.State.Board.BlockMovingChanged += Game.Sound.BlockLanded;
        }
예제 #4
0
        /// <summary>
        /// Indicates to the game mode that it is activated.
        /// </summary>
        public void Activate()
        {
            // Set up the sprites
            sprites.IsMouseSensitive = true;
            Game.SpriteManager.Add(sprites);

            // Create the big text
            title = new TextDrawableSprite(Game.GetFont(FontSize),
                "Cute God");
            title.Alignment = ContentAlignment.TopCenter;
            title.Tint = Color.White;
            sprites.Add(title);

            System.Version v = GetType().Assembly.GetName().Version;
            version = new TextDrawableSprite(Game.GetFont(SmallFontSize),
                String.Format("{0}.{1}.{2}",
                    v.Major, v.Minor, v.Build));
            version.Alignment = ContentAlignment.BottomRight;
            version.Tint = Color.FromArgb(64, Color.White);
            sprites.Add(version);

            // Create the buttons
            newGame = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("new-game"));
            newGame.Clicked += NewGameClicked;
            sprites.Add(newGame);

            settings = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("settings"));
            sprites.Add(settings);

            resume = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("resume-game"));

            if (Game.PlayMode != null)
                resume.Clicked += ResumeClicked;

            sprites.Add(resume);

            help = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("help"));
            sprites.Add(help);

            scores = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("high-scores"));
            sprites.Add(scores);

            credits = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("credits"));
            credits.Clicked += CreditsClicked;
            sprites.Add(credits);

            quit = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("quit"));
            quit.Clicked += QuitClicked;
            sprites.Add(quit);

            // Create the block viewport
            board = new BlockBoard(BoardRows, BoardColumns);
            board.BlockMovingChanged += OnBlockMovingChanged;

            viewport = new BlockViewport(board, AssetLoader.Instance);
            viewport.FocusPosition = Constants.FocusPosition;
            PopulateBoard();
            // We don't add to the sprites since we are manually
            // drawing it to add a black screen in front of it.
        }
예제 #5
0
        /// <summary>
        /// Constructs the basic minor mode and sets up the internal
        /// structures.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="prayer"></param>
        public PrayerCompletedMinorMode(int x, int y, Prayer prayer)
            : base()
        {
            // Save the values
            X = x;
            Y = y;

            // Set up the prayer board
            Prayer = prayer;
            Prayer.Board.MaximumPosition = 5;
            Prayer.Board.MinimumPosition = -2;

            // Create the block viewport
            blockViewport =
                new BlockViewport(Prayer.Board, AssetLoader.Instance);
            blockViewport.Size = blockViewport.Extents.Size;
            blockViewport.ClipContents = false;
            Viewport.Add(blockViewport);

            // We modify the prayer to simulate a drop by raising
            // everything but the bottommost one.
            for (int i = 0; i < prayer.Board.Columns; i++)
            {
                // Get the stack
                IList<BlockStack> stacks = prayer.Board[i];

                // Go through the stack
                for (int j = 0; j < stacks.Count; j++)
                {
                    // Get the stack
                    BlockStack stack = stacks[j];
                    stack.IsInInitialPlacement = false;

                    // Go through the blocks
                    foreach (Block block in stack)
                    {
                        // Mark this as unusable
                        block.Data = false;

                        // Figure out the position
                        if (block.BottomPosition != 0)
                        {
                            // For the top blocks
                            block.BottomPosition *=
                                Constants.PrayerDroppingMultiplier;
                            block.BottomPosition +=
                                Entropy.NextFloat(-0.5f, 0.5f);
                            block.IsMoving = true;
                            block.Mass = Constants.PrayerBlockMass;
                            block.Vector = Constants.PrayerDroppedVector;
                        }
                        else
                        {
                            // For the bottom blocks
                            block.IsMoving = false;
                            block.Vector = 0;
                            block.Mass = 0;
                        }
                    }
                }
            }

            // Attack some new events
            prayer.Board.BlockMovingChanged += OnBlockMovingChanged;
            prayer.Board.MovingChanged += OnMovingChanged;
        }
예제 #6
0
        /// <summary>
        /// Indicates to the game mode that it is activated.
        /// </summary>
        public void Activate()
        {
            // Set up the sprites
            sprites.IsMouseSensitive = true;
            Game.SpriteManager.Add(sprites);

            // Create the big text
            title = new TextDrawableSprite(Game.GetFont(FontSize),
                                           "Cute God");
            title.Alignment = ContentAlignment.TopCenter;
            title.Tint      = Color.White;
            sprites.Add(title);

            System.Version v = GetType().Assembly.GetName().Version;
            version = new TextDrawableSprite(Game.GetFont(SmallFontSize),
                                             String.Format("{0}.{1}.{2}",
                                                           v.Major, v.Minor, v.Build));
            version.Alignment = ContentAlignment.BottomRight;
            version.Tint      = Color.FromArgb(64, Color.White);
            sprites.Add(version);

            // Create the buttons
            newGame = new MainMenuButton(AssetLoader.Instance
                                         .CreateDrawable("new-game"));
            newGame.Clicked += NewGameClicked;
            sprites.Add(newGame);

            settings = new MainMenuButton(AssetLoader.Instance
                                          .CreateDrawable("settings"));
            sprites.Add(settings);

            resume = new MainMenuButton(AssetLoader.Instance
                                        .CreateDrawable("resume-game"));

            if (Game.PlayMode != null)
            {
                resume.Clicked += ResumeClicked;
            }

            sprites.Add(resume);

            help = new MainMenuButton(AssetLoader.Instance
                                      .CreateDrawable("help"));
            sprites.Add(help);

            scores = new MainMenuButton(AssetLoader.Instance
                                        .CreateDrawable("high-scores"));
            sprites.Add(scores);

            credits = new MainMenuButton(AssetLoader.Instance
                                         .CreateDrawable("credits"));
            credits.Clicked += CreditsClicked;
            sprites.Add(credits);

            quit = new MainMenuButton(AssetLoader.Instance
                                      .CreateDrawable("quit"));
            quit.Clicked += QuitClicked;
            sprites.Add(quit);

            // Create the block viewport
            board = new BlockBoard(BoardRows, BoardColumns);
            board.BlockMovingChanged += OnBlockMovingChanged;

            viewport = new BlockViewport(board, AssetLoader.Instance);
            viewport.FocusPosition = Constants.FocusPosition;
            PopulateBoard();
            // We don't add to the sprites since we are manually
            // drawing it to add a black screen in front of it.
        }