//THIS IS USED TO HELP SET SPINNERS....
    public void SaveToVar(SettingsNames names, int val)
    {
        if (GameMan.GetSettings() == null)
        {
            GameMan.MenuMan.LoadSettings();
        }
        if (GameMan.GetSettings() != null)
        {
            D_Settings Settings = GameMan.GetSettings();
            switch (names)
            {
            case SettingsNames.GFX_FULLSCREEN:
                Settings.Graphics.FullScreen = (FullScreenMode)val;
                break;

            case SettingsNames.GFX_RES:
                Resolution res = Screen.resolutions[val];
                Settings.Graphics.Res.width   = res.width;
                Settings.Graphics.Res.height  = res.height;
                Settings.Graphics.Res.refresh = res.refreshRate;
                break;

            default:
                Debug.LogWarning(names.ToString() + " is not supported by floats");
                break;
            }
        }
        else
        {
            Debug.LogWarning("THERE ARE NO SETTINGS ATTACHED TO THIS GAME MANAGER");
        }
    }
Ejemplo n.º 2
0
 public static void UpdateData(SettingsNames name, object data)
 {
     if (SettingsData == null)
     {
         UpdateDataFromSource();
     }
     NewSettings[name.ToString()] = data;
 }
Ejemplo n.º 3
0
 private static bool SetColor(SettingsNames resourceName, String colorName)
 {
     if (ValidateColor(colorName))
     {
         System.Windows.Application.Current.Resources[resourceName.ToString()] = brushConverter.ConvertFromString(colorName);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
        public string ReadSetting(SettingsNames name)
        {
            var val = _context.SettingItems.SingleOrDefault(z => z.Name == name.ToString());

            if (val == null)
            {
                return(string.Empty);
            }
            return(val.Value);
        }
Ejemplo n.º 5
0
        public void WriteSettings(SettingsNames name, string value)
        {
            var val = _context.SettingItems.SingleOrDefault(z => z.Name == name.ToString());

            if (val == null)
            {
                val = new SettingItem
                {
                    Name        = name.ToString(),
                    Value       = value,
                    LastChanged = DateTime.UtcNow
                };
                _context.SettingItems.Add(val);
            }
            else
            {
                val.Value       = value;
                val.LastChanged = DateTime.UtcNow;
            }
            _context.SaveChanges();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the setting by name.
        /// </summary>
        /// <returns></returns>
        public static SettingsDto GetSettingByName(SettingsNames settingName)
        {
            SettingsDto dto = null;

            // Load the object
            if (dto == null)
            {
                CommonSettingsAdmin admin = new CommonSettingsAdmin();
                admin.LoadBySettingName(settingName.ToString());
                dto = admin.CurrentDto;
            }

            dto.AcceptChanges();

            return(dto);
        }
    //This is used to help set Sliders
    public void SaveToVar(SettingsNames names, float val)
    {
        if (GameMan.GetSettings() == null)
        {
            GameMan.MenuMan.LoadSettings();
        }
        if (GameMan.GetSettings() != null)
        {
            D_Settings Settings = GameMan.GetSettings();
            switch (names)
            {
            case SettingsNames.AUD_MASTER:
                Settings.Audio.Master = val;
                break;

            case SettingsNames.AUD_MUSIC:
                Settings.Audio.Music = val;
                break;

            case SettingsNames.AUD_EFFECTS:
                Settings.Audio.Effects = val;
                break;

            case SettingsNames.AUD_VOICE:
                Settings.Audio.Voice = val;
                break;

            case SettingsNames.GP_TIMESCALE:
                Settings.Gameplay.TimeScale = val;
                break;

            default:
                Debug.LogWarning(names.ToString() + " is not supported by floats");
                break;
            }
        }
        else
        {
            Debug.LogWarning("THERE ARE NO SETTINGS ATTACHED TO THIS GAME MANAGER");
        }
    }
Ejemplo n.º 8
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;
        }
    }
Ejemplo n.º 9
0
 public static T GetSetting <T>(SettingsNames name)
 {
     return((T)(GetData()[name.ToString()]));
 }
Ejemplo n.º 10
0
 public static void SetBorderThickness(SettingsNames resourceName, int value) =>
 System.Windows.Application.Current.Resources[resourceName.ToString()] = new System.Windows.Thickness(value);
Ejemplo n.º 11
0
 public static void SetCornerRadius(SettingsNames resourceName, int value) =>
 System.Windows.Application.Current.Resources[resourceName.ToString()] = new System.Windows.CornerRadius(value);