Ejemplo n.º 1
0
    //开始加载场景
    public static void BeginLoadScene()
    {
        ResourcesLoader.OnAssetBundleComplete = OnSharedComplete;
        CUtils.DebugCastTime("LoadingFirst.BeginLoadScene");
        var req = CRequest.Get();

        req.relativeUrl = CUtils.GetRightFileName(sceneAssetBundleName);
        req.assetName   = sceneName;
        req.OnComplete  = OnSceneAbLoaded;
        req.OnEnd       = OnSceneAbError;
        req.assetType   = CacheManager.Typeof_ABScene;
        CacheManager.Unload(req.keyHashCode);
        ResourcesLoader.LoadAsset(req);
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Load the specified localization dictionary.
        /// </summary>
        static bool LoadDictionary(string value)
        {
            if (value.Equals(SystemLanguage.ChineseSimplified.ToString()))
            {
                value = SystemLanguage.Chinese.ToString();
            }

            string assetName = Common.LANGUAGE_PREFIX + value.ToLower();
            string abName    = CUtils.GetRightFileName(assetName + Common.CHECK_ASSETBUNDLE_SUFFIX);

            CRequest req = CRequest.Get();

            req.relativeUrl = abName;
            req.assetName   = assetName;
            req.assetType   = typeof(BytesAsset);
            req.async       = false;
            var uri = new UriGroup();

            uri.Add(CUtils.GetRealPersistentDataPath(), true);
            uri.Add(CUtils.GetRealStreamingAssetsPath());
            req.uris = uri;

            req.OnComplete += delegate(CRequest req1)
            {
                BytesAsset main = req1.data as BytesAsset; //www.assetBundle.mainAsset as TextAsset;
                byte[]     txt  = main.bytes;
#if UNITY_EDITOR
                Debug.Log(mLanguage + " is loaded " + txt.Length + " " + Time.frameCount);
#endif
                if (txt != null)
                {
                    Load(txt);
                }
                SelectLanguage(mLanguage);
                CacheManager.Unload(req1.keyHashCode);
                localizationHasBeenSet = true;
            };

            req.OnEnd += delegate(CRequest req1)
            {
                if (!value.ToLower().Equals(SystemLanguage.English.ToString().ToLower()))
                {
                    language = SystemLanguage.English.ToString();
                }
            };

            ResourcesLoader.LoadAsset(req);
            return(false);
        }
Ejemplo n.º 3
0
    //开始加载场景
    internal static void BeginLoadScene(string beginLua)
    {
        ManifestManager.LoadUpdateFileManifest(null);
        PLua.DestoryLua();
        PLua.enterLua = beginLua;
        CUtils.DebugCastTime("LoadingFirst");
        var req = CRequest.Get();

        req.relativeUrl = CUtils.GetRightFileName(sceneAssetBundleName);
        req.assetName   = sceneName;
        req.OnComplete  = OnSceneAbLoaded;
        req.OnEnd       = OnSceneAbError;
        req.assetType   = CacheManager.Typeof_ABScene;
        req.async       = true;
        ResourcesLoader.LoadAsset(req);
        ResourcesLoader.OnAssetBundleComplete = OnSharedComplete;
    }