Exemplo n.º 1
0
        private void DrawElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            plyVar   plyVar   = this.variables.varDefs[index];
            plyVarEd plyVarEd = plyVariablesEditor.editors[plyVar.ValueHandler.GetType()];

            plyVariablesEditor.GC_VarName.text = plyVar.name;
            plyVariablesEditor.GC_VarType.text = plyVarEd.VarTypeName(plyVar);
            float num   = (float)(plyEdGUI.Styles.Label_RT.CalcSize(plyVariablesEditor.GC_VarType).x + 7.0);
            Rect  rect2 = rect;

            rect2.height = EditorGUIUtility.singleLineHeight;
            rect2.y     += 3f;
            rect2.width -= num;
            GUI.Label(rect2, plyVariablesEditor.GC_VarName, EditorStyles.boldLabel);
            rect2.x     = (float)(rect2.xMax + 5.0);
            rect2.width = num;
            GUI.Label(rect2, plyVariablesEditor.GC_VarType);
            rect2.y    += (float)(rect2.height + 2.0);
            rect2.x     = (float)(rect.x + 20.0);
            rect2.width = (float)(rect.width - 20.0);
            EditorGUI.BeginChangeCheck();
            if (plyVarEd.DrawEditor(rect2, this.isOnSceneObject, plyVar, plyVar, 0))
            {
                this.advVar = plyVar;
                this.advEd  = plyVarEd;
                plyEdGUI.ClearFocus();
            }
            if (EditorGUI.EndChangeCheck())
            {
                this.Save();
            }
            if (Event.current.type == EventType.MouseDrag && rect.Contains(Event.current.mousePosition))
            {
                plyEdGUI.ClearFocus();
                DragAndDrop.PrepareStartDrag();
                DragAndDrop.objectReferences = new UnityEngine.Object[0];
                DragAndDrop.paths            = null;
                DragAndDrop.SetGenericData("plyVariable", new DragDropData
                {
                    name       = plyVar.name,
                    plyVarType = this.varsType,
                    varValType = plyVar.variableType
                });
                DragAndDrop.StartDrag(plyVar.name);
                Event.current.Use();
            }
        }
Exemplo n.º 2
0
        private void DrawElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            plyVar plyVar = this.targetHandler.variables[index];

            if (plyVar != null && plyVar.ValueHandler != null)
            {
                plyVarEd plyVarEd = plyVariablesEditor.editors[plyVar.ValueHandler.GetType()];
                plyVarEd_Array.GC_Element.text = this.targetHandler.variables.Count.ToString();
                float num   = (float)(plyEdGUI.Styles.Label_RT.CalcSize(plyVarEd_Array.GC_Element).x + 5.0);
                Rect  rect2 = rect;
                rect2.width = num;
                plyVarEd_Array.GC_Element.text = index.ToString();
                GUI.Label(rect2, plyVarEd_Array.GC_Element, plyEdGUI.Styles.Label_RT);
                rect2.x     = rect2.xMax;
                rect2.width = rect.width - num;
                EditorGUI.BeginChangeCheck();
                plyVarEd.DrawEditor(rect2, this.isOnSceneObject, plyVar, this.targetVar, index);
                if (EditorGUI.EndChangeCheck())
                {
                    this.saveCallback();
                }
            }
        }