Пример #1
0
        public override bool LoadSync()
        {
            if (!CheckLoadAble())
            {
                return(false);
            }

            State = ResState.Loading;

#if UNITY_EDITOR
            if (SimulateAssetBundleInEditor)
            {
            }
            else
#endif
            {
                var url    = FrameworkSettingData.AssetBundleName2Url(mAssetName);
                var bundle = AssetBundle.LoadFromFile(url);

                mUnloadFlag = true;

                if (bundle == null)
                {
                    Log.E("Failed Load AssetBundle:" + mAssetName);
                    OnResLoadFaild();
                    return(false);
                }

                AssetBundle = bundle;
            }

            State = ResState.Ready;

            return(true);
        }
Пример #2
0
        private static void Open()
        {
            var frameworkConfigEditorWindow = (PreferencesWindow)GetWindow(typeof(PreferencesWindow), true);

            frameworkConfigEditorWindow.titleContent   = new GUIContent("QFramework Settings");
            frameworkConfigEditorWindow.CurSettingData = FrameworkSettingData.Load();
            frameworkConfigEditorWindow.position       = new Rect(100, 100, 500, 400);
            frameworkConfigEditorWindow.Show();
        }
Пример #3
0
        public string[] GetAllDependenciesByUrl(string url)
        {
            var abName = FrameworkSettingData.AssetBundleUrl2Name(url);

            //var a = new AssetBundleManifest();

            for (var i = m_ActiveAssetDataGroup.Count - 1; i >= 0; --i)
            {
                string[] depends;
                if (!m_ActiveAssetDataGroup[i].GetAssetBundleDepends(abName, out depends))
                {
                    continue;
                }

                return(depends);
            }

            return(null);
        }
Пример #4
0
        public override IEnumerator DoLoadAsync(System.Action finishCallback)
        {
            //开启的时候已经结束了
            if (RefCount <= 0)
            {
                OnResLoadFaild();
                finishCallback();
                yield break;
            }

#if UNITY_EDITOR
            if (SimulateAssetBundleInEditor)
            {
                yield return(null);
            }
            else
#endif
            {
                var url  = FrameworkSettingData.AssetBundleName2Url(mAssetName);
                var abcR = AssetBundle.LoadFromFileAsync(url);

                mAssetBundleCreateRequest = abcR;
                yield return(abcR);

                mAssetBundleCreateRequest = null;

                if (!abcR.isDone)
                {
                    Log.E("AssetBundleCreateRequest Not Done! Path:" + mAssetName);
                    OnResLoadFaild();
                    finishCallback();
                    yield break;
                }

                AssetBundle = abcR.assetBundle;
            }

            State = ResState.Ready;
            finishCallback();
        }
Пример #5
0
        public static FrameworkSettingData Load()
        {
            mConfigSavedDir.CreateDirIfNotExists();

            if (!File.Exists(mConfigSavedDir + mConfigSavedFileName))
            {
                using (var fileStream = File.Create(mConfigSavedDir + mConfigSavedFileName))
                {
                    fileStream.Close();
                }
            }

            var frameworkConfigData = SerializeHelper.LoadJson <FrameworkSettingData>(mConfigSavedDir + mConfigSavedFileName);

            if (frameworkConfigData == null || string.IsNullOrEmpty(frameworkConfigData.Namespace))
            {
                frameworkConfigData           = new FrameworkSettingData();
                frameworkConfigData.Namespace = "QFramework.Example";
            }

            return(frameworkConfigData);
        }
        private void CreateUIPanelCode(GameObject uiPrefab, string uiPrefabPath)
        {
            if (null == uiPrefab)
            {
                return;
            }

            var behaviourName = uiPrefab.name;

            var strFilePath = string.Empty;

            var prefabDirPattern = FrameworkSettingData.Load().UIPrefabDir;

            if (uiPrefabPath.Contains(prefabDirPattern))
            {
                strFilePath = uiPrefabPath.Replace(prefabDirPattern, GetScriptsPath());
            }
            else if (uiPrefabPath.Contains("/Resources"))
            {
                strFilePath = uiPrefabPath.Replace("/Resources", GetScriptsPath());
            }
            else
            {
                strFilePath = uiPrefabPath.Replace("/" + uiPrefabPath.GetLastDirName(), GetScriptsPath());
            }

            strFilePath.Replace(uiPrefab.name + ".prefab", string.Empty).CreateDirIfNotExists();

            strFilePath = strFilePath.Replace(".prefab", ".cs");

            if (File.Exists(strFilePath) == false)
            {
                UIPanelCodeTemplate.Generate(strFilePath, behaviourName, GetProjectNamespace());
            }

            CreateUIPanelComponentsCode(behaviourName, strFilePath);
            Debug.Log(">>>>>>>Success Create UIPrefab Code: " + behaviourName);
        }
 private static string GetProjectNamespace()
 {
     return(FrameworkSettingData.Load().Namespace);
 }
 private static string GetScriptsPath()
 {
     return(FrameworkSettingData.Load().UIScriptDir);
 }
Пример #9
0
 public UIKitSettingView()
 {
     mFrameworkSettingData = FrameworkSettingData.Load();
 }