Example #1
0
        void Start()
        {
            mRectTransform = GetComponent <RectTransform>();
            if (null == mRectTransform)
            {
                LogFile.Error("mRectTransform is null");
                return;
            }
            if (null == Handler)
            {
                Handler = GetComponent <UIHandler>();
            }
            IsBillboard = false;
#if UNITY_EDITOR
            if (GameUIManager.HasInstance())
            {
#endif
            //进入初始化之后直接隐藏UI,修复在UI切换的时候会显示该UI,等待上个UI隐藏动画完成后再播放动画修复的bug
            gameObject.SetActive(false);
#if UNITY_EDITOR
        }
#endif

            init();
        }
        private static void _progressMainEvents(EventPairDic dic, EventObjList listWait, EventObjList listDo, bool isMainThread = false)
        {
            monitorEnter(dic);

            foreach (EventObj item in listWait)
            {
                listDo.AddLast(item);
            }
            listWait.Clear();

            monitorExit(dic);

            for (int i = 0; i < listDo.Count; i++)
            {
                var item = listDo.First.Value;
                try
                {
                    item.info.method.Invoke(item.info.obj, item.args);
                }
                catch (System.Exception e)
                {
                    LogFile.Error("progress " + (isMainThread ? "main" : "thread") + " event error: event[" + item.info.eventName + "]; msg: " + e.ToString());
                }
                listDo.RemoveFirst();
            }
        }
Example #3
0
        /// <summary>
        /// 只能在编辑器模式下使用
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="assetNames"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        private IEnumerator _onLoadRes <T>(string[] assetNames, Action <UObj[]> action = null, LuaFunction luaFunc = null) where T : UObj
        {
            yield return(null);

            List <T> list = new List <T>();

#if UNITY_EDITOR
            foreach (var _name in assetNames)
            {
                T t = AssetDatabase.LoadAssetAtPath <T>(_name);
                if (t == null)
                {
                    LogFile.Error("加载本地零散资源{0}失败,类型:{1}", _name, typeof(T));
                }
                list.Add(t);
                //yield return null;
            }
#endif
            if (null != action)
            {
                action(list.ToArray());
            }
            if (luaFunc != null)
            {
                luaFunc.Call((object)list.ToArray());
                luaFunc.Dispose();
                //luaFunc = null;
            }
            yield return(null);
        }
Example #4
0
        /// <summary>
        /// 添加打入Lua代码的AssetBundle
        /// </summary>
        /// <param name="bundle"></param>
        public void AddBundle(string bundleName)
        {
            string url = Tools.GetLuaAsbPath(bundleName);

#if UNITY_ANDROID
            //这是个大坑,要注意,没有.Replace("!/", "!")是读不出来的,开始我以为是雨松手滑写错
            url = url.Replace("jar:file://", "").Replace("!/", "!");
#endif
            bundleName = bundleName.Replace(GameConfig.STR_ASB_EXT, "");

            if (HasBundle(bundleName))
            {
                return;
            }

            AssetBundle bundle = AssetBundle.LoadFromFile(url);
            if (bundle != null)
            {
                base.AddSearchBundle(bundleName.ToLower(), bundle);
            }
            else
            {
                LogFile.Error("AddBundle: error [" + url + "] do not exists");
            }
        }
        /// <summary>
        /// 重新设置ScrollView的ItemSize
        /// </summary>
        private void resetItemSize()
        {
            GameObject    obj           = Instantiate(mTarget.ItemPrefab);
            RectTransform rectTransform = obj.GetComponent <RectTransform>();
            ScrollItem    i             = obj.GetComponent <ScrollItem>();

            if (null == i)
            {
                LogFile.Error("ScrollView 的 Item 必须添加ScrollView组件!");
                return;
            }
            if (null != rectTransform)
            {
                mTarget.ItemSize = rectTransform.rect.size;
                if (!rectTransform.anchorMin.x.Equals(rectTransform.anchorMax.x))
                {
                    mTarget.ItemSize.x = -1;
                }
                if (!rectTransform.anchorMin.y.Equals(rectTransform.anchorMax.y))
                {
                    mTarget.ItemSize.y = -1;
                }
            }
            DestroyImmediate(obj);
            serializedObject.ApplyModifiedProperties();
        }
Example #6
0
 /// <summary>
 /// 从prefab显示UI,慎用,建议使用ShowView
 /// </summary>
 /// <param name="prefab">Prefab.</param>
 /// <param name="luaTable">Lua table.</param>
 /// <param name="asbName">Asb name.</param>
 /// <param name="prefabName">Prefab name.</param>
 public void ShowViewPrefab(GameObject prefab, LuaTable luaTable = null, string asbName = null, string prefabName = null)
 {
     if (null != prefab)
     {
         GameObject uiObj = Instantiate(prefab);
         UIBase     ui    = uiObj.GetComponent <UIBase>();
         if (null != luaTable)
         {
             ui.SetLuaStatusListeners(luaTable);
         }
         _addUIObj(ui);
         if (ui.IsStatic)
         {
             if (mStaticViewInfos.Count == mStaticViews.Count)
             {
                 AsbInfo info = ObjPools.GetAsbInfo();
                 info.Set(asbName, prefabName);
                 mStaticViewInfos.Add(info);
                 mStaticViews.Add(ui);
             }
             else
             {
                 LogFile.Error("GameUIManager error ==> showViewPrefab mStaticViewInfos.Count != mStaticViews.Count");
             }
         }
         //要显示UI先SetActive(true),防止有UIprefab中没有启用,不会进入Start方法
         uiObj.SetActive(true);
         //UI初始化后才Show(播放显示动画)
         ui.OnInitCallbcak = (bool hasInit) =>
         {
             if (ui.IsInStack)
             {
                 if (ui.HideBefor && mStackViews.Count > 0)
                 {
                     UIBase curView = mStackViews.Peek();
                     if (curView.isActiveAndEnabled)
                     {
                         HideView(curView, (bool ret) =>
                         {
                             _pushUI(ui as UIView);
                             ShowViewObj(ui, null);
                         });
                         return;
                     }
                 }
                 //之前的UI隐藏或者本UI被设置为不隐藏之前的UI则不隐藏之前的UI直接push
                 {
                     _pushUI(ui as UIView);
                     ShowViewObj(ui, null);
                 }
             }
             else
             {
                 ShowViewObj(ui, null);
             }
         };
     }
 }
Example #7
0
        private void onRecive(int idx)
        {
            string fileName = SavePath + ".tmp" + idx;

            //LogFile.Log("onRecave idx:{0}, fileName:{1}", idx, fileName);
            byte[] buffer = new byte[BufferSize];

            FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write);

            mPartDoneSize[idx] = fs.Length;
            if (!mPartialEnabled)
            {
                mPartDoneSize[idx] = 0;
            }
            try
            {
                //LogFile.Log("onRecave idx:{0}, readSize:{1}", idx, mPartDoneSize[idx]);
                if (mPartDoneSize[idx] < mPartSize[idx])
                {
                    //TODO:断点续传还有问题
                    //断点续传核心,设置本地文件流的起始位置
                    fs.Seek(mPartDoneSize[idx], SeekOrigin.Begin);
                    mRequest.AddRange((int)mPartStartPos[idx], (int)(mPartStartPos[idx] + mPartSize[idx] - 1));
                    HttpWebResponse response = (HttpWebResponse)mRequest.GetResponse();
                    Stream          stream   = response.GetResponseStream();
                    //TODO:判断服务器是否支持读取范围
                    int length = stream.Read(buffer, 0, BufferSize);
                    while (length > 0)
                    {
                        fs.Write(buffer, 0, length);
                        mPartDoneSize[idx] += length;
                        if (mPartDoneSize[idx] > mPartSize[idx])
                        {
                            LogFile.Error(fileName + "下载出错,写入大小大于原文件分块");
                        }
                        length = stream.Read(buffer, 0, BufferSize);
                        //LogFile.WriteLine(string.Format("tmp{0}下载进度:{1}/{2}", idx, mPartDoneSize[idx], mPartSize[idx]));
                    }
                    //LogFile.WriteLine(string.Format("tmp{0}下载完成:{1}/{2}", idx, mPartDoneSize[idx], mPartSize[idx]));
                    stream.Close();
                    stream.Dispose();
                }
                else
                {
                    //TODO:之前已经下载完成
                    mPartDoneSize[idx] = mPartSize[idx];
                }
                fs.Close();
                fs.Dispose();
            }
            catch (Exception ex)
            {
                LogFile.Warn("download {0} error, msg:{1}", SavePath, ex.Message);
                fs.Close();
                fs.Dispose();
            }
        }
        protected override void init()
        {
            base.init();

            EventManager.registerToMain(STR_NOTIFY_FUNC, this, "UpdateDownloadView");
            if (null != Handler)
            {
                mTextVersions = Handler.GetCompByIndex <Text>(0);
                mTextInfo     = Handler.GetCompByIndex <Text>(1);
                mSlider       = Handler.GetCompByIndex <Slider>(2);
            }

            if (GameConfig.useAsb && GameConfig.checkUpdate)
            {
                GameUpManager.Instance.CheckLocalRes((bool rst, string msg) =>
                {
                    LogFile.Log("检测本地资源结果:" + rst);
                    if (rst)
                    {
                        GameUpManager.Instance.CheckAppVer((bool obj) =>
                        {
                            LogFile.Log("检测APP version资源结果:" + rst);
                            if (obj)
                            {
                                GameUpManager.Instance.CheckServerRes((bool _rst, string _msg) =>
                                {
                                    if (_rst)
                                    {
                                        startGameLogic();
                                    }
                                    else
                                    {
                                        LogFile.Error("服务器资源更新失败");
                                        //TODO:显示弹窗等
                                        startGameLogic();
                                    }
                                });
                            }
                            else
                            {
                                LogFile.Error("包内不含ResConf.bytes文件");
                            }
                        });
                    }
                    else
                    {
                        LogFile.Error("包内不含ResConf.bytes文件");
                    }
                });
            }
            else
            {
                startGameLogic();
            }
        }
Example #9
0
 bool onPoolGetDelegate(ref ScrollItem obj)
 {
     if (null == obj)
     {
         GameObject gobj = Instantiate(ItemPrefab, this.content, false);
         gobj.name = "item" + mItemPool.TotalObjCount;
         //LogFile.Warn(gobj.name);
         obj = gobj.GetComponent <ScrollItem>();
         if (null == obj)
         {
             LogFile.Error("ItemPrefab:{0} prefab没有添加ScrollItem组件", ItemPrefab.name);
             return(false);
         }
         obj.OnItemClicked     = onItemClicked;
         obj.OnBtnClickedIndex = onItemBtnClickI;
         obj.OnBtnClickedStr   = onItemBtnClickS;
         if (ItemSize.x.Equals(-1f))
         {
             //修改锚点
             Vector2 vector = obj.rectTransform.anchorMax;
             vector.x = 0.5f;
             obj.rectTransform.anchorMax = vector;
             vector   = obj.rectTransform.anchorMin;
             vector.x = 0.5f;
             obj.rectTransform.anchorMin = vector;
             obj.rectTransform.pivot     = vector;
             //修改 item 宽高
             vector.x = mRealItemSize.x;
             vector.y = obj.rectTransform.rect.height;
             obj.rectTransform.sizeDelta = vector;
         }
         if (ItemSize.y.Equals(-1f))
         {
             //修改锚点
             Vector2 vector = obj.rectTransform.anchorMax;
             vector.y = 0.5f;
             obj.rectTransform.anchorMax = vector;
             vector   = obj.rectTransform.anchorMin;
             vector.y = 0.5f;
             obj.rectTransform.anchorMin = vector;
             obj.rectTransform.pivot     = vector;
             //修改 item 宽高
             vector.x = obj.rectTransform.rect.width;
             vector.y = mRealItemSize.y;
             obj.rectTransform.sizeDelta = vector;
         }
     }
     obj.gameObject.SetActive(true);
     return(true);
 }
Example #10
0
 public static UnityEngine.Object Guid2Obj(string guid)
 {
     UnityEngine.Object obj = null;
     try
     {
         string path = AssetDatabase.GUIDToAssetPath(guid);
         obj = AssetDatabase.LoadAssetAtPath(path, typeof(UnityEngine.Object));
     }
     catch (Exception ex)
     {
         LogFile.Error(ex.Message);
     }
     return(obj);
 }
Example #11
0
        //public static string SetLanguage(int language, Action<bool> action, LuaFunction function)
        //{
        //    return SetLanguage((SystemLanguage)language, action, function);
        //}

        public static void SetLanguage(string language, Action <bool> action, LuaFunction function)
        {
            if (sLanguages.Contains(language))
            {
                GameConfig.SetStr(GameDefine.STR_CUR_LANGUAGE, language);
                ResMgr.Instance.GetStrAsync(STR_BASE_ASB_PATH, "Language/" + language + ".bytes", (text) =>
                {
                    // TextAsset text = obj as TextAsset;
                    bool ret = text != null;
                    if (ret)
                    {
                        _resetLanguageData(text);
                    }
                    else
                    {
                        LogFile.Error("基础语言配置不存在:" + STR_BASE_ASB_PATH + "/Language/" + language + ".bytes");
                    }

                    if (null != action)
                    {
                        action(ret);
                    }

                    if (null != function)
                    {
                        function.Call(ret);
                        function.Dispose();
                        function = null;
                    }

                    ResManager.Instance.UnloadAssetBundle(STR_BASE_ASB_PATH);
                });
            }
            else
            {
                LogFile.Warn("设置语言不存在:" + language + ",请初始化支持的语言");
                if (null != action)
                {
                    action(false);
                }

                if (null != function)
                {
                    function.Call(false);
                    function.Dispose();
                    function = null;
                }
            }
        }
Example #12
0
 public static void Init(Action <bool> action)
 {
     ResMgr.Instance.GetStrAsync(STR_BASE_ASB_PATH, "Language/config.bytes", (text) =>
     {
         // TextAsset text = obj as TextAsset;
         if (string.IsNullOrEmpty(text) && null != action)
         {
             action(false);
             LogFile.Error("语言配置文件不存在");
             return;
         }
         SetValidLanguages(text);
         SetLanguage(GetCurLanguage(), action, null);
     });
 }
Example #13
0
        protected override void Start()
        {
            base.Start();
            if (null == ItemPrefab)
            {
                LogFile.Error("ScrollView error:ItemPrefab 为空。");
                return;
            }

            bool isVertical = ScrollViewType.Vertical == ScrollType;

            vertical   = isVertical;
            horizontal = !isVertical;

            this.onValueChanged.AddListener(onSrollViewValueChanged);
        }
Example #14
0
        /// <summary>
        /// 重新设置ScrollView的ItemSize
        /// </summary>
        private void resetItemSize()
        {
            GameObject    obj           = Instantiate(mTarget.ItemPrefab);
            RectTransform rectTransform = obj.GetComponent <RectTransform>();
            ScrollItem    i             = obj.GetComponent <ScrollItem>();

            if (null == i)
            {
                LogFile.Error("ScrollView 的 Item 必须添加ScrollView组件!");
                return;
            }
            if (null != rectTransform)
            {
                mTarget.ItemSize = rectTransform.rect.size;
            }
            DestroyImmediate(obj);
        }
Example #15
0
 public PlatformAnd()
 {
     if (Application.platform == RuntimePlatform.Android)
     {
         LogFile.Warn("PlatformAnd 开始");
         AndroidJavaClass _class = new AndroidJavaClass("com.dekiven.gameframework.GF_PluginAndroid");
         if (null != _class)
         {
             //_class.CallStatic("start");
             mPluginObj = _class.CallStatic <AndroidJavaObject>("getInstance");
         }
         if (null == mPluginObj)
         {
             LogFile.Error("GameFramework Android插件加载失败,请检查arr文件是否存在。");
         }
     }
 }
 bool OnGetItemDelegate(ref ScrollItem obj)
 {
     if (null == obj)
     {
         GameObject gobj = Instantiate(ItemPrefab, Content, false);
         gobj.name = "item" + mItemPool.TotalObjCount;
         //LogFile.Warn(gobj.name);
         obj = gobj.GetComponent <ScrollItem>();
         if (null == obj)
         {
             LogFile.Error("ItemPrefab:{0} prefab没有添加ScrollItem组件", ItemPrefab.name);
             return(false);
         }
         obj.OnItemClicked = onItemClicked;
     }
     obj.transform.SetSiblingIndex(0);
     obj.gameObject.SetActive(true);
     return(true);
 }
        bool onGetDelegate(ref Toggle obj)
        {
            if (null == obj)
            {
                GameObject gobj = Instantiate(TogglePrefab, Content, false);
                gobj.name = "item" + mPool.TotalObjCount;
                obj       = gobj.GetComponent <Toggle>();

                if (null == obj)
                {
                    LogFile.Error("TogglePrefab:{0} prefab没有添加ScrollItem组件", TogglePrefab.name);
                    return(false);
                }
            }
            obj.transform.SetParent(Content.transform);
            obj.enabled = EnableTouch;
            obj.gameObject.SetActive(true);
            Group.RegisterToggle(obj);
            return(true);
        }
Example #18
0
        public void CalculateContentSize()
        {
            if (!gameObject.activeSelf)
            {
                return;
            }
            if (null == mItemDatas || null == ItemPrefab)
            {
                LogFile.Warn("ScrollView calculateContentSize Error: null == mItemDatas || null == ItemPrefab");
                return;
            }

            Rect    rect     = content.rect;
            Vector2 rectSize = rect.size;
            Vector2 viewSize = viewport.rect.size;
            Vector2 useSize  = Vector2.zero;

            mRealItemSize = ItemSize;

            int dataCount = mItemDatas.Count;

            if (ScrollViewType.Vertical == ScrollType)
            {
                useSize.x = rectSize.x - PaddingLeft - PaddingRight;
                useSize.y = viewSize.y - PaddingTop - PaddingBottom;
                if (ItemSize.x.Equals(-1f))
                {
                    mRealItemSize.x = useSize.x;
                }
                if (ItemSize.y.Equals(-1f))
                {
                    mRealItemSize.y = useSize.y;
                }
                mNumPerLine  = Mathf.FloorToInt(useSize.x / mRealItemSize.x);
                mLinePerPage = Mathf.FloorToInt(useSize.y / mRealItemSize.y);
                if (mNumPerLine < 1 || mLinePerPage < 1)
                {
                    LogFile.Error("ScrollView calculateContentSize Error:  mNumPerLine < 1 || mLinePerPage < 1, mRealItemSize:{0}, useSize:{1}", mRealItemSize, useSize);
#if UNITY_EDITOR
                    if (UnityEditor.EditorUtility.DisplayDialog("提示", "ScrollItem宽高超出可显示区域,请修改 ScrollItem 宽高或者 ScrollView宽高、 padding", "退出运行并修改"))
                    {
                        UnityEditor.EditorApplication.isPlaying = false;
                    }
#endif
                }
                float space = useSize.x - mRealItemSize.x * mNumPerLine;
                if (mNumPerLine > 1)
                {
                    mContentPadding.x = space / (mNumPerLine - 1);
                }
                else if (mNumPerLine == 1)
                {
                    mContentPadding.x = 0f;
                    PaddingLeft      += space / 2;
                    PaddingRight     += space / 2;
                }
                space = useSize.y - mLinePerPage * mRealItemSize.y;
                if (ShowItemIntegers)
                {
                    if (mLinePerPage > 1)
                    {
                        mContentPadding.y = space / (mLinePerPage - 1);
                    }
                    else if (mLinePerPage == 1)
                    {
                        mContentPadding.y = mContentPadding.x;
                    }
                }
                else
                {
                    mContentPadding.y = LineOffset;
                    ////TODO:mLinePerPage 根据 lineOffset 来算
                    //if (useSize.y - ItemSize.y * mLinePerPage - LineOffset * (mLinePerPage - 1) - PaddingBottom > 0.5)
                    //{
                    //    mLinePerPage += 1;
                    //}
                }

                mTotalLines = Mathf.CeilToInt(dataCount / (float)mNumPerLine);
                float height = PaddingTop + PaddingBottom + mTotalLines * mRealItemSize.y + (mTotalLines - 1) * mContentPadding.y;
                //content.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height);
                content.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, viewSize.y > height ? viewSize.y : height);
                //LogFile.Log("PaddingBottom:{0}, mTotalLines:{1},hieght:{2}, space:{3}", PaddingBottom, mTotalLines, rect.height, space);
            }
            else
            {
                useSize.x = viewSize.x - PaddingLeft - PaddingRight;
                useSize.y = rectSize.y - PaddingTop - PaddingBottom;
                if (ItemSize.x.Equals(-1f))
                {
                    mRealItemSize.x = useSize.x;
                }
                if (ItemSize.y.Equals(-1f))
                {
                    mRealItemSize.y = useSize.y;
                }
                mNumPerLine  = Mathf.FloorToInt(useSize.y / mRealItemSize.y);
                mLinePerPage = Mathf.FloorToInt(useSize.x / mRealItemSize.x);

                float space = useSize.y - mRealItemSize.y * mNumPerLine;
                if (mNumPerLine > 1)
                {
                    mContentPadding.y = space / (mNumPerLine - 1);
                }
                else if (mNumPerLine == 1)
                {
                    mContentPadding.y = 0f;
                    PaddingTop       += space / 2;
                    PaddingBottom    += space / 2;
                }
                space = useSize.x - mLinePerPage * mRealItemSize.x;
                if (ShowItemIntegers)
                {
                    if (mLinePerPage > 1)
                    {
                        mContentPadding.x = space / (mLinePerPage - 1);
                    }
                    else if (mLinePerPage == 1)
                    {
                        mContentPadding.x = mContentPadding.y;
                    }
                }
                else
                {
                    mContentPadding.x = LineOffset;
                    ////TODO:mLinePerPage 根据 lineOffset 来算
                    //if(useSize.x - ItemSize.x * mLinePerPage - LineOffset*(mLinePerPage - 1) - PaddingRight > 0.5)
                    //{
                    //    mLinePerPage += 1;
                    //}
                }


                mTotalLines = Mathf.CeilToInt(dataCount / (float)mNumPerLine);
                float width = PaddingLeft + PaddingRight + mTotalLines * mRealItemSize.x + (mTotalLines - 1) * mContentPadding.x;
                content.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, viewSize.x > width ? viewSize.x : width);
                //content.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, width);
            }
        }
Example #19
0
        IEnumerator onLoadAsset <T>(string abName) where T : UObj
        {
            AssetBundleInfo bundleInfo = GetLoadedAssetBundle(abName);

            if (bundleInfo == null)
            {
                yield return(StartCoroutine(OnLoadAssetBundle(abName, typeof(T))));

                bundleInfo = GetLoadedAssetBundle(abName);
                if (bundleInfo == null)
                {
                    m_LoadRequests.Remove(abName);
                    LogFile.Error("OnLoadAsset error --->>>" + abName);
                    yield break;
                }
            }
            List <LoadAssetRequest> list = null;

            if (!m_LoadRequests.TryGetValue(abName, out list))
            {
                m_LoadRequests.Remove(abName);
                yield break;
            }
            for (int i = 0; i < list.Count; i++)
            {
                string[]    assetNames = list[i].assetNames;
                List <UObj> result     = new List <UObj>();

                AssetBundle ab = bundleInfo.m_AssetBundle;
                for (int j = 0; j < assetNames.Length; j++)
                {
                    string assetPath = assetNames[j];
                    if (!string.IsNullOrEmpty(assetPath))
                    {
                        AssetBundleRequest request = ab.LoadAssetAsync(assetPath, list[i].assetType);
                        yield return(request);

                        result.Add(request.asset);
                    }
                    else
                    {
                        result.Add(null);
                    }
                    ////TODO:UnloadAsset
                    //Resources.UnloadAsset(request.asset);
                }
                if (list[i].sharpFunc != null)
                {
                    //LogFile.Log("call c# func of {0}, result.Count:{1}", abName, result.Count);
                    list[i].sharpFunc(result.ToArray());
                    list[i].sharpFunc = null;
                }
                if (list[i].luaFunc != null)
                {
                    list[i].luaFunc.Call((object)result.ToArray());
                    list[i].luaFunc.Dispose();
                    list[i].luaFunc = null;
                }
                bundleInfo.m_ReferencedCount++;
            }
            m_LoadRequests.Remove(abName);
        }
Example #20
0
        /// <summary>
        /// 加载场景
        /// </summary>
        /// <param name="asbName">Asb name.</param>
        /// <param name="sceneName">Scene name.</param>
        /// <param name="sync">If set to <c>true</c> sync.</param>
        /// <param name="add">If set to <c>true</c> add.</param>
        /// <param name="callback">Callback.</param>
        /// <param name="luaFunc">Lua func.</param>
        public void LoadScene(string asbName, string sceneName, bool sync, bool add, Action <float> callback = null, LuaFunction luaFunc = null)
        {
            if (sceneName.Equals(""))
            {
                sceneName = ".unity";
            }
            string        scenePath = Tools.GetResInAssetsName(asbName, sceneName);
            LoadSceneMode mode      = add ? LoadSceneMode.Additive : LoadSceneMode.Single;

#if UNITY_EDITOR
            if (!GameConfig.UseAsb)
            {
                //Tools.RelativeTo(Tools.GetResPath(Tools.PathCombine(asbName, sceneName)), Application.dataPath, true);
                //Debug.LogWarning(scenePath);
                int index = SceneUtility.GetBuildIndexByScenePath(scenePath);
                //Debug.LogWarning(index);

                bool   hasSceneLoad = index >= 0;
                string loadName     = "";
                if (hasSceneLoad)
                {
                    loadName = SceneUtility.GetScenePathByBuildIndex(index);
                }
                _loadScene(sync, mode, loadName, hasSceneLoad, callback, luaFunc);
                return;
            }
#endif
            LoadRes <UObj>(asbName, string.Empty
                           , delegate(UObj obj)
            {
                if (obj != null)
                {
                    LogFile.Log(obj.ToString());
                }
                AssetBundleInfo info = GetLoadedAssetBundle(Tools.GetAsbName(asbName));
                bool rst             = false;
                string loadName      = "";

                if (null != info)
                {
                    string[] scenes = info.m_AssetBundle.GetAllScenePaths();
                    for (int i = 0; i < scenes.Length; ++i)
                    {
                        string s = scenes[i];
                        //LogFile.Log("Scenename {0}: {1}, inputName:{2}", i, s, scenePath);
                        if (s.Equals(scenePath))
                        {
                            loadName = s;
                            //SceneManager.LoadScene(s, mode);
                            rst = true;
                            //LogFile.Log("找到名字相同的scene,break");
                            break;
                        }
                    }
                    if (!rst)
                    {
                        LogFile.Error("LoadScene加载Assetbundl:{0},查找{1}失败!!", asbName, scenePath);
                    }
                }
                else
                {
                    LogFile.Error("LoadScene找不到Assetbundle:{0}", asbName);
                }
                _loadScene(sync, mode, loadName, rst, callback, luaFunc);
            });
        }