Ejemplo n.º 1
0
    private static void CalculateDepth()
    {
        var panel   = UnityEditor.Selection.activeTransform.GetComponent <UIPanel>();
        var widgets = GetPanelWidgets(panel, false);

        UnityEditor.Undo.RecordObjects(widgets, "CalculateDepth");
        DepthCalculationAlgorithm.CalculateDepthForWidgets(widgets);
    }
Ejemplo n.º 2
0
    private static void AdjustDepth()
    {
        var panel   = UnityEditor.Selection.activeTransform.GetComponent <UIPanel>();
        var widgets = GetPanelWidgets(panel, false);

        DepthCalculatorBindingAlgorithm.BindToWidgets(widgets);
        UnityEditor.Undo.RecordObjects(widgets, "AdjustDepth");
        DepthCalculationAlgorithm.CalculateDepthForWidgets(widgets);
        foreach (var w in widgets)
        {
            var c = w.GetComponent <DepthCalculator>();
            if (c != null)
            {
                NGUITools.Destroy(c);
            }
        }
    }