예제 #1
0
        /// <summary>
        /// 读取打包资源配置信息.
        /// </summary>
        /// <returns>打包资源配置信息.</returns>
        /// <param name="iDirPath">Asset存放目录文件(不指定:当前选定对象所在目录).</param>
        public static T ReadSetting <T>(string iDirPath = null) where T : UnityEngine.ScriptableObject
        {
            T      objRet = default(T);
            string path   = null;

            try {
                path = GetAssetFilePath <T>(iDirPath);
                if (true == string.IsNullOrEmpty(path))
                {
                    UtilsLog.Error("UtilityAsset", "GetAssetFilePath():Failed!!!(Dir:{0})",
                                   true == string.IsNullOrEmpty(iDirPath) ? "null" : iDirPath);
                    return(objRet);
                }
                UtilsLog.Info("UtilityAsset", "ReadSetting:{0}", path);
                objRet = UtilsAsset.LoadAssetFile <T>(path);

                SetAssetDirty(objRet);
            }
            catch (System.IO.DirectoryNotFoundException exp)
            {
                UtilsLog.Fatal("UtilityAsset", "ReadSetting()::Failed!!! DetailInfo ClassName:{0} \n AssetFile:{1} \n Error:{2}",
                               typeof(T).ToString(),
                               (path == null) ? "null" : path,
                               exp.Message);
            }

            if (default(T) == objRet)
            {
                objRet = UtilsAsset.CreateAsset <T> (iDirPath);
                AssetsRefresh();
                SetAssetDirty(objRet);
            }

            return(objRet);
        }
예제 #2
0
        /// <summary>
        /// 创建设定文件(在当前目录).
        /// </summary>
        protected static T1 CreateAssetAtCurDir()
        {
            string curDir = GetCurDir();

            if (Directory.Exists(curDir) == false)
            {
                return(null);
            }
            return(UtilsAsset.CreateAsset <T1> (curDir));
        }
예제 #3
0
 static AutoRefreshImagesSetting Create()
 {
     return(UtilsAsset.CreateAsset <AutoRefreshImagesSetting> ());
 }
예제 #4
0
 /// <summary>
 /// 创建设定文件(在当前目录).
 /// </summary>
 protected static T1 CreateAsset()
 {
     return(UtilsAsset.CreateAsset <T1> ());
 }