public static void StoreAll() { DefaultOptions.Clear(); for (uint i = 0; i < PrefabCollection <VehicleInfo> .PrefabCount(); i++) { DefaultOptions.Store(PrefabCollection <VehicleInfo> .GetPrefab(i)); } DebugUtils.Log("Default values stored"); }
public override void OnReleased() { try { DebugUtils.Log("Restoring default values"); DefaultOptions.RestoreAll(); DefaultOptions.Clear(); } catch (Exception e) { DebugUtils.LogException(e); } }
/// <summary> /// Called when the level (game, map editor, asset editor) is loaded /// </summary> public override void OnLevelLoaded(LoadMode mode) { try { // Is it an actual game ? if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame) { DefaultOptions.Clear(); return; } AdvancedVehicleOptions.isGameLoaded = true; if (instance != null) { GameObject.DestroyImmediate(instance.gameObject); } instance = new GameObject("AdvancedVehicleOptions").AddComponent <AdvancedVehicleOptions>(); try { DefaultOptions.BuildVehicleInfoDictionary(); VehicleOptions.Clear(); DebugUtils.Log("UIMainPanel created"); } catch { DebugUtils.Log("Could not create UIMainPanel"); if (instance != null) { GameObject.Destroy(instance.gameObject); } return; } //new EnumerableActionThread(BrokenAssetsFix); } catch (Exception e) { if (instance != null) { GameObject.Destroy(instance.gameObject); } DebugUtils.LogException(e); } }
private IEnumerator Store() { while (PrefabCollection <VehicleInfo> .GetPrefab(0) == null) { yield return(null); } DefaultOptions.Clear(); for (uint i = 0; i < PrefabCollection <VehicleInfo> .PrefabCount(); i++) { DefaultOptions.Store(PrefabCollection <VehicleInfo> .GetPrefab(i)); } DebugUtils.Log("Default values stored"); Destroy(gameObject); }
/// <summary> /// Called when the level is unloaded /// </summary> public override void OnLevelUnloading() { try { DebugUtils.Log("Restoring default values"); DefaultOptions.RestoreAll(); DefaultOptions.Clear(); if (instance != null) { GameObject.Destroy(instance.gameObject); } AdvancedVehicleOptions.isGameLoaded = false; } catch (Exception e) { DebugUtils.LogException(e); } }