/// <summary> /// Loads the video data for this game /// </summary> /// <returns>The video settings saved to disk or player prefs</returns> public static VideoData LoadVideo() { // Get a default videodata in case none exists VideoData data = new VideoData(); #if UNITY_WEBPLAYER // If there is data related to video, get those values if (PlayerPrefs.HasKey(videoHash + 0)) { data.ResolutionIndex = PlayerPrefs.GetInt(videoHash + 0); data.QualityIndex = PlayerPrefs.GetInt(videoHash + 1); int full = PlayerPrefs.GetInt(videoHash + 2); data.Fullscreen = (full == 1) ? true : false; } // Otherwise save the default data else { SaveManager.SaveVideo(new VideoData()); } return(data); #else // If a file exists if (File.Exists(videoDataPath)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(videoDataPath, FileMode.Open); data = (VideoData)bf.Deserialize(file); file.Close(); return(data); } // No file exists, so save the default data else { SaveManager.SaveVideo(data); return(data); } #endif }
public static VideoData LoadVideo() { VideoData _data = new VideoData(); #if UNITY_WEBPLAYER if (PlayerPrefs.HasKey(_videoHash + 0)) { _data.ResolutionIndex = PlayerPrefs.GetInt(_videoHash + 0); _data.QualityIndex = PlayerPrefs.GetInt(_videoHash + 1); int _full = PlayerPrefs.GetInt(_videoHash + 2); _data.Fullscreen = (_full == 1) ? true : false; } else { SaveManager.SaveVideo(_data.ResolutionIndex, _data.QualityIndex, _data.Fullscreen); } return(_data); #else if (File.Exists(_videoDataPath)) { BinaryFormatter _bf = new BinaryFormatter(); FileStream _file = File.Open(_videoDataPath, FileMode.Open); _data = (VideoData)_bf.Deserialize(_file); _file.Close(); return(_data); } else { VideoData _newData = new VideoData(); SaveManager.SaveVideo(_data.ResolutionIndex, _data.QualityIndex, _data.Fullscreen); return(_newData); } #endif }