Exemple #1
0
 public ES2EditorRowCurve(ES2EditorColumn leftColumn, ES2EditorRow leftRow, ES2EditorColumn rightColumn, ES2EditorRow rightRow, Color color)
 {
     this.leftColumn  = leftColumn;
     this.rightColumn = rightColumn;
     this.leftRow     = leftRow;
     this.rightRow    = rightRow;
     this.color       = color;
 }
Exemple #2
0
    public ES2EditorRow AddRow(string label, IES2Selectable obj, GUIStyle iconStyle, GUIStyle selectedIconStyle, int indentLevel = 0)
    {
        ES2EditorRow row = new ES2EditorRow(this, label, obj, rows.Length, iconStyle, selectedIconStyle, indentLevel);

        // Add the item to the rows array.
        ArrayUtility.Add(ref rows, row);

        return(row);
    }
Exemple #3
0
    /* Gets the Rect of the row relative to the Horizontal layout */
    private Rect GetRowRect(ES2EditorColumn column, ES2EditorRow row)
    {
        Rect columnRect = GetColumnRect(column);
        Rect rowRect    = column.GetRowRect(row);

        return(new Rect(columnRect.xMin + rowRect.x,
                        columnRect.yMin + rowRect.y,
                        rowRect.width,
                        rowRect.height));
    }
Exemple #4
0
    protected void GetColumnsForAutoSave(ES2AutoSave autoSave, int hierarchyDepth)
    {
        ES2EditorColumn column = GetColumn(0);
        ES2EditorRow    row    = column.AddRow(autoSave.gameObject.name, autoSave, ES2EditorWindow.instance.style.saveButtonStyle, ES2EditorWindow.instance.style.saveButtonSelectedStyle, hierarchyDepth);

        if (autoSave.selected)
        {
            if (autoSave.selectionChanged)
            {
                ES2EditorAutoSaveUtility.UpdateAutoSave(autoSave);
            }

            GetComponentsColumnForAutoSave(autoSave, column, row);
        }

        if (autoSave.buttonSelected && autoSave.buttonSelectionChanged)
        {
            // Add support for any Components which are currently unsupported.
            Component[] components = autoSave.GetComponents <Component>();
            foreach (Component c in components)
            {
                // Handle unassigned components.
                if (c == null)
                {
                    continue;
                }
                // If this Component isn't currently supported, add support for it and isn't an ES2AutoSave.
                if (!ES2EditorTypeUtility.TypeIsSupported(c.GetType()) &&
                    !typeof(ES2AutoSave).IsAssignableFrom(c.GetType()) &&
                    !typeof(ES2AutoSaveManager).IsAssignableFrom(c.GetType()))
                {
                    ES2EditorTypeUtility.AddType(c.GetType());
                }
            }
        }

        foreach (Transform t in autoSave.transform)
        {
            ES2AutoSave child = ES2AutoSave.GetAutoSave(t.gameObject);
            if (child != null)
            {
                GetColumnsForAutoSave(child, hierarchyDepth + 1);
            }
        }
    }
Exemple #5
0
 public Rect GetRowRect(ES2EditorRow row)
 {
     return(new Rect(columnStyle.padding.left, columnStyle.padding.top + (row.rowNo * row.height), row.width, row.height));
 }
Exemple #6
0
 private void SetTooltips(ES2AutoSaveVariableInfo info, ES2EditorRow row)
 {
     /*
      * Set the row's buttonTooltip and labelTooltip fields here to show a tooltip for each.
      */
 }
Exemple #7
0
    /*
     *  Displays all Properties for the given VariableInfo (which can also be a ComponentInfo.
     *  Finish GetVariablesColumn Method
     */
    private ES2EditorColumn GetVariablesColumnForVariable(ES2AutoSaveVariableInfo info, ES2EditorColumn previousColumn, ES2EditorRow previousRow, int columnIndex)
    {
        ES2EditorColumn column = GetColumn(columnIndex);

        ES2EditorRow firstRow = null;

        foreach (string variableID in info.variableIDs)
        {
            ES2AutoSaveVariableInfo variable = info.autoSave.GetCachedVariableInfo(variableID);
            ES2EditorRow            row      = column.AddRow(variable.name, variable, ES2EditorWindow.instance.style.saveButtonStyle, ES2EditorWindow.instance.style.saveButtonSelectedStyle);
            if (firstRow == null)
            {
                firstRow = row;
            }

            SetTooltips(variable, row);

            // If this variable was just selected ...
            if (variable.buttonSelectionChanged && variable.buttonSelected)
            {
                // ... select all of it's ancestors.
                SelectParentButtons(variable);

                // If this type isn't currently supported, add support for it.
                if (!ES2EditorTypeUtility.TypeIsSupported(variable.type))
                {
                    ES2EditorTypeUtility.AddType(variable.type);
                }
            }

            // If the button for the Auto Save of this Component was deselected, deselect this one too.
            if (info.buttonSelectionChanged && !info.buttonSelected)
            {
                row.obj.buttonSelected = false;
            }

            if (variable.selected)
            {
                // If we just selected this variable, update it.
                if (variable.selectionChanged && variable.selected)
                {
                    ES2EditorAutoSaveUtility.UpdateVariablesForVariable(variable);
                }

                GetVariablesColumnForVariable(variable, column, row, columnIndex + 1);
            }
        }

        if (info.variableIDs.Count == 0)
        {
            //firstRow = column.AddRow("No supportable types", null, null, null);
            return(null);
        }

        // Add seperator row.
        column.AddRow("", null, null, null);

        ArrayUtility.Add(ref curves, new ES2EditorRowCurve(previousColumn, previousRow, column, firstRow, info.autoSave.color));

        return(column);
    }
Exemple #8
0
    protected void GetComponentsColumnForAutoSave(ES2AutoSave autoSave, ES2EditorColumn previousColumn, ES2EditorRow previousRow)
    {
        ES2EditorColumn column = GetColumn(1);

        ES2EditorRow firstRow = null;

        // GameObject instance variables. These have to be handled seperately.
        ES2AutoSaveVariableInfo[] instanceVariables = new ES2AutoSaveVariableInfo[] { autoSave.activeSelfVariable, autoSave.parentVariable, autoSave.nameVariable, autoSave.tagVariable, autoSave.layerVariable };
        for (int i = 0; i < instanceVariables.Length; i++)
        {
            ES2AutoSaveVariableInfo variable = instanceVariables[i];

            ES2EditorRow newRow = column.AddRow(variable.name, variable, ES2EditorWindow.instance.style.saveButtonStyle, ES2EditorWindow.instance.style.saveButtonSelectedStyle, 0);
            if (firstRow == null)
            {
                firstRow = newRow;
            }

            SetTooltips(variable, newRow);

            // If this component was selected, also select it's Auto Save.
            if (variable.buttonSelectionChanged && variable.buttonSelected)
            {
                autoSave.buttonSelected = true;
            }

            // If the button for the Auto Save of this Component was deselected, deselect this one too.
            if (autoSave.buttonSelectionChanged && !autoSave.buttonSelected)
            {
                newRow.obj.buttonSelected = false;
            }

            // Get variables column if this Component is selected.
            if (variable.selected)
            {
                // Update this component if we've only just selected this Component.
                if (variable.selectionChanged)
                {
                    ES2EditorAutoSaveUtility.UpdateVariablesForVariable(variable);
                }

                GetVariablesColumnForVariable(variable, column, newRow, 2);
            }
        }

        // Create rows for Component's attached to this GameObject.
        for (int i = 0; i < autoSave.components.Count; i++)
        {
            ES2AutoSaveComponentInfo componentInfo = autoSave.components[i];
            ES2EditorRow             newRow        = column.AddRow(componentInfo.name, componentInfo, ES2EditorWindow.instance.style.saveButtonStyle, ES2EditorWindow.instance.style.saveButtonSelectedStyle, 0);
            if (firstRow == null)
            {
                firstRow = newRow;
            }

            SetTooltips(componentInfo, newRow);

            // If this component was selected ...
            if (componentInfo.buttonSelectionChanged && componentInfo.buttonSelected)
            {
                // ... also select it's Auto Save.
                autoSave.buttonSelected = true;
                // If this Component isn't currently supported, add support for it.
                if (!ES2EditorTypeUtility.TypeIsSupported(componentInfo.type))
                {
                    ES2EditorTypeUtility.AddType(componentInfo.type);
                }
            }

            // If the button for the Auto Save of this Component was deselected, deselect this one too.
            if (autoSave.buttonSelectionChanged && !autoSave.buttonSelected)
            {
                newRow.obj.buttonSelected = false;
            }

            // Get variables column if this Component is selected.
            if (componentInfo.selected)
            {
                // Update this component if we've only just selected this Component.
                if (componentInfo.selectionChanged)
                {
                    ES2EditorAutoSaveUtility.UpdateVariablesForVariable(componentInfo);
                }

                GetVariablesColumnForVariable(componentInfo, column, newRow, 2);
            }
        }

        if (autoSave.components.Count == 0)
        {
            firstRow = column.AddRow("No supportable Components", null, null, null, 0);
        }

        // Add seperator row.
        column.AddRow("", null, null, null);
        // Add curve line between columns.
        ArrayUtility.Add(ref curves, new ES2EditorRowCurve(previousColumn, previousRow, column, firstRow, autoSave.color));
    }