예제 #1
0
 private void Start()
 {
     mover       = true;
     inputBinder = FindObjectOfType <InputBinder>();
     index       = 0;
     botones[index].GetComponent <Image>().color = Color.green;
     inputBinder.BindAxis("MenuMove", MoverMenu);
 }
예제 #2
0
		} //

		private void ClearKeyBindings() {

			InputBinder binder = this.GetService<InputBinder>();
			if( binder != null ) {
				binder.RemoveBindings( this );
			}

		}
    public override void OnDisable()
    {
        // Clear Delegate on Disabled
        InputBinderForUpdate = null;

        Cursor.lockState = CursorLockMode.None;
        Cursor.visible   = true;
    }
예제 #4
0
		/// <summary>
		/// Sets up basic keybindings for the UI.
		/// </summary>
		private void SetUIKeys() {

			InputBinder binder = this.GetService<InputBinder>();
			if( binder != null ) {
				binder.AddBinding( this, new KeyBinding( this.CmdPrevFile, new KeyGesture( Key.Left ) ) );
				binder.AddBinding( this, new KeyBinding( this.CmdNextFile, new KeyGesture( Key.Right ) ) );
			}

		} //
예제 #5
0
    // Use this for initialization
    void Start()
    {
        inputBinder = GetComponent <InputBinder>();

        //inputBinder.BindAxis("Horizontal", Horizontal);
        //inputHandler.BindAxis("Vertical", Vertical);

        inputBinder.BindButton("Jump", InputEvent.Pressed, JumpPressed);
        //inputBinder.BindButton("Jump", InputButtonEvent.Released, JumpReleased);
        //inputHandler.BindButton("Jump", InputButtonEvent.Held, JumpHeld);
    }
예제 #6
0
 /// <summary>
 /// Remove a binded function from an input
 /// </summary>
 /// <param name="inputName">Name of the input</param>
 /// <param name="function">Function to be removed</param>
 /// <param name="inputType">Remove function from UP, PRESSED or DOWN event</param>
 public void RemoveInput(string inputName, Action <object[]> function, InputType inputType = InputType.DOWN)
 {
     for (int i = 0; i < inputList.Count; ++i)
     {
         InputBinder inputBinder = (InputBinder)inputList[i];
         if (String.Equals(inputBinder.GetName(), inputName) &&
             inputBinder.IsThisFunction(function))
         {
             inputList.RemoveAt(i);
         }
     }
 }
예제 #7
0
		} //

		#endregion

		private void CategorySetUpdated( object sender, NotifyCollectionChangedEventArgs e ) {

			InputBinder binder = this.GetService<InputBinder>();
			if( binder == null ) {
				Console.WriteLine( @"ERROR: Can't find InputBinder service." );
				return;
			}

			switch( e.Action ) {

				case NotifyCollectionChangedAction.Remove:

					foreach( FileCategory cat in e.OldItems ) {
						binder.RemoveBinding( this, cat.Gesture );
					}
					break;

				case NotifyCollectionChangedAction.Add:

					Console.WriteLine( @"CategorySet ADD ACTION" );
					foreach( FileCategory cat in e.NewItems ) {
						InputBinding b = this.CategorySet.MakeCategoryBinding( this.CmdCategoryClick, cat );
						if( b != null ) {
							binder.AddBinding( this, b );
						}
					}
					break;

				case NotifyCollectionChangedAction.Replace:

					foreach( FileCategory cat in e.OldItems ) {
						binder.RemoveBinding( this, cat.Gesture );
					}
					foreach( FileCategory cat in e.NewItems ) {

						InputBinding b = this.CategorySet.MakeCategoryBinding( this.CmdCategoryClick, cat );
						if( b != null ) {
							binder.AddBinding( this, b );
						}

					}

					break;
				case NotifyCollectionChangedAction.Reset:
					Console.WriteLine( @"RESET COLLECTION ACTION" );
					this.ClearKeyBindings();
					this.ResetKeyBindings();
					break;

			}

		} //
예제 #8
0
        /// <summary>
        /// Replaces Lambda parameter references or transparent scope property accesses over those Lambda
        /// parameter references with <see cref="InputReferenceExpression"/>s to the appropriate corresponding
        /// <see cref="QueryableResourceExpression"/>s, based on the 'input' QueryableResourceExpression to which the
        /// Lambda is logically applied and any enclosing transparent scope applied to that input resource.
        /// </summary>
        /// <param name="e">The expression to rebind</param>
        /// <param name="currentInput">
        /// The 'current input' resource - either the root resource or the
        /// rightmost resource in the navigation chain.</param>
        /// <param name="inputParameter">The Lambda parameter that represents a reference to the 'input'</param>
        /// <param name="referencedInputs">A list that will be populated with the resources that were referenced by the rebound expression</param>
        /// <returns>
        /// The rebound version of <paramref name="e"/> where MemberExpression/ParameterExpressions that
        /// represent resource references have been replaced with appropriate InputReferenceExpressions.
        /// </returns>
        internal static Expression Bind(Expression e, ResourceExpression currentInput, ParameterExpression inputParameter, List <ResourceExpression> referencedInputs)
        {
            Debug.Assert(e != null, "Expression cannot be null");
            Debug.Assert(currentInput != null, "A current input resource is required");
            Debug.Assert(inputParameter != null, "The input lambda parameter is required");
            Debug.Assert(referencedInputs != null, "The referenced inputs list is required");

            InputBinder binder = new InputBinder(currentInput, inputParameter);
            Expression  result = binder.Visit(e);

            referencedInputs.AddRange(binder.referencedInputs);
            return(result);
        }
예제 #9
0
    private void Start()
    {
        inputBinder = FindObjectOfType <InputBinder>();
        anim        = this.GetComponentInChildren <Animator>();
        stats       = FindObjectOfType <Stats_Jugador>();
        rb          = this.GetComponent <Rigidbody2D>();

        inputBinder.BindAxis("Walk", Caminar);
        inputBinder.BindAxis("Aim", Apuntar);

        apuntando = false;
        enSuelo   = true;
    }
예제 #10
0
        public void Setup(InputKey key, InputData inputData)
        {
            _key    = key;
            _binder = inputData.InputBinder;

            UpdateInfo();

            if (!_listenersAdded)
            {
                remapConsole.onClick.AddListener(RebindConsoleButton);
                remapKeyboard.onClick.AddListener(RebindKeyboardButton);

                _listenersAdded = true;
            }

            _binding = Binding.None;
        }
예제 #11
0
		/// <summary>
		/// Initialize bindings of Category keys to file sorting.
		/// </summary>
		private void ResetKeyBindings() {

			Console.WriteLine( "RESET CATEGORY KEY BINDINGS" );
			if( this._categorySet != null ) {

				InputBinder binder = this.GetService<InputBinder>();

				if( binder != null ) {
					IEnumerable<InputBinding> bindings = this._categorySet.MakeCategoryBindings( this.CmdCategoryClick );
					binder.AddBindings( this, bindings );
				} else {
					Console.WriteLine( "FileSortVM.ResetKeyBindings(): Error: No InputBinder" );
				}

			} else {
				Console.WriteLine( "CategorySet NULL" );
			}

		}
예제 #12
0
    // Use this for initialization
    void Start()
    {
        Application.targetFrameRate = 60;

        if (binder == null)
        {
            binder = FindObjectOfType <InputBinder>();
        }

        if (state == GameState.Start)
        {
            binder.OnBind.AddListener(OnBind);
        }

        if (state == GameState.Gaming)
        {
            player1.BindInputManager(binder.inputs[0]);
            player2.BindInputManager(binder.inputs[1]);
        }
    }
    public void Awake()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;

        if (!photonView.IsMine && PhotonNetwork.IsConnected)
        {
            this.enabled = false;
        }
        else
        {
            //
            _instance = this;

            _currentInput.PositionInput = Vector3.zero;
            _currentInput.RotationInput = Vector3.zero;

            _playerMovement = GetComponent <PlayerMovement>();
            if (CheckComponentValue())
            {
                Debug.Log("Player InputController : Components are Unset, Please Check Object");
                gameObject.SetActive(false);
            }

            _playerCameraComponent         = PlayerCamera.GetComponent <Camera>();
            _playerCameraComponent.enabled = true;
            PlayerCamera.GetComponent <AudioListener>().enabled = true;

            _leftHandAction  = PlayerHandL.GetComponent <PlayerHandAction>();
            _rightHandAction = PlayerHandR.GetComponent <PlayerHandAction>();

            // Delegate : Bind Input by Controller Type
            if (XRDevice.isPresent)
            {
                _trackedObjRightHand = PlayerHandR.GetComponent <SteamVR_Behaviour_Pose>();
                _trackedObjLeftHand  = PlayerHandL.GetComponent <SteamVR_Behaviour_Pose>();

                _north = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("North");
                _south = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("South");
                _west  = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("West");
                _east  = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("East");

                _interaction = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("InteractUI");

                InputBinderForUpdate += new InputBinder(SVRPositionInput);
                InputBinderForUpdate += new InputBinder(SVRRotationInput);
                InputBinderForUpdate += new InputBinder(SVRActionInput);

                _leftHandAction.SetVRPlayerHandProperties(true);
                _rightHandAction.SetVRPlayerHandProperties(false);
            }
            else
            {
                InputBinderForUpdate += new InputBinder(KMPositionInput);
                InputBinderForUpdate += new InputBinder(KMRotationInput);
                InputBinderForUpdate += new InputBinder(KMActionInput);

                _leftHandAction.SetKMPlayerHandProperties(KMPlayerHandLenght, "Fire1", true);
                _rightHandAction.SetKMPlayerHandProperties(KMPlayerHandLenght, "Fire2", false);
            }
        }
    }