private void DoActionAddButton() { GUIStyle buttonStyle = new GUIStyle("AC Button"); GUIContent buttonContent = new GUIContent("Add Callback"); Rect buttonRect = GUILayoutUtility.GetRect(buttonContent, buttonStyle, GUILayout.ExpandWidth(true)); buttonRect.x = buttonRect.width * 0.5f - buttonStyle.fixedWidth * 0.5f; buttonRect.width = buttonStyle.fixedWidth; if (GUI.Button(buttonRect, buttonContent, buttonStyle)) { AddObjectWindow.ShowWindow(buttonRect, typeof(StatCallback), AddCallback, CreateCallbackScript); } }
private void DoAddButton() { GUIStyle buttonStyle = new GUIStyle("AC Button"); GUIContent buttonContent = new GUIContent("Add Condition"); Rect buttonRect = GUILayoutUtility.GetRect(buttonContent, buttonStyle, GUILayout.ExpandWidth(true)); buttonRect.x = buttonRect.width * 0.5f - buttonStyle.fixedWidth * 0.5f; buttonRect.width = buttonStyle.fixedWidth; if (GUI.Button(buttonRect, buttonContent, buttonStyle)) { AddObjectWindow.ShowWindow(buttonRect, this.m_ElementType, Add, CreateScript); } }
protected override void GraphContextMenu(Vector2 position) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Add Node"), false, delegate() { Vector2 pos = (position + this.m_GraphOffset) * this.m_GraphZoom + this.m_GraphViewArea.position; this.m_CreateNodePosition = position; AddObjectWindow.ShowWindow <FlowNode>(new Rect(pos.x - this.m_GraphViewArea.x, pos.y, 230f, 0f), AddNode, CreateNodeScript); // AddNodeWindow.ShowWindow(new Rect(pos.x, pos.y, 230f, 21f), position, this.m_Graph); }); if (!string.IsNullOrEmpty(this.m_Copy)) { menu.AddItem(new GUIContent("Paste Nodes"), false, delegate { this.PasteNodes(position); }); } else { menu.AddDisabledItem(new GUIContent("Paste Nodes")); } menu.ShowAsContext(); }