Пример #1
0
    /// <summary>
    /// 解压释放包内资源到沙盒
    /// </summary>
    private void UnCompressStreamRes2Persistent()
    {
        LogMgr.I("UpdateMgr", "UnCompressStreamRes2Persistent", "开始释放包内资源", BeShowLog);

        Listener onUnCompressOver = () =>
        {
            LogMgr.I("UpdateMgr", "UnCompressStreamRes2Persistent", "解压包内资源完毕:", BeShowLog);
            SetState(UnCompressState.readPersistResVerAfterUnCompress);
        };

        CallbackMgr cbMgr = new CallbackMgr(onUnCompressOver);

        cbMgr.ProgressEvent = (progress) => {
            //20-100的进度转换,就是20+80*progress
            float p = 0.2f + 0.8f * progress;
            ntools.Messenger.Broadcast <float>("updateLoadingProgress", p);
            LogMgr.I("UpdateMgr", "UnCompressStreamRes2Persistent", "释放进度 progress:" + progress, BeShowLog);
        };

        foreach (var p in resInfoDicInStream)
        {
            cbMgr.Add(BuildCB(p.Key));
        }//foreach结尾


        //解压resVer.txt
        cbMgr.Add(BuildCB("/resVer.txt"));
        //解压resInfoList.bytes
        cbMgr.Add(BuildCB("/resInfoList.bytes"));

        cbMgr.Start();
    }
Пример #2
0
    void LoadRole()
    {
        Listener onLoadAllRoleOver = () =>
        {
            LogMgr.I("StageScnMgr", "LoadRole", "全部角色载入完毕:", BeShowLog);
            SetState(StageState.loadOther);
        };

        CallbackMgr cbMgr = new CallbackMgr(onLoadAllRoleOver);

        cbMgr.ProgressEvent = (progress) => {
            //20-100的进度转换,就是20+80*progress
            float p = ScnProgress + RoleProgress * progress;
            ntools.Messenger.Broadcast <float>(GameEvent.loading_progress, p);
            LogMgr.I("StageScnMgr", "LoadRole", "载入进度 progress:" + progress, BeShowLog);
        };

        int count = scnInfo.roleList.Count;

        for (int i = 0; i < count; i++)
        {
            var cb = LoadRole(scnInfo.roleList[i]);
            cbMgr.Add(cb);
        }

        cbMgr.Start();
    }