예제 #1
0
        private void SoundClick(Button obj)
        {
            var checkBox = obj as CheckBox;

            PixelDungeon.SoundFx(checkBox != null && checkBox.Checked());
            Sample.Instance.Play(Assets.SND_CLICK);
        }
예제 #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());
            }
        }