Пример #1
0
        public override void Initialize()
        {
            this.FadeOutImmediately();

            Sprite background = this.AddSprite("Content/1x1.png");
            background.ScaleX = 400;
            background.ScaleY = 300;

            TowerSprite logo = new TowerSprite(this, "Content/deengames-logo.jpg");
            logo.Click += (sprite) => {
                System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("http://www.deengames.com"), "_newWindow");
            };

            EmbeddedResourceHelper.ProjectNamespace = "DeenGames.Valence";
            // Sneaky way of playing this with asynchronous loading. MAN this is tough!
            //AudioManager.Instance.LoadSound(CoreModel.SOUND_FILE_PATH + "takbeer-of-athan.mp3", true);
            AudioManager.Instance.LoadSounds(CoreModel.SOUND_FILE_PATH);

            this._splashTimer.Interval = TimeSpan.FromSeconds(4);

            this._splashTimer.Tick += new EventHandler(splashTimer_Tick);
            this.FadeOutComplete += new FadeEventDelegate(SplashScreen_FadeOutComplete);
            this.FadeInComplete += new FadeEventDelegate(SplashScreen_FadeInComplete);

            base.Initialize();

            this.FadeIn();
        }
Пример #2
0
 public void AttachTo(TowerSprite sprite, bool changeRelative)
 {
     this.BaseText.AttachTo(sprite.InternalSprite, changeRelative);
 }
Пример #3
0
        public override void Initialize()
        {
            base.Initialize();
            this.FadeOutImmediately();

            this.AddSprite("Content/menus/menu-screen.jpg");
            Sprite title = this.AddSprite("Content/credits/credits.png");
            // Align with top of the center area, plus our height, plus 8-16 padding
            title.Y = 160 + title.Texture.Height + 16;

            const int SPACE_BETWEEN_IMAGES = 4;
            const int FULL_IMAGE_SIZE = 128;
            const int ACTUAL_IMAGE_SIZE = FULL_IMAGE_SIZE - 2; // 2 for border
            Point TOP_LEFT_OF_IMAGE_AREA = new Point(-325 + FULL_IMAGE_SIZE / 2, 200 - FULL_IMAGE_SIZE / 2);

            // Make a 5x3 grid of sprites
            // See procurement plan for first 13; last two are button/titlescreen
            string[] images = new string[] {
                "titlescreen.jpg",
                "story-1.jpg",
                "story-2.jpg",
                "metal-background.jpg",
                "metal-under-board.jpg",
                "eroded-metal.jpg",
                "extruded-metal.jpg",
                "metal-gate.jpg",
                "stripes.jpg",
                "speaker-icon.png",
                "speaker-icon.png",
                "speaker-icon.png",
                "speaker-icon.png",
                "speaker-icon.png",
                "speaker-icon.png"
            };

            int imageIndex = 0;
            foreach (string imageFileName in images)
            {
                TowerSprite image = new TowerSprite(this, "Content/Credits/" + imageFileName);
                // Shrink to 126x126
                image.RightTextureCoordinate = (ACTUAL_IMAGE_SIZE / image.Texture.Width);
                image.BottomTextureCoordinate = (ACTUAL_IMAGE_SIZE / image.Texture.Height);
                FlatRedBall.Math.Geometry.AxisAlignedRectangle border = this.AddAxisAlignedRectangle(ACTUAL_IMAGE_SIZE / 2, ACTUAL_IMAGE_SIZE / 2);
                image.AttachTo(border, true);

                // Can't move image, it's bound to border
                border.X = TOP_LEFT_OF_IMAGE_AREA.X + (imageIndex % 5 * ((SPACE_BETWEEN_IMAGES + ACTUAL_IMAGE_SIZE)));
                border.Y = TOP_LEFT_OF_IMAGE_AREA.Y - ((imageIndex / 5) * (SPACE_BETWEEN_IMAGES + ACTUAL_IMAGE_SIZE));

                this._imageToImageIndex[image] = imageIndex;

                image.OnMouseEnter += () => {
                    int index = this._imageToImageIndex[image];
                    this._infoText.DisplayText = this._captions[index];
                    if (index >= 9)
                    {
                        // Sound file
                        AudioManager.Instance.PlaySound(CoreModel.SOUND_FILE_PATH + this._soundFiles[index - 9]);
                    }
                };

                imageIndex++;
            }

            Sprite infoWindow = this.AddSprite("Content/Credits/credits-info-window.png");
            infoWindow.Y = -219;

            _infoText = new TowerText(this.AddText("Some items used with the implicit permission of their authors. Hover over items for details."));
            _infoText.Y = infoWindow.Y;

            Tower3SliceButton backButton = new Tower3SliceButton(this, "Back", "bubble", 18, -5);
            backButton.X = 340;
            backButton.Y = -275;
            backButton.Click += () =>
            {
                this.FadeOutComplete += (fadeType) =>
                {
                    MoveToScreen(typeof(MainMenuScreen));
                };
                this.FadeOut();
            };

            this.FadeIn();
        }
Пример #4
0
        public override void Initialize()
        {
            this.FadeOutImmediately();

            this.AddSprite("Content/Menus/menu-screen.jpg");
            Sprite title = this.AddSprite("Content/Menus/select-level.png");

            const int VERTICAL_OFFSET = 160;
            const int HORIZONTAL_OFFSET_FROM_SCREEN = 30;
            const int VERTICAL_PADDING_BETWEEN_ROWS = 10;

            int SQUARE_WIDTH = 0;
            int SQUARE_HEIGHT = 0;

            // Start Y of levels, plus our height, plus 8-16 padding
            title.Y = VERTICAL_OFFSET + title.Texture.Height + 16;

            int currentLevel = CoreModel.Instance.MaxLevelReached;

            // 12 normal levels
            for (int i = 1; i <= CoreModel.NUMBER_OF_LEVELS; i++)
            {
                TowerSprite square;
                if (i <= currentLevel)
                {
                    square = new TowerSprite(this, "Content/Menus/normal-level.png");
                }
                else
                {
                    square = new TowerSprite(this, "Content/Menus/inactive-level.png");
                }

                SQUARE_WIDTH = square.Width;
                SQUARE_HEIGHT = square.Height;

                square.X = -300 + HORIZONTAL_OFFSET_FROM_SCREEN +
                    (((i - 1) % 3) * square.Width);

                square.Y = VERTICAL_OFFSET -
                    (((i - 1) / 3) * (VERTICAL_PADDING_BETWEEN_ROWS + square.Height) );

                square.Click += new TowerSprite.ClickedDelegate(levelSquare_Click);

                TowerText t = new TowerText(this.AddText(i.ToString()));
                t.X = square.X;

                if (i <= currentLevel)
                {
                    t.Colour(0, 0, 0);
                    t.Y = square.Y + 3;
                }
                else
                {
                    t.Colour(255, 255, 255);
                    t.Y = square.Y - 10;
                }

                t.Z = square.Z + 1;
                t.AttachTo(square, true);
            }

            currentLevel -= CoreModel.NUMBER_OF_LEVELS;

            // 12 puzzle levels
            for (int i = 1; i <= CoreModel.NUMBER_OF_LEVELS; i++)
            {
                TowerSprite square;
                if (i <= currentLevel)
                {
                    square = new TowerSprite(this, "Content/Menus/puzzle-level.png");
                }
                else
                {
                    square = new TowerSprite(this, "Content/Menus/inactive-level.png");
                }

                square.X = (square.Width / 2) +
                    (((i - 1) % 3) * square.Width);

                square.Y = VERTICAL_OFFSET -
                    (((i - 1) / 3) * (VERTICAL_PADDING_BETWEEN_ROWS + square.Height));

                square.Click += new TowerSprite.ClickedDelegate(levelSquare_Click);

                TowerText t = new TowerText(this.AddText(string.Format("P{0}", i)));
                t.X = square.X;

                if (i <= currentLevel)
                {
                    t.Colour(0, 0, 0);
                    t.Y = square.Y + 3;
                }
                else
                {
                    t.Colour(255, 255, 255);
                    t.Y = square.Y - 10;
                }

                t.Z = square.Z + 1;

                t.AttachTo(square, true);
            }

            Tower3SliceButton backButton = new Tower3SliceButton(this, "Back", "bubble", 18, -5);
            backButton.X = 340;//;HORIZONTAL_OFFSET_FROM_SCREEN + (1.25f * SQUARE_WIDTH);
            backButton.Y = -275; //;VERTICAL_OFFSET - (4 * SQUARE_HEIGHT) - (6 * VERTICAL_PADDING_BETWEEN_ROWS);
            backButton.Click += new TowerBaseButton.ClickedDelegate(backButton_Click);

            if (CoreModel.Instance.MaxLevelReached >= CoreModel.AVALANCHE_LEVEL)
            {
                TowerSprite avalanche = new TowerSprite(this, "Content/Menus/avalanche-level.png");
                avalanche.X = -325 + HORIZONTAL_OFFSET_FROM_SCREEN + (0.5f * SQUARE_WIDTH);
                avalanche.Y = VERTICAL_OFFSET - (4 * SQUARE_HEIGHT) - (6 * VERTICAL_PADDING_BETWEEN_ROWS);
                avalanche.Click += new TowerSprite.ClickedDelegate(avalanche_Click);

                TowerText avalancheText = new TowerText(this.AddText("Avalanche"));
                avalancheText.X = avalanche.X;
                avalancheText.Y = avalanche.Y + 5;
                avalancheText.Z = avalanche.Z + 1;
                avalancheText.Colour(0, 0, 0);
                avalancheText.AttachTo(avalanche, true);

                TowerSprite trickle = new TowerSprite(this, "Content/Menus/trickle-level.png");
                trickle.X = avalanche.X + SQUARE_WIDTH + 50;
                trickle.Y = avalanche.Y;
                trickle.Click += new TowerSprite.ClickedDelegate(trickle_Click);

                TowerText trickleText = new TowerText(this.AddText("Trickle"));
                trickleText.X = trickle.X;
                trickleText.Y = trickle.Y + 9;
                trickleText.Z = trickle.Z + 1;
                trickleText.AttachTo(trickle, true);
            }

            base.Initialize();

            this.FadeIn();
        }