コード例 #1
0
		public void BuildElement(Element element, ref Grid buildingSpace)
		{
			string type = "Savage.Core.ModelBuilding.Builders." + element.GetType().Name + "Builder";
			if(BuilderMap.ContainsKey(type))
			{
				TagBuilder = BuilderMap[type];
			}
			else
			{
				Type TagType = Type.GetType(type, false, true);
				if(TagType != null)
				{
					ConstructorInfo ci = TagType.GetConstructor(
						new Type[] { });
					object Obj = ci.Invoke(new object[] { });
					TagBuilder = Obj as ITagBuilder;
					BuilderMap.Add(type, TagBuilder);// Obj as ITagBuilder);
				}
				else
				{

				}
			}
			TagBuilder?.Build(element, ref buildingSpace);
			foreach(var ch in element.Children.ToList())
			{
				BuildElement(ch, ref buildingSpace);
			}
		}
コード例 #2
0
		public void Setup(Element parent, Element previous)
		{
			Parent = parent;
			Previous = previous;
			if (Parent != null && Parent.children.Count > 0)
			{
				PreviousSibling = Parent.children[Parent.children.Count - 1];
				PreviousSibling.NextSibling = this;
			}
		}
コード例 #3
0
		internal void AddChild(Element element)
		{

			element.Parent = this;
			Element previous = children.ElementAtOrDefault(children.Count - 1);
			if (previous != null)
			{
				element.PreviousSibling = previous;
				previous.NextSibling = element;
			}
			children.Add(element);
		}