private PawnTreeCategory CreatePawnTreeCategory(PawnTemplateCategory templateCategory) { PawnTreeCategory ret = new PawnTreeCategory { Template = templateCategory }; foreach (PawnTemplateElement childTemplateElement in templateCategory.Children) { PawnTreeElement childTreeElement = null; PawnTemplateParameter childTemplateParameter = childTemplateElement as PawnTemplateParameter; if (childTemplateParameter != null) { childTreeElement = CreatePawnTreeParameter(childTemplateParameter); } else { PawnTemplateCategory childTemplateCategory = childTemplateElement as PawnTemplateCategory; childTreeElement = CreatePawnTreeCategory(childTemplateCategory); } ret.Children.Add(childTreeElement); } return(ret); }
public IEnumerable GetChildren(object parent) { PawnTreeCategory parentCategory = parent == null ? loadedPawnTreeRoot : parent as PawnTreeCategory; if (parentCategory != null) { return(parentCategory.Children); } return(null); }
private void SetLoadedPawn(PawnData pawnData) { loadedPawnData = pawnData; nameParameter = null; loadedPawnTreeRoot = CreatePawnTreeCategory(templatePawnRoot); }
public bool HasChildren(object parent) { PawnTreeCategory parentCategory = parent as PawnTreeCategory; return(parentCategory != null && parentCategory.Children.Count > 0); }
private PawnTreeCategory CreatePawnTreeCategory(PawnTemplateCategory templateCategory) { PawnTreeCategory ret = new PawnTreeCategory { Template = templateCategory }; foreach (PawnTemplateElement childTemplateElement in templateCategory.Children) { PawnTreeElement childTreeElement = null; PawnTemplateParameter childTemplateParameter = childTemplateElement as PawnTemplateParameter; if (childTemplateParameter != null) { childTreeElement = CreatePawnTreeParameter(childTemplateParameter); } else { PawnTemplateCategory childTemplateCategory = childTemplateElement as PawnTemplateCategory; childTreeElement = CreatePawnTreeCategory(childTemplateCategory); } ret.Children.Add(childTreeElement); } return ret; }