public static void LoadHostGameGUID() { string text = PlayerPrefsFile.GetString("guid", null, true); if (string.IsNullOrEmpty(text)) { text = Guid.NewGuid().ToString(); } CoopLobby.Instance.SetGuid(text); }
public static bool KeyExist(string name) { return(CoopSteamCloud.CloudFileExist(name + ((!BoltNetwork.isRunning) ? string.Empty : "MP")) || !string.IsNullOrEmpty(PlayerPrefsFile.GetString(name, string.Empty, true))); }
static LevelSerializer() { LevelSerializer.allPrefabs = new Dictionary <string, GameObject>(); LevelSerializer.IgnoreTypes = new HashSet <string>(); LevelSerializer.CustomSerializers = new Dictionary <Type, IComponentSerializer>(); LevelSerializer.PlayerName = string.Empty; LevelSerializer.SaveResumeInformation = true; LevelSerializer.SerializationMode = LevelSerializer.SerializationModes.CacheSerialization; LevelSerializer.MaxGames = 20; LevelSerializer.SavedGames = new Index <string, List <LevelSerializer.SaveEntry> >(); LevelSerializer._stopCases = new List <Type>(); LevelSerializer.createdPlugins = new List <object>(); LevelSerializer.useCompression = false; LevelSerializer.webClient = new WebClient(); LevelSerializer.Guard = new object(); LevelSerializer._collectionCount = 0; LevelSerializer.Deserialized = delegate { }; LevelSerializer.GameSaved = delegate { }; LevelSerializer.SuspendingSerialization = delegate { }; LevelSerializer.ResumingSerialization = delegate { }; LevelSerializer.StoreComponent = delegate { }; LevelSerializer.Progress = delegate { }; LevelSerializer.webClient.UploadDataCompleted += new UploadDataCompletedEventHandler(LevelSerializer.HandleWebClientUploadDataCompleted); LevelSerializer.webClient.UploadStringCompleted += new UploadStringCompletedEventHandler(LevelSerializer.HandleWebClientUploadStringCompleted); LevelSerializer._stopCases.Add(typeof(PrefabIdentifier)); UnitySerializer.AddPrivateType(typeof(AnimationClip)); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Assembly assembly = assemblies[i]; UnitySerializer.ScanAllTypesForAttribute(delegate(Type tp, Attribute attr) { LevelSerializer.createdPlugins.Add(Activator.CreateInstance(tp)); }, assembly, typeof(SerializerPlugIn)); UnitySerializer.ScanAllTypesForAttribute(delegate(Type tp, Attribute attr) { LevelSerializer.CustomSerializers[((ComponentSerializerFor)attr).SerializesType] = (Activator.CreateInstance(tp) as IComponentSerializer); }, assembly, typeof(ComponentSerializerFor)); } LevelSerializer.AllPrefabs = Resources.FindObjectsOfTypeAll(typeof(GameObject)).Cast <GameObject>().Where(delegate(GameObject go) { PrefabIdentifier component = go.GetComponent <PrefabIdentifier>(); return(component != null && !component.IsInScene()); }).Distinct(LevelSerializer.CompareGameObjects.Instance).ToDictionary((GameObject go) => go.GetComponent <PrefabIdentifier>().ClassId, (GameObject go) => go); try { string @string = PlayerPrefsFile.GetString("_Save_Game_Data_", string.Empty, true); if (!string.IsNullOrEmpty(@string)) { try { LevelSerializer.SavedGames = UnitySerializer.Deserialize <global::Lookup <string, List <LevelSerializer.SaveEntry> > >(Convert.FromBase64String(@string)); } catch { LevelSerializer.SavedGames = null; } } if (LevelSerializer.SavedGames == null) { LevelSerializer.SavedGames = new Index <string, List <LevelSerializer.SaveEntry> >(); LevelSerializer.SaveDataToPlayerPrefs(); } } catch { LevelSerializer.SavedGames = new Index <string, List <LevelSerializer.SaveEntry> >(); } }