internal void OnLoadData(ISerializableData serializableDataManager) { var data = serializableDataManager.LoadData(DataID); if (data == null || data.Length == 0) { return; } var binaryFormatter = new BinaryFormatter(); using (var memoryStream = new MemoryStream(data)) { try { MixID = binaryFormatter.Deserialize(memoryStream) as string; } catch (Exception exception) { Debug.LogError(exception); } } if (MixID == null) { return; } ThemeMix mix = SerializationService.Instance.GetMix(MixID); if (mix != null && !mix.ThemesMissing() && mix.Load()) { CurrentMix = mix; } }
public void OnLevelLoaded() { CacheThemes(); if (CurrentMix != null) { return; } CurrentMix = SerializationService.Instance.GetDefaultMix() ?? SerializationService.Instance.GetSavedLocalMix(); if (CurrentMix == null) { if (SimulationManager.instance.m_metaData.m_MapThemeMetaData != null) { CurrentMix = new ThemeMix(SimulationManager.instance.m_metaData.m_MapThemeMetaData.mapThemeRef); } else { switch (SimulationManager.instance.m_metaData.m_environment) { case "Sunny": CurrentMix = new ThemeMix("1899640536.CO-Temperate-Theme"); break; case "Europe": CurrentMix = new ThemeMix("1899640536.CO-European-Theme"); break; case "Winter": CurrentMix = new ThemeMix("1899640536.CO-Winter-Theme"); break; case "North": CurrentMix = new ThemeMix("1899640536.CO-Boreal-Theme"); break; case "Tropical": CurrentMix = new ThemeMix("1899640536.CO-Tropical-Theme"); break; } } SaveLocalMix(); } else { CurrentMix.Load(); } }
public void LoadCategory(ThemeCategory category, string themeID) { switch (category) { case ThemeCategory.Themes: CurrentMix = new ThemeMix(themeID); break; case ThemeCategory.Terrain: CurrentMix.Terrain.Load(themeID); break; case ThemeCategory.Water: CurrentMix.Water.Load(themeID); break; case ThemeCategory.Structures: CurrentMix.Structures.Load(themeID); break; case ThemeCategory.Atmosphere: CurrentMix.Atmosphere.Load(themeID); break; case ThemeCategory.Weather: CurrentMix.Weather.Load(themeID); break; } SaveLocalMix(); EventUIDirty?.Invoke(this, new UIDirtyEventArgs(CurrentMix)); }
internal void LoadMix(ThemeMix mix) { CurrentMix = mix; MixID = mix.ID; CurrentMix.Load(); }