private HierarchyObjectElement CreateHierarchy(HierarchyObject hierarchyObject, int depthOffset) { var bufferedHierarchyObject = bufferedHierarhcyElementStructures[hierarchyObject.bufferedHierarchyType].bufferedHierarchyObjectElements.GetUnusedPooledObjects(1)[0]; var hierarchyObjectElement = bufferedHierarchyObject.hierarchyObjectElement; hierarchyObjectElement.elementName = hierarchyObject.elementName; hierarchyObjectElement.bufferedHierarchyObjectElement = bufferedHierarchyObject; hierarchyObjectElement.bufferedHierarchyType = hierarchyObject.bufferedHierarchyType; if (hierarchyObject.childrenObjects.Count > 0) { //identifity the corresponding strucutre, initalise from that strucutre, for (int i = 0; i < hierarchyObject.childrenObjects.Count; i++) { var childHierarchyObject = CreateHierarchy(hierarchyObject.childrenObjects[i], depthOffset + 1); hierarchyObjectElement.AddHeirarchyElement(childHierarchyObject); } hierarchyObjectElement.enableArrowElement = true; } else { hierarchyObjectElement.enableArrowElement = false; } hierarchyObjectElement.elementHeight = hierarchyBaseElement.hierarchyElementsHeight; hierarchyObjectElement.AddTabElements(bufferedHierarchyTabElements.GetUnusedPooledObjects(depthOffset)); //bufferedHierarchyObject.hierarchyObjectElement.ResetHierarchyElement(); return(hierarchyObjectElement); }
//TODO: Return parent objects should be HierarchyObjectElement as they should alread be created by the hierarchy #region AddHierarchyObjectFunctions public HierarchyObjectElement AddHierarchyObjectWithoutUpdate(HierarchyObject hierarchyObject) { var hierarchyObjectElement = CreateHierarchy(hierarchyObject); hierarchyBaseElement.parentElements.Add(hierarchyObjectElement); return(hierarchyObjectElement); }
public HierarchyObjectElement AddHierarchyObject(HierarchyObject hierarchyObject, int siblingIndex) { var hierarchyObjectElement = AddHierarchyObjectWithoutUpdate(hierarchyObject, siblingIndex); hierarchyBaseElement.hierarchyContentElement.UpdateRootElements(); hierarchyBaseElement.hierarchyContentElement.UpdateChildrenElements(hierarchyObjectElement); return(hierarchyObjectElement); }
public HierarchyObjectElement AddHierarchyObjectWithoutUpdate(HierarchyObject hierarchyObject, int siblingIndex) { var hierarchyObjectElement = CreateHierarchy(hierarchyObject); hierarchyBaseElement.parentElements.Insert(Mathf.Clamp(siblingIndex, 0, hierarchyBaseElement.parentElements.Count), hierarchyObjectElement); hierarchyObjectElement.rectTransform.SetSiblingIndex(siblingIndex); return(hierarchyObjectElement); }
public HierarchyObjectElement AddHierarchyObject(HierarchyObject hierarchyObject) { var hierarchyObjectElement = AddHierarchyObjectWithoutUpdate(hierarchyObject); hierarchyContentElement.UpdateRootElements(); hierarchyContentElement.UpdateChildrenElements(hierarchyObjectElement); return(hierarchyObjectElement); }
public HierarchyObjectElement AddHierarchyObjectWithoutUpdate(HierarchyObject hierarchyObject, HierarchyObjectElement parent) { var hierarchyObjectElement = CreateHierarchy(hierarchyObject, parent.depthIndex + 1); if (parent.hierarchyObjectElements.Count == 0) { parent.enableArrowElement = true; } parent.AddHeirarchyElement(hierarchyObjectElement); return(hierarchyObjectElement); }
public HierarchyObjectElement AddHierarchyObject(HierarchyObject hierarchyObject, HierarchyObjectElement parent, int siblingIndex) { var hierarchyObjectElement = AddHierarchyObjectWithoutUpdate(hierarchyObject, parent, siblingIndex); //Cannot use this function as even though this places the Object correctly while being more optmised than updating all children elements //If the update is being is being optimised by calling AddHierarchyObjectWithoutUpdate, when finally calling AddHierarchyObject, the objects called WithoutUpdate would be missplaced //hierarchyBaseElement.hierarchyContentElement.UpdateElementPosition(hierarchyObjectElement); hierarchyBaseElement.hierarchyContentElement.UpdateChildrenElements(parent); hierarchyBaseElement.hierarchyContentElement.UpdateHierarchyBranch(parent); if (parent.isExpanded) { hierarchyBaseElement.hierarchyContentElement.UpdateRootElements(); } return(hierarchyObjectElement); }
private HierarchyObjectElement CreateHierarchy(HierarchyObject hierarchyObject) { return(CreateHierarchy(hierarchyObject, 0)); }