// Use this for initialization void Start() { Deserialize(appList); //application pause behavior, user defined. userSettings = new UserSettings(); //load default values/settings //...default value object for resetting. {unused} //defaultSettings = new UserSettings(); weather = new WeatherOpenAPI(); LoadWeatherParameters(); Load(); // load configuration save data if it exists #region disclaimer //monitor disclaimer called in Awake if (isFirstTime == true) { if (WarningMsg("This software is provided 'as-is'," + " without any express or implied warranty. " + "In no event will the authors be held liable for any damages arising from the use of this software.", "Just a second") == 2) { Application.Quit(); return; } } monitor = new Monitors(); //load default LoadMonitor(); //creates new file if not found, with proper resolution of primary monitor #endregion disclaimer Color tmpColor; if (ColorUtility.TryParseHtmlString(MenuController.menuController.userSettings.uiColor, out tmpColor)) { userUiColor = tmpColor; } else { Debug.Log("color parse error: start() menucontroller"); } tmpCityName = userSettings.cityName; // if cityname changes, reload main.instance.Start_(); if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "Preload") { StartCoroutine(LoadingScreen()); } }
/// <summary> /// Load stored weather to reduce weatherquery to server, binary file. /// </summary> /// <returns> /// True if load successful, else false. /// </returns> public bool Load_Weather() { if (File.Exists(System.Environment.ExpandEnvironmentVariables("%USERPROFILE%\\Saved Games\\rePaper\\") + "weather.dat")) { try { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(System.Environment.ExpandEnvironmentVariables("%USERPROFILE%\\Saved Games\\rePaper\\") + "weather.dat", FileMode.Open); //tmpWeather = (WeatherOpenAPI)bf.Deserialize(file); weather = (WeatherOpenAPI)bf.Deserialize(file); file.Close(); /* * weather.cityName = tmpWeather.cityName; * weather.countryName = tmpWeather.countryName; * weather.conditionName = tmpWeather.conditionName; * weather.conditionID = tmpWeather.conditionID; * weather.temp = tmpWeather.temp; * weather.windSpeed = tmpWeather.windSpeed; * weather.weatherUnit = tmpWeather.weatherUnit; * weather.sunrise = tmpWeather.sunrise; * weather.sunset = tmpWeather.sunset; * weather.last_run_date = tmpWeather.last_run_date; */ //Debug.Log("weather loaded: " + weather.temp); return(true); } catch (Exception e) { Debug.Log("load_weather: " + e.Message); return(false); } } else { return(false); } }