Ejemplo n.º 1
0
        public static UICommand AddCommand(this UIContextMenu menu, string text, CommandEventHandler handler, Image image)
        {
            var command = AddCommand(menu, text, handler);

            command.Image = image;
            return(command);
        }
Ejemplo n.º 2
0
 public MarkerContextMenu(Map map, Player player)
 {
     _menu   = JanusContextMenu.Create();
     _map    = map;
     _player = player;
     InitializeMenu();
 }
Ejemplo n.º 3
0
        public TribeContextMenu(Map map, Tribe tribe)
        {
            _tribe = tribe;

            _menu = JanusContextMenu.Create();

            if (map.Display.IsVisible(tribe))
            {
                _menu.AddCommand(ControlsRes.ContextMenu_Pinpoint, OnPinPoint);
            }
            _menu.AddCommand(ControlsRes.ContextMenu_PinpointAndCenter, OnPinpointAndCenter, Properties.Resources.TeleportIcon);
            _menu.AddSeparator();

            var markerContext = new MarkerContextMenu(map, tribe);

            _menu.AddMarkerContextCommands(markerContext);
            _menu.AddSeparator();

            _menu.AddCommand(ControlsRes.ContextMenu_TwStats, OnTwStats);
            _menu.AddCommand(ControlsRes.ContextMenu_TwGuest, OnTwGuest);

            _menu.AddSeparator();

            _menu.AddCommand(ControlsRes.ContextMenu_ToClipboard, OnToClipboard, Properties.Resources.clipboard);
            _menu.AddCommand(ControlsRes.ContextMenu_ToBbCode, OnBbCode, Properties.Resources.clipboard);
        }
Ejemplo n.º 4
0
        public TribeContextMenu(Map map, Tribe tribe)
        {
            _tribe = tribe;

            _menu = JanusContextMenu.Create();

            if (map.Display.IsVisible(tribe))
            {
                _menu.AddCommand("Pinpoint", OnPinPoint);
            }
            _menu.AddCommand("Pinpoint && Center", OnPinpointAndCenter, Properties.Resources.TeleportIcon);
            _menu.AddSeparator();

            var markerContext = new MarkerContextMenu(map, tribe);
            _menu.AddMarkerContextCommands(markerContext);
            _menu.AddSeparator();

            _menu.AddCommand("TWStats", OnTwStats);
            _menu.AddCommand("TW Guest", OnTwGuest);

            _menu.AddSeparator();

            _menu.AddCommand("To clipboard", OnToClipboard, Properties.Resources.clipboard);
            _menu.AddCommand("BBCode", OnBbCode, Properties.Resources.clipboard);
        }
Ejemplo n.º 5
0
        /////////////////////////////////////////

        protected override void OnRenderContextMenu(UIContextMenu menu, CanvasRenderer renderer)
        {
            base.OnRenderContextMenu(menu, renderer);

            //draw background
            renderer.AddQuad(menu.GetScreenRectangle(), new ColorValue(0.1, 0.1, 0.7));
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
 public MarkerContextMenu(Map map, Player player)
 {
     _menu = JanusContextMenu.Create();
     _map = map;
     _player = player;
     InitializeMenu();
 }
Ejemplo n.º 8
0
 public MarkerContextMenu(Map map, Tribe tribe)
 {
     _menu = JanusContextMenu.Create();
     _map = map;
     _tribe = tribe;
     InitializeMenu();
 }
Ejemplo n.º 9
0
 public MarkerContextMenu(Map map, Tribe tribe)
 {
     _menu  = JanusContextMenu.Create();
     _map   = map;
     _tribe = tribe;
     InitializeMenu();
 }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        public static void AddToggleCommand(this UIContextMenu menu, string text, bool defaultValue, CommandEventHandler handler)
        {
            var cmd = new UICommand("", text, CommandType.ToggleButton);

            cmd.IsChecked = defaultValue;
            cmd.Click    += handler;
            menu.Commands.Add(cmd);
        }
        private AttackersPoolContextMenuCommandCreator(UIContextMenu menu, IEnumerable <Village> villages)
        {
            _villages = villages.ToArray();

            if (_villages.Any())
            {
                var cmd = menu.AddCommand(string.Format(ControlsRes.AttackersPoolContextMenu_AddXToPool, _villages.Count), OnAddAttackers, Resources.FlagGreen);
                cmd.ToolTipText = ControlsRes.AttackersPoolContextMenu_AddXVillagesTooltip;
            }
        }
Ejemplo n.º 13
0
        public static void AddPlayerContextCommands(this UIContextMenu menu, Map map, Player player, bool addTribeCommands)
        {
            string playerDesc = string.Format("{0} ({1})", player.Name, Common.GetPrettyNumber(player.Points));

            if (player.Rank <= 100)
            {
                playerDesc = string.Format("#{0} {1}", player.Rank, playerDesc);
            }
            var playerCommand = menu.AddCommand(playerDesc, null, Properties.Resources.Player);

            AddPlayerContextCommands(map, player, addTribeCommands, playerCommand);
        }
Ejemplo n.º 14
0
        public static void AddTextBoxCommand(this UIContextMenu menu, string text, string defaultTextBoxValue, EventHandler handler)
        {
            var txtBox = new TextBox();

            txtBox.Text         = defaultTextBoxValue;
            txtBox.TextChanged += handler;

            var cmd = new UICommand("", text, CommandType.TextBoxCommand);

            cmd.Control = txtBox;
            menu.Commands.Add(cmd);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Gets the command that owns GetCommands()
        /// </summary>
        public UICommand GetMainCommand(UIContextMenu menu)
        {
            Debug.Assert(_mainCommand == null);
            var marker = GetMarker();
            var cmd = menu.AddCommand(GetMainCommandText(marker));
            if (marker.Settings.Enabled)
            {
                cmd.Image = GetMainCommandImage(marker);
            }

            _mainCommand = cmd;
            return cmd;
        }
Ejemplo n.º 16
0
        public NoVillageAttackContextMenu(AttackManipulatorManager manipulator)
        {
            _manipulator = manipulator;

            _menu = JanusContextMenu.Create();

            _menu.AddToggleCommand(ControlsRes.NoVillageAttackContextMenu_ShowNonActivePlanTargets, _manipulator.Settings.ShowOtherTargets, OnShowOtherTargets);
            _menu.AddToggleCommand(ControlsRes.NoVillageAttackContextMenu_ShowNonActivePlanAttackers, _manipulator.Settings.ShowOtherAttackers, OnShowOtherAttackers);
            _menu.AddSeparator();
            _menu.AddToggleCommand(ControlsRes.NoVillageAttackContextMenu_AlwaysShowAttackPlans, _manipulator.Settings.ShowIfNotActiveManipulator, OnShowIfNotActiveManipulator);
            _menu.AddSeparator();
            _menu.AddToggleCommand(ControlsRes.NoVillageAttackContextMenu_ShowArrivalTimesWhenSentNow, _manipulator.Settings.ShowArrivalTimeWhenSentNow, OnShowArrivalTimeWhenSentNow);
        }
Ejemplo n.º 17
0
        public static void AddSetVillageTypeCommand(this UIContextMenu menu, CommandEventHandler onVillageTypeChange, Village village)
        {
            VillageType currentVillageType = village == null ? VillageType.None : village.Type;
            UICommand   villageTypes       = menu.AddCommand(ControlsRes.VillageContextMenu_SetPurpose, null, currentVillageType.GetImage(true));

            AddVillageTypeCommand(villageTypes, VillageType.Attack, currentVillageType, onVillageTypeChange);
            AddVillageTypeCommand(villageTypes, VillageType.Catapult, currentVillageType, onVillageTypeChange);
            AddVillageTypeCommand(villageTypes, VillageType.Defense, currentVillageType, onVillageTypeChange);
            villageTypes.Commands.AddSeparator();
            AddVillageTypeCommand(villageTypes, VillageType.Noble, currentVillageType, onVillageTypeChange);
            AddVillageTypeCommand(villageTypes, VillageType.Scout, currentVillageType, onVillageTypeChange);
            AddVillageTypeCommand(villageTypes, VillageType.Farm, currentVillageType, onVillageTypeChange);
        }
Ejemplo n.º 18
0
        public VillageContextMenu(Map map, Village village, Action onVillageTypeChangeDelegate = null)
        {
            _village = village;
            _map = map;
            _onVillageTypeChangeDelegate = onVillageTypeChangeDelegate;
            _attackPlan = World.Default.Map.Manipulators.AttackManipulator.GetPlan(_village, out _isActiveAttackPlan, out _attacker, false);

            _menu = JanusContextMenu.Create();

            AddAttackPlanItems();

            _menu.AddSeparator();

            if (map.Display.IsVisible(village))
            {
                _menu.AddCommand("Quick Details", OnPinPoint, Properties.Resources.LeftNavigation_QuickFind);
            }
            _menu.AddCommand("Pinpoint && Center", OnPinpointAndCenter, Properties.Resources.TeleportIcon);

            _menu.AddSeparator();
            _menu.AddSetVillageTypeCommand(OnVillageTypeChange, village);

            if (World.Default.Settings.Church)
            {
                var church = _map.Manipulators.ChurchManipulator.GetChurch(_village);
                AddChurchCommands(_menu, church, ChurchChange_Click);
            }

            if (village.HasPlayer)
            {
                _menu.AddSeparator();

                _menu.AddPlayerContextCommands(map, village.Player, false);

                if (village.HasTribe)
                {
                    _menu.AddTribeContextCommands(map, village.Player.Tribe);
                }

                if (village.PreviousVillageDetails != null && village.PreviousVillageDetails.Player != village.Player && village.PreviousVillageDetails.Player != null)
                {
                    var oldPlayer = World.Default.GetPlayer(village.PreviousVillageDetails.Player.Name);
                    _menu.AddPlayerNobledContextCommands(map, oldPlayer ?? village.PreviousVillageDetails.Player, true);
                }
            }

            _menu.AddSeparator();
            _menu.AddCommand("TWStats", OnTwStats);
            _menu.AddCommand("To clipboard", OnToClipboard, Properties.Resources.clipboard);
            _menu.AddCommand("BBCode", OnBbCode, Properties.Resources.clipboard);
        }
Ejemplo n.º 19
0
        public VillageContextMenu(Map map, Village village, Action onVillageTypeChangeDelegate = null)
        {
            _village = village;
            _map     = map;
            _onVillageTypeChangeDelegate = onVillageTypeChangeDelegate;
            _attackPlan = World.Default.Map.Manipulators.AttackManipulator.GetPlan(_village, out _isActiveAttackPlan, out _attacker, false);

            _menu = JanusContextMenu.Create();

            AddAttackPlanItems();

            _menu.AddSeparator();

            if (map.Display.IsVisible(village))
            {
                _menu.AddCommand(ControlsRes.ContextMenu_QuickDetails, OnPinPoint, Properties.Resources.LeftNavigation_QuickFind);
            }
            _menu.AddCommand(ControlsRes.ContextMenu_PinpointAndCenter, OnPinpointAndCenter, Properties.Resources.TeleportIcon);

            _menu.AddSeparator();
            _menu.AddSetVillageTypeCommand(OnVillageTypeChange, village);

            if (World.Default.Settings.Church)
            {
                var church = _map.Manipulators.ChurchManipulator.GetChurch(_village);
                AddChurchCommands(_menu, church, ChurchChange_Click);
            }

            if (village.HasPlayer)
            {
                _menu.AddSeparator();

                _menu.AddPlayerContextCommands(map, village.Player, false);

                if (village.HasTribe)
                {
                    _menu.AddTribeContextCommands(map, village.Player.Tribe);
                }

                if (village.PreviousVillageDetails != null && village.PreviousVillageDetails.Player != village.Player && village.PreviousVillageDetails.Player != null)
                {
                    var oldPlayer = World.Default.GetPlayer(village.PreviousVillageDetails.Player.Name);
                    _menu.AddPlayerNobledContextCommands(map, oldPlayer ?? village.PreviousVillageDetails.Player, true);
                }
            }

            _menu.AddSeparator();
            _menu.AddCommand(ControlsRes.ContextMenu_TwStats, OnTwStats);
            _menu.AddCommand(ControlsRes.ContextMenu_ToClipboard, OnToClipboard, Properties.Resources.clipboard);
            _menu.AddCommand(ControlsRes.ContextMenu_ToBbCode, OnBbCode, Properties.Resources.clipboard);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Gets the command that owns GetCommands()
        /// </summary>
        public UICommand GetMainCommand(UIContextMenu menu)
        {
            Debug.Assert(_mainCommand == null);
            var marker = GetMarker();
            var cmd    = menu.AddCommand(GetMainCommandText(marker));

            if (marker.Settings.Enabled)
            {
                cmd.Image = GetMainCommandImage(marker);
            }

            _mainCommand = cmd;
            return(cmd);
        }
Ejemplo n.º 21
0
        public static void AddTribeContextCommands(this UIContextMenu menu, Map map, Tribe tribe)
        {
            string tribeDesc = string.Format("{0} ({1})", tribe.Tag, Common.GetPrettyNumber(tribe.AllPoints));

            if (tribe.Rank <= 20)
            {
                tribeDesc = string.Format("#{0} {1}", tribe.Rank, tribeDesc);
            }
            var tribeCommand = menu.AddCommand(tribeDesc, null, Properties.Resources.Tribe);

            tribeCommand.ToolTipText = tribe.Tooltip;
            var tribeContext = new TribeContextMenu(map, tribe);

            tribeCommand.Commands.AddRange(tribeContext.GetCommands().ToArray());
        }
Ejemplo n.º 22
0
        public static UICommand AddCommand(this UIContextMenu menu, string text, CommandEventHandler handler = null, Shortcut?shortcut = null, Icon icon = null)
        {
            var cmd = new UICommand("", text, CommandType.Command);

            cmd.Click += handler;
            if (shortcut.HasValue)
            {
                cmd.Shortcut = shortcut.Value;
            }
            cmd.Icon = icon;

            menu.Commands.Add(cmd);

            return(cmd);
        }
Ejemplo n.º 23
0
        public static void AddComboBoxCommand(this UIContextMenu menu, string text, IEnumerable <string> list, string defaultValue, EventHandler handler)
        {
            var ctl = new UIComboBox
            {
                DataSource    = list.ToArray(),
                SelectedValue = defaultValue,
                ComboStyle    = ComboStyle.DropDownList
            };

            ctl.SelectedValueChanged += handler;

            var cmd = new UICommand("", text, CommandType.ComboBoxCommand);

            cmd.Control = ctl;
            menu.Commands.Add(cmd);
        }
Ejemplo n.º 24
0
        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);
        }
Ejemplo n.º 25
0
        public static void AddChurchCommands(UIContextMenu menu, ChurchInfo church, CommandEventHandler handler)
        {
            Debug.Assert(World.Default.Settings.Church);
            string commandText      = ControlsRes.Church + (church == null ? "" : string.Format(" ({0})", church.ChurchLevel));
            var    containerCommand = new UICommand("", commandText)
            {
                Image = Properties.Resources.Church
            };

            containerCommand.Commands.AddRange(CreateChurchLevelCommands(handler, church));

            if (church != null)
            {
                containerCommand.Commands.AddSeparator();
                containerCommand.Commands.AddChangeColorCommand("Color", church.Color, ChurchInfo.DefaultColor, (sender, selectedColor) => church.Color = selectedColor);
            }

            menu.Commands.Add(containerCommand);
        }
Ejemplo n.º 26
0
        public NoVillageContextMenu(Point gameLocation)
        {
            _gameLocation = gameLocation;

            _menu = JanusContextMenu.Create();
            _menu.AddCommand("Center here", OnMapCenter, Properties.Resources.TeleportIcon);
            _menu.AddCommand("Set Home", OnSetHome, Properties.Resources.HomeIcon);
            _menu.AddSeparator();

            _menu.AddChangeColorCommand("Background color", World.Default.Map.Display.Settings.BackgroundColor, Color.Green, OnBackgroundColor);
            _menu.AddToggleCommand("Show continent lines", World.Default.Map.Display.Settings.ContinentLines, OnContinentLines);
            _menu.AddToggleCommand("Show province lines", World.Default.Map.Display.Settings.ProvinceLines, OnProvinceLines);
            _menu.AddSeparator();

            _menu.AddToggleCommand("Hide all abandoned", World.Default.Map.Display.Settings.HideAbandoned, OnHideAbandoned);
            _menu.AddToggleCommand("Show marked only", World.Default.Map.Display.Settings.MarkedOnly, OnMarkedOnly);
            _menu.AddSeparator();

            var showTooltip = _menu.AddCommand("Show village &tooltip", OnShowTooltip);
            showTooltip.IsChecked = World.Default.Map.Manipulators.CurrentManipulator.TooltipActive;
        }
Ejemplo n.º 27
0
        public PlayerContextMenu(Map map, Player player, bool addTribeCommands)
        {
            _player = player;

            _menu = JanusContextMenu.Create();
            _menu.ShowToolTips = InheritableBoolean.True;

            if (map.Display.IsVisible(player))
            {
                _menu.AddCommand(ControlsRes.ContextMenu_Pinpoint, OnPinPoint);
            }
            _menu.AddCommand(ControlsRes.ContextMenu_PinpointAndCenter, OnPinpointAndCenter, Properties.Resources.TeleportIcon);
            _menu.AddSeparator();

            if (World.Default.You.Empty)
            {
                _menu.AddCommand(ControlsRes.PlayerContextMenu_ThisIsMe, OnPlayerYouSet, Properties.Resources.Player);
                _menu.AddSeparator();
            }

            var markerContext = new MarkerContextMenu(map, player);

            _menu.AddMarkerContextCommands(markerContext);

            if (addTribeCommands && player.HasTribe)
            {
                _menu.AddTribeContextCommands(map, player.Tribe);
            }

            _menu.AddSeparator();

            _menu.AddCommand(ControlsRes.ContextMenu_TwStats, OnTwStats);
            _menu.AddCommand(ControlsRes.ContextMenu_TwGuest, OnTwGuest);

            _menu.AddSeparator();

            _menu.AddCommand(ControlsRes.ContextMenu_ToClipboard, OnToClipboard, Properties.Resources.clipboard);
            _menu.AddCommand(ControlsRes.ContextMenu_ToBbCode, OnBbCode, Properties.Resources.clipboard);
            _menu.AddCommand(ControlsRes.ContextMenu_ToBbCodeOperation, OnBbCodeOperation, Properties.Resources.clipboard);
        }
Ejemplo n.º 28
0
        public NoVillageContextMenu(Point gameLocation)
        {
            _gameLocation = gameLocation;

            _menu = JanusContextMenu.Create();
            _menu.AddCommand(ControlsRes.NoVillageContextMenu_CenterHere, OnMapCenter, Properties.Resources.TeleportIcon);
            _menu.AddCommand(ControlsRes.NoVillageContextMenu_SetHome, OnSetHome, Properties.Resources.HomeIcon);
            _menu.AddSeparator();

            _menu.AddChangeColorCommand(ControlsRes.NoVillageContextMenu_BackgroundColor, World.Default.Map.Display.Settings.BackgroundColor, Color.Green, OnBackgroundColor);
            _menu.AddToggleCommand(ControlsRes.NoVillageContextMenu_ContinentLines, World.Default.Map.Display.Settings.ContinentLines, OnContinentLines);
            _menu.AddToggleCommand(ControlsRes.NoVillageContextMenu_ProvinceLines, World.Default.Map.Display.Settings.ProvinceLines, OnProvinceLines);
            _menu.AddSeparator();

            _menu.AddToggleCommand(ControlsRes.NoVillageContextMenu_HideAbandoned, World.Default.Map.Display.Settings.HideAbandoned, OnHideAbandoned);
            _menu.AddToggleCommand(ControlsRes.NoVillageContextMenu_ShowMarkedOnly, World.Default.Map.Display.Settings.MarkedOnly, OnMarkedOnly);
            _menu.AddSeparator();

            var showTooltip = _menu.AddCommand(ControlsRes.NoVillageContextMenu_ShowVillageTooltip, OnShowTooltip);

            showTooltip.IsChecked = World.Default.Map.Manipulators.CurrentManipulator.TooltipActive;
        }
Ejemplo n.º 29
0
        public PlayerContextMenu(Map map, Player player, bool addTribeCommands)
        {
            _player = player;

            _menu = JanusContextMenu.Create();
            _menu.ShowToolTips = InheritableBoolean.True;

            if (map.Display.IsVisible(player))
            {
                _menu.AddCommand("Pinpoint", OnPinPoint);
            }
            _menu.AddCommand("Pinpoint && Center", OnPinpointAndCenter, Properties.Resources.TeleportIcon);
            _menu.AddSeparator();

            if (World.Default.You.Empty)
            {
                _menu.AddCommand("This is me!", OnPlayerYouSet, Properties.Resources.Player);
                _menu.AddSeparator();
            }

            var markerContext = new MarkerContextMenu(map, player);
            _menu.AddMarkerContextCommands(markerContext);

            if (addTribeCommands && player.HasTribe)
            {
                _menu.AddTribeContextCommands(map, player.Tribe);
            }

            _menu.AddSeparator();

            _menu.AddCommand("TWStats", OnTwStats);
            _menu.AddCommand("TW Guest", OnTwGuest);

            _menu.AddSeparator();

            _menu.AddCommand("To clipboard", OnToClipboard, Properties.Resources.clipboard);
            _menu.AddCommand("BBCode", OnBbCode, Properties.Resources.clipboard);
            _menu.AddCommand("Operation", OnBbCodeOperation, Properties.Resources.clipboard);
        }
Ejemplo n.º 30
0
        public VillagesContextMenu(Map map, ICollection<Village> villages, Action<VillageType> onVillageTypeChangeDelegate = null)
        {
            _villages = villages;
            _map = map;
            _onVillageTypeChangeDelegate = onVillageTypeChangeDelegate;

            _menu = JanusContextMenu.Create();
            // TODO: hehe, the ActiveVillageManipulator takes the first player and selects all his villages...
            //if (map.Display.IsVisible(_villages))
            //{
            //    _menu.AddCommand("Pinpoint", OnPinPoint);
            //}
            //_menu.AddCommand("Pinpoint && Center", OnPinpointAndCenter, Properties.Resources.TeleportIcon);
            //_menu.AddSeparator();

            _menu.AddSetVillageTypeCommand(OnVillageTypeChange, null);
            _menu.AddCommand("Remove purpose", OnRemovePurpose);

            if (World.Default.Settings.Church)
            {
                VillageContextMenu.AddChurchCommands(_menu, null, ChurchChange_Click);
            }

            _menu.AddSeparator();
            if (!World.Default.You.Empty && villages.All(x => x.Player == World.Default.You))
            {
                _menu.AddCommand("Defend these villages", OnAddTargets, Properties.Resources.swordsman);

                AttackersPoolContextMenuCommandCreator.Add(_menu, _villages);
            }
            else
            {
                _menu.AddCommand("Attack these villages", OnAddTargets, Properties.Resources.barracks);
            }
            _menu.AddSeparator();

            _menu.AddCommand("BBCode", OnBbCode, Properties.Resources.clipboard);
        }
Ejemplo n.º 31
0
        public VillagesContextMenu(Map map, ICollection <Village> villages, Action <VillageType> onVillageTypeChangeDelegate = null)
        {
            _villages = villages;
            _map      = map;
            _onVillageTypeChangeDelegate = onVillageTypeChangeDelegate;

            _menu = JanusContextMenu.Create();
            // TODO: hehe, the ActiveVillageManipulator takes the first player and selects all his villages...
            //if (map.Display.IsVisible(_villages))
            //{
            //    _menu.AddCommand(ControlsRes.ContextMenu_Pinpoint, OnPinPoint);
            //}
            //_menu.AddCommand(ControlsRes.ContextMenu_PinpointAndCenter, OnPinpointAndCenter, Properties.Resources.TeleportIcon);
            //_menu.AddSeparator();

            _menu.AddSetVillageTypeCommand(OnVillageTypeChange, null);
            _menu.AddCommand(ControlsRes.VillageContextMenu_RemovePurpose, OnRemovePurpose);

            if (World.Default.Settings.Church)
            {
                VillageContextMenu.AddChurchCommands(_menu, null, ChurchChange_Click);
            }

            _menu.AddSeparator();
            if (!World.Default.You.Empty && villages.All(x => x.Player == World.Default.You))
            {
                _menu.AddCommand(ControlsRes.VillagesContextMenu_DefendThem, OnAddTargets, Properties.Resources.swordsman);

                AttackersPoolContextMenuCommandCreator.Add(_menu, _villages);
            }
            else
            {
                _menu.AddCommand(ControlsRes.VillagesContextMenu_AttackThem, OnAddTargets, Properties.Resources.barracks);
            }
            _menu.AddSeparator();

            _menu.AddCommand(ControlsRes.ContextMenu_ToBbCode, OnBbCode, Properties.Resources.clipboard);
        }
Ejemplo n.º 32
0
        /////////////////////////////////////////

        protected override void OnRenderContextMenu(UIContextMenu control, CanvasRenderer renderer)
        {
            base.OnRenderContextMenu(control, renderer);
        }
Ejemplo n.º 33
0
        public static void AddChurchCommands(UIContextMenu menu, ChurchInfo church, CommandEventHandler handler)
        {
            Debug.Assert(World.Default.Settings.Church);
            string commandText = "Church" + (church == null ? "" : string.Format(" ({0})", church.ChurchLevel));
            var containerCommand = new UICommand("", commandText)
                {
                    Image = Properties.Resources.Church
                };
            containerCommand.Commands.AddRange(CreateChurchLevelCommands(handler, church));

            if (church != null)
            {
                containerCommand.Commands.AddSeparator();
                containerCommand.Commands.AddChangeColorCommand("Color", church.Color, ChurchInfo.DefaultColor, (sender, selectedColor) => church.Color = selectedColor);
            }

            menu.Commands.Add(containerCommand);
        }
 public static void Add(UIContextMenu menu, IEnumerable <Village> villages)
 {
     new AttackersPoolContextMenuCommandCreator(menu, villages);
 }
Ejemplo n.º 35
0
        public static void AddMarkerContextCommands(this UIContextMenu menu, MarkerContextMenu markerContext)
        {
            var markerHolder = markerContext.GetMainCommand(menu);

            markerHolder.Commands.AddRange(markerContext.GetCommands().ToArray());
        }
Ejemplo n.º 36
0
 public static void AddChangeColorCommand(this UIContextMenu menu, string text, Color defaultSelectedColor, Action <object, Color> handler)
 {
     menu.AddChangeColorCommand(text, defaultSelectedColor, defaultSelectedColor, handler);
 }
Ejemplo n.º 37
0
        public static void AddPlayerNobledContextCommands(this UIContextMenu menu, Map map, Player player, bool addTribeCommands)
        {
            var playerCommand = menu.AddCommand(string.Format(ControlsRes.VillageContextMenu_NobledFrom, player.Name), null, Properties.Resources.nobleman);

            AddPlayerContextCommands(map, player, addTribeCommands, playerCommand);
        }
Ejemplo n.º 38
0
 public static void AddCommand(this UIContextMenu menu, string text, CommandEventHandler handler, Icon icon)
 {
     AddCommand(menu, text, handler, null, icon);
 }
Ejemplo n.º 39
0
 public static void AddSeparator(this UIContextMenu menu)
 {
     menu.Commands.AddSeparator();
 }