GPUGraph.Node.OnGUI C# (CSharp) Метод

OnGUI() публичный Метод

Runs the GUI display window for this node. Returns what happened.
public OnGUI ( int &clickedInput, int isSelected ) : GUIResults
clickedInput int /// If the user clicked an input, /// the index of that input will be stored in this variable. ///
isSelected int /// If this node's output was previously selected, pass -1. /// If an input was selected, pass the index of that input. /// Otherwise, pass anything else. ///
Результат GUIResults
        public GUIResults OnGUI(ref int clickedInput, int isSelected)
        {
            GUIResults result = GUIResults.Nothing;

            GUILayout.BeginHorizontal();

            GUILayout.BeginVertical();

            for (int i = 0; i < Inputs.Count; ++i)
            {
                GUILayout.BeginHorizontal();

                GUILayout.Label(InputNames[i]);

                //Button to select input.
                string buttStr = (isSelected == i ? "x" : "X");
                if (GUILayout.Button(buttStr))
                {
                    result = GUIResults.ClickInput;
                    clickedInput = i;
                }

                //If this input is a constant, expose a text box to edit it.
                if (Inputs[i].IsAConstant)
                {
                    float newVal = EditorGUILayout.FloatField(Inputs[i].ConstantValue);
                    if (AreFloatsDifferent(newVal, Inputs[i].ConstantValue))
                    {
                        result = GUIResults.Other;
                        Inputs[i] = new NodeInput(newVal);
                    }
                }
                //Otherwise, expose a button to release the connection.
                else
                {
                    Rect otherPos = Owner.GetNode(Inputs[i].NodeID).Pos;
                    Vector2 endPos = new Vector2(otherPos.xMax, otherPos.yMin + OutputHeight) - Pos.min;

                    GUIUtil.DrawLine(new Vector2(0.0f, TitleBarHeight + ((float)i * InputSpacing)),
                                     endPos, 2.0f, Color.white);

                    if (GUILayout.Button("Disconnect"))
                    {
                        Inputs[i] = new NodeInput(InputDefaultVals[i]);

                        result = GUIResults.Other;
                    }
                }

                GUILayout.EndHorizontal();
            }

            if (CustomGUI())
            {
                result = GUIResults.Other;
            }

            GUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();

            //Output button.
            if (GUILayout.Button(isSelected == -1 ? "o" : "O"))
            {
                result = GUIResults.ClickOutput;
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            //"Duplicate" button.
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Duplicate"))
            {
                result = GUIResults.Duplicate;
            }

            GUILayout.FlexibleSpace();

            //"Delete" button.
            if (GUILayout.Button("Delete"))
            {
                result = GUIResults.Delete;
            }

            GUILayout.EndHorizontal();

            return result;
        }