Пример #1
0
        private void ScaleUpClick(Button obj)
        {
            var checkBox = obj as CheckBox;

            PixelDungeon.ScaleUp(checkBox != null && checkBox.Checked());
        }
Пример #2
0
        public WndSettings(bool inGame)
        {
            CheckBox btnImmersive = null;

            if (inGame)
            {
                var w = BtnHeight;

                _btnZoomOut             = new RedButton(TxtZoomOut);
                _btnZoomOut.ClickAction = button => Zoom(pdsharp.noosa.Camera.Main.Zoom - 1);
                Add(_btnZoomOut.SetRect(0, 0, w, BtnHeight));

                _btnZoomIn             = new RedButton(TxtZoomIn);
                _btnZoomIn.ClickAction = button => Zoom(pdsharp.noosa.Camera.Main.Zoom + 1);
                Add(_btnZoomIn.SetRect(WIDTH - w, 0, w, BtnHeight));

                var btnZoomDefault = new RedButton(TxtZoomDefault);
                btnZoomDefault.ClickAction = button => Zoom(PixelScene.defaultZoom);
                btnZoomDefault.SetRect(_btnZoomOut.Right(), 0, WIDTH - _btnZoomIn.Width - _btnZoomOut.Width, BtnHeight);
                Add(btnZoomDefault);
            }
            else
            {
                var btnScaleUp = new CheckBox(TxtScaleUp);
                btnScaleUp.ClickAction = ScaleUpClick;
                btnScaleUp.SetRect(0, 0, WIDTH, BtnHeight);
                btnScaleUp.SetChecked(PixelDungeon.ScaleUp());
                Add(btnScaleUp);

                btnImmersive             = new CheckBox(TxtImmersive);
                btnImmersive.ClickAction = ImmersiveClick;
                btnImmersive.SetRect(0, btnScaleUp.Bottom() + Gap, WIDTH, BtnHeight);
                btnImmersive.SetChecked(PixelDungeon.Immersed());
                btnImmersive.Enable(Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat);
                Add(btnImmersive);
            }

            var btnMusic = new CheckBox(TxtMusic);

            btnMusic.ClickAction = button =>
            {
                var checkBox = button as CheckBox;
                PixelDungeon.Music(checkBox != null && checkBox.Checked());
            };
            btnMusic.SetRect(0, (btnImmersive != null ? btnImmersive.Bottom() : BtnHeight) + Gap, WIDTH, BtnHeight);
            btnMusic.SetChecked(PixelDungeon.Music());
            Add(btnMusic);

            var btnSound = new CheckBox(TxtSound);

            btnSound.ClickAction = SoundClick;
            btnSound.SetRect(0, btnMusic.Bottom() + Gap, WIDTH, BtnHeight);
            btnSound.SetChecked(PixelDungeon.SoundFx());
            Add(btnSound);

            if (!inGame)
            {
                var btnOrientation = new RedButton(OrientationText());
                btnOrientation.ClickAction = OrientationClick;
                btnOrientation.SetRect(0, btnSound.Bottom() + Gap, WIDTH, BtnHeight);
                Add(btnOrientation);

                Resize(WIDTH, (int)btnOrientation.Bottom());
            }
            else
            {
                var btnBrightness = new CheckBox(TxtBrightness);
                btnBrightness.ClickAction = button =>
                {
                    var checkBox = button as CheckBox;
                    PixelDungeon.Brightness(checkBox != null && checkBox.Checked());
                };
                btnBrightness.SetRect(0, btnSound.Bottom() + Gap, WIDTH, BtnHeight);
                btnBrightness.SetChecked(PixelDungeon.Brightness());
                Add(btnBrightness);

                Resize(WIDTH, (int)btnBrightness.Bottom());
            }
        }
Пример #3
0
        public override void Create()
        {
            base.Create();

            GameScene.Scene = null;

            defaultZoom = (int)Math.Ceiling(Game.density * 2.5);
            while ((Game.Width / defaultZoom < MIN_WIDTH || Game.Height / defaultZoom < MIN_HEIGHT) && defaultZoom > 1)
            {
                defaultZoom--;
            }

            landscapeAvailable = Game.Height / defaultZoom >= MIN_WIDTH && Game.Width / defaultZoom >= MIN_HEIGHT;

            if (PixelDungeon.ScaleUp())
            {
                while ((Game.Width / (defaultZoom + 1) >= MIN_WIDTH && Game.Height / (defaultZoom + 1) >= MIN_HEIGHT))
                {
                    defaultZoom++;
                }
            }

            minZoom = 1;
            maxZoom = defaultZoom * 2;


            Camera.Reset(new PixelCamera(defaultZoom));

            float uiZoom = defaultZoom;

            uiCamera = Camera.CreateFullscreen(uiZoom);
            Camera.Add(uiCamera);

            if (font1x == null)
            {
                // 3x5 (6)
                font1x          = Font.ColorMarked(BitmapCache.Get(Assets.FONTS1X), Android.Graphics.Color.Argb(0x00, 0x00, 0x00, 0x00), Font.LatinFull);
                font1x.BaseLine = 6;
                font1x.tracking = -1;

                // 5x8 (10)
                font15x          = Font.ColorMarked(BitmapCache.Get(Assets.FONTS15X), 12, Android.Graphics.Color.Argb(0x00, 0x00, 0x00, 0x00), Font.LatinFull);
                font15x.BaseLine = 9;
                font15x.tracking = -1;

                // 6x10 (12)
                font2x          = Font.ColorMarked(BitmapCache.Get(Assets.FONTS2X), 14, Android.Graphics.Color.Argb(0x00, 0x00, 0x00, 0x00), Font.LatinFull);
                font2x.BaseLine = 11;
                font2x.tracking = -1;

                // 7x12 (15)
                font25x          = Font.ColorMarked(BitmapCache.Get(Assets.FONTS25X), 17, Android.Graphics.Color.Argb(0x00, 0x00, 0x00, 0x00), Font.LatinFull);
                font25x.BaseLine = 13;
                font25x.tracking = -1;

                // 9x15 (18)
                font3x          = Font.ColorMarked(BitmapCache.Get(Assets.FONTS3X), 22, Android.Graphics.Color.Argb(0x00, 0x00, 0x00, 0x00), Font.LatinFull);
                font3x.BaseLine = 17;
                font3x.tracking = -2;
            }

            Sample.Instance.Load(Assets.SND_CLICK, Assets.SND_BADGE, Assets.SND_GOLD);
        }