示例#1
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;

            var archs = new Archs();

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

            var pw = Math.Min(160, w - 6);
            var ph = h - 30;

            var panel = Chrome.Get(Chrome.Type.WINDOW);

            panel.Size(pw, ph);
            panel.X = (w - pw) / 2;
            panel.Y = (h - ph) / 2;
            Add(panel);

            var title = CreateText(TxtTitle, 9);

            title.Hardlight(Window.TitleColor);
            title.Measure();
            title.X = Align((w - title.Width) / 2);
            title.Y = Align((panel.Y - title.BaseLine()) / 2);
            Add(title);

            Badge.LoadGlobal();

            ScrollPane list = new BadgesList(true);

            Add(list);

            list.SetRect(panel.X + panel.MarginLeft(), panel.Y + panel.MarginTop(), panel.InnerWidth(), panel.InnerHeight());

            var btnExit = new ExitButton();

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

            FadeIn();
        }
示例#2
0
        public override void Create()
        {
            base.Create();

            var text = CreateMultiline(Txt, 8);

            text.MaxWidth = Math.Min(Camera.Main.CameraWidth, 120);
            text.Measure();
            Add(text);

            text.X = Align((Camera.Main.CameraWidth - text.Width) / 2);
            text.Y = Align((Camera.Main.CameraHeight - text.Height) / 2);

            var link = CreateMultiline(Lnk, 8);

            link.MaxWidth = Math.Min(Camera.Main.CameraWidth, 120);
            link.Measure();
            link.Hardlight(Window.TitleColor);
            Add(link);

            link.X = text.X;
            link.Y = text.Y + text.Height;

            var hotArea = new TouchArea(link);

            hotArea.ClickAction = HotAreaClickAction;
            Add(hotArea);

            var wata = Icons.WATA.Get();

            wata.X = Align(text.X + (text.Width - wata.Width) / 2);
            wata.Y = text.Y - wata.Height - 8;
            Add(wata);

            new Flare(7, 64).Color(0x112233, true).Show(wata, 0).AngularSpeed = +20;

            var archs = new Archs();

            archs.SetSize(Camera.Main.CameraWidth, Camera.Main.CameraHeight);
            AddToBack(archs);

            var btnExit = new ExitButton();

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

            FadeIn();
        }
示例#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();
        }
示例#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;

            _archs = new Archs();
            _archs.SetSize(w, h);
            Add(_archs);

            Rankings.Instance.Load();

            if (Rankings.Instance.records.Count > 0)
            {
                var left = (w - Math.Min(160, w)) / 2 + Gap;
                var top  = Align((h - RowHeight * Rankings.Instance.records.Count) / 2);

                var title = CreateText(TxtTitle, 9);
                title.Hardlight(Window.TitleColor);
                title.Measure();
                title.X = Align((w - title.Width) / 2);
                title.Y = Align(top - title.Height - Gap);
                Add(title);

                var pos = 0;

                foreach (var rec in Rankings.Instance.records)
                {
                    var row = new RecordButton(pos, pos == Rankings.Instance.lastRecord, rec);
                    row.SetRect(left, top + pos * RowHeight, w - left * 2, RowHeight);
                    Add(row);

                    pos++;
                }

                if (Rankings.Instance.totalNumber >= Rankings.TABLE_SIZE)
                {
                    var total = CreateText(Utils.Format(TxtTotal, Rankings.Instance.totalNumber), 8);
                    total.Hardlight(Window.TitleColor);
                    total.Measure();
                    total.X = Align((w - total.Width) / 2);
                    total.Y = Align(top + pos * RowHeight + Gap);
                    Add(total);
                }
            }
            else
            {
                var title = CreateText(TxtNoGames, 8);
                title.Hardlight(Window.TitleColor);
                title.Measure();
                title.X = Align((w - title.Width) / 2);
                title.Y = Align((h - title.Height) / 2);
                Add(title);
            }

            var btnExit = new ExitButton();

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

            FadeIn();
        }
示例#5
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();
        }