void LoadSettings() { _texQualityNames.Clear(); _texQualityNames.Add("Full"); _texQualityNames.Add("Half"); _texQualityNames.Add("Quarter"); _texQualityNames.Add("Eight"); GameObject gameReg = GameObject.Find("_GameRegistry"); _data = gameReg.GetComponent <DataMap>(); _controls = gameReg.GetComponent <ControlMap>(); _setControls = _controls; //Gameplay _mouseMode = _data.GetBool("MouseMode"); //Audio _bgmVol = _data.GetFloat("BGM_Vol"); _sfxVol = _data.GetFloat("SFX_Vol"); _masterVol = _data.GetFloat("Master_Vol"); //Video _vSync = _data.GetBool("VSync"); _resHeight = _data.GetInt("Res_Height"); _resWidth = _data.GetInt("Res_Width"); _resRefresh = _data.GetInt("Res_Refresh"); _AA = _data.GetInt("Anti_Aliasing"); _aniso = _data.GetBool("Aniso_Filtering"); _texQuality = _data.GetInt("Tex_Quality"); _fullscreen = _data.GetBool("Fullscreen"); _resolutions = Screen.resolutions; int i = 0; foreach (Resolution r in _resolutions) { Debug.Log(r.width + ":" + _resWidth + " | " + r.height + ":" + _resHeight + " | " + r.refreshRate + ":" + _resRefresh); if (r.width == _resWidth) { if (r.height == _resHeight) { if (r.refreshRate == _resRefresh) { _resIndex = i; break; } } } i++; } }
void UpdateUiForConfigDataMap(DataMap config) { bool uiUpdated = false; foreach (var configKey in config.KeySet()) { if (!config.ContainsKey(configKey)) { continue; } int color = config.GetInt(configKey); if (Log.IsLoggable(Tag, LogPriority.Debug)) { Log.Debug(Tag, "Found watch face config key: " + configKey + " -> " + Integer.ToHexString(color)); } if (UpdateUiForKey(configKey, color)) { uiUpdated = true; } } if (uiUpdated) { Invalidate(); } }
void SetupColorPickerSelection(int spinnerId, string configKey, DataMap config, int defaultColorNameResId) { var defaultColorName = GetString(defaultColorNameResId); var defaultColor = Color.ParseColor(defaultColorName); int color = config != null?config.GetInt(configKey, defaultColor) : defaultColor; var spinner = FindViewById <Spinner> (spinnerId); var colorNames = Resources.GetStringArray(Resource.Array.ColorArray); for (int i = 0; i < colorNames.Length; i++) { if (Color.ParseColor(colorNames [i]) == color) { spinner.SetSelection(i); break; } } }
void UpdateUiForConfigDataMap(DataMap config) { bool uiUpdated = false; foreach (var configKey in config.KeySet ()) { if (!config.ContainsKey (configKey)) { continue; } int color = config.GetInt (configKey); if (Log.IsLoggable (Tag, LogPriority.Debug)) { Log.Debug (Tag, "Found watch face config key: " + configKey + " -> " + Integer.ToHexString (color)); } if (UpdateUiForKey (configKey, color)) { uiUpdated = true; } } if (uiUpdated) { Invalidate (); } }
void SetupColorPickerSelection(int spinnerId, string configKey, DataMap config, int defaultColorNameResId) { var defaultColorName = GetString (defaultColorNameResId); var defaultColor = Color.ParseColor (defaultColorName); int color = config != null ? config.GetInt (configKey, defaultColor) : defaultColor; var spinner = FindViewById<Spinner> (spinnerId); var colorNames = Resources.GetStringArray (Resource.Array.ColorArray); for (int i = 0; i < colorNames.Length; i++) { if (Color.ParseColor (colorNames [i]) == color) { spinner.SetSelection (i); break; } } }