Exemple #1
0
    private static void OnSnapEvent()
    {
        if (CurrentViewHeader != "Sprite")
        {
            EditorUtility.DisplayDialog("Error", "Operation is allowed only in UISprite!!", "OK");
            return;
        }

        if (Selection.objects == null || Selection.objects.Length == 0)
        {
            return;
        }

        int count = 0;

        UnityEngine.Object[] sprites = Selection.GetFiltered(typeof(UISprite), SelectionMode.Deep);
        foreach (UISprite uiSprite in sprites)
        {
            if (UIModifierHelper.OnSnap(uiSprite, m_SpriteProperty))
            {
                count++;
            }
        }

        //EditorUtility.DisplayDialog("", "Completed!!\r\nTotal: " + count, "OK");
        Debug.Log("Total modify count:  " + count);
    }
Exemple #2
0
    static private void OnChangeAllEvent()
    {
        if (Selection.objects == null || Selection.objects.Length == 0)
        {
            return;
        }

        int count = 0;

        if (CurrentViewHeader == "Label")
        {
            UnityEngine.Object[] labels = Selection.GetFiltered(typeof(UILabel), SelectionMode.Deep);
            foreach (UILabel uiLabel in labels)
            {
                if (UIModifierHelper.ChangeAllProperties(uiLabel, m_LabelProperty))
                {
                    count++;
                }
            }
        }
        else if (CurrentViewHeader == "Sprite")
        {
            UnityEngine.Object[] sprites = Selection.GetFiltered(typeof(UISprite), SelectionMode.Deep);
            foreach (UISprite uiSprite in sprites)
            {
                if (UIModifierHelper.ChangeAllProperties(uiSprite, m_SpriteProperty))
                {
                    count++;
                }
            }
        }
        else if (CurrentViewHeader == "Button")
        {
            UnityEngine.Object[] buttons = Selection.GetFiltered(typeof(UIButton), SelectionMode.Deep);
            foreach (UIButton uiButton in buttons)
            {
                if (UIModifierHelper.ChangeButtonProperties(uiButton, m_ButtonProperty))
                {
                    count++;
                }
            }
        }

        //EditorUtility.DisplayDialog("", "Completed!!\r\nTotal: " + count, "OK");
        Debug.Log("Total modify count:  " + count);
    }
Exemple #3
0
    private static void OnButtonUpdateEvent()
    {
        if (Selection.objects == null || Selection.objects.Length == 0)
        {
            return;
        }

        int count = 0;

        UnityEngine.Object[] buttons = Selection.GetFiltered(typeof(UIImageButton), SelectionMode.Deep);
        foreach (UIImageButton uiImageButton in buttons)
        {
            if (UIModifierHelper.UpgradeUIImageButton(uiImageButton))
            {
                count++;
            }
        }

        //EditorUtility.DisplayDialog("", "Completed!!\r\nTotal: " + count, "OK");
        Debug.Log("Total modify count:  " + count);
    }