Esempio n. 1
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);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        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");
        }
Esempio n. 4
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;
        }
Esempio n. 5
0
 public PawnModel(PawnTemplateCategory templatePawnRoot)
 {
     this.templatePawnRoot = templatePawnRoot;
 }
Esempio n. 6
0
 public PawnModel(PawnTemplateCategory templatePawnRoot)
 {
     this.templatePawnRoot = templatePawnRoot;
 }