Beispiel #1
0
        override public void dispose()
        {
            if (m_selfGo != null)
            {
                UtilApi.Destroy(m_selfGo);
            }

            base.dispose();

            if (m_prefabRes != null)
            {
                Ctx.m_instance.m_uiPrefabMgr.unload(m_prefabRes.GetPath(), null);
            }
        }
Beispiel #2
0
        // 代码资源加载完成处理
        public void onCodeloadedByRes(UIPrefabRes res)
        {
            UIFormID ID = m_UIAttrs.GetFormIDByPath(res.GetPath(), ResPathType.ePathCodePath);  // 获取 FormID

            m_ID2CodeLoadingItemDic.Remove(ID);
            addFormNoReady(m_id2FormDic[ID]);
            onCodeLoadedByForm(m_id2FormDic[ID]);
        }
Beispiel #3
0
        // 代码资源加载处理
        public void onCodeLoadEventHandle(IDispatchObject dispObj)
        {
            UIPrefabRes res = dispObj as UIPrefabRes;

            if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded())
            {
                onCodeloadedByRes(res);
            }
            else if (res.refCountResLoadResultNotify.resLoadState.hasFailed())
            {
                UIFormID ID = m_UIAttrs.GetFormIDByPath(res.GetPath(), ResPathType.ePathCodePath);  // 获取 FormID
                m_ID2CodeLoadingItemDic.Remove(ID);
            }
        }
Beispiel #4
0
        // 窗口控件资源加载处理
        public void onWidgetLoadEventHandle(IDispatchObject dispObj)
        {
            UIPrefabRes res = dispObj as UIPrefabRes;

            if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded())
            {
                onWidgetloadedByRes(res);
            }
            else if (res.refCountResLoadResultNotify.resLoadState.hasFailed())
            {
                UIFormID ID = m_UIAttrs.GetFormIDByPath(res.GetPath(), ResPathType.ePathComUI);  // 获取 FormID
                m_ID2WidgetLoadingItemDic.Remove(ID);
                Ctx.m_instance.m_logSys.log("UIFormID =  , Failed Prefab");
            }
        }
Beispiel #5
0
        // 窗口控件资源加载完成处理
        public void onWidgetloadedByRes(UIPrefabRes res)
        {
            string   path = res.GetPath();
            UIFormID ID   = m_UIAttrs.GetFormIDByPath(path, ResPathType.ePathComUI); // 获取 FormID

            m_ID2WidgetLoadingItemDic.Remove(ID);

            UIAttrItem attrItem = m_UIAttrs.m_id2AttrDic[ID];

            m_id2FormDic[ID].bLoadWidgetRes    = true;
            m_id2FormDic[ID].m_GUIWin.m_uiRoot = res.InstantiateObject(attrItem.m_widgetPath);
            if (attrItem.m_bNeedLua)
            {
                m_id2FormDic[ID].luaCSBridgeForm.gameObject = m_id2FormDic[ID].m_GUIWin.m_uiRoot;
                m_id2FormDic[ID].luaCSBridgeForm.init();
            }

            // 设置位置
            UtilApi.SetParent(m_id2FormDic[ID].m_GUIWin.m_uiRoot.transform, m_canvasList[(int)attrItem.m_canvasID].layerList[(int)attrItem.m_LayerID].layerTrans, false);

            // 先设置再设置缩放,否则无效
            m_id2FormDic[ID].m_GUIWin.m_uiRoot.transform.SetAsLastSibling();   // 放在最后
            UtilApi.SetActive(m_id2FormDic[ID].m_GUIWin.m_uiRoot, false);      // 出发 onShow 事件
            //if (m_dicForm[ID].hideOnCreate)
            //{
            //    UtilApi.SetActive(m_dicForm[ID].m_GUIWin.m_uiRoot, false);
            //}
            if (!m_id2FormDic[ID].hideOnCreate)
            {
                showFormInternal(ID);   // 如果 onShow 中调用 exit 函数,就会清掉 m_dicForm 中的内容。如果设置了 exitMode = false,就不会清掉 m_dicForm ,就不会有问题
            }

            if (null != Ctx.m_instance.m_cbUIEvent)
            {
                if (m_id2FormDic.ContainsKey(ID))                                // 如果 onShow 中调用 exit 函数,并且没有设置 exitMode = false ,就会清除 m_dicForm, 这个时候再调用这个函数,就会有问题,是不是添加延迟卸载
                {
                    Ctx.m_instance.m_cbUIEvent.onWidgetLoaded(m_id2FormDic[ID]); // 资源加载完成
                }
            }

            // 卸载资源
            Ctx.m_instance.m_uiPrefabMgr.unload(path, onWidgetLoadEventHandle);
        }
Beispiel #6
0
        override public void dispose()
        {
            if (m_model != null)
            {
                m_model.dispose();
                m_model = null;
            }

            if (m_uiPrefabRes != null)
            {
                Ctx.m_instance.m_uiPrefabMgr.unload(m_uiPrefabRes.GetPath(), null);
                m_uiPrefabRes = null;
            }
            if (m_boxModel != null)
            {
                Ctx.m_instance.m_modelMgr.unload(m_boxModel.GetPath(), null);
                m_boxModel = null;
            }
        }
Beispiel #7
0
        public void testAsyncLoadUIPrefabRefCount()
        {
            LoadParam param;

            param = Ctx.m_instance.m_poolSys.newObject <LoadParam>();
            LocalFileSys.modifyLoadParam("UI/UIChat/UIChat.prefab", param);
            param.m_loadEventHandle = onUIPrefabLoadEventHandle;
            UIPrefabRes aaa = Ctx.m_instance.m_uiPrefabMgr.getAndLoad <UIPrefabRes>(param);

            Ctx.m_instance.m_poolSys.deleteObj(param);

            Ctx.m_instance.m_uiPrefabMgr.unload(aaa.GetPath(), onUIPrefabLoadEventHandle);

            param = Ctx.m_instance.m_poolSys.newObject <LoadParam>();
            LocalFileSys.modifyLoadParam("UI/UIChat/UIChat.prefab", param);
            param.m_loadEventHandle = onUIPrefabLoadEventHandle;
            UIPrefabRes bbb = Ctx.m_instance.m_uiPrefabMgr.getAndLoad <UIPrefabRes>(param);

            Ctx.m_instance.m_poolSys.deleteObj(param);

            Ctx.m_instance.m_uiPrefabMgr.unload(bbb.GetPath(), onUIPrefabLoadEventHandle);
        }
Beispiel #8
0
        // 窗口控件资源加载完成处理
        public void onWidgetloadedByRes(UIPrefabRes res)
        {
            string path = res.GetPath();
            UIFormID ID = m_UIAttrs.GetFormIDByPath(path, ResPathType.ePathComUI);  // 获取 FormID
            m_ID2WidgetLoadingItemDic.Remove(ID);

            UIAttrItem attrItem = m_UIAttrs.m_id2AttrDic[ID];
            m_id2FormDic[ID].bLoadWidgetRes = true;
            m_id2FormDic[ID].m_GUIWin.m_uiRoot = res.InstantiateObject(attrItem.m_widgetPath);
            if (attrItem.m_bNeedLua)
            {
                m_id2FormDic[ID].luaCSBridgeForm.gameObject = m_id2FormDic[ID].m_GUIWin.m_uiRoot;
                m_id2FormDic[ID].luaCSBridgeForm.init();
            }

            // 设置位置
            UtilApi.SetParent(m_id2FormDic[ID].m_GUIWin.m_uiRoot.transform, m_canvasList[(int)attrItem.m_canvasID].layerList[(int)attrItem.m_LayerID].layerTrans, false);

            // 先设置再设置缩放,否则无效
            m_id2FormDic[ID].m_GUIWin.m_uiRoot.transform.SetAsLastSibling();               // 放在最后
            UtilApi.SetActive(m_id2FormDic[ID].m_GUIWin.m_uiRoot, false);      // 出发 onShow 事件
            //if (m_dicForm[ID].hideOnCreate)
            //{
            //    UtilApi.SetActive(m_dicForm[ID].m_GUIWin.m_uiRoot, false);
            //}
            if (!m_id2FormDic[ID].hideOnCreate)
            {
                showFormInternal(ID);   // 如果 onShow 中调用 exit 函数,就会清掉 m_dicForm 中的内容。如果设置了 exitMode = false,就不会清掉 m_dicForm ,就不会有问题
            }

            if (null != Ctx.m_instance.m_cbUIEvent)
            {
                if (m_id2FormDic.ContainsKey(ID))      // 如果 onShow 中调用 exit 函数,并且没有设置 exitMode = false ,就会清除 m_dicForm, 这个时候再调用这个函数,就会有问题,是不是添加延迟卸载
                {
                    Ctx.m_instance.m_cbUIEvent.onWidgetLoaded(m_id2FormDic[ID]);  // 资源加载完成
                }
            }

            // 卸载资源
            Ctx.m_instance.m_uiPrefabMgr.unload(path, onWidgetLoadEventHandle);
        }
Beispiel #9
0
 // 代码资源加载完成处理
 public void onCodeloadedByRes(UIPrefabRes res)
 {
     UIFormID ID = m_UIAttrs.GetFormIDByPath(res.GetPath(), ResPathType.ePathCodePath);  // 获取 FormID
     m_ID2CodeLoadingItemDic.Remove(ID);
     addFormNoReady(m_id2FormDic[ID]);
     onCodeLoadedByForm(m_id2FormDic[ID]);
 }