public override void CreateNode() { ToolBase tool = new InputTool(); tool.graphNode = GraphNode; GraphNode.UserObject = tool; InitShape(new GoDrawing(GoFigure.Ellipse), color10, color10, 28, 12, 28, 12); UpdatePorts("io", "io", "io", "io"); }
protected override void OnMouseDown(MouseButtonEventArgs e) { if (e.ClickCount == 2) { } else { InputTool.OnMouseDown(e); base.OnMouseDown(e); Focus(); } }
public void Update() { //2017-9-30 yanru 备注:测试发现,iphone输入法在最新unity2017出的包如下条件就可以满足输入处理了,后面的#if全未生效 if (keyboardVisable != TouchScreenKeyboard.visible || keyboardHideInput != TouchScreenKeyboard.hideInput) { AddLog("输入结束:TouchScreenKeyboard.visible=" + TouchScreenKeyboard.visible + ",TouchScreenKeyboard.hideInput=" + TouchScreenKeyboard.hideInput + ",keyBoardAndroid=" + (keyBoardAndroid == null) + ",hasEditInput?" + hasEditInput); keyboardVisable = TouchScreenKeyboard.visible; keyboardHideInput = TouchScreenKeyboard.hideInput; //2017-9-30 在iphone测试发现 点done的时候,这两个条件必须同时满足, //否则,如果点输入法空白处 或者点取消哦,hideInput会为true,但TouchScreenKeyboard.visible却为true,此时不应该处理输入 if (keyboardVisable == false)//hidepunt条件不是必须的.跟是否结束输入无关系 && keyboardHideInput == false) { AddLog("此时文本=" + this.input_field.text + ",hasEditInput?" + hasEditInput + ",点过顶部遮罩?" + _hasClickedInputTopMask + ",inputString=" + Input.inputString + ",keyBoardAndroid=" + (keyBoardAndroid == null ? "NULL" : keyBoardAndroid.text)); string inputContent = this.input_field.text; //注意:假如输入法组件 未显示在屏幕中,input_field.text内容为空,此时只能通过keyBoardAndroid去获取输入的文本 if (keyBoardAndroid != null) { inputContent = keyBoardAndroid.text; } if (inputContent != "" && false == _hasClickedInputTopMask) //点击过输入法以外的顶部遮罩则按“取消”处理 { SendChatMessage(inputContent); return; } else { ActiveTopInputMask(false);//_hasClickedInputTopMask 为true的时候,可以修改为 清空输入框文本 } } else { hasEditInput = false; } } //备注:一定要在 OnUpdate 检查,保证先结束输入法处理,后重置UI通知。 InputTool.keyBoardUpdate(_rectTransfrom, screenHeight); }
public void Awake() { txt_content.text = ""; _rectTransfrom = this.GetComponent <RectTransform>(); InputTool.initScrrenSize(this.transform); screenHeight = InputTool.ScreenSize.y; setInputFieldPos(true); //清理输入框 keyboardVisable = true; keyboardHideInput = false; //hasKeyboardObj = true; hasEditInput = false; this.input_field.text = ""; btnSendInput.onClick.AddListener(() => { OnClickBtnSendChatMsg(btnSendInput.gameObject); }); btnClearLog.onClick.AddListener(() => { resetContent(); }); }