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); }
/// <summary> /// Initializes the object using the given config. /// Throws an exception if parsing the config fails. /// </summary> /// <param name="config"> /// Contains the instructions for parsing the .sav file, /// as well as information on how to display Pawn parameters to the user, /// such as labels, slider ranges, and drop-down options. /// </param> /// <returns> /// The root of the parsed Pawn template /// </returns> public static PawnTemplateCategory ParseConfig(XElement config) { PawnTemplateCategory template = ParsePawnTemplate(config); ParseSavConfig(config); return(template); }
private void SetConfig(XElement config) { int?version = GetConfigVersion(config); configFileVersion = version.HasValue ? version.Value : 0; PawnTemplateCategory template = PawnIO.ParseConfig(config); pawnModel = new PawnModel(template); PawnEditTreeTab.TreeList.Model = pawnModel; NotifyPropertyChanged("PawnModel"); }
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 PawnModel(PawnTemplateCategory templatePawnRoot) { this.templatePawnRoot = templatePawnRoot; }