Ejemplo n.º 1
0
        // 加载一个表完成
        public void onLoadEventHandle(IDispatchObject dispObj)
        {
            ResItem res = dispObj as ResItem;

            if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath());
                string text = res.getText("");

                if (text != null)
                {
                    string[] lineSplitStr = { "\r\n" };
                    string[] tabSplitStr  = { "\t" };
                    string[] lineList     = text.Split(lineSplitStr, StringSplitOptions.RemoveEmptyEntries);
                    int      lineIdx      = 0;
                    string[] tabList      = null;

                    m_filterArr = new string[lineList.Length];

                    while (lineIdx < lineList.Length)
                    {
                        tabList = lineList[lineIdx].Split(tabSplitStr, StringSplitOptions.RemoveEmptyEntries);
                        m_filterArr[lineIdx] = tabList[1];
                        ++lineIdx;
                    }
                }
            }
            else if (res.refCountResLoadResultNotify.resLoadState.hasFailed())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, res.GetPath());
            }

            // 卸载资源
            Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoadEventHandle);
        }
Ejemplo n.º 2
0
        public void onLoadEventHandle(IDispatchObject dispObj)
        {
            ResItem res = dispObj as ResItem;

            if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath());

                byte[] textAsset = (res as DataResItem).getBytes();
                if (textAsset != null)
                {
                    loadFormText(System.Text.Encoding.UTF8.GetString(textAsset), m_path2PakDic);
                }

                // 卸载
                Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoadEventHandle);

                if (m_pakCfgLoadDisp != null)
                {
                    m_pakCfgLoadDisp();
                }
            }
            else if (res.refCountResLoadResultNotify.resLoadState.hasFailed())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, res.GetPath());
                // 卸载
                Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoadEventHandle);

                if (m_pakCfgLoadDisp != null)
                {
                    m_pakCfgLoadDisp();
                }
            }
        }
Ejemplo n.º 3
0
        public void onLoadEventHandle(IDispatchObject dispObj)
        {
            ResItem res = dispObj as ResItem;

            if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath());

                if (m_path2SoundDic.ContainsKey(res.GetPath()))      // 如果有,说明还没被停止
                {
                    if (m_path2SoundDic[res.GetPath()].m_soundResType == SoundResType.eSRT_Prefab)
                    {
                        m_path2SoundDic[res.GetPath()].setResObj(res.InstantiateObject(res.GetPath()));
                    }
                    else
                    {
                        m_path2SoundDic[res.GetPath()].setResObj(res.getObject(res.GetPath()));
                    }
                }
                // 播放音乐
                play(res.GetPath());
            }
            else if (res.refCountResLoadResultNotify.resLoadState.hasFailed())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath());
                delSoundItem(m_path2SoundDic[res.GetPath()]);
            }
            // 卸载数据
            Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoadEventHandle);
        }
Ejemplo n.º 4
0
        // 加载一个表完成
        public void onLoadEventHandle(IDispatchObject dispObj)
        {
            m_res = dispObj as ResItem;
            if (m_res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, m_res.GetPath());

                byte[] bytes = m_res.getBytes("");
                if (bytes != null)
                {
                    m_byteArray = Ctx.m_instance.m_factoryBuild.buildByteBuffer();
                    m_byteArray.clear();
                    m_byteArray.writeBytes(bytes, 0, (uint)bytes.Length);
                    m_byteArray.setPos(0);
                    readTable(getTableIDByPath(m_res.GetPath()), m_byteArray);
                }
            }
            else if (m_res.refCountResLoadResultNotify.resLoadState.hasFailed())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, m_res.GetPath());
            }

            // 卸载资源
            Ctx.m_instance.m_resLoadMgr.unload(m_res.GetPath(), onLoadEventHandle);
        }
Ejemplo n.º 5
0
        public void onModuleFailed(IDispatchObject dispObj)
        {
            ResItem res = dispObj as ResItem;

            Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, res.GetPath());

            Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoginLoadEventHandle);
        }
Ejemplo n.º 6
0
        public static void onFailed(IDispatchObject dispObj, Action <IDispatchObject> loadEventHandle)
        {
            ResItem res = dispObj as ResItem;

            Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, res.GetPath());

            // 卸载资源
            Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), loadEventHandle);
        }
Ejemplo n.º 7
0
        override protected void initImpl(ResItem res)
        {
            m_atlasPath = res.GetPath();
            m_soSpriteList = res.getObject(res.getPrefabName()) as SOSpriteList;

            initImage();
        }
Ejemplo n.º 8
0
        public virtual void onLoadEventHandle(IDispatchObject dispObj)
        {
            ResItem res  = dispObj as ResItem;
            string  path = res.GetPath();

            if (m_path2ResDic.ContainsKey(path))
            {
                m_path2ResDic[path].refCountResLoadResultNotify.resLoadState.copyFrom(res.refCountResLoadResultNotify.resLoadState);
                if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded())
                {
                    m_path2ResDic[path].init(res);
                    if (m_path2ResDic[path].bOrigResNeedImmeUnload)
                    {
                        // 卸载资源
                        Ctx.m_instance.m_resLoadMgr.unload(path, onLoadEventHandle);
                    }
                }
                else
                {
                    m_path2ResDic[path].failed(res);
                    Ctx.m_instance.m_resLoadMgr.unload(path, onLoadEventHandle);
                }
            }
            else
            {
                Ctx.m_instance.m_logSys.log(string.Format("路径不能查找到 {0}", path));
                Ctx.m_instance.m_resLoadMgr.unload(path, onLoadEventHandle);
            }
        }
Ejemplo n.º 9
0
        override protected void initImpl(ResItem res)
        {
            m_atlasPath    = res.GetPath();
            m_soSpriteList = res.getObject(res.getPrefabName()) as SOSpriteList;

            initImage();
        }
Ejemplo n.º 10
0
        // 加载一个表完成
        public void onLoadEventHandle(IDispatchObject dispObj)
        {
            m_res = dispObj as ResItem;
            if (m_res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, m_res.GetPath());

                string text = m_res.getText("");
                if (text != null)
                {
                    m_id2CfgDic[getXmlCfgIDByPath(m_res.GetPath())].parseXml(text);
                }
            }
            else if (m_res.refCountResLoadResultNotify.resLoadState.hasFailed())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, m_res.GetPath());
            }

            Ctx.m_instance.m_resLoadMgr.unload(m_res.GetPath(), onLoadEventHandle);
        }
Ejemplo n.º 11
0
        // 加载一个表完成
        public void onLoadEventHandle(IDispatchObject dispObj)
        {
            ResItem res = dispObj as ResItem;

            if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath());

                string text = res.getText("");

                if (text != null)
                {
                    string[] lineSplitStr = { "\r\n" };
                    m_nameList = text.Split(lineSplitStr, StringSplitOptions.RemoveEmptyEntries);
                }
            }
            else if (res.refCountResLoadResultNotify.resLoadState.hasFailed())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, res.GetPath());
            }

            // 卸载资源
            Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoadEventHandle);
        }
Ejemplo n.º 12
0
        public void onAutoUpdateLoadEventHandle(IDispatchObject dispObj)
        {
            ResItem res = dispObj as ResItem;

            if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath());

                Ctx.m_instance.m_layerMgr.m_path2Go[ModulePath.AUTOUPDATEMN]                  = res.InstantiateObject(m_type2ItemDic[ModuleID.AUTOUPDATEMN].m_path);
                Ctx.m_instance.m_layerMgr.m_path2Go[ModulePath.AUTOUPDATEMN].name             = ModuleName.AUTOUPDATEMN;
                Ctx.m_instance.m_layerMgr.m_path2Go[ModulePath.AUTOUPDATEMN].transform.parent = Ctx.m_instance.m_layerMgr.m_path2Go[NotDestroyPath.ND_CV_Root].transform;

                // 立马卸载这个资源
                Ctx.m_instance.m_resLoadMgr.unload(m_type2ItemDic[ModuleID.AUTOUPDATEMN].m_path, onAutoUpdateLoadEventHandle);
            }
            else if (res.refCountResLoadResultNotify.resLoadState.hasFailed())
            {
                onModuleFailed(dispObj);
            }
        }
Ejemplo n.º 13
0
        // 加载一个表完成
        public void onLoadEventHandle(IDispatchObject dispObj)
        {
            ResItem res = dispObj as ResItem;

            //Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath());    // 这行执行的时候 m_isLoaded 设置加载标志,但是 m_nodeList 还没有初始化
            Ctx.m_instance.m_logSys.log("local xml loaded");

            string text = res.getText(m_ID2FileName[m_langID].m_filePath);

            if (text != null)
            {
                SecurityParser SP = new SecurityParser();
                SP.LoadXml(text);
                SecurityElement SE = SP.ToXml();
                m_nodeList = SE.Children;
            }

            // 卸载资源
            Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoadEventHandle);
        }
Ejemplo n.º 14
0
        // 加载一个表完成
        public void onLoadEventHandle(IDispatchObject dispObj)
        {
            m_res = dispObj as ResItem;
            if (m_res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, m_res.GetPath());

                byte[] bytes = m_res.getBytes("");
                if (bytes != null)
                {
                    m_byteArray = Ctx.m_instance.m_factoryBuild.buildByteBuffer();
                    m_byteArray.clear();
                    m_byteArray.writeBytes(bytes, 0, (uint)bytes.Length);
                    m_byteArray.setPos(0);
                    readTable(getTableIDByPath(m_res.GetPath()), m_byteArray);
                }
            }
            else if (m_res.refCountResLoadResultNotify.resLoadState.hasFailed())
            {
                Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, m_res.GetPath());
            }

            // 卸载资源
            Ctx.m_instance.m_resLoadMgr.unload(m_res.GetPath(), onLoadEventHandle);
        }