Ejemplo n.º 1
0
    public static void LoadLevel(int id)
    {
        uint profileTotalAllocate = Profiler.GetTotalAllocatedMemory();
        uint profileTotalReserved = Profiler.GetTotalReservedMemory();
        long gcTotal = System.GC.GetTotalMemory(false);

        Log.LogInfo("profile totalAllocate:" + profileTotalAllocate + " profile TotalReserved:" + profileTotalReserved + " gc totalAllocate:" + gcTotal);
        Log.LogInfo("start load level:" + id);
        if (FightWnd.Exist)
        {
            FightWnd.Instance.Close();
        }
        //if (StateWnd.Exist)
        //    StateWnd.Instance.Close();
        WindowMng.CloseAll();
        Log.LogInfo("WindowMng.CloseAll();");
        //暂时不允许使用声音管理器,在切换场景时不允许播放
        SoundManager.Instance.StopAll();
        SoundManager.Instance.Enable(false);
        SaveLastLevelData();
        ClearLevelData();
        Log.LogInfo("ClearLevelData");
        Level lev = LevelMng.Instance.GetItem(id);

        Global.GLevelItem = lev;
        Log.LogInfo("Global.GLevelItem = lev;");
        LoadingWnd.Instance.Open();
        Log.LogInfo("LoadingWnd.Instance.Open();");
        Resources.UnloadUnusedAssets();
        GC.Collect();
        if (!string.IsNullOrEmpty(lev.goodList))
        {
            string num    = lev.goodList.Substring(2);
            int    number = int.Parse(num);
            Debug.Log("b" + number);
            PlayMovie("b" + number);
        }
        LevelHelper helper = ins.gameObject.AddComponent <LevelHelper>();

        helper.Load(id);
        Log.LogInfo("helper.load end");
    }
Ejemplo n.º 2
0
    public static void LoadLevel(int id, int gate)
    {
        if (FightWnd.Exist)
        {
            FightWnd.Instance.Close();
        }
        //if (StateWnd.Exist)
        //    StateWnd.Instance.Close();
        SoundManager.Instance.StopAll();
        SoundManager.Instance.Enable(false);
        WindowMng.CloseAll();
        SaveLastLevelData();
        ClearLevelData();
        Destroy(GameBattleEx.Instance.gameObject);
        Level lev = LevelMng.Instance.GetItem(id);

        Global.GLevelItem = lev;
        LoadingWnd.Instance.Open();
        LevelHelper helper = ins.gameObject.AddComponent <LevelHelper>();

        helper.Load(id, gate);
    }