예제 #1
0
    protected virtual void OnControllerButtonReleased(InputControlType pButton)
    {
        Debug.LogFormat("Controller button {0} was released", pButton);

        InputAction action = _taskActions.Peek();

        if (pButton == action.controlType)
        {
            if (action.GetType() == typeof(JoystickAction))
            {
                JoystickAction joystickAction = action as JoystickAction;
                Debug.Log("Joystick Task Detected - Released");
            }
            else if (action.GetType() == typeof(ButtonAction))
            {
                ButtonAction btnAction = action as ButtonAction;
                if (btnAction.isHold)
                {
                    _isHoldTimerActive = false;
                    _holdTime          = 0f;
                    _holdTimer         = 0f;

                    // Add a check for holdTimer buffer to see if withing range then deque task
                }
            }
        }

        if (_taskActions.Count == 0)
        {
            Messenger.Broadcast(Messages.MINI_GAME_COMPLETE, true);
        }
    }
예제 #2
0
    /* PRIVATE FUNCTIONS */


    /* EVENT HANDLERS */

    protected virtual void OnControllerButtonPressed(InputControlType pButton)
    {
        Debug.LogFormat("Controller button {0} was pressed", pButton);
        InputAction action = _taskActions.Peek();

        if (pButton == action.controlType)
        {
            if (action.GetType() == typeof(JoystickAction))
            {
                JoystickAction joystickAction = action as JoystickAction;
                Debug.Log("Joystick Task Detected - Pressed");
            }
            else if (action.GetType() == typeof(ButtonAction))
            {
                ButtonAction btnAction = action as ButtonAction;
                if (btnAction.isHold)
                {
                    _isHoldTimerActive = true;
                    _holdTime          = btnAction.holdTime;
                }
            }
        }

        if (_taskActions.Count == 0)
        {
            Messenger.Broadcast(Messages.MINI_GAME_COMPLETE, true);
        }
    }
예제 #3
0
    /* EVENT HANDLERS */
    protected override void OnControllerButtonReleased(InputControlType pButton)
    {
        InputAction action = _taskActions.Peek();

        if (action.GetType() == typeof(ButtonAction))
        {
            ButtonAction btnAction = action as ButtonAction;
            Debug.Log("[YOGA] - Task Count: " + _taskActions.Count);
            Debug.LogFormat("<color=red>[YOGA] - Timer: {0}</color>", _timer);
            Debug.LogFormat("[YOGA] - Button Pressed: {0} - Looking For Button: {1}", pButton, action.controlType);
            // Debug.Break();

            if (_timer >= _minTime && _timer <= _maxTime && action.controlType == pButton)
            {
                Debug.Log("[YOGA] - PASS");
                Messenger.Broadcast(Messages.MINI_GAME_STEP_COMPLETE, typeof(MiniGameYoga));
            }
            else
            {
                if (_timer <= _minTime)
                {
                    Debug.LogFormat("[YOGA] - TOO EARLY!!");
                    // Debug.Break();
                }
                Messenger.Broadcast(Messages.MINI_GAME_COMPLETE, false);
            }
        }
    }
예제 #4
0
// The following is just a wrapper for UserData.AddAction(_categoryId) since it's a little fiddly to configure.
        private static InputAction AddRewiredAction(UserData userData, string name, InputActionType type, string descriptiveName, int categoryId, bool userAssignable)
        {
            // Add an action to the data store
            userData.AddAction(categoryId);

            // Get a reference to the added action
            int[]       actionIds    = userData.GetActionIds();
            int         lastActionId = actionIds[actionIds.Length - 1];
            InputAction inputAction  = userData.GetActionById(lastActionId);

            // Configure our action according to args

            if (string.IsNullOrEmpty(name) == false)
            {
                FieldInfo _name = inputAction.GetType().GetField("_name", BindingFlags.NonPublic | BindingFlags.Instance);
                _name.SetValue(inputAction, name);
            }

            if (type != InputActionType.Button)
            {
                FieldInfo _type = inputAction.GetType().GetField("_type", BindingFlags.NonPublic | BindingFlags.Instance);
                _type.SetValue(inputAction, type);
            }

            if (string.IsNullOrEmpty(descriptiveName) == false)
            {
                FieldInfo _descriptiveName = inputAction.GetType().GetField("_descriptiveName", BindingFlags.NonPublic | BindingFlags.Instance);
                _descriptiveName.SetValue(inputAction, descriptiveName);
            }

            if (!userAssignable)
            {
                FieldInfo _userAssignable = inputAction.GetType().GetField("_userAssignable", BindingFlags.NonPublic | BindingFlags.Instance);
                _userAssignable.SetValue(inputAction, userAssignable);
            }

            /*
             * if (false) { // not used for simple keybinds
             *  FieldInfo _behaviorId = inputAction.GetType().GetField("_behaviorId", BindingFlags.NonPublic | BindingFlags.Instance);
             *  _behaviorId.SetValue(inputAction, _behaviorId);
             * }
             */

            return(inputAction);
        }
예제 #5
0
        public void EditAction(InputAction action)
        {
            if (action == null)
            {
                return;
            }

            var cc = this.controller;

            if (action is KeyAction)
            {
                new MapKeystrokeForm(mainForm, cc, action as KeyAction).ShowDialog(this);
            }
            else if (action is MouseButtonAction)
            {
                new MapMouseButtonForm(mainForm, cc, action as MouseButtonAction).ShowDialog(this);
            }
            else if (action is MousePointerAction)
            {
                new MapPointerForm(mainForm, cc, action as MousePointerAction).ShowDialog(this);
            }
            else if (action is MouseWheelAction)
            {
                new MapMouseWheelForm(mainForm, cc, action as MouseWheelAction).ShowDialog(this);
            }
            else if (action is RunCommandAction)
            {
                new MapCommandDialog(mainForm, cc, action as RunCommandAction).ShowDialog(this);
            }
            else if (action is OpenFileAction)
            {
                new MapOpenFileDialog(mainForm, cc, action as OpenFileAction).ShowDialog(this);
            }
            else
            {
                MessageBox.Show("Error: This version of Pad Tie is not able to edit actions of type " + action.GetType().Name);
            }
        }