コード例 #1
0
    void OnGUI()
    {
        BackGround();
        e = Event.current;
        mousePos = e.mousePosition;
        
        if (IsReallyTimeView = GUI.Toggle(rect_ReallyTimeView_Toggle, IsReallyTimeView, "Really Time Rend"))
            Repaint();

        if (GUI.RepeatButton(new Rect(position.width-200,20,150,30),"Update Code Now!") && !IsPickingNodeInterface)
        {
            StringBuilder modelContext = new StringBuilder();
            for (int i = 0; i < windowsNode.Count; i++)
            {
                ResultGroupNode result = windowsNode[i] as ResultGroupNode;
                if (result)
                    modelContext.Append(result.GetRootMorphContext());
            }
            for (int j = 0; j < windowsNode.Count; j++)
            {
                ResultGroupNode result = windowsNode[j] as ResultGroupNode;
                if (result)
                {
                    modelContext.Append(result.resultContext);
                    result.resultContext = "";
                }
            }
            AutoManager.CreateMyAsset(modelContext.ToString());
        }

        if (e.button == 1 && !IsPickingNodeInterface)
        {
            MouseAtThisWindow_1 = null;
            bool IsShowMainMenu = true;

            for (int i = 0; i < windowsNode.Count; i++)
            {
                BaseInput tmp_MouseAtWindow = windowsNode[i].IsMouseAtWindow(e.mousePosition - new Vector2(20,0));
                if (tmp_MouseAtWindow)
                {
                    MouseAtThisWindow_1 = tmp_MouseAtWindow;
                    IsPickingNodeInterface = false;
                    IsShowMainMenu = false;

                    if (tmp_MouseAtWindow.Picked(out NodeData))
                        linkMenu.ShowMenu(position);
                    else
                        removeMenu.ShowMenu(position);
                }
            }
            if (IsShowMainMenu)
                mainMenu.ShowMenu(position);
        }
        else if (IsPickingNodeInterface)
        {
            DrawCurve(NodeData.otherPos,mousePos);
            if (e.button == 0 && e.type == EventType.MouseDown)
            {
                if (!MouseAtThisWindow_1.IsMouseAtWindow(mousePos))
                    IsPickingNodeInterface = false;
                for (int i = 0; i < windowsNode.Count; i++)
                {
                    BaseInput tmp_MouseAtWindow = windowsNode[i].IsMouseAtWindow(e.mousePosition + new Vector2(20, 0));
                    if (tmp_MouseAtWindow)
                    {
                        MouseAtThisWindow_2 = tmp_MouseAtWindow;
                        if (MouseAtThisWindow_2 != MouseAtThisWindow_1)
                        {
                            NodeData.otherInputNode = MouseAtThisWindow_1;
                            IsPickingNodeInterface = !MouseAtThisWindow_2.SetInput(NodeData);
                        }
                    }
                }
            }
            Repaint();
        }
        else if (!IsPickingNodeInterface && e.type == EventType.MouseDown)
        {
            Repaint();
            for (int i = 0; i < windowsNode.Count; i++)
            {
                BaseInput tmp_MouseAtWindow = windowsNode[i].IsMouseAtWindow(e.mousePosition + new Vector2(20, 0));
                if (tmp_MouseAtWindow)
                    tmp_MouseAtWindow.SetInput(null);
            }
        }

        Draw();

        for (int i = 0; i < windowsNode.Count; i++)
            windowsNode[i].DrawCurve();

    }