Esempio n. 1
0
        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");
        }
Esempio n. 2
0
 public override void OnReleased()
 {
     try
     {
         DebugUtils.Log("Restoring default values");
         DefaultOptions.RestoreAll();
         DefaultOptions.Clear();
     }
     catch (Exception e)
     {
         DebugUtils.LogException(e);
     }
 }
Esempio n. 3
0
        /// <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);
            }
Esempio n. 5
0
        /// <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);
            }
        }