Beispiel #1
0
        public override IEnumerator StartIEnumeratorTask(Action finishCallback)
        {
            //开启的时候已经结束了
            if (RefCount <= 0)
            {
                OnResLoadFaild();
                finishCallback();
                yield break;
            }

            string url = QFrameworkConfigData.AssetBundleName2Url(mAssetName);
            AssetBundleCreateRequest 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();
        }
Beispiel #2
0
        public override bool LoadSync()
        {
            if (!CheckLoadAble())
            {
                return(false);
            }

            State = ResState.Loading;

            //TimeDebugger timer = ResMgr.Instance.timeDebugger;

            string url = QFrameworkConfigData.AssetBundleName2Url(mAssetName);

            //timer.Begin("LoadSync AssetBundle:" + mName);
            AssetBundle bundle = AssetBundle.LoadFromFile(url);

            //timer.End();

            mUnloadFlag = true;

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

            assetBundle = bundle;
            State       = ResState.Ready;

            //Log.I(string.Format("Load AssetBundle Success.ID:{0}, Name:{1}", bundle.GetInstanceID(), bundle.name));

            //timer.Dump(-1);
            return(true);
        }
Beispiel #3
0
        private void CreateUIPanelCode(GameObject uiPrefab, string uiPrefabPath)
        {
            if (null == uiPrefab)
            {
                return;
            }

            var behaviourName = uiPrefab.name;
            var strFilePath   = uiPrefabPath.Replace(QFrameworkConfigData.Load().UIPrefabDir, GetScriptsPath());

            if (!uiPrefabPath.Contains(QFrameworkConfigData.Load().UIPrefabDir) &&
                uiPrefabPath.Contains("/Resources"))
            {
                strFilePath = uiPrefabPath.Replace("/Resources", GetScriptsPath());
            }

            strFilePath.Replace(uiPrefab.name + ".prefab", "").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);
        }
		static void Open() 
		{
			QFrameworkConfigEditorWindow frameworkConfigEditorWindow = (QFrameworkConfigEditorWindow)EditorWindow.GetWindow(typeof(QFrameworkConfigEditorWindow),true);
			frameworkConfigEditorWindow.titleContent = new  GUIContent("QFrameworkConfig");
			frameworkConfigEditorWindow.CurConfigData = QFrameworkConfigData.Load ();
			frameworkConfigEditorWindow.Show ();
		}
        public static void ApplyAllPlatform()
        {
            var frameworkConfigData = QFrameworkConfigData.Load();

            ApplySymbol(frameworkConfigData, BuildTargetGroup.iOS);
            ApplySymbol(frameworkConfigData, BuildTargetGroup.Android);
            ApplySymbol(frameworkConfigData, BuildTargetGroup.Standalone);
        }
        private static void Open()
        {
            var frameworkConfigEditorWindow = (PreferencesWindow)GetWindow(typeof(PreferencesWindow), true);

            frameworkConfigEditorWindow.titleContent  = new GUIContent("QFrameworkConfig");
            frameworkConfigEditorWindow.CurConfigData = QFrameworkConfigData.Load();
            frameworkConfigEditorWindow.Show();
            frameworkConfigEditorWindow.OnShow();
        }
Beispiel #7
0
        public string[] GetAllDependenciesByUrl(string url)
        {
            var abName = QFrameworkConfigData.AssetBundleUrl2Name(url);

            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);
        }
        public static void ApplySymbol(QFrameworkConfigData frameworkConfigData, BuildTargetGroup targetGroup)
        {
            string symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup);

            if (string.IsNullOrEmpty(symbols))
            {
                symbols = frameworkConfigData.ResLoaderSupportSymbol;
            }
            else
            {
                string[] symbolSplit = symbols.Split(new char[] { ';' });

                symbols = "";

                for (int i = 0; i < symbolSplit.Length; i++)
                {
                    var symbol = symbolSplit [i];
                    if (string.Equals(symbol, QFrameworkConfigData.RES_LOADER_SUPPORT_SYMBOLS [0]) ||
                        string.Equals(symbol, QFrameworkConfigData.RES_LOADER_SUPPORT_SYMBOLS [1]) ||
                        string.Equals(symbol, QFrameworkConfigData.LUA_SUPPORT_SYMBOLS [0]) ||
                        string.Equals(symbol, QFrameworkConfigData.LUA_SUPPORT_SYMBOLS [1]) ||
                        string.Equals(symbol, QFrameworkConfigData.LUA_SUPPORT_SYMBOLS [2]) ||
                        string.Equals(symbol, QFrameworkConfigData.LUA_SUPPORT_SYMBOLS [3]) ||
                        string.Equals(symbol, QFrameworkConfigData.COCOS_SUPPORT_SYMBOLS[0]) ||
                        string.Equals(symbol, QFrameworkConfigData.COCOS_SUPPORT_SYMBOLS[1]))
                    {
                    }
                    else
                    {
                        symbols += symbol + ";";
                    }
                }

                symbols += frameworkConfigData.ResLoaderSupportSymbol + ";";
                symbols += frameworkConfigData.LuaSupportSymbol + ";";
                symbols += frameworkConfigData.CocosSupportSymbol + ";";
            }

            PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, symbols);
        }
        public static QFrameworkConfigData Load()
        {
            mConfigSavedDir.CreateDirIfNotExists();

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

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

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

            return(frameworkConfigData);
        }
Beispiel #10
0
 private static string GetProjectNamespace()
 {
     return(QFrameworkConfigData.Load().Namespace);
 }
Beispiel #11
0
 private static string GetScriptsPath()
 {
     return(QFrameworkConfigData.Load().UIScriptDir);
 }
Beispiel #12
0
 public static string[] GetAllDependenciesByUrl(string url)
 {
     return(mManifest.GetAllDependencies(QFrameworkConfigData.AssetBundleUrl2Name(url)));
 }