/// <summary> /// update scroll view according to us selection /// </summary> /// <param name="section"></param> private static void UpdateFocusGame(int section) { string pathOfBun = ""; EGameBundle game = (EGameBundle)section; if (game == EGameBundle.EGB_ALL) { Setting = ScriptableObject.CreateInstance <BundleInfo>(); foreach (var obj in bundlesConfigs) { LoadBundles(obj.Value, true); } } else { Setting = null; pathOfBun = bundlesConfigs[game]; LoadBundles(pathOfBun, false); } }
/// <summary> /// 新建一组Bundle的配置 /// </summary> public static void Create() { EGameBundle tmp = (EGameBundle)focusGame; if (tmp != EGameBundle.EGB_ALL) { BundleInfo.Element OneOf = new BundleInfo.Element(); OneOf.Name = "Bundle_" + Time.realtimeSinceStartup; //OneOf.Parent = OneOf.Name; OneOf.Path = ""; OneOf.Mode = BundleInfo.BundleMode.AllInOne; OneOf.bCopy = Setting.bToStreamingAsset; string str = tmp.ToString(); string chars = "_"; OneOf.gameName = str.Split(chars.ToCharArray())[1]; Setting.ListOfBundles.Add(OneOf); SelBundle = 0; } else { EditorUtility.DisplayDialog("Warning", "Can not create a bundle in preview model(ALL)", "Cancel"); } }
/// <summary> /// collect all bundles which will be cooked /// </summary> private static void CollectNeedBuildBundles() { EGameBundle game = (EGameBundle)focusGame; List <string> needBuild = new List <string>(); if (game == EGameBundle.EGB_ALL) { foreach (var obj in bundlesConfigs) { if (obj.Key != EGameBundle.EGB_ALL) { needBuild.Add(obj.Value); } } } else { needBuild.Add(bundlesConfigs[EGameBundle.EGB_Common]); if (game != EGameBundle.EGB_Common) { needBuild.Add(bundlesConfigs[game]); } } //build bundle cookingSetting = ScriptableObject.CreateInstance <BundleInfo>(); int idx = 0; foreach (string path in needBuild) { BundleInfo tmpSetting = AssetDatabase.LoadAssetAtPath(path, typeof(BundleInfo)) as BundleInfo; if (tmpSetting != null) { if (idx > 0) { BundleInfo.Element info = null; for (int i = 0; i < tmpSetting.ListOfBundles.Count; ++i) { info = tmpSetting.ListOfBundles[i]; foreach (var obj in cookingSetting.ListOfBundles) { if (obj.Name.Equals(info.Name)) { info = null; UnityEngine.Debug.LogWarning("has contains " + obj.Name); break; } } if (info != null) { cookingSetting.ListOfBundles.Add(info); } } } else { cookingSetting.ListOfBundles.AddRange(tmpSetting.ListOfBundles); } } idx++; } }