Ejemplo 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);
        }
Ejemplo n.º 2
0
        private static PawnTemplateParameter ParseEditParameter(XElement xElement)
        {
            PawnTemplateParameter editParameter = null;

            foreach (XElement child in xElement.Elements())
            {
                if (child.Name == ElementNameEditTypeDropDown)
                {
                    editParameter = ParseEditElementDropDown(child);
                }
                else if (child.Name == ElementNameEditTypeSlider)
                {
                    editParameter = ParseEditElementSlider(child);
                }
                else if (child.Name == ElementNameEditTypeName)
                {
                    editParameter = new PawnTemplateParameterName();
                }
                else if (child.Name == ElementNameEditTypeHex)
                {
                    editParameter = new PawnTemplateParameterHex();
                }
            }

            editParameter.Key   = GetElementKey(xElement);
            editParameter.Label = GetEditElementLabel(xElement);

            return(editParameter);
        }
Ejemplo n.º 3
0
        private PawnTreeParameter CreatePawnTreeParameter(PawnTemplateParameter templateParameter)
        {
            PawnTreeParameter ret = templateParameter.CreateTreeParameter();

            ret.@PawnParameter = loadedPawnData.GetOrAddParameter(templateParameter.Key);

            if (nameParameter == null)
            {
                nameParameter = ret as PawnTreeParameterName;
            }

            return(ret);
        }