private void ProcessWidgets_Recrusive(List <UEditorWidgetBase> CurrentContainer) { List <UEditorWidgetBase> __nestedWidgets = new List <UEditorWidgetBase>(); foreach (var item in CurrentContainer) { UEditorWidgetBase __castWidget = (UEditorWidgetBase)item; UWidgetCodeGen __cGen = new UWidgetCodeGen(__castWidget); _widgetDeclarations.Add(__cGen.WidgetDeclaration); _widgetPropertySetters.Add("\t//Property setters for ->" + item.Name); foreach (var setter in __cGen.PropertySetters) { _widgetPropertySetters.Add("\t" + setter); } _widgetPropertySetters.Add("\t" + __cGen.WidgetParent); _widgetPropertySetters.Add(""); _widgetPropertySetters.Add(""); if (item.GetType().IsSubclassOf(typeof(UEditorPanelBase))) { UEditorPanelBase __castPanel = (UEditorPanelBase)item; __nestedWidgets.AddRange(__castPanel.Children.Cast <UEditorWidgetBase>().ToList()); } } if (__nestedWidgets.Count > 0) { ProcessWidgets_Recrusive(__nestedWidgets); } }
public void BuildHericRecursive(UEditorWidgetFoldout ParentFoldout, List <UEditorWidgetBase> widgetList) { ParentFoldout.ClearChilden(); foreach (var item in widgetList) { UEditorWidgetFoldout __newFoldout = UWidget.Create <UEditorWidgetFoldout>(); __newFoldout.IndentLevel = ParentFoldout.IndentLevel + 1; __newFoldout.BindTo(item, "Name"); __newFoldout.LayoutMode = ePositioningLayout.Layout; __newFoldout.OnClick += __newFoldout_OnClick; //Set the widget ID to match the one on the canvas. //This little bit of hackery help us keep the desinger hierarchy and the toolbox layout in sync. __newFoldout.ObjectID = item.ObjectID; if (item.GetType().IsSubclassOf(typeof(UEditorPanelBase))) { ParentFoldout.AddChild(__newFoldout); UEditorPanelBase __castPanel = (UEditorPanelBase)item; __castPanel.onContainerChange += Hierarchy_onContainerChange; List <UEditorWidgetBase> __childList = new List <UEditorWidgetBase>(); foreach (var __childWidgets in __castPanel.Children) { if (item.GetType().IsSubclassOf(typeof(UEditorWidgetBase))) { UEditorWidgetBase __castChild = (UEditorWidgetBase)__childWidgets; __childList.Add(__castChild); } } BuildHericRecursive(__newFoldout, __childList); } else { __newFoldout.BaseStyle = "label"; ParentFoldout.AddChild(__newFoldout); } } }
private void ValidateNames_Recrusive(List <UEditorWidgetBase> CurrentContainer) { foreach (var item in CurrentContainer) { if (_widgetObjectKeys.ContainsKey(item.Name) == true) { int __nameIndex = 1; while (_widgetObjectKeys.ContainsKey(item.Name + __nameIndex.ToString()) == true) { __nameIndex++; } item.Name += __nameIndex.ToString(); } _widgetObjectKeys.Add(item.Name, item); if (item.GetType().IsSubclassOf(typeof(UEditorPanelBase))) { UEditorPanelBase __castPanel = (UEditorPanelBase)item; ValidateNames_Recrusive(__castPanel.Children); //And down the rabbit hole we go } } }