public void Hide() { if (mFocusProperty != null && mFocusProperty.ReguexData() && mFocusDecorator != null) { mFocusDecorator.UpdatePropertiesInfo(); } Visible = false; Context = null; Mode = EMode.none; mRaycastProperty = null; mFocusProperty = null; mFocusDecorator = null; mRaycastDecorator = null; mDropDownMeta = null; mSearchContext = ""; }
void OnPropertiesList(Rect r, BehaviourNodeGUI.Decorator decorator, Vector2 tsize, Vector2 dsize) { BTInputProperty[] properties = decorator.Properties; if (properties.Length == 0) { return; } Rect h = new Rect(); h.size = new Vector2(dsize.x - 6 * GlobalScale, dsize.y); h.position = r.position + Vector2.one * 3 * GlobalScale; Installizer.contentStyle.alignment = TextAnchor.MiddleLeft; Installizer.contentStyle.fontSize = (int)Mathf.Max(1, BehaviourNodeGUI.SUB_FONT_SIZE * GlobalScale); bool dirty = false; for (int i = 0; i < properties.Length; i++) { BTInputProperty prop = properties[i]; Installizer.contentContent.text = prop.PropertyName; GUI.Label(h, Installizer.contentContent, Installizer.contentStyle); h.y += dsize.y;// = new Vector2(r.xMin + x0, r.yMin + i * dsize.y); //GUI.Label(h, "", "textfield");// "TL LoopSection"); QuickGUI.DrawBox(h, Color.clear, Color.gray, 1); if (h.Contains(Event.current.mousePosition)) { mRaycastProperty = prop; } if (mFocusProperty == prop) { string str = GUI.TextField(h, prop.InputData, Installizer.contentStyle); dirty |= str != prop.InputData; prop.InputData = str; } else { prop.ReguexData(); GUI.Label(h, prop.IsDefaultValue ? string.Format("<i><color=#a0a0a0>({0})</color></i> {1} ", prop.TypeName, prop.InputData) : prop.InputData, Installizer.contentStyle); } h.y += tsize.y; } if (dirty) { decorator.UpdatePropertiesInfo(); mResizeNode = true; } }
public override bool InteractMouseClick(EMouseButton button, Vector2 mousePosition) { if (!Visible) { return(false); } mFocusSearch = mRaycastSearch; if (mRaycastMeta != null && button == EMouseButton.left) { if (mRaycastMeta.IsTitle) { mRaycastMeta.Collaped = !mRaycastMeta.Collaped; } //mDropDownMeta = mRaycastMeta == mDropDownMeta ? null : mRaycastMeta; else { switch (mRaycastMeta.BTMeta.NodeType) { case EBTNodeType.task: case EBTNodeType.controller: mWindow.AddChild(Context, mRaycastMeta.BTMeta, new Vector2(LocalRect.center.x, LocalRect.yMin)); Hide(); return(true); case EBTNodeType.condition: case EBTNodeType.service: BehaviourNodeGUI node = Context as BehaviourNodeGUI; if (node != null) { BehaviourNodeGUI.Decorator decor = node.AddDecorator(mRaycastMeta.BTMeta); if (decor != null && decor.Properties.Length > 0) { //mFocusDecorator = decor; decor.UpdatePropertiesInfo(); } //Hide(); node.Resize(); if (decor == null) { EditorCanvasTip.NewTip("不能添加<color=yellow>" + mRaycastMeta.BTMeta.DisplayName + "</color>", 2) .Show(mWindow.RootCanvas, mWindow.RootCanvas.CalculateLocalPosition(mousePosition - Vector2.up * 20)); } } return(true); default: break; } } } bool act = mFocusProperty == null && mRaycastProperty == null; if (mFocusProperty != mRaycastProperty) { SubmitProperty(); } mFocusProperty = mRaycastProperty; mFocusDecorator = mRaycastDecorator; if (act && mRaycastDecorator != null && mRaycastDecorator.BTMeta.NodeType == EBTNodeType.condition) { mRaycastDecorator.NotFlag = !mRaycastDecorator.NotFlag; } //if (mRaycastDecorator != null && mRaycastDecorator.Properties.Length > 0) //{ // mFocusDecorator = mRaycastDecorator; //} return(Visible); }