Esempio n. 1
0
 private void LoadPageCallback(UIBase ub, int uiid)
 {
     if (ub != null)
     {
         if (ub.IsNeedMask)
         {
             if (!m_bgMask.gameObject.activeInHierarchy)
             {
                 m_bgMask.Show();
             }
             m_bgMask.transform.SetSiblingIndex(-2);
         }
         ub.transform.SetAsLastSibling();
         if (null != m_curPage)
         {
             m_curPage.Close();
         }
         m_curPage = ub;
         ResMgr.Log(Tag, "LoadCallback", "load ui succ " + ub.GetType().ToString());
     }
     else
     {
         ResMgr.LogError(Tag, "LoadCallback", "load ui fail");
     }
 }
Esempio n. 2
0
    public void LoadUIAsync(int uiid, Action callback)
    {
        string str = UIUtil.GetUITypeName(uiid);

        if (string.IsNullOrEmpty(str))
        {
            ResMgr.LogError(Tag, "LoadUIAsync", "UIMgr uiid not exist ==>" + uiid); return;
        }
        sb.Clear();
        sb.Append(string.Format(m_UIPath, str));
        ResMgr.LoadGobjAsync(sb.ToString(), callback);
    }
Esempio n. 3
0
    public IEnumerator Init()
    {
        ResMgr.Log(Tag, "Init", "Start Async Init");
        string path = XGamePath.GetStreamingAbPath(m_manifest_name);

        ResMgr.Log(Tag, "Init", "==>" + path);
        if (File.Exists(path))
        {
            //同步加载
            //FileStream fs = File.Open(path, FileMode.Open);
            //m_manifest_ab = AssetBundle.LoadFromStream(fs);
            //m_manifest = m_manifest_ab.LoadAsset<AssetBundleManifest>("AssetBundleManifest");

            //if (m_Ab_Dic.Count > 0)
            //{
            //    Debug.LogError("不应该发生的事情发生了");
            //}
            //m_Ab_Dic.Clear();
            //loader = new AbSyncLoader();
            //异步加载
            AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(path);
            yield return(request);

            if (request.isDone)
            {
                m_manifest = request.assetBundle.LoadAsset <AssetBundleManifest>("AssetBundleManifest");
                if (m_Ab_Dic.Count > 0)
                {
                    ResMgr.LogError(Tag, "Init", "this should never happen !!!!");
                }
                //string[] depends = m_manifest.GetAllAssetBundles();
                //foreach (var item in depends)
                //{
                //    Debug.Log("depends log ==>" + item);
                //}
                m_Ab_Dic.Clear();
                ResMgr.Log(Tag, "Init", "load manifest success");
            }
            else
            {
                ResMgr.Log(Tag, "Init", "load manifest fail");
            }
        }
        else
        {
            ResMgr.Log(Tag, "Init", "manifest not exist");
        }
    }
Esempio n. 4
0
 private void LoadWindCallback(UIBase ub, int uiid)
 {
     if (ub != null)
     {
         if (ub.IsNeedMask)
         {
             if (!m_bgMask.gameObject.activeInHierarchy)
             {
                 m_bgMask.Show();
             }
             m_bgMask.transform.SetSiblingIndex(-2);
         }
         ub.transform.SetAsLastSibling();
         Push(uiid);
         ResMgr.Log("UIMgr", "LoadCallback", "load ui succ " + ub.GetType().ToString());
     }
     else
     {
         ResMgr.LogError("UIMgr", "LoadCallback", "load ui fail");
     }
 }