Ejemplo n.º 1
0
    protected override void GetColumns()
    {
        columns = new ES2EditorColumn[0];
        curves  = new ES2EditorRowCurve[0];

        if (ES2EditorAutoSaveUtility.mgr == null)
        {
            GUIStyle style = new GUIStyle(ES2EditorWindow.instance.style.contentButtonStyle);
            // Stretch style to full height.
            style.stretchWidth  = true;
            style.stretchHeight = true;

            if (GUILayout.Button("Click to enable Auto Save for this scene", ES2EditorWindow.instance.style.contentButtonStyle))
            {
                ES2EditorAutoSaveUtility.AddManagerToScene();
            }
            return;
        }

        // Get ES2AutoSaves at top of hierarchy.
        ES2AutoSave[] autoSaves = ES2EditorAutoSaveUtility.mgr.sceneObjects;

        foreach (ES2AutoSave autoSave in autoSaves)
        {
            if (autoSave != null && autoSave.transform != null)
            {
                if (autoSave.transform.parent == null)
                {
                    GetColumnsForAutoSave(autoSave, 0);
                }
            }
        }
    }
Ejemplo n.º 2
0
    private void DrawCurve(ES2EditorRowCurve curve)
    {
        Rect firstColumnRect = GetColumnRect(curve.leftColumn);
        Rect selectedRowRect = GetRowRect(curve.leftColumn, curve.leftRow);

        Rect firstRowRect = GetRowRect(curve.rightColumn, curve.rightRow);

        // First curve (straight line) should be between row's right margin and column's right margin.
        // Use firstCurveLength variable to determine where along this line it should be.
        float firstCurveEndPos = firstColumnRect.xMax - ((firstColumnRect.xMax - selectedRowRect.xMax) / firstCurveLength);

        DrawCurveBetween(new Vector2(selectedRowRect.xMax, selectedRowRect.center.y),
                         new Vector2(firstCurveEndPos, selectedRowRect.center.y), curve.color, null, 2, 0);

        DrawCurveBetween(new Vector2(firstCurveEndPos, selectedRowRect.center.y),
                         new Vector2(firstRowRect.xMin, firstRowRect.center.y), curve.color, null, 2, 1);

        // Arrow head.
        float arrowHeadSize = firstRowRect.height / 4;

        DrawArrowHeadRight(new Vector2(firstRowRect.xMin + arrowHeadSize, firstRowRect.center.y), arrowHeadSize, curve.color);
    }
Ejemplo n.º 3
0
    protected override void GetColumns()
    {
        columns = new ES2EditorColumn[0];
        curves  = new ES2EditorRowCurve[0];
        // Get ES2AutoSaves at top of hierarchy.
        ES2AutoSave[] autoSaves = ES2EditorAutoSaveUtility.globalMgr.prefabArray;

        foreach (ES2AutoSave autoSavePrefab in autoSaves)
        {
            if (autoSavePrefab != null)
            {
                GetColumnsForAutoSave(autoSavePrefab, 0);
            }
        }

        if (columns.Length == 0)
        {
            GUIStyle centerStyle = new GUIStyle(ES2EditorWindow.instance.style.contentTextStyle);
            centerStyle.stretchHeight = true;
            centerStyle.alignment     = TextAnchor.MiddleCenter;
            EditorGUILayout.LabelField("To enable Auto Save for a prefab, right-click it in Project and select \'Easy Save 2 / Enable Auto Save for Prefab\'.", centerStyle);
            return;
        }
    }