/// <summary> /// 同一组UI,后选择的在最上面; /// 并且一个UI内的不同panel会根据之前摆好的层级排列 /// </summary> /// <param name="target">Target.</param> /// <param name="level">Level.</param> public static void Reposition(ManagedUI target, int level) { for (int i = 0; i < uis[level].Count; i++) { ManagedUI ui = uis[level][i]; if (ui != target) { ui.subLevel = i; } ui.panel.depth = level * 4000 + ui.subLevel * 80; List <UIPanel> panels = new List <UIPanel>(); panels.AddRange(ui.GetComponentsInChildren <UIPanel>(true)); panels.Remove(ui.panel); if (panels.Count >= 80) { Debug.Log(panels.Count + ";;;;;;" + level + ";;;" + target.uiName, target); throw new UnityException("too many panels!"); } panels.Sort((x, y) => { return(x.depth - y.depth); }); int temp = ui.panel.depth; foreach (var p in panels) { if (ui.panel == p) { continue; } p.depth = ++temp; } } }
/// <summary> /// 同一组UI,后选择的在最上面; /// 并且一个UI内的不同panel会根据之前摆好的层级排列 /// </summary> /// <param name="target">Target.</param> /// <param name="level">Level.</param> static void Reposition(ManagedUI target, int level) { for (int i=0; i<uis [level].Count; i++) { ManagedUI ui = uis [level] [i]; if (ui != target) { ui.subLevel = i; } ui.panel.depth = level * 4000 + ui.subLevel * 80; List<UIPanel> panels = new List<UIPanel>(); panels.AddRange(ui.GetComponentsInChildren<UIPanel>(true)); panels.Remove(ui.panel); if (panels.Count >= 80) { Debug.Log(panels.Count + ";;;;;;" + level + ";;;" + target.uiName, target); throw new UnityException("too many panels!"); } panels.Sort((x,y) => { return x.depth - y.depth; }); int temp = ui.panel.depth; foreach (var p in panels) { if (ui.panel == p) { continue; } p.depth = ++temp; } } }
public static void ResetAllCacheDepth() { for (int i = 0; i < BackSequenceStack.Count; i++) { ManagedUI.Repostion(BackSequenceStack[i].m_panel, i); } }
private static void Main(string[] args) { var path = System.IO.Path.Combine(Constants.PublishFolder, Constants.ExecFile); Debug.Write(path.ToString()); AssemblyManager.GetAssemblyInfo(path, out Guid guid, out Version version); var managedUI = new ManagedUI(); managedUI.InstallDialogs .Add(Dialogs.Welcome) .Add(Dialogs.InstallDir) .Add <ConnectionStringDialog>() .Add(Dialogs.Progress) .Add(Dialogs.Exit); managedUI.ModifyDialogs .Add(Dialogs.MaintenanceType) .Add(Dialogs.Progress) .Add(Dialogs.Exit); var project = new ManagedProject(Constants.CommonInstallationName, new Dir(Constants.InstallationDirectory, new DirFiles(Path.Combine(Constants.PublishFolder, "*.*")), new Dir("css", new DirFiles(Path.Combine(Constants.PublishFolder, "css", "*.*"))), new Dir("Images", new DirFiles(Path.Combine(Constants.PublishFolder, "Images", "*.*"))), new Dir("Script", new Dir("app", new DirFiles(Path.Combine(Constants.PublishFolder, "Script", "app", "*.*"))), new Dir("Vendor", new DirFiles(Path.Combine(Constants.PublishFolder, "Script", "Vendor", "*.*")))), new Dir("Views", new DirFiles(Path.Combine(Constants.PublishFolder, "Views", "*.*")), new Dir("Codes", new DirFiles(Path.Combine(Constants.PublishFolder, "Views", "Codes", "*.*"))), new Dir("Home", new DirFiles(Path.Combine(Constants.PublishFolder, "Views", "Home", "*.*"))), new Dir("Shared", new DirFiles(Path.Combine(Constants.PublishFolder, "Views", "Shared", "*.*")))) ), new Dir(Constants.ProgramMenuDirectory, new ExeFileShortcut($"Uninstall {Constants.ProductName}", "[System64Folder]msiexec.exe", "/x [ProductCode]"), new ExeFileShortcut(Constants.ProductName, "[INSTALLDIR]Display-control.exe", arguments: "")), new Dir(@"%Desktop%", new ExeFileShortcut(Constants.ExecFile, $"[INSTALLDIR]{Constants.ExecFile}", arguments: ""))) { GUID = guid, Description = Constants.CommonInstallationName, InstallPrivileges = InstallPrivileges.elevated, MajorUpgradeStrategy = new MajorUpgradeStrategy { UpgradeVersions = VersionRange.OlderThanThis, PreventDowngradingVersions = VersionRange.ThisAndNewer, NewerProductInstalledErrorMessage = Messages.NewerProductInstalledErrorMessage, RemoveExistingProductAfter = Step.InstallInitialize }, ManagedUI = managedUI, Version = version, }; project.ControlPanelInfo.Manufacturer = Constants.Manufacturer; project.DefaultRefAssemblies.AddRange( AssemblyManager.GetAssemblyPathsCollection(System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().Location))); project.AfterInstall += Project_AfterInstall; project.UIInitialized += Project_UIInitialized; Compiler.BuildMsi(project); }
public void DepthsReposition(int depth) { ManagedUI.Repostion(m_panel, depth); }