static MCSUpgrade() { //Have we shown the popup for 1.0->1.6? UpgradeMeta meta = GetMeta(); bool shouldShowPopup = !meta.disabled && !meta.hideOneDotSixPopup; if (meta.installed != null && meta.installed.Length != 3) { //we might have pending packages string[] paths = Directory.GetFiles(pathToPackages, "*.unitypackage", SearchOption.TopDirectoryOnly); if (meta.installed == null) { meta.installed = new string[] { }; } List <string> pending = new List <string>(); for (int i = 0; i < paths.Length; i++) { string basePath = Application.dataPath; string path = paths[i].Replace(@"\", @"/").Replace(basePath, ""); bool newPackage = true; for (int j = 0; j < meta.installed.Length; j++) { if (meta.installed[j].Equals(path)) { newPackage = false; break; } } if (newPackage) { UnityEngine.Debug.Log("Need to install: " + path); pending.Add(path); } } if (pending.Count > 0) { window = MCSUpgradeWindow.Instance; window.packageQueue = pending; window.deleteQueue = new List <string>(); } } if (shouldShowPopup) { window = MCSUpgradeWindow.Instance; } }
static MCSUpgrade() { //Have we shown the popup for 1.0->1.6? UpgradeMeta meta = GetMeta(); if (!meta.hideOneDotSixPopup) { MCSUpgradeWindow window = MCSUpgradeWindow.Instance; } }
public static void SaveMeta(UpgradeMeta meta) { try { string raw = JsonUtility.ToJson(meta); File.WriteAllText(pathToConfig, raw); } catch (Exception e) { UnityEngine.Debug.LogError("Unable to save meta configuration for upgrade"); UnityEngine.Debug.LogException(e); } }
public static void AcceptInstall() { UpgradeMeta meta = GetMeta(); meta.hideOneDotSixPopup = true; SaveMeta(meta); window.packageQueue = new List <string>(); window.deleteQueue = new List <string>(); window.packageQueue.Add(pathToPackagesCore); window.packageQueue.Add(pathToPackagesFemale); window.packageQueue.Add(pathToPackagesMale); }
public static UpgradeMeta GetMeta() { UpgradeMeta?meta = null; if (File.Exists(pathToConfig)) { try { string raw = File.ReadAllText(pathToConfig); meta = JsonUtility.FromJson <UpgradeMeta>(raw); } catch { } } if (meta == null) { meta = new UpgradeMeta(); } return((UpgradeMeta)meta); }
public static void AcceptInstall() { UpgradeMeta meta = GetMeta(); meta.hideOneDotSixPopup = true; meta.autoInstallPackages = true; SaveMeta(meta); if (File.Exists(pathToPackagesCore)) { AssetDatabase.ImportPackage(pathToPackagesCore, false); } if (File.Exists(pathToPackagesBase)) { AssetDatabase.ImportPackage(pathToPackagesBase, false); } if (InstallPackage(pathToPackagesCore) == false) { UnityEngine.Debug.LogError("Failed to install critical code package: " + pathToPackagesCore); return; } if (InstallPackage(pathToPackagesBase) == false) { UnityEngine.Debug.LogError("Failed to install critical base package: " + pathToPackagesCore); return; } string[] paths = Directory.GetFiles(pathToPackages, "*.unitypackage", SearchOption.AllDirectories); foreach (string path in paths) { if (path.Contains(pathToPackagesCore) || path.Contains(pathToPackagesBase)) { continue; } InstallPackage(path); } }