Example #1
0
    // ===========================================================
    // Methods
    // ===========================================================

    void OnGUI()
    {
        MadGUI.Info("This tool initialized your scene for GUI drawing. Please choose root object name and layer "
                    + "on which GUI will be painted.");

        rootObjectName = EditorGUILayout.TextField("Root Name", rootObjectName);
        layer          = EditorGUILayout.LayerField("Layer", layer);

        OnFormGUI();

        if (GUILayout.Button("Create"))
        {
            var  panel  = MadPanel.UniqueOrNull();
            bool doInit = true;
            if (panel != null)
            {
                doInit = EditorUtility.DisplayDialog("Scene initialized", "Scene looks like it is already initialized. "
                                                     + "Are you sure that you want to continue?", "Yes", "No");
            }

            if (doInit)
            {
                root = Init(rootObjectName, layer, hideInvisibleSprites, depthBasedRenderMode);
                AfterCreate(root);
            }
        }
    }
Example #2
0
        static void CreateBullets()
        {
            var panel   = MadPanel.UniqueOrNull();
            var bullets = MadLevelGridBulletsTool.Create(panel);

            Selection.activeObject = bullets.gameObject;
        }
Example #3
0
        static Transform ActiveParentOrPanel()
        {
            Transform parentTransform = null;

            var transforms = Selection.transforms;

            if (transforms.Length > 0)
            {
                var firstTransform = transforms[0];
                if (MadTransform.FindParent <MadPanel>(firstTransform) != null)
                {
                    parentTransform = firstTransform;
                }
            }

            if (parentTransform == null)
            {
                var panel = MadPanel.UniqueOrNull();
                if (panel != null)
                {
                    parentTransform = panel.transform;
                }
            }

            return(parentTransform);
        }
Example #4
0
    private void UpdateDraggable()
    {
        var panel = MadPanel.UniqueOrNull();

        if (panel != null)
        {
            panel.ignoreInput = draggable.animating;
        }
    }
Example #5
0
    // ===========================================================
    // Static Methods
    // ===========================================================

    public static void ShowWindow()
    {
        var tool = EditorWindow.GetWindow <MadLevelBackgroundTool>(false, "Create Background", true);

        tool.panel = MadPanel.UniqueOrNull();

        if (tool.panel != null)
        {
            tool.draggable = tool.panel.GetComponentInChildren <MadDraggable>();
        }
    }
Example #6
0
    // ===========================================================
    // Static Methods
    // ===========================================================

    public static void Display()
    {
        var wizard = ScriptableWizard.DisplayWizard <MadLevelIconTool>("Create Icon", "Create");

        wizard.panel = MadPanel.UniqueOrNull();

        if (Selection.activeObject is Texture2D)
        {
            wizard.texture = Selection.activeObject as Texture2D;
            wizard.OnWizardUpdate();
        }
    }
Example #7
0
        static bool ValidateHasGridLayout()
        {
            var panel = MadPanel.UniqueOrNull();

            if (panel == null)
            {
                return(false);
            }

            var gridLayout = MadTransform.FindChild <MadLevelGridLayout>(panel.transform);

            return(gridLayout != null);
        }
Example #8
0
        static void CreateFreeLayout()
        {
            var panel = MadPanel.UniqueOrNull();

            if (panel != null)
            {
                MadLevelFreeTool.CreateUnderPanel(panel);
            }
            else
            {
                ScriptableWizard.DisplayWizard <MadLevelFreeTool>("Create Free Layout", "Create");
            }
        }
Example #9
0
 static bool ValidateHasPanel()
 {
     return(MadPanel.UniqueOrNull() != null);
 }
Example #10
0
        static void CreateIcon()
        {
            var wizard = ScriptableWizard.DisplayWizard <MadLevelIconTool>("Create Icon", "Create");

            wizard.panel = MadPanel.UniqueOrNull();
        }