Beispiel #1
0
        public static void GameOver()
        {
            Banner gameOver = new Banner(BannerSprites.Get(BannerSprites.Type.GameOver));

            gameOver.Show(0x000000, 1f);
            Scene.ShowBanner(gameOver);

            Sample.Instance.Play(Assets.SND_DEATH);
        }
Beispiel #2
0
        public static void BossSlain()
        {
            if (!Dungeon.Hero.IsAlive)
            {
                return;
            }

            Banner bossSlain = new Banner(BannerSprites.Get(BannerSprites.Type.BossSlain));

            bossSlain.Show(0xFFFFFF, 0.3f, 5f);
            Scene.ShowBanner(bossSlain);

            Sample.Instance.Play(Assets.SND_BOSS);
        }
Beispiel #3
0
        public override void Create()
        {
            base.Create();

            Badge.LoadGlobal();

            uiCamera.Visible = false;

            var w = Camera.Main.CameraWidth;
            var h = Camera.Main.CameraHeight;

            var left   = (w - WIDTH) / 2;
            var top    = (h - HEIGHT) / 2;
            var bottom = h - top;

            var archs = new Archs();

            archs.SetSize(w, h);
            Add(archs);

            var title = BannerSprites.Get(BannerSprites.Type.SelectYourHero);

            title.X = Align((w - title.Width) / 2);
            title.Y = top;
            Add(title);

            btnNewGame             = new GameButton(TXT_NEW);
            btnNewGame.ClickAction = NewGameClick;
            Add(btnNewGame);

            btnLoad             = new GameButton(TXT_LOAD);
            btnLoad.ClickAction = LoadClick;
            Add(btnLoad);

            var classes = new[]
            {
                HeroClass.Warrior,
                HeroClass.Mage,
                HeroClass.Rogue,
                HeroClass.Huntress
            };

            const float shieldW = WIDTH / 2;
            var         shieldH = Math.Min((bottom - BUTTON_HEIGHT - title.Y - title.Height) / 2, shieldW * 1.2f);

            top = (bottom - BUTTON_HEIGHT + title.Y + title.Height - shieldH * 2) / 2;
            for (var i = 0; i < classes.Length; i++)
            {
                var shield = new ClassShield(classes[i], this);
                shield.SetRect(left + (i % 2) * shieldW, top + (i / 2) * shieldH, shieldW, shieldH);
                Add(shield);

                if (Shields.ContainsKey(classes[i]))
                {
                    Shields[classes[i]] = shield;
                }
                else
                {
                    Shields.Add(classes[i], shield);
                }
            }

            unlock = new Group();
            Add(unlock);

            var challenge = new ChallengeButton();

            challenge.SetPos(w / 2 - challenge.Width / 2, top + shieldH - challenge.Height / 2);
            Add(challenge);

            if (!(huntressUnlocked = Badge.IsUnlocked(Badge.BOSS_SLAIN_3)))
            {
                var text = CreateMultiline(TXT_UNLOCK, 9);
                text.MaxWidth = (int)WIDTH;
                text.Measure();

                float pos = (bottom - BUTTON_HEIGHT) + (BUTTON_HEIGHT - text.Height) / 2;
                foreach (var line in new LineSplitter(text.Font, text.Scale, text.Text()).Split())
                {
                    line.Measure();
                    line.Hardlight(0xFFFF00);
                    line.X = Align(left + WIDTH / 2 - line.Width / 2);
                    line.Y = Align(pos);
                    unlock.Add(line);

                    pos += line.Height;
                }
            }

            var btnExit = new ExitButton();

            btnExit.SetPos(Camera.Main.CameraWidth - btnExit.Width, 0);
            Add(btnExit);

            curClass = null;
            UpdateClass(HeroClass.Values()[PixelDungeon.LastClass()]);

            FadeIn();
        }
Beispiel #4
0
        public override void Create()
        {
            base.Create();

            Music.Instance.Play(Assets.THEME, true);
            //Music.Instance.Volume(1f);

            uiCamera.Visible = false;

            var w = Camera.Main.CameraWidth;
            var h = Camera.Main.CameraHeight;

            const float height = 180;

            var archs = new Archs();

            archs.SetSize(w, h);
            Add(archs);

            var title = BannerSprites.Get(BannerSprites.Type.PixelDungeon);

            Add(title);

            title.X = (w - title.Width) / 2;
            title.Y = (h - height) / 2;

            PlaceTorch(title.X + 20, title.Y + 20);
            PlaceTorch(title.X + title.Width - 20, title.Y + 20);

            var btnBadges = new DashboardItem(TxtBadges, 3);

            btnBadges.ClickAction = (button) => PixelDungeon.SwitchNoFade <BadgesScene>();
            btnBadges.SetPos(w / 2 - btnBadges.Width, (h + height) / 2 - DashboardItem.Size);
            Add(btnBadges);

            var btnAbout = new DashboardItem(TxtAbout, 1);

            btnAbout.ClickAction = (button) => PixelDungeon.SwitchNoFade <AboutScene>();
            btnAbout.SetPos(w / 2, (h + height) / 2 - DashboardItem.Size);
            Add(btnAbout);

            var btnPlay = new DashboardItem(TxtPlay, 0);

            btnPlay.ClickAction = (button) => PixelDungeon.SwitchNoFade <StartScene>();
            btnPlay.SetPos(w / 2 - btnPlay.Width, btnAbout.Top() - DashboardItem.Size);
            Add(btnPlay);

            var btnHighscores = new DashboardItem(TxtHighscores, 2);

            btnHighscores.ClickAction = (button) => PixelDungeon.SwitchNoFade <RankingsScene>();
            btnHighscores.SetPos(w / 2, btnPlay.Top());
            Add(btnHighscores);

            var version = new BitmapText("v " + Game.version, font1x);

            version.Measure();
            version.Hardlight(0x888888);
            version.X = w - version.Width;
            version.Y = h - version.Height;
            Add(version);

            var btnPrefs = new PrefsButton();

            btnPrefs.SetPos(0, 0);
            Add(btnPrefs);

            var btnExit = new ExitButton();

            btnExit.SetPos(w - btnExit.Width, 0);
            Add(btnExit);

            FadeIn();
        }