예제 #1
0
 private void CreateInputIDs()
 {
     FocusForward        = CreateInputID(Keys.Tab, "{0} →");
     FocusBackward       = CreateInputID(Keys.Tab, "← {0}", shift: true);
     WindowFocusForward  = CreateInputID(Keys.Tab, "{0} →", ctrl: true);
     WindowFocusBackward = CreateInputID(Keys.Tab, "← {0}", ctrl: true, shift: true);
 }
예제 #2
0
        /// <summary>
        /// For the input <paramref name="InputID"/>. Returns the first <see cref="InputControl"/> recovered from <see cref="InputConfigurationInherentData"/>.
        /// Check is done in this order :
        ///     * <see cref="InputConfigurationInherentData.AttributedKeys"/>
        ///     * <see cref="InputConfigurationInherentData.AttributedMouseButtons"/>
        /// </summary>
        public static InputControl FindTheFirstInputControlForInputID(InputID InputID)
        {
            var InputConfigurationInherentData = InputConfigurationGameObject.Get().InputConfiguration.ConfigurationInherentData[InputID];

            if (InputConfigurationInherentData != null)
            {
                var inputControlLookup = InputControlLookup.Get();
                if (InputConfigurationInherentData.AttributedKeys != null)
                {
                    foreach (var attributedKey in InputConfigurationInherentData.AttributedKeys)
                    {
                        var inputControl = inputControlLookup.keyToKeyControlLookup[attributedKey];
                        if (inputControl != null)
                        {
                            return(inputControl);
                        }
                    }
                }

                if (InputConfigurationInherentData.AttributedMouseButtons != null)
                {
                    foreach (var attributedMouseButton in InputConfigurationInherentData.AttributedMouseButtons)
                    {
                        var inputControl = inputControlLookup.mouseButtonControlLookup[attributedMouseButton];
                        if (inputControl != null)
                        {
                            return(inputControl);
                        }
                    }
                }
            }

            return(null);
        }
예제 #3
0
        public SkillSlot(CoreInteractiveObject AssociatedInteractiveObject, InteractiveObjectActionPlayerSystem interactiveObjectActionPlayerSystem, ref SKillSlotUIPositionInput SKillSlotUIPositionInput,
                         InputID AssociatedInput)
        {
            this.AssociatedInteractiveObject          = AssociatedInteractiveObject;
            this._interactiveObjectActionPlayerSystem = interactiveObjectActionPlayerSystem;
            this.AssociatedInput = AssociatedInput;
            this.SkillSlotUI     = new SkillSlotUI(ref SKillSlotUIPositionInput);
            this.CurrentPlayerActionInherentData = new ObjectVariable <InteractiveObjectActionInherentData>(this.OnCurrentPlayerActionInherentDataChanged);

            this.SkillSlotUI.SetInputText(InputControlLookup.GetInputControlRawName(InputControlLookup.FindTheFirstInputControlForInputID(this.AssociatedInput)));
        }
예제 #4
0
 public bool IsPlaing(InputID playerId)
 {
     foreach (var item in menuSlots)
     {
         if (item.player == playerId)
         {
             return(item.IsSelected);
         }
     }
     return(false);
 }
예제 #5
0
            public override bool Equals(object obj)
            {
                if (obj == null || GetType() != obj.GetType())
                {
                    return(false);
                }

                InputID otherID = obj as InputID;

                return(otherID.Value == this.Value);
            }
예제 #6
0
        public ProjectileDeflectionFeedbackIcon(GameObject instanciatedGameObject, InputID DisplayedInput)
        {
            InstanciatedGameObject = instanciatedGameObject;
            this.Transform         = this.InstanciatedGameObject.transform as RectTransform;
            this.mainCamera        = Camera.main;
            this.inputText         = this.Transform.GetComponentInChildren <TMPro.TextMeshProUGUI>();

            var feedbackInputControl = InputControlLookup.FindTheFirstInputControlForInputID(DisplayedInput);

            if (feedbackInputControl != null)
            {
                this.inputText.text = InputControlLookup.GetInputControlRawName(feedbackInputControl);
            }
        }
예제 #7
0
        public void RemapAction(GamepadAction.ID actionID, InputID inputID)
        {
            var action = actions[actionID];

            // Remove old mapping
            var list = inputToAction[action.currentInputID];

            list.Remove(actionID);
            if (list.Count == 0)
            {
                inputToAction.Remove(inputID);
            }

            addMapping(inputID, actionID);
        }
예제 #8
0
        public bool EvaluateInputCondition(InputID InputID)
        {
            switch (InputID)
            {
            case InputID.FIRING_PROJECTILE_DOWN_HOLD:
                return(this.FiringProjectileDH());

            case InputID.SKILL_1_DOWN_HOLD:
                return(this.Skill1DonwHold());

            case InputID.SKILL_2_DOWN_HOLD:
                return(this.Skill2DownHold());
            }

            return(false);
        }
예제 #9
0
        private void addMapping(InputID inputID, GamepadAction.ID actionID)
        {
            var action = actions[actionID];

            action.currentInputID = inputID;

            if (inputToAction.ContainsKey(inputID))
            {
                var list = inputToAction[inputID];
                list.Add(actionID);
            }
            else
            {
                var list = new List <GamepadAction.ID>();
                list.Add(actionID);
                inputToAction.Add(inputID, list);
            }
        }
예제 #10
0
        private void RasterizeAcceleratorOverlay(
            UIOperationContext context, ref ImperativeRenderer labelRenderer, ref ImperativeRenderer targetRenderer,
            Control control, InputID id, bool showFocused = false, Control forControl = null
            )
        {
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }

            var gamePadMode = InputSources.FirstOrDefault() is GamepadVirtualKeyboardAndCursor;

            OverlayStringBuilder.Clear();
            id.Format(OverlayStringBuilder, gamePadMode);
            RasterizeAcceleratorOverlay(
                context, ref labelRenderer, ref targetRenderer,
                control, OverlayStringBuilder, showFocused
                );
        }
예제 #11
0
    public void StopGameplay(InputID winnerID)
    {
        int winner = 0;

        foreach (var item in menuSlots)
        {
            if (item.player == winnerID)
            {
                winner = menuSlots.IndexOf(item);
            }
        }

        score[winner]++;
        Debug.Log("StopGameplay | winner score: " + score[winner]);
        UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync(levels[currentSceneIndex]);
        if (score[winner] >= maxWins)
        {
            ShowFinalResult();
        }
        else
        {
            ShowCurrentResult(winner);
        }
    }
예제 #12
0
 public static string ConvertInputToReadableText(InputID inputId)
 {
     InputReadableText.TryGetValue(inputId, out string readableInputText);
     return(ConvertInputConfigurationToAReadabledText(InputConfigurationGameObject.Get().InputConfiguration.ConfigurationInherentData[inputId]) + " : " + readableInputText);
 }
예제 #13
0
 /// <summary>
 /// Returns the current unnormalized value of the virtual joystick identified by joystickID in the layout identified by layoutID.
 /// </summary>
 /// <param name="joystickID">ID of the joystick (specified in the editor)</param>
 /// <param name="layoutID">ID of the layout in which it resides (specified in the editor)</param>
 static public Vector2 GetJoystick(InputID joystickID, LayoutID layoutID)
 {
     return r_Instance.GetJoystick(joystickID, layoutID, false);
 }
예제 #14
0
    /// <summary>
    /// Funcion disparada cuando se detecta input
    /// </summary>
    /// <param name="inputID">Accion a realizar</param>
    public void OnInputDetection(InputID inputID)
    {
        StateID current = CurrentState.ID;

        // DURANTE el estado de hit no haremos nada mas
        if (current == StateID.Hit)
            return;

        switch (inputID)
        {
            case InputID.Left:
                if (TrackPosition.CanChangeRail(Direction.Left))
                    ChangeState(StateID.Left);

                break;

            case InputID.Right:
                if (TrackPosition.CanChangeRail(Direction.Right))
                    ChangeState(StateID.Right);

                break;

            case InputID.Jump:
                if (Movement.IsGrounded())
                    ChangeState(StateID.Jump);

                break;

            case InputID.Crouch:
                ChangeState(StateID.Crouch);
                break;
        }
    }
예제 #15
0
 /// <summary>
 /// Changes the current animation preset an input device identified by inputID to a preset identified by presetID.
 /// </summary>
 /// <param name="presetID">ID of the preset (specified in the editor)</param>
 /// <param name="inputID">ID of the input device (specified in the editor)</param>
 /// <param name="layoutID">ID of the layout (specified in the editor)</param>
 static public void ChangeAnimationPreset(string presetID, InputID inputID, LayoutID layoutID)
 {
     r_Instance.ChangeAnimationPreset(presetID, inputID, layoutID);
 }
예제 #16
0
    /// <summary>
    /// Returns the current animation preset ID of an input device identified by inputID in a layout identified by layoutID.
    /// </summary>
    /// <param name="inputID">ID of the input device (specified in the editor)</param>
    /// <param name="layoutID">ID of the layout (specified in the editor)</param>
	static public string GetCurrentAnimationPreset(InputID inputID, LayoutID layoutID)
    {
        return r_Instance.GetCurrentAnimationPreset(inputID, layoutID);
    }
 public void ChangeAnimationPreset(string presetID, InputID inputID, LayoutID layoutID)
 {
     TouchInputLayout til = FindLayoutByID(layoutID.ToString());
     til.ChangeAnimationPreset(presetID, inputID.ToString());
 }
예제 #18
0
 /// <summary>
 /// Returns true during the frame the user releases the virtual button identified by buttonID in the layout identified by layoutID.
 /// </summary>
 /// <param name="buttonID">ID of the button (specified in the editor)</param>
 /// <param name="layoutID">ID of the layout in which it resides (specified in the editor)</param>
 static public bool GetButtonUp(InputID buttonID, LayoutID layoutID)
 {
     return r_Instance.GetButtonUp(buttonID, layoutID);
 }
예제 #19
0
 private void Start()
 {
     rgBody          = GetComponent <Rigidbody2D>();
     capsuleCollider = GetComponent <CapsuleCollider2D>();
     inputID         = GetComponent <InputID>();
 }
 public string GetCurrentAnimationPreset(InputID inputID, LayoutID layoutID)
 {
     TouchInputLayout til = FindLayoutByID(layoutID.ToString());
     return til.GetCurrentAnimationPreset(inputID.ToString());
 }
예제 #21
0
 public static string ConvertInputToReadableText(string customDescription, InputID inputId)
 {
     return(customDescription + " : " + ConvertInputConfigurationToAReadabledText(InputConfigurationGameObject.Get().InputConfiguration.ConfigurationInherentData[inputId]));
 }
예제 #22
0
 public static ProjectileDeflectionFeedbackIcon Build(GameObject ProjectileDeflectionFeedbackPrefab, InputID DisplayedInput)
 {
     return(new ProjectileDeflectionFeedbackIcon(MonoBehaviour.Instantiate(ProjectileDeflectionFeedbackPrefab, ProjectileDeflectionFeedbackIconContainer.Get().transform), DisplayedInput));
 }
예제 #23
0
 // Start is called before the first frame update
 void Start()
 {
     pickup  = GetComponent <PickUp>();
     inputID = GetComponent <InputID>();
 }
 public Vector2 GetJoystick(InputID joystickID, LayoutID layoutID, bool normalized)
 {
     TouchInputLayout til = FindLayoutByID(layoutID.ToString());
     return til.GetJoystick(joystickID.ToString(), normalized);
 }
 public Vector2 GetJoystick(InputID joystickID, LayoutID layoutID)
 {
     return GetJoystick(joystickID, layoutID, false);
 }
예제 #26
0
 public InputPacket(InputID inputID, UpDownID upDownID, ActionID actionID)
 {
     this.inputID  = inputID;
     this.upDownID = upDownID;
     this.actionID = actionID;
 }
예제 #27
0
    /// <summary>
    /// Returns the current value of the virtual joystick identified by joystickID in the layout identified by layoutID, normalizing the returned value if asked to.
    /// </summary>
    /// <param name="joystickID">ID of the joystick (specified in the editor)</param>
    /// <param name="layoutID">ID of the layout in which it resides (specified in the editor)</param>
    /// <param name="normalized">Whether or not we should normalize the value</param>
    static public Vector2 GetJoystick(InputID joystickID, LayoutID layoutID, bool normalized)
    {
        return r_Instance.GetJoystick(joystickID, layoutID, normalized);

    }
예제 #28
0
 // Start is called before the first frame update
 void Start()
 {
     capsuleCollider = GetComponent <CapsuleCollider2D>();
     inputID         = GetComponent <InputID>();
 }
 public bool GetButtonUp(InputID buttonID, LayoutID layoutID)
 {
     TouchInputLayout til = FindLayoutByID(layoutID.ToString());
     return til.GetButtonUp(buttonID.ToString());
 }