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); } } }
List <Type> GetDataTypeOrAllowed(BackEnd.Input inp) { if (inp.GetDataType() == null)//several data type; we don't know which data type this input is taking { return(inp.GetAllowedDataTypes()); } else//only one data type { return(new List <Type>(new Type[] { inp.GetDataType() })); } }