Ejemplo n.º 1
0
        public override void OnShow(IMenuContainer root)
        {
            base.OnShow(root);

#if __ANDROID__
            // 3xBRZ shader is not available in OpenGL ES 3.0 version
            resizeMode = new ChoiceControl(api, "Resize Mode", (int)Resize, "None", "HQ2x");
            vibrations = new ChoiceControl(api, "Vibrations", Duality.Android.InnerView.allowVibrations ? 1 : 0, "Disable", "Enable");
#else
            resizeMode = new ChoiceControl(api, "Resize Mode", (int)Resize, "None", "HQ2x", "3xBRZ", "4xBRZ", "CRT");

            ScreenMode screenModeCurrent = api.ScreenMode;
            int        screenModeValue;
            if ((screenModeCurrent & ScreenMode.FullWindow) != 0)
            {
                screenModeValue = 1;
            }
            else
            {
                screenModeValue = 0;
            }
            screenMode = new ChoiceControl(api, "Screen Mode", screenModeValue, "Window", "Fullscreen");
#endif
            musicVolume = new SliderControl(api, "Music Volume", MusicVolume, 0f, 1f);
            sfxVolume   = new SliderControl(api, "SFX Volume", SfxVolume, 0f, 1f);

#if __ANDROID__
            controls = new MenuControlBase[] {
                resizeMode, vibrations, musicVolume, sfxVolume,
                new LinkControl(api, "Controls", OnControlsPressed)
            };
#else
            controls = new MenuControlBase[] {
                resizeMode, screenMode, musicVolume, sfxVolume,
                new LinkControl(api, "Controls", OnControlsPressed)
            };
#endif
        }
Ejemplo n.º 2
0
        public override void OnShow(IMenuContainer root)
        {
            base.OnShow(root);

#if !__ANDROID__ && !WASM
            ScreenMode screenModeCurrent = api.ScreenMode;
            int        screenModeValue;
            if ((screenModeCurrent & ScreenMode.FullWindow) != 0)
            {
                screenModeValue = 1;
            }
            else
            {
                screenModeValue = 0;
            }
            screenMode = new ChoiceControl(api, "menu/settings/screen".T(), screenModeValue,
                                           "menu/settings/screen/0".T(), "menu/settings/screen/1".T());

            int refreshModeValue = (int)api.RefreshMode;
            refreshMode = new ChoiceControl(api, "menu/settings/refresh".T(), refreshModeValue,
                                            "menu/settings/refresh/0".T(), "menu/settings/refresh/1".T(), "menu/settings/refresh/2".T(), "menu/settings/refresh/3".T());
#endif
            availableLanguages = i18n.AvailableLanguages;
            string   currentLanguage      = i18n.Language;
            int      currentLanguageIndex = 0;
            string[] languageNames        = new string[availableLanguages.Length];
            for (int i = 0; i < availableLanguages.Length; i++)
            {
                if (availableLanguages[i] == currentLanguage)
                {
                    currentLanguageIndex = i;
                }

                try {
                    languageNames[i] = CultureInfo.GetCultureInfo(availableLanguages[i]).DisplayName;
                } catch {
                    languageNames[i] = availableLanguages[i].ToUpperInvariant();
                }
            }
            language = new ChoiceControl(api, "menu/settings/language".T(), currentLanguageIndex, languageNames);

#if !WASM
            musicVolume = new SliderControl(api, "menu/settings/music".T(), MusicVolume, 0f, 1f);
            sfxVolume   = new SliderControl(api, "menu/settings/sfx".T(), SfxVolume, 0f, 1f);
#endif

#if __ANDROID__
            vibrations = new ChoiceControl(api, "menu/settings/vibrations".T(), Android.InnerView.AllowVibrations ? 1 : 0, "disabled".T(), "enabled".T());

            leftPadding  = new SliderControl(api, "menu/settings/left padding".T(), Android.InnerView.LeftPadding, 0f, 0.15f);
            rightPadding = new SliderControl(api, "menu/settings/right padding".T(), Android.InnerView.RightPadding, 0f, 0.15f);

            controls = new MenuControlBase[] {
                new LinkControl(api, "menu/settings/rescale".T(), OnRescaleModePressed),
                language, vibrations, musicVolume, sfxVolume,
                new LinkControl(api, "menu/settings/controls".T(), OnControlsPressed),
                leftPadding, rightPadding
            };
#elif WASM
            controls = new MenuControlBase[] {
                new LinkControl(api, "menu/settings/rescale".T(), OnRescaleModePressed),
                language,
                new LinkControl(api, "menu/settings/controls".T(), OnControlsPressed)
            };
#else
            controls = new MenuControlBase[] {
                new LinkControl(api, "menu/settings/rescale".T(), OnRescaleModePressed),
                screenMode, refreshMode, language, musicVolume, sfxVolume,
                new LinkControl(api, "menu/settings/controls".T(), OnControlsPressed)
            };
#endif
        }