Пример #1
0
    // 读表展示UI,
    public static bool ShowUIByID(int tableID, OnOpenUIDelegate delOpenUI = null, object param = null)
    {
        if (null == m_instance)
        {
            LogModule.ErrorLog("game manager is not init");
            return(false);
        }

        Tab_UIPath curTabPath = TableManager.GetUIPathByID(tableID, 0);

        if (null == curTabPath)
        {
            LogModule.ErrorLog("cur ui is not set in table" + tableID);
            return(false);
        }

        if (!UIPathData.m_DicUIInfo.ContainsKey(curTabPath.Path))
        {
            LogModule.ErrorLog("cur ui is not set in table" + curTabPath.Path);
            return(false);
        }

        UIPathData curData = UIPathData.m_DicUIInfo[curTabPath.Path];

        return(UIManager.ShowUI(curData, delOpenUI, param));
    }
Пример #2
0
    void OpenUI(Tab_UIPath uiPath)
    {
        if (UIPathData.m_DicUIInfo.ContainsKey(uiPath.Path))
        {
            UIPathData curData = UIPathData.m_DicUIInfo[uiPath.Path];
            // 科技院单独处理
            if (uiPath.Path == "Prefab/UI/Restaurant")
            {
                RestaurantController.OpenWindow(true);
            }
            else
            {
                UIManager.ShowUI(curData, (bSuccess, param) =>
                {
                    if (!string.IsNullOrEmpty(uiPath.Param))
                    {
                        switch (uiPath.Path)
                        {
                        case "Prefab/UI/ActivityController":
                            ActivityController.Instance().m_HuoDongControl.ChangeTab(uiPath.Param);
                            break;

                        case "Prefab/UI/PartnerFrameRoot":
                            PartnerFrameLogic.Instance().m_TabController.ChangeTab(uiPath.Param);
                            break;
                        }
                    }
                });
            }
        }
    }
Пример #3
0
    public static void CloseUIByID(int tableID)
    {
        if (null == m_instance)
        {
            LogModule.ErrorLog("game manager is not init");
            return;
        }


        Tab_UIPath curTabPath = TableManager.GetUIPathByID(tableID, 0);

        if (null == curTabPath)
        {
            LogModule.ErrorLog("cur ui is not set in table" + tableID);
            return;
        }

        if (!UIPathData.m_DicUIInfo.ContainsKey(curTabPath.Path))
        {
            LogModule.ErrorLog("cur ui is not set in table " + curTabPath.Path);
            return;
        }

        UIPathData curPathData = UIPathData.m_DicUIInfo[curTabPath.Path];

        CloseUI(curPathData);
    }
Пример #4
0
    private int m_nMaxSize           = 128;                         //池子中每种类型的GameObject可容纳的子队列大小

    // 从Bundle加载一个可复用的ITEM
    public void CreateUIFromBundle(UIPathData uiData, string objName, CreatePoolObjDelegate delFun, object param1, object param2)
    {
        GameObject obj = ReUseElement(objName);

        if (null == obj)
        {
            if (m_nMaxGameObjectType > 0 && m_ActivePool.Count == m_nMaxGameObjectType)
            {
                if (null != delFun)
                {
                    delFun(null, param1, param2);
                }
                return;
            }

            UIManager.LoadItem(uiData, OnLoadBundleItem, new LoadBundleParam(delFun, param1, param2, uiData, objName));
        }
        else
        {
            if (null != delFun)
            {
                delFun(obj, param1, param2);
            }
        }
    }
Пример #5
0
 void DoLoadUIItem(UIPathData uiData, GameObject curItem, object fun, object param)
 {
     if (null != fun)
     {
         OnLoadUIItemDelegate delLoadItem = fun as OnLoadUIItemDelegate;
         delLoadItem(curItem, param);
     }
 }
Пример #6
0
 public void SetData(string titleSprite, UIPathData curUIData)
 {
     if (null != sprTitle)
     {
         sprTitle.spriteName = titleSprite;
     }
     m_curUIData = curUIData;
 }
Пример #7
0
 public LoadBundleParam(CreatePoolObjDelegate delFun, object param1, object param2, UIPathData uiData, string objName)
 {
     m_delFun     = delFun;
     m_userParam1 = param1;
     m_userParam2 = param2;
     m_uiData     = uiData;
     m_objName    = objName;
 }
Пример #8
0
    /// <summary>
    /// 加载头顶信息Prefab
    /// </summary>
    /// <param name="nParent">父节点</param>
    /// <param name="strPrefabName">Prefab名字</param>
    /// <returns></returns>
    public static void LoadHeadInfoPrefab(UIPathData uiData, GameObject nParent, string strPrefabName, LoadHeadInfoDelegate delFun)
    {
        if (null == GameManager.gameManager.ActiveScene ||
            null == GameManager.gameManager.ActiveScene.NameBoardPool)
        {
            LogModule.ErrorLog("scene is not init when load headinfo");
            return;
        }

        GameManager.gameManager.ActiveScene.NameBoardPool.CreateUIFromBundle(uiData, strPrefabName, OnLoadHeadInfo, nParent, delFun);
    }
Пример #9
0
    public static bool LoadItem(UIPathData pathData, OnLoadUIItemDelegate delLoadItem, object param = null)
    {
        if (null == m_instance)
        {
            LogModule.ErrorLog("game manager is not init");
            return(false);
        }

        m_instance.LoadUIItem(pathData, delLoadItem, param);
        return(true);
    }
Пример #10
0
 // 将打开的界面记录到m_UIOpenedList中
 private static void PushToOpenedList(UIPathData ui)
 {
     if (m_instance == null || m_instance.m_UIOpenedList == null)
     {
         return;
     }
     if (UIInfo.CentreNotice == ui || UIInfo.NewPlayerGuidRoot == ui)
     {
         return;
     }
     m_instance.m_UIOpenedList.Add(ui);
 }
Пример #11
0
    public static GameObject GetGroupUIItem(UIPathData data)
    {
        if (null == data.uiGroupName)
        {
            return(null);
        }
        if (m_BundleDicUIGroup.ContainsKey(data.uiGroupName))
        {
            return(m_BundleDicUIGroup[data.uiGroupName].LoadAsset(data.name) as GameObject);
        }

        return(null);
    }
Пример #12
0
    /// <summary>
    /// 没有缓存的UI,进行加载
    /// </summary>
    /// <param name="uiData"></param>
    /// <param name="delOpenUI"></param>
    /// <param name="param1"></param>
    void LoadUI(UIPathData uiData, OnOpenUIDelegate delOpenUI = null, object param1 = null)
    {
        GameObject curWindow = null;

#if UNITY_ANDROID
        if (m_PrefabNameList != null && m_PrefabList != null)
        {
            if (m_PrefabNameList.Contains(uiData.name))
            {
                if (m_PrefabList.ContainsKey(uiData.name))
                {
                    curWindow = m_PrefabList[uiData.name];
                }
            }
        }
#endif
        if (curWindow == null)
        {
            curWindow = ResourceManager.LoadResource("Prefab/UI/" + uiData.name) as GameObject;
        }

        //GameObject curWindow = ResourceManager.LoadResource("Prefab/UI/" + uiData.name) as GameObject;
        if (null != curWindow)
        {
            DoAddUI(uiData, curWindow, delOpenUI, param1);
            //LogModule.ErrorLog("can not open controller path not found:" + path);
            return;
        }

        if (uiData.uiGroupName != null)
        {
            GameObject objCacheBundle = BundleManager.GetGroupUIItem(uiData);
            if (null != objCacheBundle)
            {
                DoAddUI(uiData, objCacheBundle, delOpenUI, param1);
                return;
            }
        }

#if UNITY_WP8
        if (UIPathData.UIType.TYPE_POP == uiData.uiType || UIPathData.UIType.TYPE_MENUPOP == uiData.uiType)
        {
            m_UnloadItemBundle = true;
        }
#endif

        StartCoroutine(BundleManager.LoadUI(uiData, DoAddUI, delOpenUI, param1));
    }
Пример #13
0
    void LoadUIItem(UIPathData uiData, OnLoadUIItemDelegate delLoadItem, object param = null)
    {
#if UNITY_ANDROID
        if (uiData.name == "MissionItem" && m_MissionItemPrefab != null)
        {
            DoLoadUIItem(uiData, m_MissionItemPrefab, delLoadItem, param);
            return;
        }

        //m_StaicMission
        //if (uiData.name == "MissionItem" && m_StaicMission != null)
        //{
        //    DoLoadUIItem(uiData, m_StaicMission, delLoadItem, param);
        //    return;
        //}
#endif

        GameObject curWindow = ResourceManager.LoadResource("Prefab/UI/" + uiData.name) as GameObject;
        if (null != curWindow)
        {
            DoLoadUIItem(uiData, curWindow, delLoadItem, param);
            return;
        }

        if (uiData.uiGroupName != null)
        {
            GameObject objCacheBundle = BundleManager.GetGroupUIItem(uiData);
            if (null != objCacheBundle)
            {
                DoLoadUIItem(uiData, objCacheBundle, delLoadItem, param);
                return;
            }
        }

#if UNITY_WP8
        if (m_UnloadItemBundle && uiData.name != "MissionItem")
        {
            m_itemBundleNameList.Add(uiData.name);
        }
#endif

        StartCoroutine(BundleManager.LoadUI(uiData, DoLoadUIItem, delLoadItem, param));
    }
Пример #14
0
    // 从m_UIOpenedList中pop一个界面,根据isDoClose确定是否执行关闭操作
    // 返回值为true时不弹出游戏退出提示,false时弹出
    public static bool PopOpenedList(bool isDoClose = true)
    {
        // Login 场景不处理
        if (GameManager.gameManager.RunningScene == (int)GameDefine_Globe.SCENE_DEFINE.SCENE_LOGIN)
        {
            return(false);
        }

        if (m_instance == null || m_instance.m_UIOpenedList == null)
        {
            return(false);
        }
        int count = m_instance.m_UIOpenedList.Count;

        if (count <= 0)
        {
            return(false);
        }
        UIPathData ui = m_instance.m_UIOpenedList[count - 1];

        if (isDoClose)
        {
            if (ui.uiType == UIPathData.UIType.TYPE_BASE || ui.uiType == UIPathData.UIType.TYPE_DEATH || ui.uiType == UIPathData.UIType.TYPE_STORY)
            {
                if (PlayerFrameLogic.Instance() != null && !PlayerFrameLogic.Instance().Fold)
                {
                    PlayerFrameLogic.Instance().PlayerFrameHeadOnClick();
                    m_instance.m_UIOpenedList.RemoveAt(count - 1);
                    return(true);
                }
                return(false);
            }
            CloseUI(ui);
            return(true);
        }
        m_instance.m_UIOpenedList.RemoveAt(count - 1);
        return(true);
    }
Пример #15
0
    public static IEnumerator LoadUI(UIPathData uiData, LoadBundleFinish delFinish, object param1, object param2)
    {
        if (m_BundleListFont.Count == 0)
        {
            WWW www = WWW.LoadFromCacheOrDownload(GetBundleLoadUrl(BundleManager.PathUICommon, BundleManager.UIFontName), m_cacheResVersion);
            yield return(www);

            if (null != www.assetBundle)
            {
                www.assetBundle.LoadAllAssets();
                m_BundleListFont.Add(www.assetBundle);
            }
        }

        // 加载通用资源
        if (m_BundleListCommon.Count == 0)
        {
            WWW www = WWW.LoadFromCacheOrDownload(GetBundleLoadUrl(BundleManager.PathUICommon, BundleManager.UICommonName), m_cacheResVersion);
            yield return(www);

            if (null != www.assetBundle)
            {
                www.assetBundle.LoadAllAssets();
                m_BundleListCommon.Add(www.assetBundle);
            }
        }

        // 加载Login资源
        if (GameManager.gameManager.OnLineState == false)
        {
            if (m_BundleListMainUI.Count == 0)
            {
                WWW www = WWW.LoadFromCacheOrDownload(GetBundleLoadUrl(BundleManager.PathUICommon, BundleManager.UIMainName), m_cacheResVersion);
                yield return(www);

                if (null != www.assetBundle)
                {
                    www.assetBundle.LoadAllAssets();
                    m_BundleListMainUI.Add(www.assetBundle);
                }
            }
        }
        else
        {
            if (GameManager.gameManager.RunningScene == (int)Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE.SCENE_LOGIN)
            {
                if (m_BundleListLoginUI.Count == 0)
                {
                    WWW www = WWW.LoadFromCacheOrDownload(GetBundleLoadUrl(BundleManager.PathUICommon, BundleManager.UILoginName), m_cacheResVersion);
                    yield return(www);

                    if (null != www.assetBundle)
                    {
                        www.assetBundle.LoadAllAssets();
                        m_BundleListLoginUI.Add(www.assetBundle);
                    }
                }
            }
            else
            {
                if (m_BundleListMainUI.Count == 0)
                {
                    WWW www = WWW.LoadFromCacheOrDownload(GetBundleLoadUrl(BundleManager.PathUICommon, BundleManager.UIMainName), m_cacheResVersion);
                    yield return(www);

                    if (null != www.assetBundle)
                    {
                        www.assetBundle.LoadAllAssets();
                        m_BundleListMainUI.Add(www.assetBundle);
                    }
                }
            }
        }

        // 加载当前UI
        GameObject retObj = null;
        WWW        wwwUI;

        if (uiData.uiGroupName != null)
        {
            // 分组缓存,不释放
            while (m_BundleUILoadingList.Contains(uiData.uiGroupName))
            {
                yield return(null);
            }
            m_BundleUILoadingList.Add(uiData.uiGroupName);

            if (m_BundleDicUIGroup.ContainsKey(uiData.uiGroupName))
            {
                retObj = m_BundleDicUIGroup[uiData.uiGroupName].LoadAsset(uiData.name, typeof(GameObject)) as GameObject;
            }
            else
            {
                LogModule.DebugLog("load asset :" + uiData.name + "UI gropu:" + uiData.uiGroupName);
                wwwUI = WWW.LoadFromCacheOrDownload(GetBundleLoadUrl(BundleManager.PathUIPrefab, uiData.uiGroupName + ".data"), m_cacheResVersion);
                yield return(wwwUI);

                if (null != wwwUI.assetBundle)
                {
                    retObj = wwwUI.assetBundle.LoadAsset(uiData.name, typeof(GameObject)) as GameObject;
                    m_BundleDicUIGroup.Add(uiData.uiGroupName, wwwUI.assetBundle);
                }
                else
                {
                    LogModule.ErrorLog("load assetbundle none :" + uiData.uiGroupName);
                }
            }

            m_BundleUILoadingList.Remove(uiData.uiGroupName);
        }
        else if (uiData.uiType == UIPathData.UIType.TYPE_BASE || uiData.uiType == UIPathData.UIType.TYPE_ITEM || uiData.uiType == UIPathData.UIType.TYPE_MESSAGE)
        {
            while (m_BundleUILoadingList.Contains(uiData.path))
            {
                yield return(null);
            }
            m_BundleUILoadingList.Add(uiData.path);

#if UNITY_WP8
            string _url = GetBundleLoadUrl(BundleManager.PathUIPrefab, uiData.name + ".data");

            if (m_bobDownloadingWWWs.Contains(_url))
            {
                yield break;
            }
            if (m_UIBundleList.ContainsKey(_url))
            {
                retObj = m_UIBundleList[_url].LoadAsset(uiData.name, typeof(GameObject)) as GameObject;
            }
            else
            {
                wwwUI = new WWW(_url);
                m_bobDownloadingWWWs.Add(_url);
                yield return(wwwUI);

                m_bobDownloadingWWWs.Remove(_url);
                if (null != wwwUI.assetBundle)
                {
                    retObj = wwwUI.assetBundle.LoadAsset(uiData.name, typeof(GameObject)) as GameObject;
                    m_UIBundleList.Add(_url, wwwUI.assetBundle);
                }
                else
                {
                    LogModule.ErrorLog("load assetbundle none :" + uiData.uiGroupName);
                }
            }
#else
            wwwUI = WWW.LoadFromCacheOrDownload(GetBundleLoadUrl(BundleManager.PathUIPrefab, uiData.name + ".data"), m_cacheResVersion);
            yield return(wwwUI);

            if (null != wwwUI.assetBundle)
            {
                retObj = wwwUI.assetBundle.LoadAsset(uiData.name, typeof(GameObject)) as GameObject;
                CacheBundle(wwwUI);
            }
            else
            {
                LogModule.ErrorLog("load assetbundle none :" + uiData.uiGroupName);
            }
            m_BundleUILoadingList.Remove(uiData.path);
#endif
        }
        else
        {
            while (m_BundleUILoadingList.Contains(uiData.path))
            {
                yield return(null);
            }
            m_BundleUILoadingList.Add(uiData.path);
#if UNITY_WP8
            string _url = GetBundleLoadUrl(BundleManager.PathUIPrefab, uiData.name + ".data");

            if (m_bobDownloadingWWWs.Contains(_url))
            {
                yield break;
            }
            if (m_UIBundleList.ContainsKey(_url))
            {
                retObj = m_UIBundleList[_url].LoadAsset(uiData.name, typeof(GameObject)) as GameObject;
            }
            else
            {
                wwwUI = new WWW(_url);
                m_bobDownloadingWWWs.Add(_url);
                yield return(wwwUI);

                m_bobDownloadingWWWs.Remove(_url);
                if (null != wwwUI.assetBundle)
                {
                    retObj = wwwUI.assetBundle.LoadAsset(uiData.name, typeof(GameObject)) as GameObject;
                    m_UIBundleList.Add(_url, wwwUI.assetBundle);
                }
                else
                {
                    LogModule.ErrorLog("load assetbundle none :" + uiData.uiGroupName);
                }
            }
#else
            if (m_BundleDicUIRef.ContainsKey(uiData.name))
            {
                LogModule.ErrorLog("load ui data fail: already load a same bundle " + uiData.name);
            }
            else
            {
                LogModule.DebugLog("load asset :" + uiData.name + "UI gropu:" + uiData.uiGroupName);
                wwwUI = WWW.LoadFromCacheOrDownload(GetBundleLoadUrl(BundleManager.PathUIPrefab, uiData.name + ".data"), m_cacheResVersion);
                yield return(wwwUI);

                if (null != wwwUI.assetBundle)
                {
                    retObj = wwwUI.assetBundle.LoadAsset(uiData.name, typeof(GameObject)) as GameObject;
                    CacheBundle(wwwUI);
                    //m_BundleDicUIRef.Add(uiData.name, wwwUI.assetBundle);
                }
                else
                {
                    LogModule.ErrorLog("load assetbundle none :" + uiData.uiGroupName);
                }
            }
            m_BundleUILoadingList.Remove(uiData.path);
#endif
        }

        if (null != delFinish)
        {
            delFinish(uiData, retObj, param1, param2);
        }
    }
Пример #16
0
    void DoAddUI(UIPathData uiData, GameObject curWindow, object fun, object param)
    {
        if (!m_dicWaitLoad.Remove(uiData.name))
        {
            return;
        }

        if (null != curWindow)
        {
#if UNITY_ANDROID
            if (m_PrefabNameList != null && m_PrefabList != null)
            {
                if (m_PrefabNameList.Contains(uiData.name))
                {
                    if (!m_PrefabList.ContainsKey(uiData.name))
                    {
                        m_PrefabList.Add(uiData.name, curWindow);
                    }
                    else
                    {
                        if (m_PrefabList[uiData.name] == null)
                        {
                            m_PrefabList[uiData.name] = curWindow;
                        }
                    }
                }
            }
#endif

#if UNITY_ANDROID
            if (!PlatformHelper.IsChannelMainland())
            {
                PushToOpenedList(uiData);
            }
#endif

            Transform parentRoot = null;
            Dictionary <string, GameObject> relativeDic = null;
            switch (uiData.uiType)
            {
            case UIPathData.UIType.TYPE_BASE:
                parentRoot  = BaseUIRoot;
                relativeDic = m_dicBaseUI;
                break;

            case UIPathData.UIType.TYPE_POP:
                parentRoot  = PopUIRoot;
                relativeDic = m_dicPopUI;
                break;

            case UIPathData.UIType.TYPE_STORY:
                parentRoot  = StoryUIRoot;
                relativeDic = m_dicStoryUI;
                break;

            case UIPathData.UIType.TYPE_TIP:
                parentRoot  = TipUIRoot;
                relativeDic = m_dicTipUI;
                break;

            case UIPathData.UIType.TYPE_MENUPOP:
                parentRoot  = MenuPopUIRoot;
                relativeDic = m_dicMenuPopUI;
                break;

            case UIPathData.UIType.TYPE_MESSAGE:
                parentRoot  = MessageUIRoot;
                relativeDic = m_dicMessageUI;
                break;

            case UIPathData.UIType.TYPE_DEATH:
                parentRoot  = DeathUIRoot;
                relativeDic = m_dicDeathUI;
                break;

            default:
                break;
            }

            if (uiData.uiType == UIPathData.UIType.TYPE_POP || uiData.uiType == UIPathData.UIType.TYPE_MENUPOP)
            {
                OnLoadNewPopUI(m_dicPopUI, uiData.name);
                OnLoadNewPopUI(m_dicMenuPopUI, uiData.name);
            }

            if (null != relativeDic && relativeDic.ContainsKey(uiData.name))
            {
                relativeDic[uiData.name].SetActive(true);
            }
            else if (null != parentRoot && null != relativeDic)
            {
                GameObject newWindow = GameObject.Instantiate(curWindow) as GameObject;
                if (null != newWindow)
                {
                    newWindow.transform.parent        = parentRoot;
                    newWindow.transform.localPosition = Vector3.zero;
                    newWindow.transform.localScale    = Vector3.one;
                    relativeDic.Add(uiData.name, newWindow);

                    //自动加的一个比较大的MenuSubUIShield,有个大collider。王喆说以后应该不用了

                    /*if (uiData.uiType == UIPathData.UIType.TYPE_MENUPOP)
                     * {
                     *  LoadMenuSubUIShield(newWindow);
                     * }*/
                }
            }

            //if (uiData.uiType == UIPathData.UIType.TYPE_STORY)
            //{
            //    BaseUIRoot.gameObject.SetActive(false);
            //    TipUIRoot.gameObject.SetActive(false);
            //    PopUIRoot.gameObject.SetActive(false);
            //    MenuPopUIRoot.gameObject.SetActive(false);
            //    MessageUIRoot.gameObject.SetActive(false);
            //    StoryUIRoot.gameObject.SetActive(true);
            //}
            //else if (uiData.uiType == UIPathData.UIType.TYPE_MENUPOP)
            if (uiData.uiType == UIPathData.UIType.TYPE_POP ||
                (uiData.name == "BackPackRoot" && BackPackLogic.m_OpenWay == BackPackLogic.OPEN_WAY.NEWFUNCTION_QUICK) ||
                (uiData.name == "RelationRoot" && RelationLogic.m_OpenWay == RelationLogic.OPEN_WAY.MISSION_TEAM))
            {
                if (PlayerFrameLogic.Instance() != null)
                {
                    PlayerFrameLogic.Instance().SwitchAllWhenPopUIShow(false);
                    PlayerFrameLogic.Instance().gameObject.SetActive(false);
                }
                if (MenuBarLogic.Instance() != null)
                {
                    MenuBarLogic.Instance().gameObject.SetActive(false);
                }

                if (!(uiData.name.Equals("ServerChooseController") ||
                      uiData.name.Equals("RoleCreate")))
                {
#if !UNITY_ANDROID
                    StartCoroutine(GCAfterOneSceond());
#endif
                }
            }
            else if (uiData.uiType == UIPathData.UIType.TYPE_MENUPOP)
            {
                if (null != PlayerFrameLogic.Instance() && null != MenuBarLogic.Instance())
                {
                    MenuBarLogic.Instance().gameObject.SetActive(false);
                    PlayerFrameLogic.Instance().gameObject.SetActive(false);

#if !UNITY_ANDROID
                    StartCoroutine(GCAfterOneSceond());
#endif
                }
            }
            else if (uiData.uiType == UIPathData.UIType.TYPE_DEATH)
            {
                ReliveCloseOtherSubUI();
            }
        }

        if (null != fun)
        {
            OnOpenUIDelegate delOpenUI = fun as OnOpenUIDelegate;
            delOpenUI(curWindow != null, param);
        }
    }
Пример #17
0
    // 关闭UI,根据类型不同,触发不同行为
    public static void CloseUI(UIPathData pathData)
    {
        if (null == m_instance)
        {
            return;
        }

        //int MaxCloseCount = PlayerPreferenceData.MaxCleanUICount;
        //if (MaxCloseCount > 6)
        //{
        //    MaxCloseCount = 6;
        //}

        //关闭MaxCloseCount次UI的时候,立即GC
        //if (++m_sCloseUICount >= MaxCloseCount)
        //{
        //    Resources.UnloadUnusedAssets();
        //    GC.Collect();
        //    m_sCloseUICount = 0;
        //   // LogModule.DebugLog("CloseUI GC 1");
        //}
        //else
        //{
        //    //活动,侠客,世界地图,PK,酒楼, 美人,背包界面,伙伴,每次打开都清理
        //    if (pathData.name == "ActivityController" ||
        //        pathData.name == "SwordsManController" ||
        //        pathData.name == "SceneMapRoot" ||
        //        pathData.name == "PKSetRoot" ||
        //        pathData.name == "Restaurant" ||
        //        pathData.name == "BelleController" ||
        //        pathData.name == "BackPackRoot" ||
        //        pathData.name == "PartnerAndMountRoot")
        //    {
        //        Resources.UnloadUnusedAssets();
        //        GC.Collect();
        //        m_sCloseUICount = 0;
        //        //LogModule.DebugLog("CloseUI GC 2 " + pathData.name);
        //    }
        //}
        //LogModule.DebugLog("m_sCloseUICount : " + m_sCloseUICount + " MaxCloseCount= " + MaxCloseCount);

        //if (!m_GCTimerGo)
        //{
        //    //关闭UI的时候,如果玩家不会进行其他操作,则顺手清理一下内存
        //    //如果关闭UI的时候玩家需要流畅的玩耍,则要排除掉
        //    //目前先增加特例,之后等特例多了之后进行统一处理
        //    if (pathData.name != "NewPlayerGuidRoot")
        //    {
        //        m_GCTimerGo = true;
        //        m_GCWaitTime = Time.fixedTime;
        //    }
        //}

        if (pathData.name.Equals("BelleController"))
        {
            BundleManager.DoUnloadUnuseBundle();
        }

#if UNITY_WP8
        m_UnloadBundle = false;
#endif
#if UNITY_ANDROID
        if (!PlatformHelper.IsChannelMainland())
        {
            PopOpenedList(false);
        }
#endif
        m_instance.RemoveLoadDicRefCount(pathData.name);
        switch (pathData.uiType)
        {
        case UIPathData.UIType.TYPE_BASE:
            m_instance.CloseBaseUI(pathData.name);
            break;

        case UIPathData.UIType.TYPE_POP:
            m_instance.ClosePopUI(pathData.name);
            break;

        case UIPathData.UIType.TYPE_STORY:
            m_instance.CloseStoryUI(pathData.name);
            break;

        case UIPathData.UIType.TYPE_TIP:
            m_instance.CloseTipUI(pathData.name);
            break;

        case UIPathData.UIType.TYPE_MENUPOP:
            m_instance.CloseMenuPopUI(pathData.name);
            break;

        case UIPathData.UIType.TYPE_MESSAGE:
            m_instance.CloseMessageUI(pathData.name);
            break;

        case UIPathData.UIType.TYPE_DEATH:
            m_instance.CloseDeathUI(pathData.name);
            break;

        default:
            break;
        }

#if UNITY_WP8 //windows phone 清理 assetbundle
        if (m_UnloadBundle && pathData.uiType != UIPathData.UIType.TYPE_BASE && pathData.uiType != UIPathData.UIType.TYPE_MESSAGE)
        {
            if (pathData.uiType != UIPathData.UIType.TYPE_TIP)
            {
                ClearUIBundle(m_itemBundleNameList);

                m_itemBundleNameList.Clear();
                m_UnloadItemBundle = false;
            }


            ClearUIBundleAsyc(pathData.name);
        }
#endif
        if (pathData.uiGroupName != null && pathData.isMainAsset)
        {
            BundleManager.ReleaseLoginBundle();
#if UNITY_WP8
            BundleManager.ReleaseSingleGroupBundle(pathData.uiGroupName);
#endif
        }
    }
Пример #18
0
    // 展示UI,根据类型不同,触发不同行为
    public static bool ShowUI(UIPathData pathData, OnOpenUIDelegate delOpenUI = null, object param = null)
    {
        if (null == m_instance)
        {
            LogModule.ErrorLog("game manager is not init");
            return(false);
        }

        m_instance.AddLoadDicRefCount(pathData.name);


#if !UNITY_EDITOR && !UNITY_STANDALONE_WIN
        if (pathData.uiType == UIPathData.UIType.TYPE_POP ||
//        pathData.uiType == UIPathData.UIType.TYPE_STORY ||    // 现在对话界面有可能是小对话不需要释放摇杆了,把释放摇杆的操作放到具体逻辑中去
            pathData.uiType == UIPathData.UIType.TYPE_TIP ||
            pathData.uiType == UIPathData.UIType.TYPE_MENUPOP)
        {
            if (JoyStickLogic.Instance() != null)
            {
                ProcessInput.Instance().ReleaseTouch();
                JoyStickLogic.Instance().ReleaseJoyStick();
            }
        }
#endif

        Dictionary <string, GameObject> curDic = null;
        switch (pathData.uiType)
        {
        case UIPathData.UIType.TYPE_BASE:
            curDic = m_instance.m_dicBaseUI;
            break;

        case UIPathData.UIType.TYPE_POP:
            curDic = m_instance.m_dicPopUI;
            break;

        case UIPathData.UIType.TYPE_STORY:
            curDic = m_instance.m_dicStoryUI;
            break;

        case UIPathData.UIType.TYPE_TIP:
            curDic = m_instance.m_dicTipUI;
            break;

        case UIPathData.UIType.TYPE_MENUPOP:
            curDic = m_instance.m_dicMenuPopUI;
            break;

        case UIPathData.UIType.TYPE_MESSAGE:
            curDic = m_instance.m_dicMessageUI;
            break;

        case UIPathData.UIType.TYPE_DEATH:
            curDic = m_instance.m_dicDeathUI;

            break;

        default:
            return(false);
        }

        if (null == curDic)
        {
            return(false);
        }

        if (m_instance.m_dicCacheUI.ContainsKey(pathData.name))
        {
            if (!curDic.ContainsKey(pathData.name))
            {
                curDic.Add(pathData.name, m_instance.m_dicCacheUI[pathData.name]);
            }

            m_instance.m_dicCacheUI.Remove(pathData.name);
        }

        if (curDic.ContainsKey(pathData.name))
        {
            // 如果缓存区有,那么直接显示
            curDic[pathData.name].SetActive(true);
            m_instance.DoAddUI(pathData, curDic[pathData.name], delOpenUI, param);
            return(true);
        }

        m_instance.LoadUI(pathData, delOpenUI, param);

        return(true);
    }