Esempio n. 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();
        }
Esempio n. 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();
        }
Esempio n. 3
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();
        }
Esempio n. 4
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();
        }
Esempio n. 5
0
        public override void Create()
        {
            base.Create();

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

            uiCamera.Visible = false;

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

            var archs = new Archs();

            archs.Reversed = true;
            archs.SetSize(w, h);
            Add(archs);

            var vx = Align((w - WIDTH) / 2);
            var vy = Align((h - HEIGHT) / 2);

            var s = pdsharp.noosa.Camera.Main.CameraToScreen(vx, vy);

            _viewport = new pdsharp.noosa.Camera(s.X, s.Y, WIDTH, HEIGHT, defaultZoom);
            pdsharp.noosa.Camera.Add(_viewport);

            var window = new Group();

            window.Camera = _viewport;
            Add(window);

            var dayTime = !Dungeon.NightMode;

            var sky = new Sky(dayTime);

            sky.Scale.Set(WIDTH, HEIGHT);
            window.Add(sky);

            if (!dayTime)
            {
                for (var i = 0; i < Nstars; i++)
                {
                    var size = pdsharp.utils.Random.Float();
                    var star = new ColorBlock(size, size, Color.Argb(255, 255, 255, 255));
                    star.X  = pdsharp.utils.Random.Float(WIDTH) - size / 2;
                    star.Y  = pdsharp.utils.Random.Float(HEIGHT) - size / 2;
                    star.Am = size * (1 - star.Y / HEIGHT);
                    window.Add(star);
                }
            }

            const float range = HEIGHT * 2 / 3;

            for (var i = 0; i < Nclouds; i++)
            {
                var cloud = new Cloud((Nclouds - 1 - i) * (range / Nclouds) + pdsharp.utils.Random.Float(range / Nclouds), dayTime);
                window.Add(cloud);
            }

            var nPatches = (int)(sky.Width / GrassPatch.WIDTH + 1);

            for (var i = 0; i < nPatches * 4; i++)
            {
                var patch = new GrassPatch((i - 0.75f) * GrassPatch.WIDTH / 4, HEIGHT + 1, dayTime);
                patch.Brightness(dayTime ? 0.7f : 0.4f);
                window.Add(patch);
            }

            var a = new Avatar(Dungeon.Hero.heroClass);

            a.X = Align((WIDTH - a.Width) / 2);
            a.Y = HEIGHT - a.Height + 1;
            window.Add(a);

            var pet = new Pet();

            pet.Rm = pet.Gm = pet.Bm = 1.2f;
            pet.X  = WIDTH / 2 + 2;
            pet.Y  = HEIGHT - pet.Height;
            window.Add(pet);

            if (dayTime)
            {
                a.Brightness(1.2f);
                pet.Brightness(1.2f);
            }

            //window.Add(new TouchArea(sky) { protected void OnClick(Touch touch) { pet.Jump(); }; });

            for (var i = 0; i < nPatches; i++)
            {
                var patch = new GrassPatch((i - 0.5f) * GrassPatch.WIDTH, HEIGHT, dayTime);
                patch.Brightness(dayTime ? 1.0f : 0.8f);
                window.Add(patch);
            }

            var frame = new Image(Assets.SURFACE);

            if (!dayTime)
            {
                frame.Hardlight(0xDDEEFF);
            }

            frame.Frame(0, 0, 88, 125);
            frame.X = vx - 4;
            frame.Y = vy - 9;
            Add(frame);

            var gameOver = new RedButton("Game Over");

            gameOver.ClickAction = GameOverClickAction;
            gameOver.SetSize(WIDTH - 10, 20);
            gameOver.SetPos(5 + frame.X + 4, frame.Y + frame.Height + 4);
            Add(gameOver);

            Badge.ValidateHappyEnd();

            FadeIn();
        }
Esempio n. 6
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();
        }