// Token: 0x06000867 RID: 2151
 public static void ForceMemoryCleanUp()
 {
     foreach (SpawnPool spawnPool in UnityEngine.Object.FindObjectsOfType(typeof(SpawnPool)) as SpawnPool[])
     {
         for (int i = spawnPool._prefabPools.Count - 1; i >= 0; i--)
         {
             PrefabPool prefabPool = spawnPool._prefabPools[i];
             int        j          = 0;
             int        count      = prefabPool.despawned.Count;
             while (j < count)
             {
                 if (prefabPool.despawned[j] != null)
                 {
                     UnityEngine.Object.Destroy(prefabPool.despawned[j].gameObject);
                 }
                 j++;
             }
             prefabPool._despawned.Clear();
             if (prefabPool.spawned.Count <= 0)
             {
                 spawnPool.prefabs._prefabs.Remove(prefabPool.prefab.name);
                 spawnPool._prefabPools.RemoveAt(i);
             }
         }
     }
     RsResourceManager.UnloadUnusedAssets(true);
 }
Esempio n. 2
0
    private static void DoLoadLevelCheck()
    {
        if (configHolder == null || configHolder.config == null || configHolder.config.loadLevelBinds == null)
        {
            return;
        }

        Dictionary <string, BTLevelConfigEntry> levelBinds = configHolder.config.loadLevelBinds;

        foreach (KeyValuePair <string, BTLevelConfigEntry> kvp in levelBinds)
        {
            if (kvp.Value.hotkey == null)
            {
                continue;
            }
            if (!AreKeysJustDown(kvp.Value.hotkey))
            {
                continue;
            }

            configHolder.LogMessage(LogType.Log, "loading level: " + kvp.Key);
            if (kvp.Value.isLocalFile)
            {
                LoadLocalLevel(kvp.Key);
            }
            else
            {
                RsResourceManager.LoadLevel(kvp.Key);
            }

            //can only load one level at a time, so might as well stop here.
            break;
        }
    }
Esempio n. 3
0
 // Token: 0x06000683 RID: 1667 RVA: 0x0006BCEC File Offset: 0x00069EEC
 private void SpawnEels()
 {
     if (BTDebugCamInputManager.GetConfigHolder().hackConfig != null && BTDebugCamInputManager.GetConfigHolder().hackConfig.eelRoast_spawnAllEels)
     {
         foreach (EelRoastMarkerInfo markerInfo in this._EelRoastInfos)
         {
             string randomEelPath = this.GetRandomEelPath(markerInfo);
             if (!string.IsNullOrEmpty(randomEelPath))
             {
                 string[] array = randomEelPath.Split(new char[]
                 {
                     '/'
                 });
                 RsResourceManager.LoadAssetFromBundle(array[0] + "/" + array[1], array[2], new RsResourceEventHandler(this.ResourceEventHandler), typeof(GameObject), false, markerInfo);
             }
             else
             {
                 UtDebug.Log("Eel Asset path is empty ");
             }
         }
     }
     else
     {
         if (this._EelRoastInfos == null || this._EelRoastInfos.Length < 1 || this._NoOfEelsToSpawn.Min < 1f || this._NoOfEelsToSpawn.Min > this._NoOfEelsToSpawn.Max)
         {
             return;
         }
         List <EelRoastMarkerInfo> list = new List <EelRoastMarkerInfo>(this._EelRoastInfos);
         int num = Mathf.Clamp(this._NoOfEelsToSpawn.GetRandomInt(), 1, this._EelRoastInfos.Length);
         for (int i = 0; i < num; i++)
         {
             int    index         = UnityEngine.Random.Range(0, list.Count);
             string randomEelPath = this.GetRandomEelPath(list[index]);
             if (!string.IsNullOrEmpty(randomEelPath))
             {
                 string[] array = randomEelPath.Split(new char[]
                 {
                     '/'
                 });
                 RsResourceManager.LoadAssetFromBundle(array[0] + "/" + array[1], array[2], new RsResourceEventHandler(this.ResourceEventHandler), typeof(GameObject), false, list[index]);
             }
             else
             {
                 UtDebug.Log("Eel Asset path is empty ");
             }
             list.RemoveAt(index);
         }
     }
 }
Esempio n. 4
0
    /* ConfigManagement
     * ============================================================================*/

    /*============================================================================
     * Cutscene Control */

    private static void LoadCutscene(BTCutsceneConfigEntry targetCutscene)
    {
        DeleteCurrentCutsceneObject();

        if (targetCutscene == null)
        {
            return;
        }

        if (targetCutscene.isLocalFile)
        {
            AssetBundle assetBundle = AssetBundle.LoadFromFile(targetCutscene.resourcePath);
            try{
                if (assetBundle == null)
                {
                    configHolder.LogMessage(LogType.Log, "Unable to load cutsceneBundle from path: " + targetCutscene.resourcePath);
                    return;
                }
                GameObject uninstantiatedCutsceneObject = assetBundle.LoadAsset <GameObject>(targetCutscene.assetName);
                if (uninstantiatedCutsceneObject == null)
                {
                    configHolder.LogMessage(LogType.Log, "Unable to find GameObject (" + targetCutscene.assetName + ") in loaded assetBundle");
                    return;
                }
                CutsceneLoadDone(uninstantiatedCutsceneObject);
            }finally{
                if (assetBundle != null)
                {
                    assetBundle.Unload(false);
                }
            }
        }
        else
        {
            RsResourceManager.LoadAssetFromBundle(
                targetCutscene.resourcePath,
                targetCutscene.assetName,
                new RsResourceEventHandler(CutsceneLoadEvent),
                typeof(GameObject),
                false,
                false
                );
        }
    }
Esempio n. 5
0
    private static void LoadLocalLevel(string bundlePath)
    {
        AssetBundle bundle = null;

        try{
            bundle = AssetBundle.LoadFromFile(bundlePath);
            if (bundle == null)
            {
                configHolder.LogMessage(LogType.Error, "failed to load bundleFile at path: " + bundlePath);
                return;
            }

            if (!bundle.isStreamedSceneAssetBundle)
            {
                configHolder.LogMessage(LogType.Error, "failed to load bundleFile-Scene, incompatible format!");
                return;
            }

            string[] scenePaths = bundle.GetAllScenePaths();
            if (scenePaths.Length <= 0)
            {
                configHolder.LogMessage(LogType.Error, "failed to load bundleFile-Scene, no scenes found in bundle!");
                return;
            }

            configHolder.LogMessage(LogType.Log, "bundle loaded, available scenes: " + string.Join(", ", scenePaths));
            RsResourceManager.LoadLevel(Path.GetFileNameWithoutExtension(scenePaths[0]));
            //SceneManager.LoadScene(Path.GetFileNameWithoutExtension(scenePaths[0]));
        }catch (Exception e) {
            configHolder.LogMessage(LogType.Error, "caught exception while loading bundleFile-Level: " + e.ToString());
        }finally{
            if (bundle != null)
            {
                bundle.Unload(false);
            }
        }
    }