Beispiel #1
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);
        }
        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);
        }
Beispiel #3
0
 public MarkerContextMenu(Map map, Tribe tribe)
 {
     _menu  = JanusContextMenu.Create();
     _map   = map;
     _tribe = tribe;
     InitializeMenu();
 }
Beispiel #4
0
 public MarkerContextMenu(Map map, Player player)
 {
     _menu   = JanusContextMenu.Create();
     _map    = map;
     _player = player;
     InitializeMenu();
 }
Beispiel #5
0
        private Image GetMainCommandImage(Marker marker)
        {
            if (marker.Empty)
            {
                return(null);
            }

            return(JanusContextMenu.DrawContextIcon(marker.Settings.Color, marker.Settings.ExtraColor));
        }
Beispiel #6
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);
        }
        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);
        }
        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);
        }
Beispiel #9
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);
        }
Beispiel #10
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;
        }
Beispiel #11
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);
        }