Esempio n. 1
0
        /// <summary>
        /// 加载 Assets SourceAssets 文件夹下资源
        /// </summary>
        /// <param name="resName">加载的资源名字</param>
        /// <param name="bundPath">导入 AssetBundle 路径</param>
        /// <param name="type">资源的类型</param>
        /// <returns></returns>
        private static LoadSourceEntity LoadBuildSources(string resName, string bundPath)
        {
            if (string.IsNullOrEmpty(bundPath))
            {
                bundPath = resName;
            }
            string path = LCSPathHelper.UnityBuildRootPath() + bundPath;

            return(LoadBinarySources(path, resName));
        }
Esempio n. 2
0
        /// <summary>
        /// 加载 streamingAssets 文件夹下的文件
        ///
        /// entity.BundlePath 相对于 streamingAssets 文件夹的路径
        /// </summary>
        /// <param name="entity">资源管理实体</param>
        /// <param name="callback">资源管理类的回调函数</param>
        private void LoadStreamingSources(LoadSourceEntity entity, Action <LoadSourceEntity> callback)
        {
            if (entity == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(entity.BundlePath))
            {
                entity.BundlePath = entity.ResName;
            }
            string loadPath = LCSPathHelper.UnityStreamingAssets() + entity.BundlePath;

            LoadBinarySources(entity, loadPath, callback);
        }
Esempio n. 3
0
        /// <summary>
        /// 将日志保存到日志文件中
        /// </summary>
        public static void SaveToFile()
        {
            if (!LCSConfig.IsDebugMode || _fileLogs == null) return;
            string savePath = LCSPathHelper.UnityLogFilePath();
            FileStream stream = File.Open(savePath, FileMode.OpenOrCreate);
            if (stream.Length > LCSConfig.KbSize)
            {
                stream.Close();
                File.WriteAllText(savePath, "");
            }
            stream.Close();
            stream = null;

            StreamWriter write = File.AppendText(savePath);
            for (int i = 0, len = _fileLogs.Count; i < len; i++)
            {
                write.WriteLine(_fileLogs[i]);
            }
            _fileLogs.Clear();
            write.Flush();
            write.Close();
            write = null;
        }