public override bool DrawAdvancedEditor(plyVar target, bool isOnSceneObject, Action saveCallback) { this.doCloseStandalone = false; this.isOnSceneObject = isOnSceneObject; this.saveCallback = saveCallback; this.targetVar = target; this.targetHandler = (plyVar_List)target.ValueHandler; if (this.list == null) { this.list = new plyReorderableList(null, typeof(plyVar), false, true, true, true, true, false, false, new plyReorderableList.Button[1] { new plyReorderableList.Button { label = new GUIContent(Ico._arrow_up, "Back to variables list"), callback = delegate { this.doCloseStandalone = true; } } }, null); this.list.elementHeight = (float)(EditorGUIUtility.singleLineHeight + 2.0); this.list.drawHeaderCallback = this.DrawListHeader; this.list.drawElementCallback = this.DrawElement; this.list.onAddElement = this.OnAdd; this.list.onRemoveElement = this.OnRemove; } this.list.list = this.targetHandler.variables; this.list.DoLayoutList(); return(this.doCloseStandalone); }
public override bool DrawCreateWizard(plyVar target) { this.targetVar = target; this.targetHandler = (plyVar_List)target.ValueHandler; if (plyVarEd_List.menu == null) { List <plyVarEd> list = new List <plyVarEd>(); foreach (plyVarEd value in plyVariablesEditor.editors.Values) { if (!((plyVarEdAttribute)value.nfo).UsesAdvancedEditor) { list.Add(value); } } plyVarEd_List.menu = new GenericMenu(); for (int i = 0; i < list.Count; i++) { if (list[i].handleTypes.Count == 1) { string varTypeName = ((plyVarEdAttribute)list[i].nfo).VarTypeName; MenuData userData = new MenuData { varType = ((plyVarEdAttribute)list[i].nfo).TargetType, baseType = list[i].handleTypes[0] }; plyVarEd_List.menu.AddItem(new GUIContent(varTypeName), false, this.OnTypeSelected, userData); } else { for (int j = 0; j < list[i].handleTypeNames.Length; j++) { string text = ((plyVarEdAttribute)list[i].nfo).VarTypeName + "/" + list[i].handleTypeNames[j].text; MenuData userData2 = new MenuData { varType = ((plyVarEdAttribute)list[i].nfo).TargetType, baseType = list[i].handleTypes[j] }; plyVarEd_List.menu.AddItem(new GUIContent(text), false, this.OnTypeSelected, userData2); } } } } if (GUILayout.Button(BloxEd.PrettyTypeName(this.targetHandler.baseType, false))) { plyVarEd_List.menu.ShowAsContext(); } return(this.targetHandler.baseType != null); }
public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx) { plyVar_List plyVar_List = (plyVar_List)target.ValueHandler; this.targetVar = target; this.targetHandler = plyVar_List; this.isOnSceneObject = isOnSceneObject; bool result = false; plyVarEd_List.GC_Button.text = "[" + plyVar_List.variables.Count + "] click to edit list"; if (GUI.Button(rect, plyVarEd_List.GC_Button, GUI.skin.label)) { result = true; plyVarEd_List.GC_Head.text = "List: <b>" + target.name + "</b>"; } return(result); }
public override string VarTypeName(plyVar target) { plyVar_List plyVar_List = (plyVar_List)target.ValueHandler; return("List<" + BloxEd.PrettyTypeName(plyVar_List.baseType, false) + ">"); }