static public InstantGuiList CreateList() { InstantGuiList element = (InstantGuiList)InstantGuiElement.Create("List", typeof(InstantGuiList), GetSelectedElement()); element.slider = CreateVerticalSlider(); element.slider.useStylePlacement = true; element.slider.transform.parent = element.transform; element.elementStyleName = "List_Element"; //element.diamond = InstantGuiElement.Create("Slider_Diamond", InstantGuiElement, element); //element.incrementButton = InstantGuiElement.Create("Slider_IncrementButton", InstantGuiElement, element); //element.decrementButton = InstantGuiElement.Create("Slider_DecrementButton", InstantGuiElement, element); InstantGui.ForceUpdate(); Selection.activeGameObject = element.gameObject; return(element); }
public override void OnInspectorGUI() { InstantGuiList script = (InstantGuiList)target; base.OnInspectorGUI(); script.guiElementProps = EditorGUILayout.Foldout(script.guiElementProps, "List"); if (script.guiElementProps) { EditorGUI.indentLevel = 1; //showing labels array; script.guiShowLabels = EditorGUILayout.Foldout(script.guiShowLabels, "Labels"); if (script.guiShowLabels) { script.labels = InstantGuiInspector.DrawStringArray(script.labels, 4); } script.lineHeight = EditorGUILayout.IntField("Line Height:", script.lineHeight); script.selected = EditorGUILayout.IntField("Selected:", script.selected); script.firstShown = EditorGUILayout.IntField("First Shown:", script.firstShown); script.slider = (InstantGuiSlider)EditorGUILayout.ObjectField("Slider:", script.slider, typeof(InstantGuiSlider), true); script.sliderMargin = EditorGUILayout.IntField("Slider Margin:", script.sliderMargin); //setting style //this is a clone of element editor section. string[] styleNames = new string[script.styleSet.styles.Length]; int selectedStyle = -1; //default if style could not be found //compiling popup array for (int i = 0; i < script.styleSet.styles.Length; i++) { styleNames[i] = script.styleSet.styles[i].name; } //finding popup selected if (script.elementStyle == null) { selectedStyle = 0; } else { for (int i = 0; i < styleNames.Length; i++) { if (styleNames[i] == script.elementStyleName) { selectedStyle = i; } } } styleNames[0] = "None"; int newSelected = EditorGUILayout.Popup("Element Style:", selectedStyle, styleNames); if (newSelected != selectedStyle) { script.elementStyle = script.styleSet.styles[newSelected]; script.elementStyleName = script.elementStyle.name; //script.elementStyleNum = newSelected; } EditorGUI.indentLevel = 0; } }