Esempio n. 1
0
		public Widget LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
		{
			var widget = NewWidget(node.Key, args);

			if (parent != null)
				parent.AddChild( widget );

			if (node.Key.Contains("@"))
				FieldLoader.LoadField(widget, "Id", node.Key.Split('@')[1]);

			foreach (var child in node.Value.Nodes)
				if (child.Key != "Children")
					FieldLoader.LoadField(widget, child.Key, child.Value.Value);

			if (!args.ContainsKey("modRules"))
				args = new WidgetArgs(args) { { "modRules", modData.DefaultRules } };
			widget.Initialize(args);

			foreach (var child in node.Value.Nodes)
				if (child.Key == "Children")
					foreach (var c in child.Value.Nodes)
						LoadWidget( args, widget, c);

			widget.PostInit(args);
			return widget;
		}
Esempio n. 2
0
        public Widget LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
        {
            if (!args.ContainsKey("modData"))
                args = new WidgetArgs(args) { { "modData", modData } };

            var widget = NewWidget(node.Key, args);

            if (parent != null)
                parent.AddChild(widget);

            if (node.Key.Contains("@"))
                FieldLoader.LoadField(widget, "Id", node.Key.Split('@')[1]);

            foreach (var child in node.Value.Nodes)
                if (child.Key != "Children")
                    FieldLoader.LoadField(widget, child.Key, child.Value.Value);

            widget.Initialize(args);

            foreach (var child in node.Value.Nodes)
                if (child.Key == "Children")
                    foreach (var c in child.Value.Nodes)
                        LoadWidget(args, widget, c);

            var logicNode = node.Value.Nodes.FirstOrDefault(n => n.Key == "Logic");
            var logic = logicNode == null ? null : logicNode.Value.ToDictionary();
            args.Add("logicArgs", logic);

            widget.PostInit(args);

            args.Remove("logicArgs");

            return widget;
        }
Esempio n. 3
0
        public Widget LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
        {
            if (!args.ContainsKey("modData"))
            {
                args = new WidgetArgs(args)
                {
                    { "modData", modData }
                }
            }
            ;

            var widget = NewWidget(node.Key, args);

            if (parent != null)
            {
                parent.AddChild(widget);
            }

            if (node.Key.Contains("@"))
            {
                FieldLoader.LoadField(widget, "Id", node.Key.Split('@')[1]);
            }

            foreach (var child in node.Value.Nodes)
            {
                if (child.Key != "Children")
                {
                    FieldLoader.LoadField(widget, child.Key, child.Value.Value);
                }
            }

            widget.Initialize(args);

            foreach (var child in node.Value.Nodes)
            {
                if (child.Key == "Children")
                {
                    foreach (var c in child.Value.Nodes)
                    {
                        LoadWidget(args, widget, c);
                    }
                }
            }

            var logicNode = node.Value.Nodes.FirstOrDefault(n => n.Key == "Logic");
            var logic     = logicNode == null ? null : logicNode.Value.ToDictionary();

            args.Add("logicArgs", logic);

            widget.PostInit(args);

            args.Remove("logicArgs");

            return(widget);
        }
Esempio n. 4
0
        public Widget LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
        {
            if (!args.ContainsKey("modRules"))
            {
                args = new WidgetArgs(args)
                {
                    { "modRules", modData.DefaultRules }
                }
            }
            ;

            var widget = NewWidget(node.Key, args);

            if (parent != null)
            {
                parent.AddChild(widget);
            }

            if (node.Key.Contains("@"))
            {
                FieldLoader.LoadField(widget, "Id", node.Key.Split('@')[1]);
            }

            foreach (var child in node.Value.Nodes)
            {
                if (child.Key != "Children")
                {
                    FieldLoader.LoadField(widget, child.Key, child.Value.Value);
                }
            }

            widget.Initialize(args);

            foreach (var child in node.Value.Nodes)
            {
                if (child.Key == "Children")
                {
                    foreach (var c in child.Value.Nodes)
                    {
                        LoadWidget(args, widget, c);
                    }
                }
            }

            widget.PostInit(args);
            return(widget);
        }