Exemplo n.º 1
0
 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_Array)target.ValueHandler;
     if (this.list == null)
     {
         this.list = new plyReorderableList(null, typeof(plyVar), false, true, true, true, true, 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);
 }
Exemplo n.º 2
0
 public override bool DrawCreateWizard(plyVar target)
 {
     this.targetVar     = target;
     this.targetHandler = (plyVar_Array)target.ValueHandler;
     if (plyVarEd_Array.menu == null)
     {
         List <plyVarEd> list = new List <plyVarEd>();
         foreach (plyVarEd value in plyVariablesEditor.editors.Values)
         {
             if (!((plyVarEdAttribute)value.nfo).UsesAdvancedEditor)
             {
                 list.Add(value);
             }
         }
         plyVarEd_Array.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_Array.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_Array.menu.AddItem(new GUIContent(text), false, this.OnTypeSelected, userData2);
                 }
             }
         }
     }
     if (GUILayout.Button(BloxEd.PrettyTypeName(this.targetHandler.baseType, false)))
     {
         plyVarEd_Array.menu.ShowAsContext();
     }
     return(this.targetHandler.baseType != null);
 }
Exemplo n.º 3
0
        public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx)
        {
            plyVar_Array plyVar_Array = (plyVar_Array)target.ValueHandler;

            this.targetVar       = target;
            this.targetHandler   = plyVar_Array;
            this.isOnSceneObject = isOnSceneObject;
            bool result = false;

            plyVarEd_Array.GC_Button.text = "[" + plyVar_Array.variables.Count + "] click to edit array";
            if (GUI.Button(rect, plyVarEd_Array.GC_Button, GUI.skin.label))
            {
                result = true;
                plyVarEd_Array.GC_Head.text = "Array: <b>" + target.name + "</b>";
            }
            return(result);
        }
Exemplo n.º 4
0
        public override string VarTypeName(plyVar target)
        {
            plyVar_Array plyVar_Array = (plyVar_Array)target.ValueHandler;

            return("Array<" + BloxEd.PrettyTypeName(plyVar_Array.baseType, false) + ">");
        }