public static void OnInitialize() { EditorUtility.ClearProgressBar(); Utility.dataPath = System.Environment.CurrentDirectory; Utility.downloadURL = ColaEditHelper.GetManifest().downloadURL; Utility.assetBundleMode = AppConst.SimulateMode; Utility.getPlatformDelegate = ColaEditHelper.GetPlatformName; Utility.loadDelegate = AssetDatabase.LoadAssetAtPath; }
private void ResetManifest() { var manifest = ColaEditHelper.GetManifest(); manifest.assets = new AssetData[0]; manifest.dirs = new string[0]; manifest.bundles = new string[0]; EditorUtility.SetDirty(manifest); AssetDatabase.SaveAssets(); BuildCahe(); }
private static void MarkAssetsWithFile() { var assetsManifest = ColaEditHelper.GetManifest(); var assets = Selection.GetFiltered <Object>(SelectionMode.DeepAssets); for (var i = 0; i < assets.Length; i++) { var asset = assets[i]; var path = AssetDatabase.GetAssetPath(asset); if (Directory.Exists(path) || path.EndsWith(".cs", System.StringComparison.CurrentCulture)) { continue; } if (EditorUtility.DisplayCancelableProgressBar(MARK_ASSETS, path, i * 1f / assets.Length)) { break; } var dir = Path.GetDirectoryName(path); var name = Path.GetFileNameWithoutExtension(path); if (dir == null) { continue; } dir = dir.Replace("\\", "/") + "/"; if (name == null) { continue; } var assetBundleName = TrimedAssetBundleName(Path.Combine(dir, name)); ColaEditHelper.SetAssetBundleNameAndVariant(path, assetBundleName.ToLower(), null); } EditorUtility.SetDirty(assetsManifest); AssetDatabase.SaveAssets(); EditorUtility.ClearProgressBar(); }
private void BuildCahe() { _lastModify = File.GetLastWriteTime(Utility.AssetsManifestAsset); var manifest = ColaEditHelper.GetManifest(); var sb = new StringBuilder(512); for (var i = 0; i < manifest.bundles.Length; i++) { sb.AppendLine(string.Format("bundle[{0}]={1}", i, manifest.bundles[i])); } sb.AppendLine(); for (var i = 0; i < manifest.dirs.Length; i++) { sb.AppendLine(string.Format("dir[{0}]={1}", i, manifest.dirs[i])); } sb.AppendLine(); for (int i = 0; i < manifest.assets.Length; i++) { var assetData = manifest.assets[i]; var desc = string.Format("asset[{0}] = bundle:{1}, dir:{2}, name:{3}", i, assetData.bundle, assetData.dir, assetData.name); sb.AppendLine(desc); } _manifestStr = sb.ToString(); _lineIndex.Clear(); _lineIndex.Add(-1); for (var i = 0; i < _manifestStr.Length; i++) { if (_manifestStr[i] == '\n') { _lineIndex.Add(i); } } }