public void RemoveCategory(GuiHierarchy hierarchy) { if (hierarchy == null) { return; } var previous = this.top; var parents = hierarchy.Parents; var split = hierarchy.SplitHierarchy; for (var i = 0; i < parents.Count; i++) { previous = this.GetCategory(previous, parents[i]); } var idx = split.Length - 1; var button = this.GetButton(previous, split[idx], split[idx], hierarchy.GetSortOrder(idx)); var next = this.GetCategory(previous, split[idx]); previous.Buttons.Remove(button); previous.Nexts.Remove(next); Destroy(button.gameObject); Destroy(next.Content.gameObject); }
private Category GetCategory(Category previous, GuiHierarchy hierarchy) { var split = hierarchy.SplitHierarchy; for (var i = 0; i < split.Length; i++) { var name = split[i]; this.GetButton(previous, name, name, hierarchy.GetSortOrder(i)); previous = this.GetCategory(previous, name); } return(previous); }