public NoPolygonContextMenu(PolygonDrawerManipulator polygonDrawer) { _polygonDrawer = polygonDrawer; _menu = JanusContextMenu.Create(); if (_polygonDrawer.Polygons.Count > 0) { _menu.AddCommand(ControlsRes.NoPolygonContextMenu_ManipulateAll, OnGenerate); _menu.AddSeparator(); _menu.AddCommand(string.Format(ControlsRes.NoPolygonContextMenu_DeleteAll, _polygonDrawer.Polygons.Count), OnClearAll); int visiblePolygons = _polygonDrawer.Polygons.Count(x => x.Visible); if (visiblePolygons > 0) { _menu.AddCommand(string.Format(ControlsRes.NoPolygonContextMenu_HideAll, visiblePolygons), OnHideAll); } int hiddenPolygons = _polygonDrawer.Polygons.Count(x => !x.Visible); if (hiddenPolygons > 0) { _menu.AddCommand(string.Format(ControlsRes.NoPolygonContextMenu_ShowAll, hiddenPolygons), OnShowAll); } _menu.AddSeparator(); } _menu.AddCommand(ControlsRes.NoPolygonContextMenu_HelpCaption, OnHelp); }
public NoPolygonContextMenu(PolygonDrawerManipulator polygonDrawer) { _polygonDrawer = polygonDrawer; _menu = JanusContextMenu.Create(); if (_polygonDrawer.Polygons.Count > 0) { _menu.AddCommand("Manipulate villages from all clusters", OnGenerate); _menu.AddSeparator(); _menu.AddCommand(string.Format("Delete all clusters ({0})", _polygonDrawer.Polygons.Count), OnClearAll); int visiblePolygons = _polygonDrawer.Polygons.Count(x => x.Visible); if (visiblePolygons > 0) { _menu.AddCommand(string.Format("Hide all visible clusters ({0})", visiblePolygons), OnHideAll); } int hiddenPolygons = _polygonDrawer.Polygons.Count(x => !x.Visible); if (hiddenPolygons > 0) { _menu.AddCommand(string.Format("Show all hidden clusters ({0})", hiddenPolygons), OnShowAll); } _menu.AddSeparator(); } _menu.AddCommand("Help", OnHelp); }
public PolygonManipulatorManager(Map map) : base(map) { // Active manipulators _polygonDrawer = new PolygonDrawerManipulator(map, this); AddManipulator(_polygonDrawer); MapMover.RightClickToMove = false; }
public PolygonContextMenu(PolygonDrawerManipulator polygonDrawer) { _polygonDrawer = polygonDrawer; _menu = JanusContextMenu.Create(); Debug.Assert(_polygonDrawer.ActivePolygon != null); _menu.AddCommand(string.Format(ControlsRes.PolygonContextMenu_Manipulate, _polygonDrawer.ActivePolygon.Name), OnGenerate); AttackersPoolContextMenuCommandCreator.Add(_menu, _polygonDrawer.ActivePolygon.GetVillages().Where(x => x.Player == World.Default.You)); _menu.AddSeparator(); _menu.AddCommand(ControlsRes.PolygonContextMenu_Delete, OnDelete, Shortcut.Del); _menu.AddTextBoxCommand(ControlsRes.PolygonContextMenu_Name, _polygonDrawer.ActivePolygon.Name, NameChanged); _menu.AddTextBoxCommand(ControlsRes.PolygonContextMenu_Group, _polygonDrawer.ActivePolygon.Group, GroupChanged); _menu.AddChangeColorCommand(ControlsRes.PolygonContextMenu_Color, _polygonDrawer.ActivePolygon.LineColor, SelectedColorChanged); _menu.AddCommand(_polygonDrawer.ActivePolygon.Visible ? ControlsRes.PolygonContextMenu_Hide : ControlsRes.PolygonContextMenu_Show, ToggleVisibility); }