Example #1
0
        public AvatarSelectionCarouselDialog(InputProcessorBase inputProcessor, RaceStartScene.AvatarSelectionButtonHandler sceneButtonHandler,
                                             Scene.ObjectRegistrationHandler registrationHandler, Scene.ObjectUnregistrationHandler unregistrationHandler)
            : base(registrationHandler, unregistrationHandler)
        {
            ActionButtonPressHandler = SelectionHandler;
            InputSources.Add(inputProcessor);

            Height            = Dialog_Height;
            CarouselCenter    = new Vector2(Definitions.Back_Buffer_Center.X, Carousel_Center_Y);
            CarouselRadii     = new Vector2(Carousel_Horizontal_Radius, Carousel_Vertical_Radius);
            _itemRenderDepths = new Range(Minimum_Item_Render_Depth, Maximum_Item_Render_Depth);
            _itemScales       = new Range(Minimum_Item_Scale, Maximum_Item_Scale);

            _inputProcessor          = inputProcessor;
            _sendButtonActionToScene = sceneButtonHandler;
            _captionsForButtonsNotActivatedByGamepadStartButton.Add("Back");

            AddIconButton("previous", new Vector2(Definitions.Back_Buffer_Center.X - 450, 175), Button.ButtonIcon.Previous, Color.DodgerBlue);
            AddIconButton("next", new Vector2(Definitions.Back_Buffer_Center.X + 450, 175), Button.ButtonIcon.Next, Color.DodgerBlue);

            AddButton("Back", new Vector2(Definitions.Left_Button_Column_X, 325), Button.ButtonIcon.Back, Color.DodgerBlue, 0.7f);
            AddButton("Select", new Vector2(Definitions.Right_Button_Column_X, 325), Button.ButtonIcon.Play, Color.LawnGreen, 0.7f);

            SetupButtonLinkagesAndDefaultValues();

            registrationHandler(this);
        }
Example #2
0
        protected override void CheckForAndHandleInputFromSingleSource(InputProcessorBase inputSource, int millisecondsSinceLastUpdate)
        {
            if (!Rotating)
            {
                if ((!_carouselDisabled) && (inputSource.MoveLeft))
                {
                    _targetRotation += _rotationStep; Rotating = true;
                }
                else if ((!_carouselDisabled) && (inputSource.MoveRight))
                {
                    _targetRotation -= _rotationStep; Rotating = true;
                }

                if (Rotating)
                {
                    SoundEffectManager.PlayEffect("carousel-spin");
                }
            }

            if (!Rotating)
            {
                CheckMasterSelectActivation(inputSource);

                CheckForButtonAction(inputSource.BButtonPressed, BButtonPressedValue);
                CheckForButtonAction(inputSource.XButtonPressed, XButtonPressedValue);
                CheckForButtonAction(inputSource.YButtonPressed, YButtonPressedValue);
            }
        }
        protected override void CheckForAndHandleInputFromSingleSource(InputProcessorBase inputSource, int millisecondsSinceLastUpdate)
        {
            base.CheckForAndHandleInputFromSingleSource(inputSource, millisecondsSinceLastUpdate);

            if (inputSource.MoveDown)
            {
                if (!_downHeld)
                {
                    AttemptLevelStep(-1); _downHeld = true;
                }
            }
            else
            {
                _downHeld = false;
            }

            if (inputSource.MoveUp)
            {
                if (!_upHeld)
                {
                    AttemptLevelStep(1); _upHeld = true;
                }
            }
            else
            {
                _upHeld = false;
            }
        }
 protected override void CheckMasterSelectActivation(InputProcessorBase inputSource)
 {
     if (!_buttons["Start!"].Disabled)
     {
         base.CheckMasterSelectActivation(inputSource);
     }
 }
Example #5
0
        protected virtual void CheckForAndHandleSelection(Input.InputProcessorBase inputSource)
        {
            bool selectionMade = inputSource.SelectionTriggered;

            if ((selectionMade) && (inputSource.SelectionLocation != Vector2.Zero))
            {
                selectionMade = CheckForSelectionAtTouchLocation(inputSource.SelectionLocation);
            }

            if (inputSource.BButtonPressed)
            {
                selectionMade        = true;
                _activeButtonCaption = _cancelButtonCaption;
            }

            if (selectionMade)
            {
                ActuatingController = inputSource;
                Dismiss();
                if (SelectionCallback != null)
                {
                    SelectionCallback(_activeButtonCaption);
                }
                if (!string.IsNullOrEmpty(ActivateSelectionSoundEffectName))
                {
                    SoundEffectManager.PlayEffect(ActivateSelectionSoundEffectName);
                }
            }
        }
        private void CheckForAndHandleInputFromSingleSource(InputProcessorBase inputSource, int millisecondsSinceLastUpdate)
        {
            if (inputSource is Input.KeyboardInputProcessor)
            {
                CheckDirectionalMovementAndUpdateActiveButton(inputSource, millisecondsSinceLastUpdate);
            }

            CheckForAndHandleSelection(inputSource);
        }
        public void SetInputSourceToPlayerController(InputProcessorBase inputSource)
        {
            _primaryInputSource = inputSource;

            InputSources = new List <InputProcessorBase>();
            InputSources.Add(inputSource);

            _inputSourceIsConnected = inputSource.IsAvailable;
        }
Example #8
0
        private void CheckForAndHandleInputFromSingleSource(InputProcessorBase inputSource, int millisecondsSinceLastUpdate)
        {
            if ((inputSource.ProcessorType == InputProcessorBase.InputProcessorType.Keyboard) ||
                (inputSource.ProcessorType == InputProcessorBase.InputProcessorType.Gamepad))
            {
                CheckDirectionalMovementAndUpdateActiveButton(inputSource, millisecondsSinceLastUpdate);
            }

            CheckForAndHandleSelection(inputSource);
        }
Example #9
0
 private void CheckForAndHandleInput(int millisecondsSinceLastUpdate)
 {
     ActuatingController = null;
     for (int i = 0; i < InputSources.Count; i++)
     {
         CheckForAndHandleInputFromSingleSource(InputSources[i], millisecondsSinceLastUpdate);
         if (ActuatingController != null)
         {
             break;
         }
     }
 }
Example #10
0
        private void CheckDirectionalMovementAndUpdateActiveButton(InputProcessorBase inputSource, int millisecondsSinceLastUpdate)
        {
            _millisecondsSinceLastMovement = Math.Min(_millisecondsSinceLastMovement + millisecondsSinceLastUpdate, Movement_Repeat_Time_In_Milliseconds);

            MovementDirection direction = MovementDirection.None;

            if (inputSource.MoveUp)
            {
                direction = MovementDirection.Up;
            }
            else if (inputSource.MoveDown)
            {
                direction = MovementDirection.Down;
            }
            else if (inputSource.MoveLeft)
            {
                direction = MovementDirection.Left;
            }
            else if (inputSource.MoveRight)
            {
                direction = MovementDirection.Right;
            }

            if ((direction == _lastMovementDirection) && (_millisecondsSinceLastMovement < Movement_Repeat_Time_In_Milliseconds))
            {
                direction = MovementDirection.None;
            }

            if (direction != MovementDirection.None)
            {
                switch (direction)
                {
                case MovementDirection.Up: AttemptToActivateButton(_buttons[_activeButtonCaption].CaptionOfButtonActivatedByMovingUp); break;

                case MovementDirection.Down: AttemptToActivateButton(_buttons[_activeButtonCaption].CaptionOfButtonActivatedByMovingDown); break;

                case MovementDirection.Left: AttemptToActivateButton(_buttons[_activeButtonCaption].CaptionOfButtonActivatedByMovingLeft); break;

                case MovementDirection.Right: AttemptToActivateButton(_buttons[_activeButtonCaption].CaptionOfButtonActivatedByMovingRight); break;
                }

                _lastMovementDirection         = direction;
                _millisecondsSinceLastMovement = 0;
            }
        }
Example #11
0
 protected virtual void CheckMasterSelectActivation(InputProcessorBase inputSource)
 {
     CheckForButtonAction(inputSource.AButtonPressed, AButtonPressedValue);
     CheckForButtonAction(inputSource.StartButtonPressed, AButtonPressedValue);
 }
Example #12
0
 protected virtual void CheckForAndHandleInputFromSingleSource(InputProcessorBase inputSource, int millisecondsSinceLastUpdate)
 {
     CheckDirectionalMovementAndUpdateActiveButton(inputSource, millisecondsSinceLastUpdate);
     CheckForAndHandleSelection(inputSource);
 }