Exemple #1
0
        private AttributeData GetMergedResult(string attribute, AttributeData baseField)
        {
            List <string>    source = new List <string>();
            IExtendableField extendableBaseField = baseField.Value as IExtendableField;
            IExtendableField mergedResult        = GetExtendableField(attribute, source);

            if (extendableBaseField == null)
            {
                return new AttributeData
                       {
                           Value  = mergedResult,
                           Source = string.Join(",", source)
                       }
            }
            ;

            if (mergedResult == null)
            {
                return(baseField);
            }

            return(new AttributeData
            {
                Value = mergedResult.Merge(extendableBaseField),
                Source = baseField.Source + "," + string.Join(",", source),
                IsInherited = true
            });
        }
Exemple #2
0
 private IExtendableField MergeExtendableFields(IExtendableField field, IExtendableField parent)
 {
     if (field == null)
     {
         return(parent);
     }
     return(field.Merge(parent));
 }
Exemple #3
0
 public void AddFieldExtension(string name, IExtendableField value)
 {
     if (value.Extended)
     {
         // extendable fields should only ever exist in types, and be set at the start of the game,
         // so we should never need to worry about adding them to the undo log etc.
         m_extendableFields[name] = value;
     }
     else
     {
         Set(name, value);
     }
 }
Exemple #4
0
        private IExtendableField GetExtendableField(string attribute, List <string> source)
        {
            IExtendableField result = null;

            if (m_extendableFields.ContainsKey(attribute))
            {
                result = MergeExtendableFields(result, m_extendableFields[attribute]);
                source.Add(m_element.Name);
            }

            foreach (Element type in m_types)
            {
                if (type.Fields.HasExtendableField(attribute))
                {
                    result = MergeExtendableFields(result, type.Fields.GetExtendableField(attribute, source));
                    // Don't need to add to source here as the call to GetExtendableField will do that automatically
                }
            }

            return(result);
        }
Exemple #5
0
        public IExtendableField Merge(IExtendableField parent)
        {
            QuestList <T> parentList = parent as QuestList <T>;

            return(parentList.MergeLists(this));
        }