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"); }
/// <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 && mode != LoadMode.NewGameFromScenario) { DefaultOptions.Clear(); Logging.Error("AVO Incompatible GameMode " + mode); return; } AdvancedVehicleOptions.isGameLoaded = true; if (instance != null) { GameObject.DestroyImmediate(instance.gameObject); } instance = new GameObject("AdvancedVehicleOptions").AddComponent <AdvancedVehicleOptions>(); try { DefaultOptions.BuildVehicleInfoDictionary(); VehicleOptions.Clear(); Logging.Message("UIMainPanel created"); } catch { Logging.Error("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); } Logging.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; } AdvancedVehicleOptionsUID.isGameLoaded = true; if (instance != null) { GameObject.DestroyImmediate(instance.gameObject); } instance = new GameObject("AdvancedVehicleOptionsUID").AddComponent <AdvancedVehicleOptionsUID>(); 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); } }
/// <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); } AdvancedVehicleOptionsUID.isGameLoaded = false; } catch (Exception e) { DebugUtils.LogException(e); } }