Пример #1
0
        private void OnClick(BaseEventData arg0)
        {
            PointerEventData ev = arg0 as PointerEventData;

            if (ev == null)
            {
                return;
            }
            if (ev.button == PointerEventData.InputButton.Left)
            {
                if (OutputVisual.status == OutputVisual.LINKING)
                {
                    //linking
                    if (OutputVisual.linkInitiator.host != host)
                    {
                        Disconnect();
                        OutputVisual.CompleteLink(this);
                    }
                }
                else
                {
                    //not linking
                    if (ev.clickCount == 2)
                    {
                        Disconnect();
                    }
                }
            }
            else if (ev.button == PointerEventData.InputButton.Right)
            {
                stay = !stay;
            }
            else if (ev.button == PointerEventData.InputButton.Middle)
            {
                List <Type> allowed = inputAttachedTo.GetAllowedDataTypes();
                if (allowed.Count != 0)
                {
                    StringBuilder builder = new StringBuilder("Allowed:\n");
                    for (int i = 0; i < allowed.Count; i++)
                    {
                        string cleanName = TabMenu.CleanClassName(allowed[i].ToString());
                        builder.Append(cleanName);
                        if (i != allowed.Count - 1)
                        {
                            builder.Append(", ");
                        }
                    }
                    MouseToast.MakeToastFixed(2f, builder.ToString(), UnityEngine.Input.mousePosition);
                }
            }
        }
Пример #2
0
        private void OnClick(BaseEventData arg0)
        {
            PointerEventData ev = arg0 as PointerEventData;

            if (ev == null)
            {
                return;
            }

            if (ev.button == PointerEventData.InputButton.Left)
            {
                if (ev.clickCount == 2)
                {
                    if (status == LINKING)
                    {
                        CancelLink();
                    }
                    Disconnect();
                }
                if (status == IDLE)
                {
                    StartLinking(this);
                }
                else if (linkInitiator == this)
                {
                    CancelLink();
                }
            }
            else if (ev.button == PointerEventData.InputButton.Right)
            {
                stay = !stay;
            }
            else if (ev.button == PointerEventData.InputButton.Middle)
            {
                Type type = outputAttachedTo.GetDataType();
                MouseToast.MakeToastFixed(2f, "Type: " + TabMenu.CleanClassName(type.ToString()), UnityEngine.Input.mousePosition);
            }
        }
Пример #3
0
        private void OnSelectedRightClick(string s)
        {
            if (firstSelect)
            {
                firstSelect = false;
            }
            else
            {
                Destroy(splatRightClick.gameObject);
                switch (s)
                {
                case "doc":
                    //blabla
                    //
                    //Possible input types: blabla
                    //Possible output types: blabla
                    StringBuilder          str         = new StringBuilder(node.GetDocumentation() + "\n\n");
                    Type[]                 inputTypes  = node.GetPossibleInputTypes();
                    Type[]                 outputTypes = node.GetPossibleOutputTypes();
                    InputManagerSerializer example     = node.GetExample();

                    if (inputTypes.Length != 0)
                    {
                        str.Append("Possible input types: ");
                        for (int i = 0; i < inputTypes.Length; i++)
                        {
                            string cleanName = TabMenu.CleanClassName(inputTypes[i].ToString());
                            str.Append(cleanName);
                            if (i != inputTypes.Length - 1)
                            {
                                str.Append(", ");
                            }
                        }
                    }

                    if (outputTypes.Length != 0)
                    {
                        str.Append("\nPossible output types: ");
                        for (int i = 0; i < outputTypes.Length; i++)
                        {
                            string cleanName = TabMenu.CleanClassName(outputTypes[i].ToString());
                            str.Append(cleanName);
                            if (i != outputTypes.Length - 1)
                            {
                                str.Append(", ");
                            }
                        }
                    }
                    if (example == null)
                    {
                        MsgBox.Make(str.ToString());
                    }
                    else
                    {
                        MsgBox.Make(str.ToString(), new string[] { "Paste an example" }, new MsgBox.OnButtonClick[] {
                            (MsgBox msg, object o) => {
                                InputManagerSerializer exem = (InputManagerSerializer)o;
                                InputManager.clipboard      = exem.nodes;
                                InputManager.clipboardPos   = exem.PositionsToVector();
                                host.Paste();
                                msg.Close();
                            }
                        }, new object[] { example });
                    }
                    break;

                case "del":
                    Delete();
                    break;

                case "dis":
                    SetEnable(!node.enabled);
                    break;

                case "com":
                    StartComment();
                    break;
                }
            }
        }