public void PopupMenu(EditorControl ctrl, EditorPopupMenu menu, Vector2 pos) { _curPopup?.SetParent(null); _curPopup = menu; _curPopup.LocalPosition = pos; _curPopup.SetParent(ctrl.Root); }
public static EditorPopupMenu NodeRightClickPanel(BeTreeNode node) { EditorPopupMenu menu = NodeFactoryXML.CreateEditorControl <EditorPopupMenu>(); menu.AddMenu("Copy", obj => _canvas.CopyItem(node)); menu.AddMenu("Paste", obj => _canvas.PasteItem(node)); menu.AddMenu("Delete", obj => _canvas.DeleteItem(node)); menu.AddMenu("Create sub node", obj => _canvas.ShowExPanel(node)); menu.AddMenu("Change node", obj => _canvas.ShowExPanelExchange(node)); return(menu); }
public void AddItem(string name, EditorPopupMenu pop) { EditorButton btn = NodeFactoryXML.CreateEditorControl <EditorButton>(); btn.Content = name; btn.DefaultStyle = true; btn.Style = EditorStyles.toolbarDropDown; btn.OnBtnClick = OnSelectBtnClick; btn.Size = new Vector2(100, Size.y); _name2Context.Add(btn, pop); HorList.AddItem(btn); }
public override void InitFinish() { base.InitFinish(); ScrollPanel.Style = EditorStyles.textField; Active = Application.isPlaying; EditorPopupMenu menu = new EditorPopupMenu(); menu.AddMenu("Pause", obj => _isStop = true); menu.AddMenu("Resume", obj => _isStop = false); menu.AddMenu("Clear", obj => OnClearClick?.Invoke()); Context = menu; }
public override void Start() { base.Start(); minSize = new Vector2(300, 300); EditorPopupMenu mainPopup = NodeFactoryXML.CreateEditorControl <EditorPopupMenu>(); mainPopup.AddMenu("Save", obj => OnSave?.Invoke()); mainPopup.AddMenu("Open", obj => OpenPanel()); mainPopup.AddMenu("Create(Server)", obj => CreatePanel("txt")); mainPopup.AddMenu("Create(Client)", obj => CreatePanel("prefab")); ToolBar.AddItem("Files", mainPopup); EditorPopupMenu searchPop = NodeFactoryXML.CreateEditorControl <EditorPopupMenu>(); searchPop.AddMenu("Open search panel", obj => SearchPanel.Active = true); searchPop.AddMenu("Close search panel", obj => SearchPanel.Active = false); ToolBar.AddItem("Search", searchPop); EditorPopupMenu debugPop = NodeFactoryXML.CreateEditorControl <EditorPopupMenu>(); debugPop.AddMenu("Pause", obj => DebugPanel.IsStop = true); debugPop.AddMenu("Resume", obj => DebugPanel.IsStop = false); debugPop.AddMenu("Clear", obj => DebugPanel.TryClear()); ToolBar.AddItem("Debug", debugPop); EditorPopupMenu configPop = NodeFactoryXML.CreateEditorControl <EditorPopupMenu>(); configPop.AddMenu("Reset ID", obj => ResetID?.Invoke()); configPop.AddMenu("Open config panel", obj => GetWindow <TreeConfigPanel>()); configPop.AddMenu("Search node", obj => GetWindow <TreeSearchPanel>()); configPop.AddMenu("Change node", obj => GetWindow <NodeReplacePanel>()); ToolBar.AddItem("Tool&Config", configPop); SearchPanel.OnSearch = SearchParam; SearchPanel.LocationNode = LocateNode; }
private void OnSelectBtnClick(EditorButton obj) { EditorPopupMenu menu = _name2Context[obj]; EditorControlDragEventManager.Instance.PopupMenu(this, menu, obj.RootPosition + new Vector2(0, obj.Size.y)); }
public void FilterCtrl(List <IEditorSeletable> list, Event e) { RunEvent(_lastFrameList, e, (ies, ee) => { if (!list.Contains(ies)) { ies.MouseOut(ee); } }); RunEvent(list, e, (ies, ee) => { if (!_lastFrameList.Contains(ies)) { ies.MouseIn(ee); } }); if (e.isMouse) { if (_curPopup != null && !list.Contains(_curPopup)) { _curPopup.SetParent(null); _curPopup = null; } } switch (e.type) { case EventType.MouseDown: RunEvent(list, e, (ies, ee) => ies.MouseDown(ee)); _mouseDownList = list; break; case EventType.MouseUp: RunEvent(list, e, (ies, ee) => ies.MouseUp(ee)); RunEvent(list, e, (ies, ee) => { if (_mouseDownList.Contains(ies)) { if (e.button == 0) { ies.Click(ee); } else if (e.button == 1) { ies.RightClick(ee); EditorPopupMenu menu = (ies as EditorControl)?.Context; if (menu != null) { PopupMenu(ies as EditorControl, menu, ee.Event.mousePosition); ee.Use(); } } } }); if (_dragOutCtrl != null) { RunEvent(list, e, (ies, ee) => { _dragOutCtrl.DragOut(ies, ee); ies.DragIn(_dragOutCtrl, ee); }); _dragOutCtrl = null; } break; case EventType.KeyUp: RunEvent(_mouseDownList, e, (ies, ee) => { ies.KeyDown(ee); }); break; } _lastFrameList = list; }
public override void InitFinish() { base.InitFinish(); EditorPopupMenu filePop = NodeFactoryXML.CreateEditorControl <EditorPopupMenu>(); }