Beispiel #1
0
        public IViewAdaper <MoveToView, MoveToViewResult> GetMoveToView(string methodFolderPath, SyntaxNode node)
        {
            var viewModel = new MoveToViewModel(this, methodFolderPath, node);
            var view      = new MoveToView();

            view.DataContext = viewModel;

            AttachToParentWindow(view);
            return(new MoveToViewAdapter(view));
        }
Beispiel #2
0
    public static void DrawView(View view)
    {
        float height = CalculateLocalViewSize(view);
        float widthA = height * (view.primaryAspectRatio.x / view.primaryAspectRatio.y);
        float widthB = height * (view.secondaryAspectRatio.x / view.secondaryAspectRatio.y);

        Color transparent = new Color(1, 1, 1, 0f);
        Color fill        = viewColor;
        Color outline     = viewColor;

        bool highlight = Selection.activeGameObject == view.gameObject;

        FungusScript fungusScript = FungusScriptWindow.GetFungusScript();

        if (fungusScript != null)
        {
            MoveToView moveToViewCommand = fungusScript.selectedCommand as MoveToView;
            if (moveToViewCommand != null)
            {
                highlight = (moveToViewCommand.targetView == view);
            }

            FadeToView fadeToViewCommand = fungusScript.selectedCommand as FadeToView;
            if (fadeToViewCommand != null)
            {
                highlight = (fadeToViewCommand.targetView == view);
            }
        }

        if (highlight)
        {
            fill      = outline = Color.green;
            fill.a    = 0.1f;
            outline.a = 1f;
        }
        else
        {
            fill.a    = 0.1f;
            outline.a = 0.5f;
        }

        // Draw left box
        {
            Vector3[] verts = new Vector3[4];
            verts[0] = view.transform.TransformPoint(new Vector3(-widthB, -height, 0));
            verts[1] = view.transform.TransformPoint(new Vector3(-widthB, height, 0));
            verts[2] = view.transform.TransformPoint(new Vector3(-widthA, height, 0));
            verts[3] = view.transform.TransformPoint(new Vector3(-widthA, -height, 0));

            Handles.DrawSolidRectangleWithOutline(verts, fill, transparent);
        }

        // Draw right box
        {
            Vector3[] verts = new Vector3[4];
            verts[0] = view.transform.TransformPoint(new Vector3(widthA, -height, 0));
            verts[1] = view.transform.TransformPoint(new Vector3(widthA, height, 0));
            verts[2] = view.transform.TransformPoint(new Vector3(widthB, height, 0));
            verts[3] = view.transform.TransformPoint(new Vector3(widthB, -height, 0));

            Handles.DrawSolidRectangleWithOutline(verts, fill, transparent);
        }

        // Draw inner box
        {
            Vector3[] verts = new Vector3[4];
            verts[0] = view.transform.TransformPoint(new Vector3(-widthA, -height, 0));
            verts[1] = view.transform.TransformPoint(new Vector3(-widthA, height, 0));
            verts[2] = view.transform.TransformPoint(new Vector3(widthA, height, 0));
            verts[3] = view.transform.TransformPoint(new Vector3(widthA, -height, 0));

            Handles.DrawSolidRectangleWithOutline(verts, transparent, outline);
        }

        // Draw outer box
        {
            Vector3[] verts = new Vector3[4];
            verts[0] = view.transform.TransformPoint(new Vector3(-widthB, -height, 0));
            verts[1] = view.transform.TransformPoint(new Vector3(-widthB, height, 0));
            verts[2] = view.transform.TransformPoint(new Vector3(widthB, height, 0));
            verts[3] = view.transform.TransformPoint(new Vector3(widthB, -height, 0));

            Handles.DrawSolidRectangleWithOutline(verts, transparent, outline);
        }
    }
Beispiel #3
0
        public static void DrawView(View view, bool drawInterior)
        {
            float height = CalculateLocalViewSize(view);
            float widthA = height * (view.PrimaryAspectRatio.x / view.PrimaryAspectRatio.y);
            float widthB = height * (view.SecondaryAspectRatio.x / view.SecondaryAspectRatio.y);

            Color transparent = new Color(1, 1, 1, 0f);
            Color fill        = viewColor;
            Color outline     = viewColor;

            bool highlight = Selection.activeGameObject == view.gameObject;

            var flowchart = FlowchartWindow.GetFlowchart();

            if (flowchart != null)
            {
                var selectedCommands = flowchart.SelectedCommands;
                foreach (var command in selectedCommands)
                {
                    MoveToView moveToViewCommand = command as MoveToView;
                    if (moveToViewCommand != null &&
                        moveToViewCommand.TargetView == view)
                    {
                        highlight = true;
                    }
                    else
                    {
                        FadeToView fadeToViewCommand = command as FadeToView;
                        if (fadeToViewCommand != null &&
                            fadeToViewCommand.TargetView == view)
                        {
                            highlight = true;
                        }
                    }
                }
            }

            if (highlight)
            {
                fill      = outline = Color.green;
                fill.a    = 0.1f;
                outline.a = 1f;
            }
            else
            {
                fill.a    = 0.1f;
                outline.a = 0.5f;
            }

            if (drawInterior)
            {
                // Draw left box
                {
                    Vector3[] verts = new Vector3[4];
                    verts[0] = view.transform.TransformPoint(new Vector3(-widthB, -height, 0));
                    verts[1] = view.transform.TransformPoint(new Vector3(-widthB, height, 0));
                    verts[2] = view.transform.TransformPoint(new Vector3(-widthA, height, 0));
                    verts[3] = view.transform.TransformPoint(new Vector3(-widthA, -height, 0));

                    Handles.DrawSolidRectangleWithOutline(verts, fill, transparent);
                }

                // Draw right box
                {
                    Vector3[] verts = new Vector3[4];
                    verts[0] = view.transform.TransformPoint(new Vector3(widthA, -height, 0));
                    verts[1] = view.transform.TransformPoint(new Vector3(widthA, height, 0));
                    verts[2] = view.transform.TransformPoint(new Vector3(widthB, height, 0));
                    verts[3] = view.transform.TransformPoint(new Vector3(widthB, -height, 0));

                    Handles.DrawSolidRectangleWithOutline(verts, fill, transparent);
                }

                // Draw inner box
                {
                    Vector3[] verts = new Vector3[4];
                    verts[0] = view.transform.TransformPoint(new Vector3(-widthA, -height, 0));
                    verts[1] = view.transform.TransformPoint(new Vector3(-widthA, height, 0));
                    verts[2] = view.transform.TransformPoint(new Vector3(widthA, height, 0));
                    verts[3] = view.transform.TransformPoint(new Vector3(widthA, -height, 0));

                    Handles.DrawSolidRectangleWithOutline(verts, transparent, outline);
                }
            }

            // Draw outer box
            {
                Vector3[] verts = new Vector3[4];
                verts[0] = view.transform.TransformPoint(new Vector3(-widthB, -height, 0));
                verts[1] = view.transform.TransformPoint(new Vector3(-widthB, height, 0));
                verts[2] = view.transform.TransformPoint(new Vector3(widthB, height, 0));
                verts[3] = view.transform.TransformPoint(new Vector3(widthB, -height, 0));

                Handles.DrawSolidRectangleWithOutline(verts, transparent, outline);
            }
        }