コード例 #1
0
ファイル: HSlideBar.cs プロジェクト: chrwoizi/canyonshooter
        // Barpressed zu kleines Rec (ersma weg) und Barscroll setzen nich möglich

        public void BarPressed(Vector2 Position)
        {
            if (Position.X < makerPosition.X)
            {
                float dif   = (Position.X - makerPosition.X + makerwidth);
                float value = currentValue + (dif / PushLenght);
                if (value >= this.minValue && value <= this.maxValue)
                {
                    value        = (int)(value * this.cut);
                    currentValue = value / cut;
                    calculatingMakerPos(currentValue);
                }
                OptionList call = (OptionList)caller.caller;
                call.changed(this.caller.Name, true, true);
            }
            else if (Position.X > makerPosition.X + makerwidth)
            {
                float dif   = (Position.X - makerPosition.X + makerwidth);
                float value = currentValue + (dif / PushLenght);
                if (value >= this.minValue && value <= this.maxValue)
                {
                    value        = (int)(value * this.cut);
                    currentValue = value / cut;
                    calculatingMakerPos(currentValue);
                }
                OptionList call = (OptionList)caller.caller;
                call.changed(this.caller.Name, true, true);
            }
        }
コード例 #2
0
ファイル: HSlideBar.cs プロジェクト: chrwoizi/canyonshooter
        public void MinusPressed()
        {
            float value = currentValue - stepSize;

            if (value >= this.minValue && value <= this.maxValue)
            {
                value        = (int)(value * this.cut);
                currentValue = value / cut;
                calculatingMakerPos(currentValue);
            }
            OptionList call = (OptionList)caller.caller;

            call.changed(this.caller.Name, false, false);
        }
コード例 #3
0
        public void Minuspressed()
        {
            if (currentNumber != 0)
            {
                currentNumber--;
                currentString = Names[currentNumber];
            }
            else
            {
                currentNumber = (Names.Count - 1);
                currentString = Names[currentNumber];
            }
            OptionList call = (OptionList)Caller.caller;

            call.changed(name, false, false);
        }
コード例 #4
0
        public void Pluspressed()
        {
            if (currentNumber != (Names.Count - 1))
            {
                currentNumber++;
                currentString = Names[currentNumber];
            }
            else
            {
                currentNumber = 0;
                currentString = Names[currentNumber];
            }
            OptionList call = (OptionList)Caller.caller;

            call.changed(name, true, false);
        }
コード例 #5
0
ファイル: MenuControl.cs プロジェクト: chrwoizi/canyonshooter
        /// <summary>
        /// Execution of Player´s choise in HighscoreMenu and Option
        /// </summary>
        public void selection(string ButtonName, string SubMenu)
        {
            switch (SubMenu)
            {
                #region Highscore
            case "Highscore":
            {
                if (ButtonName.Equals("Löschen"))
                {
                    prompt = new Prompt(game, "Reset", game.Graphics.Device.Viewport.Width,
                                        game.Graphics.Device.Viewport.Height,
                                        new string[] { "Delete the Highscorestates?" }, false);
                    prompt.accept  += new PromptEventHandler(HSReset);
                    prompt.decline += new PromptEventHandler(nothing);
                    prompt.intiateButtons();
                    menu.HighscoreMenu.Active = false;
                }
                else
                {
                    menu.CurrentMenu   = "Highscore";
                    menu.HighscoreMenu = null;
                    menu.Visiblity     = true;
                }
                break;
            }
                #endregion

                #region Optionen
            case "Optionen":
            {
                switch (ButtonName)
                {
                case "Akzeptieren":
                {
                    OptionList changer = (OptionList)menu.OptionMenu.Dialog.list;
                    if (changer.controlChanges())
                    {
                        prompt = new Prompt(game, "Save", game.Graphics.Device.Viewport.Width,
                                            game.Graphics.Device.Viewport.Height,
                                            new string[] { "Save the values?" }, false);
                        prompt.accept  += new PromptEventHandler(Save);
                        prompt.decline += new PromptEventHandler(nothingOpt);
                        prompt.intiateButtons();
                        menu.OptionMenu.Activity = false;
                    }
                    else
                    {
                        discardChanges();
                    }
                    break;
                }

                case "Ablehnen":
                {
                    discardChanges();
                    break;
                }

                case "Playername":
                {
                    prompt = new Prompt(game, "Playername", game.Graphics.Device.Viewport.Width,
                                        game.Graphics.Device.Viewport.Height,
                                        new string[] { "Please insert a playername:" }, false,
                                        (string)menu.OptionMenu.Dialog.Data["Playername"], true);
                    prompt.accept  += new PromptEventHandler(SetPlayername);
                    prompt.decline += new PromptEventHandler(nothingOpt);
                    prompt.intiateButtons();
                    menu.OptionMenu.Activity = false;
                    break;
                }

                default:
                    break;
                }
                break;
            }

            case "OptionenControl":
            {
                switch (ButtonName)
                {
                case "Akzeptieren":
                {
                    OptionList changer = (OptionList)menu.OptionMenu.Listbox.List;
                    if (changer.controlChanges())
                    {
                        prompt = new Prompt(game, "Save", game.Graphics.Device.Viewport.Width,
                                            game.Graphics.Device.Viewport.Height,
                                            new string[] { "Save the values?" }, false);
                        prompt.accept  += new PromptEventHandler(SaveControlSettings);
                        prompt.decline += new PromptEventHandler(nothingOpt);
                        prompt.intiateButtons();
                        menu.OptionMenu.Activity = false;
                    }
                    else
                    {
                        discardChanges();
                    }
                    break;
                }

                case "Ablehnen":
                {
                    discardChanges();
                    break;
                }

                default:
                    break;
                }
                break;
            }

                #endregion
            default:
                break;
            }
        }