Esempio n. 1
0
        private LegoUIMeta GetUIMetaAtEditor(string uiId)
        {
            if (metaPathDict == null)
            {
                metaPathDict = new Dictionary <string, string>();
                var    app      = ProjectInfoDati.GetActualInstance();
                string metaDir  = string.Empty;
                var    pathDict = IOUtility.GetPathDictionary(metaDir, s => s.EndsWith(".txt"));
                foreach (var kv in pathDict)
                {
                    metaPathDict.Add(kv.Key.ToLower(), kv.Value);
                }
            }

            if (!metaPathDict.ContainsKey(uiId))
            {
                Debug.Log($"id为{uiId}的元数据不存在!");
                return(null);
            }

            var path    = metaPathDict[uiId];
            var content = File.ReadAllText(path);
            var uiMeta  = UnityEngine.JsonUtility.FromJson <LegoUIMeta>(content);

            uiMeta.Reset();
            var bytes   = SerializeUtility.Serialize(uiMeta);
            var newMeta = SerializeUtility.DeSerialize <LegoUIMeta>(bytes);

            uiMetaDict.Add(uiId, newMeta);
            return(uiMeta);
        }
Esempio n. 2
0
        private static void MoveAssetBundleAtEveryBuild(List <string> paths,
                                                        AssetBundleBuildSetting dirSetting)
        {
            var bundleIds = paths.Select(p => Path.GetFileNameWithoutExtension(p)?.ToLower())
                            .ToList();
            var locApp = ProjectInfoDati.GetActualInstance();
            var assetBundleOutPaths = IOUtility.GetPathDictionary(locApp.AssetBundleBuildDir, s => !s.EndsWith(".manifest"));
            var targetDirId         = IOUtility.GetLastDir(dirSetting.Dir);
            var moveDir             = locApp.AssetBundleBuildDir + targetDirId;

            moveDir = moveDir.EnsureDirEnd();
            foreach (var bundleId in bundleIds)
            {
                var sourcePath = assetBundleOutPaths[bundleId];
                var targetPath = moveDir + bundleId + ASSETBUNDLE_SHORT_SUFFIX;
                IOUtility.Move(sourcePath, targetPath);
            }
        }