예제 #1
0
        public ClickedAction GetClickedAction(MapOverlayItemBase clickedItem)
        {
            if (clickedItem == this.skipCountryItem)
            {
                return(ClickedAction.SkipCountry);
            }
            if (clickedItem == this.showCountryItem)
            {
                return(ClickedAction.ShowCountry);
            }
            if (clickedItem == this.finishGameItem)
            {
                return(ClickedAction.FinishGame);
            }
            if (clickedItem == this.startGameItem)
            {
                return(ClickedAction.StartGame);
            }
            if (clickedItem == this.restartGameItem || clickedItem == this.newGameItem)
            {
                return(ClickedAction.NewGame);
            }
            KeyValuePair <MapOverlayImageItem, MapOverlayTextItem> levelPair = this.levelItems.FirstOrDefault(x => x.Value.Equals(clickedItem) || x.Key.Equals(clickedItem));

            if (levelPair.Value != null)
            {
                SetDefaultStyleLevelItems();
                ChangeSelectionOverlayItem(levelPair.Value, true);
                return(ClickedAction.ChangeLevel);
            }
            return(ClickedAction.Unknown);
        }
예제 #2
0
        void mapControl1_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            MapHitInfo         hitInfo     = MapControl.CalcHitInfo(e.Location);
            MapOverlayItemBase clickedItem = MapOverlayUtils.GetClickedOverlayItem(hitInfo);

            if (clickedItem == null)
            {
                return;
            }
            ClickedAction action = OverlayManager.GetClickedAction(clickedItem);

            switch (action)
            {
            case ClickedAction.NewGame:
                MapInteractiveEnabling(false);
                OverlayManager.ShowNewGameOverlay();
                break;

            case ClickedAction.StartGame:
                GameInit(OverlayManager.GetSelectedLevel());
                break;

            case ClickedAction.FinishGame:
                this.gameCore.FinishGame();
                break;

            case ClickedAction.ShowCountry:
                this.gameCore.ShowCountry();
                break;

            case ClickedAction.SkipCountry:
                this.gameCore.SkipCountry();
                break;
            }
        }