private void CheckButtons(ButtonInput left, ButtonInput right, ButtonInput jump, ButtonInput Interact)
 {
     if (jump.IsPressed)
     {
         CharController.JumpInput();
     }
     if (left.IsPressed)
     {
         if (!right.IsPressed)
             CharController.MoveLeft();
         else
             CharController.ResetDirection();
     }
     if (right.IsPressed)
     {
         if (!left.IsPressed)
             CharController.MoveRight();
         else
             CharController.ResetDirection();
     }
     if (!left.IsPressed && !right.IsPressed)
     {
         CharController.ResetDirection();
     }
     if (Interact.IsPressed)
         EventManager.CallPlayerInteract();
 }
Exemple #2
0
        public override void Input()
        {
            ButtonInput changeButton = Woofer.Controller.InputManager.ActiveInputMap.Back;

            if (changeButton.Consume())
            {
                BeginModalChange();
            }
        }
        public async Task <Button> Add(ButtonInput button)
        {
            var entity = mapper.MapButton(button, new ButtonEntity());

            this.dbContext.Add(entity);
            await SaveChanges();

            return(mapper.MapButton(entity, new Button()));
        }
 public OrderArticleRowControl(int index)
     : base(string.Format("group_{0}", index + 1))
 {
     Name    = new TextInput(By.Name(string.Format("order_content_name_{0}", index + 1)), this);
     Article = new TextInput(By.Name(string.Format("order_content_article_{0}", index + 1)), this);
     Count   = new TextInput(By.Name(string.Format("order_content_count_{0}", index + 1)), this);
     Add     = new ButtonInput(By.Name(string.Format("item_button_add")), this);
     Remove  = new ButtonInput(By.Name(string.Format("item_button_remove")), this);
 }
 public void OnButtonInput(ButtonInput input)
 {
     switch (input.InputName)
     {
         case "Jump":
             if (input.State != ButtonStates.Pressed)
                 SwitchState("Falling");
             break;
     }
 }
Exemple #6
0
        public UserAdminShopCreatePage()
        {
            Name                = new TextInput(By.Name("name"));
            Address             = new TextInput(By.Name("address"));
            CompanyPickup       = new AutocompleteControl(BY.NthOfClass("ajax-combobox", 0));
            ManagersLegalEntity = new AutocompleteControl(BY.NthOfClass("ajax-combobox", 1));
            Warehouse           = new AutocompleteControl(BY.NthOfClass("ajax-combobox", 2));

            CreateButton = new ButtonInput(By.CssSelector("input.btn.btn-primary"));
        }
 public void OnButtonInput(ButtonInput input)
 {
     switch (input.InputName) {
         case "Jump":
             if (input.State == ButtonStates.Down) {
                 SwitchState("Jumping");
             }
             break;
     }
 }
    // no idea why i decided to do this
    void Update()
    {
        buttonDownState = ButtonInput.None;
        buttonState     = ButtonInput.None;

        if (Input.GetKey(KeyCode.A))
        {
            buttonDownState |= ButtonInput.A;
        }
    }
Exemple #9
0
        public override void Input()
        {
            IInputMap inputMap = Woofer.Controller.InputManager.ActiveInputMap;

            foreach (PulseAbility pa in WatchedComponents.Where(c => c is PulseAbility))
            {
                ButtonInput pulseButton = inputMap.Pulse;

                if (pa.Owner.GetComponent <Health>() is Health health && health.CurrentHealth <= 0)
                {
                    continue;
                }

                if (pa.EnergyMeter >= pa.PulseCost)
                {
                    if (pulseButton.Consume())
                    {
                        double strength = (pa.PulseStrength * Math.Sqrt(pa.EnergyMeter / pa.MaxEnergy));

                        if (pa.Owner.Components.Has <Physical>() && pa.Owner.Components.Has <PlayerOrientation>())
                        {
                            pa.Owner.Components.Get <Physical>().Velocity = pa.Owner.Components.Get <PlayerOrientation>().Unit * -strength;

                            ISoundEffect sound_low = Woofer.Controller.AudioUnit["pulse_low"];
                            sound_low.Pitch = (float)(strength / 256) - 1;
                            ISoundEffect sound_mid = Woofer.Controller.AudioUnit["pulse_mid"];
                            sound_mid.Pitch = sound_low.Pitch;
                            ISoundEffect sound_high = Woofer.Controller.AudioUnit["pulse_high"];
                            sound_high.Pitch = sound_low.Pitch;

                            sound_low.Volume = 0.6f;


                            sound_low.Play();
                            sound_mid.Play();
                            sound_high.Play();
                        }

                        pa.EnergyMeter -= pa.PulseCost;

                        if (pa.Owner.Components.Has <Spatial>())
                        {
                            Spatial sp = pa.Owner.Components.Get <Spatial>();
                            if (sp == null)
                            {
                                continue;
                            }
                            PlayerOrientation po = pa.Owner.Components.Get <PlayerOrientation>();

                            Owner.Events.InvokeEvent(new PulseEvent(pa, sp.Position + pa.Offset, po != null ? po.Unit : new Vector2D(), strength, pa.MaxRange));
                        }
                    }
                }
            }
        }
Exemple #10
0
 protected override void InitBindings()
 {
     ButtonChoose.SetOnClickCommand(ViewModel.AskUserAboutFancyThingsCommand);
     ButtonShow.SetOnClickCommand(ViewModel.ShowLastFanciedThingCommand);
     ButtonNavigate.SetOnClickCommand(ViewModel.NavigateSomewhereElseCommand);
     ButtonReset.SetOnClickCommand(ViewModel.ResetFanciness);
     ButtonDialog.SetOnClickCommand(ViewModel.ShowDialogCommand);
     ButtonDialogB.SetOnClickCommand(ViewModel.ShowDialogBCommand);
     ButtonInput.SetOnClickCommand(ViewModel.InputFanciness);
     FancyLoading.SetOnClickCommand(ViewModel.ShowLoadingDialogCommand);
 }
Exemple #11
0
 /// <summary>
 /// Registers a button input to the input manager.
 /// </summary>
 /// <param name="inputName">Name used for identification.</param>
 /// <param name="button">ButtonInput to add.</param>
 /// <param name="players">Array of players to add the button input to.</param>
 /// <param name="replace">Whether or not to replace existing inputs with the same inputName.</param>
 /// <returns>A ButtonInputSet created from the provided ButtonInput.</returns>
 public static void AddButtonInput(string inputName, ButtonInput button, Players[] players, bool replace)
 {
     if (players == null)
     {
         players = All;
     }
     for (int i = 0; i < players.Length; i++)
     {
         controllers[(int)players[i]].AddButtonInput(inputName, button.DeepCopy(), replace);
     }
 }
Exemple #12
0
        protected override GameButton[] LoadButton()
        {
            ButtonInput[] buttons = new ButtonInput[Model.buttons.Length];

            for (int i = 0; i < buttons.Length; i++)
            {
                buttons[i] = new ButtonInput(Model.buttons[i], this, (object sender) => { });
            }

            return(buttons);
        }
Exemple #13
0
        public BaseRowSearchControl(By className)
            : base(className)
        {
            ID = new TextInput(By.Name("_id"));
            //TODO     Важно! на страницы поиcка компании использовать Name а не CompanyName для поиска по имени компании
            Name        = new TextInput(By.Name("name"));
            CompanyName = new TextInput(By.Name("company"));
            ShopName    = new TextInput(By.Name("shop"));

            SeachButton = new ButtonInput(By.XPath(@"//*[@id=""filter_column__id""]/div/div/i"));
        }
Exemple #14
0
    //rework GUI to fit PC and Android:
    //Energy and health upper left corner
    //Abilities stay where they are but I need to rework the sprite
    //Jump button that's only visible when on Android in lower left corner
    //Button to open Menu in upper right corner if I ever get that far.

    private void Start()
    {
        primary        = new ButtonInput();
        primary.up     = false;
        primary.down   = false;
        primary.hold   = false;
        secundary      = new ButtonInput();
        secundary.up   = false;
        secundary.down = false;
        secundary.hold = false;
        jumpInput      = 0f;
    }
Exemple #15
0
 //Set player input
 //Set inputs (by PlayerInput)
 public override void SetPlayerInput(PlayerInput a_PlayerInput)
 {
     base.SetPlayerInput(a_PlayerInput);
     if (a_PlayerInput.GetButton("Jump") != null)
     {
         m_JumpInput = a_PlayerInput.GetButton("Jump");
     }
     else
     {
         Debug.LogError("Jump input not set up in character input");
     }
 }
Exemple #16
0
        public override void Input()
        {
            IEnumerable <InteractingAgent> agents = WatchedComponents.Where(c => c is InteractingAgent && c.Owner.Active).Select(c => c as InteractingAgent);

            foreach (Component rawC in WatchedComponents)
            {
                if (!rawC.Owner.Active)
                {
                    continue;
                }
                if (rawC is Interactable interactable)
                {
                    InteractingAgent currentAgent = null;
                    bool             inRange      = false;
                    foreach (InteractingAgent agent in agents)
                    {
                        if ((agent.Owner.Components.Get <Spatial>().Position - interactable.Owner.Components.Get <Spatial>().Position).Magnitude <= agent.MaxDistance)
                        {
                            currentAgent = agent;
                            inRange      = true;
                            break;
                        }
                    }
                    if (inRange != interactable.InRange)
                    {
                        if (inRange)
                        {
                            CurrentInteractions[interactable] = currentAgent;
                        }
                        else
                        {
                            CurrentInteractions.Remove(interactable);
                        }
                        Owner.Events.InvokeEvent(inRange ?
                                                 (Event) new InteractionRangeEnter(currentAgent, interactable) :
                                                 (Event) new InteractionRangeExit(null));
                        interactable.InRange = inRange;
                    }

                    if (inRange)
                    {
                        ButtonInput interact = Woofer.Controller.InputManager.ActiveInputMap.Interact;

                        if (interact.Consume())
                        {
                            Entity sendTo = interactable.EntityToActivate != 0 ? Owner.Entities[interactable.EntityToActivate] : interactable.Owner;
                            Owner.Events.InvokeEvent(new ActivationEvent(currentAgent, sendTo, null));
                        }
                    }
                }
            }
        }
Exemple #17
0
    // Private
    /*-----------------------------------------------------------------------*/


    /*************************************************************************
    * Helper functions                                                      *
    *************************************************************************/

    /**
     * Binds the specified input to the an gameAction with the specified input ID
     * (such as "interact") and description (e.g. "Interact with Buttons").
     *
     * If no such gameAction exists, creates one.
     *
     * If an gameAction was created, returns true; if this input was added to a
     * already bound gameAction, returns false.
     */
    private static bool BindButton(string gameActionID, string gameActionDescr, ButtonInput button)
    {
        if (gameActionBindings.ContainsKey(gameActionID)) //Already bound gameAction
        {
            gameActionBindings[gameActionID].BindButton(button);
            return(false);
        }
        else //New gameAction
        {
            gameActionBindings.Add(gameActionID, new GameAction(button, gameActionDescr));
            return(true);
        }
    }
        public async Task <Button> Update(Guid buttonId, ButtonInput button)
        {
            var entity = await this.Entity(buttonId);

            if (entity != null)
            {
                mapper.MapButton(button, entity);
                await SaveChanges();

                return(mapper.MapButton(entity, new Button()));
            }
            throw new KeyNotFoundException($"Cannot find button {buttonId.ToString()}");
        }
 public void Update(Index index)
 {
     if (UseButton())
     {
         ButtonInput?.Invoke(GetButton(), index);
     }
     else
     {
         isCurrentTriggerPressed = (GamepadInput.GamePad.GetTrigger(GetTrigger(), index) > 0);
         TriggerInput?.Invoke(GetTrigger(), index, isCurrentTriggerPressed, isPreviewTriggerPressed);
         isPreviewTriggerPressed = isCurrentTriggerPressed;
     }
 }
Exemple #20
0
    private static void UnregisterButton(ButtonInput input)
    {
        Button buttonObj;

        if (buttons.TryGetValue(input.Key, out buttonObj))
        {
            if (buttonObj.inputs.Remove(input) && buttonObj.inputs.Count == 0)
            {
                buttons.Remove(input.Key);
                buttonsList.Remove(buttonObj);
            }
        }
    }
Exemple #21
0
    // Use this for initialization
    void Start()
    {
        // ボタンを取得
        _buttonInput = gameObject.GetComponent <ButtonInput>();

        // 矢を見つけて代入
        _bow = GameObject.Find("Bow");

        // nullチェック
        if (_bow == null)
        {
            Debug.Log("null");
        }
    }
Exemple #22
0
    public void Clear()
    {
        Buttons.Clear();
        Buffer.Clear();

        foreach (TKeyType key in Definitions)
        {
            Buttons[key] = new ButtonInfo()
            {
                Frames = FramesInBuffer
            };
            Buffer[key] = new ButtonInput();
        }
    }
Exemple #23
0
        public GamePadInputMap(IGamePad gamePad)
        {
            this.gamePad = gamePad;

            Run      = new ButtonInput(() => gamePad.Buttons.Y);
            Jump     = new ButtonInput(() => gamePad.Buttons.A);
            Pulse    = new ButtonInput(() => gamePad.Buttons.X);
            Interact = new ButtonInput(() => gamePad.Buttons.B);
            Start    = new ButtonInput(() => gamePad.Buttons.Start);
            Pause    = new ButtonInput(() => gamePad.Buttons.Start);
            Back     = new ButtonInput(() => gamePad.Buttons.Back);

            Debug     = new ButtonInput(() => gamePad.Buttons.RightStick);
            Quicksave = new ButtonInput(() => gamePad.Buttons.LeftBumper);
            Quickload = new ButtonInput(() => gamePad.Buttons.RightBumper);
        }
Exemple #24
0
    private void UpdateButtonInput(ref ButtonInput input)
    {
        bool state = Input.GetButton(input.buttonName);

        // Held down
        if (input.state == state)
        {
            input.duration += Time.fixedUnscaledDeltaTime;
        }
        else
        {
            input.duration = 0.0f;
        }

        input.state = state;
    }
Exemple #25
0
        public KeyboardInputMap(IKeyboard keyboard, IMouse mouse)
        {
            this.keyboard = keyboard;
            this.mouse    = mouse;

            Run       = new ButtonInput(() => keyboard[Key.LeftShift]);
            Jump      = new ButtonInput(() => keyboard[Key.Z]);
            Pulse     = new ButtonInput(() => keyboard[Key.X]);
            Interact  = new ButtonInput(() => keyboard[Key.C]);
            Pause     = new ButtonInput(() => keyboard[Key.Escape]);
            Back      = new ButtonInput(() => keyboard[Key.Tab]);
            Debug     = new ButtonInput(() => keyboard[Key.F3]);
            Start     = new ButtonInput(() => keyboard[Key.Enter]);
            Quicksave = new ButtonInput(() => keyboard[Key.F5]);
            Quickload = new ButtonInput(() => keyboard[Key.F7]);
        }
    string GetTranslation(ButtonInput button)
    {
        switch (button)
        {
        case (ButtonInput.X):
            return("X");

        case (ButtonInput.Y):
            return("Y");

        case (ButtonInput.B):
            return("B");
        }

        return("Empty");
    }
Exemple #27
0
    private static void RegisterButton(ButtonInput input)
    {
        Button buttonObj;

        if (!buttons.TryGetValue(input.Key, out buttonObj))
        {
            buttonObj = new Button(input.Key);

            buttons[input.Key] = buttonObj;
            buttonsList.Add(buttonObj);

            // Track corresponding Unity input as well, if exists
            TrackButton(input.Key, true);
        }

        buttonObj.inputs.Add(input);
    }
Exemple #28
0
    public void process(ButtonInput input)
    {
        GridSlice gridSlice;

        switch (input)
        {
        case ButtonInput.forward:
            game.process(MoveIntent.forward);
            break;

        case ButtonInput.left:
            game.process(MoveIntent.turnLeftSide);
            break;

        case ButtonInput.right:
            game.process(MoveIntent.turnRightSide);
            break;

        case ButtonInput.unseenLeft:
            game.process(MoveIntent.turnLeftUnseen);
            gridSlice = playerPresenter.orientationForDirection(player.direction, player.position);
            worldOrientationText.text = stringForOrientation(gridSlice.worldOrientation);
            gridPresenter.updateGrid(level.hyperGrid, gridSlice);
            updateScreen(gridSlice.worldOrientation);
            break;

        case ButtonInput.unseenRight:
            game.process(MoveIntent.turnRightUnseen);
            gridSlice = playerPresenter.orientationForDirection(player.direction, player.position);
            worldOrientationText.text = stringForOrientation(gridSlice.worldOrientation);
            gridPresenter.updateGrid(level.hyperGrid, gridSlice);
            updateScreen(gridSlice.worldOrientation);
            break;
        }
        //TODO: fix how this is Connected
        playerPresenter.hyperPosition = player.position;
        gridPresenter.placeItemFor(playerPresenter, playerPresenter.orientationForDirection(player.direction, player.position));
        gridPresenter.UpdateShownPieces(playerPresenter.orientationForDirection(player.direction, player.position));
        if (game.checkWon())
        {
            Debug.Log("You Won!!!!");
        }
        //TODO: make this work again
        // playerPresenter.rotateToFace(player.direction);
    }
Exemple #29
0
        public OrderPage()
        {
            StatusOrder = new StaticText(By.CssSelector("legend > span.label"));
            BackOrders  = new ButtonInput(By.CssSelector("body > div.container > div > div.span3 > div > ul > li:nth-child(3) > a > i"));

            TableSender    = new SenderListControl(By.XPath("//div[@class='span5']/table[1]"));
            TableRecipient = new RecipientListControl(By.XPath("//div[@class='span4']/table[1]"));
            DeliveryDate   = new StaticText(By.XPath("//div[@class='span6']/table[1]/tbody/tr/td"));
            DeliveryTime   = new StaticText(By.XPath("//div[@class='span6']/table[1]/tbody/tr[2]/td"));
            TablePrice     = new PriceListControl(By.XPath("//div[4]/div[@class='span6']/table[1]"));

            TableSize = new SizeListControl(By.XPath("//div[@class='span3']/table[1]"));
//            TableArticle = new ArticelListControl(By.XPath("//div[@class='span6'][3]/table[1]"));
            TableArticle = new ArticelListControl(By.XPath("//div[6]/div[@class='span6']/table[1]"));

            СonfirmButton = new ButtonInput(By.CssSelector("div.form-actions > form > button"));
            UndoButton    = new ButtonInput(By.CssSelector("div.form-actions > form > button"));
        }
Exemple #30
0
        /// <summary>
        /// Registers multiple button inputs to the input manager, under the same ID.
        /// </summary>
        /// <param name="inputName">Name used for identification.</param>
        /// <param name="replace">Whether or not to replace existing inputs with the same inputName.</param>
        /// <param name="players">Array of players to add the button inputs to.</param>
        /// <param name="buttons">One or more buttons to add.</param>
        /// <returns>A ButtonInputSet created from the provided ButtonInputs.</returns>
        public static void AddButtonInputs(string inputName, Players[] players, bool replace, params ButtonInput[] buttons)
        {
            if (players == null)
            {
                players = All;
            }

            for (int i = 0; i < players.Length; i++)
            {
                ButtonInput[] copy = new ButtonInput[buttons.Length];
                for (int y = 0; y < buttons.Length; y++)
                {
                    copy[y] = buttons[y].DeepCopy();
                }

                controllers[(int)players[i]].AddButtonInput(inputName, replace, copy);
            }
        }
Exemple #31
0
        void ReleaseDesignerOutlets()
        {
            if (ButtonInput != null)
            {
                ButtonInput.Dispose();
                ButtonInput = null;
            }

            if (LabelAnswer != null)
            {
                LabelAnswer.Dispose();
                LabelAnswer = null;
            }

            if (LabelTime != null)
            {
                LabelTime.Dispose();
                LabelTime = null;
            }
        }
Exemple #32
0
        public UserWarehouseCreatePage()
        {
            LabelDirectory = new StaticText(By.CssSelector("legend"));
            Name           = new TextInput(By.Name("name"));
            Name           = new TextInput(By.Name("name"));
            Street         = new TextInput(By.Name("street"));
            House          = new TextInput(By.Name("house"));
            Flat           = new TextInput(By.Name("flat"));
            ContactPerson  = new TextInput(By.Name("contact_person"));
            ContactPhone   = new TextInput(By.Name("contact_phone"));
            ContactEmail   = new TextInput(By.Name("contact_email"));
            PostalCode     = new TextInput(By.Name("postal_code"));
            City           = new AutocompleteControl(BY.NthOfClass("ajax-combobox", 0));
            Freshlogic     = new TextInput(By.Name("freshlogic_id"));

            CreateButton   = new ButtonInput(By.CssSelector("input.btn.btn-primary"));
            WarehousesBack = new Link(By.Name("freshlogic_id"));

            ErrorText = new ErrorTextControl(By.ClassName("form-horizontal"));
        }
Exemple #33
0
        public CompanyCreatePage()
        {
            Name                   = new TextInput(By.Name("name"));
            CompanyDriver          = new Select(By.Name("driver"));
            CompanyAddress         = new TextInput(By.Name("address"));
            CompanyPickup          = new AutocompleteControl(BY.NthOfClass("ajax-combobox", 0));
            CompanyPickupAddButton = new ButtonInput(By.XPath("//button[@type='button']"));

            Manager             = new AutocompleteControl(BY.NthOfClass("ajax-combobox", 1));
            ManagersPickup      = new AutocompleteControl(BY.NthOfClass("ajax-combobox", 2));
            ManagersLegalEntity = new AutocompleteControl(BY.NthOfClass("ajax-combobox", 3));

            Term            = new TextInput(By.Name("term"));
            ItemsMax        = new TextInput(By.Name("items_max"));
            SinglePickup    = new CheckBox(By.Name("single_pickup"));
            Prolongation    = new CheckBox(By.Name("prolongation"));
            BarcodePull     = new CheckBox(By.Name("enabled_barcode_pull"));
            PackingPaid     = new CheckBox(By.Name("packing_paid"));
            PackingRequired = new CheckBox(By.Name("packing_required"));
        }
Exemple #34
0
 /// <summary>
 /// Called when a button is pressed or released.
 /// </summary>
 /// <param name="button">The button.</param>
 public virtual void OnButton(ButtonInput button) { }
 public void OnButtonInput(ButtonInput input)
 {
 }
        public void CreateInput(ButtonInput newButton)
        {
            #if UNITY_EDITOR
            GUILayout.BeginHorizontal();

            //GUILayout.Label(newButton.buttonName, GUILayout.MaxWidth(80));
            EditorGUILayout.LabelField(newButton.buttonName, GUILayout.MaxWidth(80));
            newButton.inputType = (typeInput)EditorGUILayout.EnumPopup(newButton.inputType, GUILayout.MaxWidth(60));
            GUIStyle textFieldSetup = new GUIStyle(GUI.skin.textField);
            GUIStyle buttonSetup = new GUIStyle(GUI.skin.button);
            if (newButton.inputSetup && newButton.inputName != "")
            {
                textFieldSetup.normal.textColor = Color.green;
                textFieldSetup.focused.textColor = Color.green;
            }
            else if (!newButton.inputSetup && newButton.inputName != "")
            {
                textFieldSetup.normal.textColor = Color.red;
                textFieldSetup.focused.textColor = Color.red;
            }
            newButton.inputName = EditorGUILayout.TextField(newButton.inputName, textFieldSetup);
            if (newButton.inputType == typeInput.Axis)
            {
                newButton.inputDir = (axisDir)EditorGUILayout.EnumPopup(newButton.inputDir, GUILayout.MaxWidth(50));
                if (newButton.inputDir == axisDir.minus || newButton.inputDir == axisDir.plus)
                {
                    if (newButton.inputDir == axisDir.minus)
                    {
                        if (newButton.absoluteVal)
                        {
                            buttonSetup.normal.textColor = Color.green;
                            buttonSetup.focused.textColor = Color.green;
                            if (GUILayout.Button("A", buttonSetup, GUILayout.MinWidth(20), GUILayout.MaxWidth(30)))
                            {
                                newButton.absoluteVal = false;
                            }
                        }
                        else
                        {
                            buttonSetup.normal.textColor = Color.red;
                            buttonSetup.focused.textColor = Color.red;
                            if (GUILayout.Button("A", buttonSetup, GUILayout.MinWidth(20), GUILayout.MaxWidth(30)))
                            {
                                newButton.absoluteVal = true;
                            }
                        }
                    }

                    if (!newButton.showSlider)
                    {
                        if (GUILayout.Button("+", GUILayout.MinWidth(20), GUILayout.MaxWidth(30)))
                        {
                            newButton.showSlider = true;
                        }
                    }
                    else
                    {
                        if (GUILayout.Button("-", GUILayout.MinWidth(20), GUILayout.MaxWidth(30)))
                        {
                            newButton.showSlider = false;
                        }
                        GUILayout.EndHorizontal();
                        GUILayout.BeginVertical();
                        newButton.axisValue = EditorGUILayout.Slider(newButton.axisValue, -1, 1);
                        ProgressBar(Mathf.Abs(newButton.axisValue), "Axis");
                        GUILayout.EndVertical();
                        GUILayout.BeginVertical();
                    }
                }
                EditorGUILayout.FloatField(newButton.axisValue);
            }
            else
            {
                newButton.buttonState = (ButtonStates)EditorGUILayout.EnumPopup(newButton.buttonState, GUILayout.MaxWidth(90));
            }
            GUILayout.EndHorizontal();
            #endif
        }
        public void UpdateInput(ButtonInput newButton)
        {
            if (newButton.inputType == typeInput.Axis)
            {
                float axisVal = UpdateUnityAxis(newButton.inputName, newButton);
                if (newButton.inputDir == axisDir.plus)
                {
                    if (axisVal >= 0)
                        newButton.axisValue = axisVal;
                    else
                        newButton.axisValue = 0;
                }
                else if (newButton.inputDir == axisDir.minus)
                {
                    if (axisVal <= 0)
                    {
                        if (newButton.absoluteVal)
                            newButton.axisValue = Mathf.Abs(axisVal);
                        else
                            newButton.axisValue = axisVal;
                    }
                    else
                        newButton.axisValue = 0;
                }
                else
                    newButton.axisValue = axisVal;
            }
            else
            {
                int inputResult = 0;
                if (newButton.inputType == typeInput.Button)
                {
                    inputResult = UpdateUnityButtons(newButton.inputName, newButton);
                }
                if (newButton.inputType == typeInput.Key)
                {
                    inputResult = UpdateUnityKeys(newButton.inputName, newButton);
                }
                if (inputResult == 1)
                {
                    newButton.Pressed = true;
                    newButton.Held = false;
                    newButton.Released = false;
                    newButton.Zero = false;
                    //Debug.Log("Pressed B");
                    newButton.buttonState = ButtonStates.Pressed;
                }
                else if (inputResult == 2)
                {
                    newButton.Pressed = false;
                    newButton.Held = true;
                    newButton.Released = false;
                    newButton.Zero = false;
                    //Debug.Log("Held B");
                    newButton.buttonState = ButtonStates.Held;
                }
                else if (inputResult == 3)
                {
                    newButton.Pressed = false;
                    newButton.Held = false;
                    newButton.Released = true;
                    newButton.Zero = false;
                    //Debug.Log("Released B");
                    newButton.buttonState = ButtonStates.Released;
                }
                else
                {
                    newButton.Pressed = false;
                    newButton.Held = false;
                    newButton.Released = false;
                    newButton.Zero = true;
                    newButton.buttonState = ButtonStates.Zero;
                }
            }

            #if UNITY_EDITOR
            if (targetInspector)
                targetInspector.Repaint();
            #endif
        }
 float UpdateUnityAxis(string axis, ButtonInput button, bool debug = false)
 {
     if (axis != "" && IsAxisAvailable(axis))
     {
         button.inputSetup = true;
         if (debug && debugString)
             Debug.Log("Axis " + axis + " setup.");
         return Input.GetAxis(axis);
     }
     else
     {
         button.inputSetup = false;
         return 0;
     }
 }
        int UpdateUnityKeys(string key, ButtonInput button, bool debug = false)
        {
            if (key != "")
            {
                if (key.Length == 1)
                    key = key.ToUpper();
                if (IsKeycodeAvailable(key))
                {
                    button.inputSetup = true;
                    if (debug && debugString)
                        Debug.Log("key " + key + " setup.");
                    KeyCode buttonKeyCode = (KeyCode)System.Enum.Parse(typeof(KeyCode), key);

                    if (Input.GetKeyDown(buttonKeyCode))
                        return 1;
                    if (Input.GetKey(buttonKeyCode))
                        return 2;
                    if (Input.GetKeyUp(buttonKeyCode))
                        return 3;
                    if (!(Input.GetKeyUp(buttonKeyCode) && Input.GetKey(buttonKeyCode) && Input.GetKeyDown(buttonKeyCode)))
                        return 0;
                    else
                        return 0;
                }
                else
                {
                    button.inputSetup = false;
                    return 0;
                }
            }
            else
            {
                button.inputSetup = false;
                return 0;
            }
        }
 int UpdateUnityButtons(string button, ButtonInput buttonInstance, bool debug = false)
 {
     if (button != "" && IsButtonAvailable(button))
     {
         buttonInstance.inputSetup = true;
         if (debug && debugString)
             Debug.Log("button " + button + " setup.");
         if (Input.GetButtonDown(button))
             return 1;
         if (Input.GetButton(button))
             return 2;
         if (Input.GetButtonUp(button))
             return 3;
         if (!(Input.GetButtonUp(button) && Input.GetButton(button) && Input.GetButtonDown(button)))
             return 0;
         else
             return 0;
     }
     else
     {
         buttonInstance.inputSetup = false;
         return 0;
     }
 }