Exemple #1
0
        public override void OnMouseDown(MouseButton button, int x, int y)
        {
            base.OnMouseDown(button, x, y);
            foreach (InterfaceElement element in elements)
            {
                element.OnMouseDown(button, x, y);
            }
            switch (ClickRegion.HitTest(clkMenuSettings, new Point(x, y)))
            {
            case "cancel":
                nextState = "Infiniminer.States.ServerBrowserState";
                break;

            case "accept":
                if (saveData() >= 1)
                {
                    _SM.Exit();
                }
                break;

                /*case "keylayout":
                 *  saveData();
                 *  nextState = "Infiniminer.States.KeySettingsState";
                 *  break;*/
            }
        }
Exemple #2
0
        public override void OnMouseDown(MouseButton button, int x, int y)
        {
            x -= drawRect.X;
            y -= drawRect.Y;
            switch (ClickRegion.HitTest(clkClassMenu, new Point(x, y)))

            {
            case "miner":

                _P.SetPlayerClass(PlayerClass.Miner);

                nextState = "Infiniminer.States.MainGameState";

                _P.PlaySound(InfiniminerSound.ClickHigh);

                break;

            case "engineer":

                _P.SetPlayerClass(PlayerClass.Engineer);

                nextState = "Infiniminer.States.MainGameState";

                _P.PlaySound(InfiniminerSound.ClickHigh);

                break;

            case "prospector":

                _P.SetPlayerClass(PlayerClass.Prospector);

                nextState = "Infiniminer.States.MainGameState";

                _P.PlaySound(InfiniminerSound.ClickHigh);

                break;

            case "sapper":

                _P.SetPlayerClass(PlayerClass.Sapper);

                nextState = "Infiniminer.States.MainGameState";

                _P.PlaySound(InfiniminerSound.ClickHigh);

                break;

            case "cancel":

                nextState = "Infiniminer.States.MainGameState";

                _P.PlaySound(InfiniminerSound.ClickHigh);

                break;
            }
        }
Exemple #3
0
        public override void OnMouseDown(MouseButton button, int x, int y)
        {
            x -= drawRect.X;
            y -= drawRect.Y;
            switch (ClickRegion.HitTest(clkTeamMenu, new Point(x, y)))
            {
            case "red":
                if (_P.playerTeam == PlayerTeam.Red && canCancel)
                {
                    nextState = "Infiniminer.States.MainGameState";
                }
                else
                {
                    _P.SetPlayerTeam(PlayerTeam.Red);
                    nextState = "Infiniminer.States.ClassSelectionState";
                }
                _P.PlaySound(InfiniminerSound.ClickHigh);
                break;

            case "blue":
                if (_P.playerTeam == PlayerTeam.Blue && canCancel)
                {
                    nextState = "Infiniminer.States.MainGameState";
                }
                else
                {
                    _P.SetPlayerTeam(PlayerTeam.Blue);
                    nextState = "Infiniminer.States.ClassSelectionState";
                }
                _P.PlaySound(InfiniminerSound.ClickHigh);
                break;

            case "cancel":
                if (canCancel)
                {
                    nextState = "Infiniminer.States.MainGameState";
                    _P.PlaySound(InfiniminerSound.ClickHigh);
                }
                break;
            }
        }
Exemple #4
0
        public override void OnMouseDown(MouseButton button, int x, int y)
        {
            if (directConnectIPEnter == false)
            {
                int serverIndex = (y - drawRect.Y - 75) / 25;
                if (serverIndex >= 0 && serverIndex < serverList.Count)
                {
                    int distanceFromCenter = Math.Abs(_SM.GraphicsDevice.Viewport.Width / 2 - x);
                    if (distanceFromCenter < descWidths[serverIndex] / 2)
                    {
                        (_SM as InfiniminerGame).propertyBag.serverName = serverList[serverIndex].serverName;
                        (_SM as InfiniminerGame).JoinGame(serverList[serverIndex].ipEndPoint);
                        nextState = "Infiniminer.States.LoadingState";
                        _P.PlaySound(InfiniminerSound.ClickHigh);
                    }
                }

                x -= drawRect.X;
                y -= drawRect.Y;
                switch (ClickRegion.HitTest(clkMenuServer, new Point(x, y)))
                {
                case "refresh":
                    _P.PlaySound(InfiniminerSound.ClickHigh);
                    serverList = (_SM as InfiniminerGame).EnumerateServers(0.5f);
                    break;

                case "direct":
                    directConnectIPEnter = true;
                    _P.PlaySound(InfiniminerSound.ClickHigh);
                    break;

                case "settings":
                    nextState = "Infiniminer.States.SettingsState";
                    _P.PlaySound(InfiniminerSound.ClickHigh);
                    break;
                }
            }
        }