示例#1
0
    IEnumerator SetupField()
    {
        yield return(null);

        switch (MenuType)
        {
        case MenuItemType.SLIDER:
            #region Slider Cases if you aren't supported you fall into 'default'
            Slider Slid = GetComponent <Slider>();
            float  val  = 0;
            switch (SettingsTarget)
            {
            case SettingsNames.AUD_MASTER:
                val = FindObjectOfType <MenuNavigator>().GetSettings().Audio.Master;
                break;

            case SettingsNames.AUD_MUSIC:
                val = FindObjectOfType <MenuNavigator>().GetSettings().Audio.Music;
                break;

            case SettingsNames.AUD_EFFECTS:
                val = FindObjectOfType <MenuNavigator>().GetSettings().Audio.Effects;
                break;

            case SettingsNames.AUD_VOICE:
                val = FindObjectOfType <MenuNavigator>().GetSettings().Audio.Voice;
                break;

            case SettingsNames.GP_TIMESCALE:
                val = FindObjectOfType <MenuNavigator>().GetSettings().Gameplay.TimeScale;
                break;

            default:
                Debug.LogWarning(SettingsTarget.ToString() + " Is not supported by " + MenuType.ToString());
                break;
            }

            Slid.normalizedValue = val;
            if (SettingsTarget == SettingsNames.GP_TIMESCALE)
            {
                UpdateText(val.ToString("N", Digit));
            }
            else
            {
                UpdateText((val * 100).ToString());
            }
            #endregion
            break;

        case MenuItemType.SPINNER:
            #region Spinner Cases if you aren't supported you fall into 'default'
            Scrollbar Scroll = GetComponent <Scrollbar>();
            int       Value  = 0;
            switch (SettingsTarget)
            {
            case SettingsNames.GFX_RES:
                #region This is a bit complex since we need to do a lot with values...
                Scroll.numberOfSteps = Screen.resolutions.Length;
                //Value = (int)(Scroll.value * Scroll.numberOfSteps);
                //if (Res == null) Res = Screen.resolutions[0];
                ScreenRes Res = FindObjectOfType <MenuNavigator>().GetSettings().Graphics.Res;
                foreach (Resolution _res in Screen.resolutions)
                {
                    if (Res.width <= _res.width)
                    {
                        //Debug.Log(Value + " | " +Res.width + " | " + _res.width);
                        break;
                    }
                    else
                    {
                        Value++;
                    }
                }
                Scroll.value = Value / (Scroll.numberOfSteps - 1);
                UpdateText(Res.width + "x" + Res.height);
                #endregion
                break;

            case SettingsNames.GFX_FULLSCREEN:
                #region
                Scroll.numberOfSteps = 4;
                Value = (int)(Scroll.value * Scroll.numberOfSteps);
                //UpdateSpinner(Scroll);
                #endregion
                break;

            default:
                Debug.LogWarning(SettingsTarget.ToString() + " Is not supported by " + MenuType.ToString());
                break;
            }
            ;
            #endregion
            break;

        case MenuItemType.BUTTON:
            #region Button Cases if you aren't supported you fall into 'default'
            switch (SettingsTarget)
            {
            default:
                Debug.LogWarning(SettingsTarget.ToString() + " Is not supported by " + MenuType.ToString());
                break;
            }
            #endregion
            break;

        case MenuItemType.TOGGLE:
            #region Button Cases if you aren't supported you fall into 'default'
            switch (SettingsTarget)
            {
            default:
                Debug.LogWarning(SettingsTarget.ToString() + " Is not supported by " + MenuType.ToString());
                break;
            }
            #endregion
            break;

        case MenuItemType.NONE:
        default:
            Debug.LogWarning(MenuType.ToString() + " Is not supported as settings");
            break;
        }
    }
示例#2
0
        public override System.Diagnostics.ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution)
        {
            string path = AppConfig.GetFullPath("vpinball");

            if (path == null)
            {
                return(null);
            }

            string exe = Path.Combine(path, "VPinballX.exe");

            if (!File.Exists(exe))
            {
                return(null);
            }

            _rom    = rom;
            _splash = ShowSplash(rom);

            ScreenResolution.SetHighDpiAware(exe);
            EnsureUltraDMDRegistered(path);
            EnsureBackglassServerRegistered(path);
            EnsureVPinMameRegistered(path);

            string romPath = Path.Combine(Path.GetDirectoryName(rom), "roms");

            if (!Directory.Exists(romPath))
            {
                romPath = null;
            }

            ScreenRes sr = ScreenRes.Load(Path.GetDirectoryName(rom));

            if (sr != null)
            {
                if (Screen.AllScreens.Length == 1 || SystemInformation.TerminalServerSession)
                {
                    sr.Delete();
                }
                else
                {
                    sr.ScreenResX = resolution == null ? Screen.PrimaryScreen.Bounds.Width : resolution.Width;
                    sr.ScreenResY = resolution == null ? Screen.PrimaryScreen.Bounds.Height : resolution.Height;

                    Screen secondary = Screen.AllScreens.FirstOrDefault(s => !s.Primary);
                    sr.Screen2ResX = secondary.Bounds.Width;
                    sr.Screen2ResY = secondary.Bounds.Height;
                    sr.Monitor     = 2;

                    sr.Save();
                }
            }

            SetupOptions(path, romPath, resolution);

            return(new ProcessStartInfo()
            {
                FileName = exe,
                Arguments = "-play  \"" + rom + "\"",
                WindowStyle = _splash != null ? ProcessWindowStyle.Minimized : ProcessWindowStyle.Normal,
                UseShellExecute = true
            });
        }