UnityEngine.Input.GetKey(UnityEngine.KeyCode)

Here are the examples of the csharp api UnityEngine.Input.GetKey(UnityEngine.KeyCode) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

259 Examples 7

19 Source : DecorationMaster.cs
with GNU General Public License v3.0
from a2659802

private void OperateItem()
        {
            if(ItemManager.Instance.setupMode)
            {
                autoSaveTimer += Time.deltaTime;
                if(autoSaveTimer > 60*3)
                {
                    SaveJson();
                    autoSaveTimer = 0;
                    Logger.LogDebug("Auto Save");
                }
            }
            if((Input.GetKey(KeyCode.LeftControl)|| Input.GetKey(KeyCode.RightControl)))
            {
                if (Input.GetKeyDown(KeyCode.C))
                    ItemManager.Instance.CopyBlock();
                else if (Input.GetKeyDown(KeyCode.Z))
                    ItemManager.Instance.DiscardLast();
            }

            if (Input.GetKeyDown(ToggleEdit))    // Toggle Edit Model
            {
                ItemManager.Instance.ToggleSetup();
            }
            if (Input.GetKeyDown(SwitchGroup))   // Switch Select Group
            {
                ItemManager.Instance.SwitchGroup();
            }

            //Vector2 cur_mousePos = GetMousePos();   //Update Mouse Pos
            Vector2 cur_mousePos = MyCursor.CursorPosition;
            if (cur_mousePos != mousePos)
            {
                mousePos = cur_mousePos;
                ItemManager.Instance.Operate(Operation.SetPos, mousePos);
            }

            if(GM != null && !GM.isPaused && !GM.IsInSceneTransition)
            {
                if (Input.GetMouseButtonUp((int)MouseButton.Left)) // Confirm Go
                {
                    ItemManager.Instance.AddCurrent();
                }
                else if (Input.GetMouseButtonUp((int)MouseButton.Right)) // Discard Go
                {
                    ItemManager.Instance.RemoveCurrent();
                }
            }
            int idx = -1;
            foreach (Selecreplacedem selector in SelectGetter.GetInvocationList())// Get user Selection
            {
                int res = selector.Invoke();
                if (res != -1)
                    idx = res;
            }
            if (ItemManager.Instance.Select(idx) == null)
                return;

        }

19 Source : GenericMoveCameraInputs.cs
with Apache License 2.0
from activey

public virtual void QueryInputSystem() {

            isSlowModifier = (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl));
            isFastModifier = (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift));
            isRotateAction = Input.GetButton("Fire2");

            // Get mouse starting point when the button was clicked.
            if ( Input.GetButtonDown("Fire2") ) {
                RotateActionStart.x = Input.mousePosition.x;
                RotateActionStart.y = Input.mousePosition.y;
            }
            isLockForwardMovement = Input.GetButton("Fire3");
            ResetMovement = Input.GetKey(KeyCode.Space);

            isPanLeft = Input.GetKey(KeyCode.A);
            isPanRight = Input.GetKey(KeyCode.D);
            isPanUp = Input.GetKey(KeyCode.Q);
            isPanDown = Input.GetKey(KeyCode.Z);

            isMoveForward = Input.GetKey(KeyCode.W);
            isMoveBackward = Input.GetKey(KeyCode.S);

            isMoveForwardAlt = Input.GetAxis("Mouse ScrollWheel") > 0;
            isMoveBackwardAlt = Input.GetAxis("Mouse ScrollWheel") < 0;

        }

19 Source : FirstPersonController.cs
with MIT License
from adrianpolimeni

private void GetInput(out float speed)
        {
            // Read input
            float horizontal = CrossPlatformInputManager.GetAxis("Horizontal");
            float vertical = CrossPlatformInputManager.GetAxis("Vertical");

            bool waswalking = m_IsWalking;

#if !MOBILE_INPUT
            // On standalone builds, walk/run speed is modified by a key press.
            // keep track of whether or not the character is walking or running
            m_IsWalking = !Input.GetKey(KeyCode.LeftShift);
#endif
            // set the desired speed to be walking or running
            speed = m_IsWalking ? m_WalkSpeed : m_RunSpeed;
            m_Input = new Vector2(horizontal, vertical);

            // normalize input if it exceeds 1 in combined length:
            if (m_Input.sqrMagnitude > 1)
            {
                m_Input.Normalize();
            }

            // handle speed change to give an fov kick
            // only if the player is going to a run, is running and the fovkick is to be used
            if (m_IsWalking != waswalking && m_UseFovKick && m_CharacterController.velocity.sqrMagnitude > 0)
            {
                StopAllCoroutines();
                StartCoroutine(!m_IsWalking ? m_FovKick.FOVKickUp() : m_FovKick.FOVKickDown());
            }
        }

19 Source : RigidbodyFirstPersonController.cs
with MIT License
from adrianpolimeni

public void UpdateDesiredTargetSpeed(Vector2 input)
            {
	            if (input == Vector2.zero) return;
				if (input.x > 0 || input.x < 0)
				{
					//strafe
					CurrentTargetSpeed = StrafeSpeed;
				}
				if (input.y < 0)
				{
					//backwards
					CurrentTargetSpeed = BackwardSpeed;
				}
				if (input.y > 0)
				{
					//forwards
					//handled last as if strafing and moving forward at the same time forwards speed should take precedence
					CurrentTargetSpeed = ForwardSpeed;
				}
#if !MOBILE_INPUT
	            if (Input.GetKey(RunKey))
	            {
		            CurrentTargetSpeed *= RunMultiplier;
		            m_Running = true;
	            }
	            else
	            {
		            m_Running = false;
	            }
#endif
            }

19 Source : KeySetting.cs
with GNU General Public License v3.0
from aelariane

public bool IsKeyHolding()
        {
            if (Value == KeyCode.None)
            {
                return false;
            }
            if (isAxis)
            {
                return CheckAxis();
            }
            return Input.GetKey(Value);
        }

19 Source : SettingsPanel.cs
with GNU General Public License v3.0
from aelariane

private void RebindButton(SmartRect rect, KeySetting set)
        {
            Label(rect, locale[set.Key] + ":");
            rect.MoveOffsetX(Style.LabelOffset * 2f);
            if (Button(rect, set == waitSetting ? locale["waiting"] : set.ToString()) && !rebindWait)
            {
                rebindWait = true;
                waitSetting = set;
            }
            rect.ResetX();
            if (set != waitSetting || !rebindWait)
            {
                return;
            }

            var curr = Event.current;
            if (curr.keyCode == set.Value && curr.keyCode != KeyCode.None)
            {
                set.SetValue(KeyCode.None);
                rebindWait = false;
                waitSetting = null;
                return;
            }
            if (Input.GetKey(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.LeftShift))
            {
                set.SetValue(KeyCode.LeftShift);
                rebindWait = false;
                waitSetting = null;
                return;
            }
            else if (Input.GetKey(KeyCode.RightShift) || Input.GetKeyDown(KeyCode.RightShift))
            {
                set.SetValue(KeyCode.RightShift);
                rebindWait = false;
                waitSetting = null;
                return;
            }
            if (Input.GetAxis("Mouse ScrollWheel") != 0f)
            {
                set.SetAsAxis(Input.GetAxis("Mouse ScrollWheel") > 0f);
                rebindWait = false;
                waitSetting = null;
            }
            if ((Input.anyKey || curr.functionKey) && curr.keyCode != KeyCode.None)
            {
                set.SetValue(curr.keyCode);
                for (int i = 0; i < 7; i++)
                {
                    if (Input.GetKeyDown(KeyCode.Mouse0 + i))
                    {
                        set.SetValue((KeyCode.Mouse0 + i));
                        waitSetting = null;
                        rebindWait = false;
                        return;
                    }
                }
                rebindWait = false;
                waitSetting = null;
                return;
            }
            for (int i = 0; i < 7; i++)
            {
                if (Input.GetKeyDown(KeyCode.Mouse0 + i))
                {
                    set.SetValue((KeyCode.Mouse0 + i));
                    waitSetting = null;
                    rebindWait = false;
                    return;
                }
            }
        }

19 Source : SingleStatsPanel.cs
with GNU General Public License v3.0
from aelariane

public override void Update()
        {
            if(UnityEngine.Input.GetKey(UnityEngine.KeyCode.Tab) == false)
            {
                DisableImmediate();
            }
        }

19 Source : RacingLogic.cs
with GNU General Public License v3.0
from aelariane

protected internal override void OnUpdate()
        {
            if (Multiplayer)
            {
                if (Input.GetKey(KeyCode.Tab))
                {
                    needShowFinishers = true;
                    UpdateLabels();
                    return;
                }
                if (needShowFinishers)
                {
                    showFinishersTime -= Time.unscaledDeltaTime;
                    if (showFinishersTime <= 0f)
                    {
                        needShowFinishers = false;
                        UpdateLabels();
                    }
                }
            }
        }

19 Source : custom_inputs.cs
with GNU General Public License v3.0
from aelariane

private void inputSetBools()
    {
        for (int i = 0; i < this.DescriptionString.Length; i++)
        {
            if (Input.GetKey(this.inputKey[i]) || (this.joystickActive[i] && Input.GetAxis(this.joystickString[i]) > 0.95f) || Input.GetKey(this.inputKey2[i]) || (this.joystickActive2[i] && Input.GetAxis(this.joystickString2[i]) > 0.95f))
            {
                this.isInput[i] = true;
            }
            else
            {
                this.isInput[i] = false;
            }
            if (Input.GetKeyDown(this.inputKey[i]) || Input.GetKeyDown(this.inputKey2[i]))
            {
                this.isInputDown[i] = true;
            }
            else
            {
                this.isInputDown[i] = false;
            }
            if ((this.joystickActive[i] && Input.GetAxis(this.joystickString[i]) > 0.95f) || (this.joystickActive2[i] && Input.GetAxis(this.joystickString2[i]) > 0.95f))
            {
                if (!this.tempjoy1[i])
                {
                    this.isInputDown[i] = false;
                }
                if (this.tempjoy1[i])
                {
                    this.isInputDown[i] = true;
                    this.tempjoy1[i] = false;
                }
            }
            if (!this.tempjoy1[i] && this.joystickActive[i] && Input.GetAxis(this.joystickString[i]) < 0.1f && this.joystickActive2[i] && Input.GetAxis(this.joystickString2[i]) < 0.1f)
            {
                this.isInputDown[i] = false;
                this.tempjoy1[i] = true;
            }
            if (!this.tempjoy1[i] && !this.joystickActive[i] && this.joystickActive2[i] && Input.GetAxis(this.joystickString2[i]) < 0.1f)
            {
                this.isInputDown[i] = false;
                this.tempjoy1[i] = true;
            }
            if (!this.tempjoy1[i] && !this.joystickActive2[i] && this.joystickActive[i] && Input.GetAxis(this.joystickString[i]) < 0.1f)
            {
                this.isInputDown[i] = false;
                this.tempjoy1[i] = true;
            }
            if (Input.GetKeyUp(this.inputKey[i]) || Input.GetKeyUp(this.inputKey2[i]))
            {
                this.isInputUp[i] = true;
            }
            else
            {
                this.isInputUp[i] = false;
            }
            if ((this.joystickActive[i] && Input.GetAxis(this.joystickString[i]) > 0.95f) || (this.joystickActive2[i] && Input.GetAxis(this.joystickString2[i]) > 0.95f))
            {
                if (this.tempjoy2[i])
                {
                    this.isInputUp[i] = false;
                }
                if (!this.tempjoy2[i])
                {
                    this.isInputUp[i] = false;
                    this.tempjoy2[i] = true;
                }
            }
            if (this.tempjoy2[i] && this.joystickActive[i] && Input.GetAxis(this.joystickString[i]) < 0.1f && this.joystickActive2[i] && Input.GetAxis(this.joystickString2[i]) < 0.1f)
            {
                this.isInputUp[i] = true;
                this.tempjoy2[i] = false;
            }
            if (this.tempjoy2[i] && !this.joystickActive[i] && this.joystickActive2[i] && Input.GetAxis(this.joystickString2[i]) < 0.1f)
            {
                this.isInputUp[i] = true;
                this.tempjoy2[i] = false;
            }
            if (this.tempjoy2[i] && !this.joystickActive2[i] && this.joystickActive[i] && Input.GetAxis(this.joystickString[i]) < 0.1f)
            {
                this.isInputUp[i] = true;
                this.tempjoy2[i] = false;
            }
        }
    }

19 Source : IN_GAME_MAIN_CAMERA.cs
with GNU General Public License v3.0
from aelariane

private void CameraMovement()
    {
        this.distanceOffsetMulti = (cameraDistance * (200f - BaseCamera.fieldOfView)) / 150f;
        BaseT.position = (Head ?? MainT).position + (Vectors.up * (this.heightMulti - ((0.6f - cameraDistance) * 2f)));
        if (!InputManager.MenuOn)
        {
            switch (CameraMode)
            {
                case CameraType.ORIGINAL:
                    if (Input.mousePosition.x < (Screen.width * 0.4f))
                    {
                        BaseT.RotateAround(BaseT.position, Vectors.up, (-((((Screen.width * 0.4f) - Input.mousePosition.x) / (Screen.width)) * 0.4f) * this.getSensitivityMultiWithDeltaTime()) * 150f);
                    }
                    else if (Input.mousePosition.x > (Screen.width * 0.6f))
                    {
                        BaseT.RotateAround(BaseT.position, Vectors.up, ((((Input.mousePosition.x - (Screen.width * 0.6f)) / (Screen.width)) * 0.4f) * this.getSensitivityMultiWithDeltaTime()) * 150f);
                    }
                    float x = ((140f * ((Screen.height * 0.6f) - Input.mousePosition.y)) / ((float)Screen.height)) * 0.5f;
                    BaseT.rotation = Quaternion.Euler(x, BaseT.rotation.eulerAngles.y, BaseT.rotation.eulerAngles.z);
                    break;

                case CameraType.WOW:
                    if (Input.GetKey(KeyCode.Mouse1))
                    {
                        BaseT.RotateAround(BaseT.position, Vectors.up, (Input.GetAxis("Mouse X") * 10f) * sensitivityMulti);
                        BaseT.RotateAround(BaseT.position, BaseT.Right(), ((-Input.GetAxis("Mouse Y") * 10f) * sensitivityMulti) * invertY);
                    }
                    break;

                case CameraType.TPS:
                    float num6 = ((-Input.GetAxis("Mouse Y") * 10f) * sensitivityMulti) * invertY;
                    BaseT.RotateAround(BaseT.position, Vectors.up, (Input.GetAxis("Mouse X") * 10f) * sensitivityMulti);
                    float num7 = BaseT.rotation.eulerAngles.x % 360f;
                    float num8 = num7 + num6;
                    if (((num6 <= 0f) || (((num7 >= 260f) || (num8 <= 260f)) && ((num7 >= 80f) || (num8 <= 80f)))) && ((num6 >= 0f) || (((num7 <= 280f) || (num8 >= 280f)) && ((num7 <= 100f) || (num8 >= 100f)))))
                    {
                        BaseT.RotateAround(BaseT.position, BaseT.Right(), num6);
                    }
                    break;

                case CameraType.NewTPS:
                    Quaternion quaternion = Quaternion.Euler(0f, BaseT.eulerAngles.y, 0f);
                    BaseT.position = (Head ?? MainT).position + Vectors.up * 3f;
                    rotationY += ((Input.GetAxis("Mouse Y") * 2.5f) * (sensitivityMulti * 2f)) * invertY;
                    rotationY = Mathf.Clamp(rotationY, -60f, 60f);
                    rotationY = Mathf.Max(rotationY, -999f + (this.heightMulti * 2f));
                    rotationY = Mathf.Min(rotationY, 999f);
                    BaseT.localEulerAngles = new Vector3(-rotationY, BaseT.localEulerAngles.y + ((Input.GetAxis("Mouse X") * 2.5f) * (sensitivityMulti * 2f)), BaseT.eulerAngles.z);
                    quaternion = Quaternion.Euler(0f, BaseT.eulerAngles.y, 0f);
                    BaseT.position -= quaternion * Vectors.forward * 10f * distanceMulti * distanceOffsetMulti;
                    BaseT.position += -Vectors.up * rotationY * 0.1f * (float)System.Math.Pow((double)heightMulti, 1.1) * distanceOffsetMulti;
                    if (cameraDistance >= 0.65f)
                    {
                        return;
                    }

                    BaseT.position += (BaseT.Right() * Mathf.Max(((0.6f - cameraDistance) * 2f), 0.65f));
                    return;
            }
        }
        BaseT.position -= (((BaseT.Forward() * this.distance) * this.distanceMulti) * this.distanceOffsetMulti);
        if (cameraDistance >= 0.65f)
        {
            return;
        }

        BaseT.position += (BaseT.Right() * Mathf.Max(((0.6f - cameraDistance) * 2f), 0.65f));
    }

19 Source : FengCustomInputs.cs
with GNU General Public License v3.0
from aelariane

private void inputSetBools()
    {
        for (int i = 0; i < this.DescriptionString.Length; i++)
        {
            if (Input.GetKey(this.inputKey[i]) || (this.joystickActive[i] && Input.GetAxis(this.joystickString[i]) > 0.95f))
            {
                this.isInput[i] = true;
            }
            else
            {
                this.isInput[i] = false;
            }
            if (Input.GetKeyDown(this.inputKey[i]))
            {
                this.isInputDown[i] = true;
            }
            else
            {
                this.isInputDown[i] = false;
            }
            if (this.joystickActive[i] && Input.GetAxis(this.joystickString[i]) > 0.95f)
            {
                if (!this.tempjoy1[i])
                {
                    this.isInputDown[i] = false;
                }
                if (this.tempjoy1[i])
                {
                    this.isInputDown[i] = true;
                    this.tempjoy1[i] = false;
                }
            }
            if (!this.tempjoy1[i] && this.joystickActive[i] && Input.GetAxis(this.joystickString[i]) < 0.1f)
            {
                this.isInputDown[i] = false;
                this.tempjoy1[i] = true;
            }
            if (Input.GetKeyUp(this.inputKey[i]))
            {
                this.isInputUp[i] = true;
            }
            else
            {
                this.isInputUp[i] = false;
            }
        }
    }

19 Source : MoveByKeys.cs
with GNU General Public License v3.0
from aelariane

private void Update()
    {
        if (Input.GetKey(KeyCode.A))
        {
            base.transform.position += Vectors.left * (this.speed * Time.deltaTime);
        }
        if (Input.GetKey(KeyCode.D))
        {
            base.transform.position += Vectors.right * (this.speed * Time.deltaTime);
        }
        if (Input.GetKey(KeyCode.W))
        {
            base.transform.position += Vectors.forward * (this.speed * Time.deltaTime);
        }
        if (Input.GetKey(KeyCode.S))
        {
            base.transform.position += Vectors.back * (this.speed * Time.deltaTime);
        }
    }

19 Source : MaxCamera.cs
with GNU General Public License v3.0
from aelariane

private void LateUpdate()
    {
        if (Input.GetMouseButton(2) && Input.GetKey(KeyCode.LeftAlt) && Input.GetKey(KeyCode.LeftControl))
        {
            this.desiredDistance -= Input.GetAxis("Mouse Y") * Time.deltaTime * (float)this.zoomRate * 0.125f * Mathf.Abs(this.desiredDistance);
        }
        else if (Input.GetMouseButton(0) && Input.GetKey(KeyCode.LeftAlt))
        {
            this.xDeg += Input.GetAxis("Mouse X") * this.xSpeed * 0.02f;
            this.yDeg -= Input.GetAxis("Mouse Y") * this.ySpeed * 0.02f;
            this.yDeg = MaxCamera.ClampAngle(this.yDeg, (float)this.yMinLimit, (float)this.yMaxLimit);
            this.desiredRotation = Quaternion.Euler(this.yDeg, this.xDeg, 0f);
            this.currentRotation = base.transform.rotation;
            this.rotation = Quaternion.Lerp(this.currentRotation, this.desiredRotation, Time.deltaTime * this.zoomDampening);
            base.transform.rotation = this.rotation;
        }
        this.desiredDistance -= Input.GetAxis("Mouse ScrollWheel") * Time.deltaTime * (float)this.zoomRate * Mathf.Abs(this.desiredDistance);
        this.desiredDistance = Mathf.Clamp(this.desiredDistance, this.minDistance, this.maxDistance);
        this.currentDistance = Mathf.Lerp(this.currentDistance, this.desiredDistance, Time.deltaTime * this.zoomDampening);
        this.position = this.target.position - (this.rotation * Vectors.forward * this.currentDistance + this.targetOffset);
        base.transform.position = this.position;
    }

19 Source : UIButtonKeys.cs
with GNU General Public License v3.0
from aelariane

private void OnKey(KeyCode key)
    {
        if (base.enabled && NGUITools.GetActive(base.gameObject))
        {
            switch (key)
            {
                case KeyCode.UpArrow:
                    if (this.selectOnUp != null)
                    {
                        UICamera.selectedObject = this.selectOnUp.gameObject;
                    }
                    break;

                case KeyCode.DownArrow:
                    if (this.selectOnDown != null)
                    {
                        UICamera.selectedObject = this.selectOnDown.gameObject;
                    }
                    break;

                case KeyCode.RightArrow:
                    if (this.selectOnRight != null)
                    {
                        UICamera.selectedObject = this.selectOnRight.gameObject;
                    }
                    break;

                case KeyCode.LeftArrow:
                    if (this.selectOnLeft != null)
                    {
                        UICamera.selectedObject = this.selectOnLeft.gameObject;
                    }
                    break;

                default:
                    if (key == KeyCode.Tab)
                    {
                        if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
                        {
                            if (this.selectOnLeft != null)
                            {
                                UICamera.selectedObject = this.selectOnLeft.gameObject;
                            }
                            else if (this.selectOnUp != null)
                            {
                                UICamera.selectedObject = this.selectOnUp.gameObject;
                            }
                            else if (this.selectOnDown != null)
                            {
                                UICamera.selectedObject = this.selectOnDown.gameObject;
                            }
                            else if (this.selectOnRight != null)
                            {
                                UICamera.selectedObject = this.selectOnRight.gameObject;
                            }
                        }
                        else if (this.selectOnRight != null)
                        {
                            UICamera.selectedObject = this.selectOnRight.gameObject;
                        }
                        else if (this.selectOnDown != null)
                        {
                            UICamera.selectedObject = this.selectOnDown.gameObject;
                        }
                        else if (this.selectOnUp != null)
                        {
                            UICamera.selectedObject = this.selectOnUp.gameObject;
                        }
                        else if (this.selectOnLeft != null)
                        {
                            UICamera.selectedObject = this.selectOnLeft.gameObject;
                        }
                    }
                    break;
            }
        }
    }

19 Source : custom_inputs.cs
with GNU General Public License v3.0
from aelariane

private void drawButtons1()
    {
        float num = this.Boxes_Y;
        float x = Input.mousePosition.x;
        float y = Input.mousePosition.y;
        Vector3 point = GUI.matrix.inverse.MultiplyPoint3x4(new Vector3(x, (float)Screen.height - y, 1f));
        GUI.skin = this.OurSkin;
        GUI.Box(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), string.Empty);
        GUI.Box(new Rect(60f, 60f, (float)(Screen.width - 120), (float)(Screen.height - 120)), string.Empty, "window");
        GUI.Label(new Rect(this.DescriptionBox_X, num - 10f, (float)this.DescriptionSize, this.buttonHeight), "name", "textfield");
        GUI.Label(new Rect(this.InputBox1_X, num - 10f, (float)this.DescriptionSize, this.buttonHeight), "input", "textfield");
        GUI.Label(new Rect(this.InputBox2_X, num - 10f, (float)this.DescriptionSize, this.buttonHeight), "alt input", "textfield");
        for (int i = 0; i < this.DescriptionString.Length; i++)
        {
            num += this.BoxesMargin_Y;
            GUI.Label(new Rect(this.DescriptionBox_X, num, (float)this.DescriptionSize, this.buttonHeight), this.DescriptionString[i], "box");
            Rect position = new Rect(this.InputBox1_X, num, (float)this.buttonSize, this.buttonHeight);
            GUI.Button(position, this.inputString[i]);
            if (!this.joystickActive[i] && this.inputKey[i] == KeyCode.None)
            {
                this.joystickString[i] = "#";
            }
            if (this.inputBool[i])
            {
                GUI.Toggle(position, true, string.Empty, this.OurSkin.button);
            }
            if (position.Contains(point) && Input.GetMouseButtonUp(0) && !this.tempbool)
            {
                this.tempbool = true;
                this.inputBool[i] = true;
                this.lastInterval = Time.realtimeSinceStartup;
            }
            if (GUI.Button(new Rect(this.resetbuttonX, this.resetbuttonLocY, (float)this.buttonSize, this.buttonHeight), this.resetbuttonText) && Input.GetMouseButtonUp(0))
            {
                PlayerPrefs.DeleteAll();
                this.reset2defaults();
                this.loadConfig();
                this.saveInputs();
            }
            if (Event.current.type == EventType.KeyDown && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = Event.current.keyCode;
                this.inputBool[i] = false;
                this.inputString[i] = this.inputKey[i].ToString();
                this.tempbool = false;
                this.joystickActive[i] = false;
                this.joystickString[i] = "#";
                this.saveInputs();
                this.checDoubles(this.inputKey[i], i, 1);
            }
            if (this.mouseButtonsOn)
            {
                int num2 = 323;
                for (int j = 0; j < 6; j++)
                {
                    if (Input.GetMouseButton(j) && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
                    {
                        num2 += j;
                        this.inputKey[i] = (KeyCode)num2;
                        this.inputBool[i] = false;
                        this.inputString[i] = this.inputKey[i].ToString();
                        this.joystickActive[i] = false;
                        this.joystickString[i] = "#";
                        this.saveInputs();
                        this.checDoubles(this.inputKey[i], i, 1);
                    }
                }
            }
            for (int k = 350; k < 409; k++)
            {
                if (Input.GetKey((KeyCode)k) && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey[i] = (KeyCode)k;
                    this.inputBool[i] = false;
                    this.inputString[i] = this.inputKey[i].ToString();
                    this.tempbool = false;
                    this.joystickActive[i] = false;
                    this.joystickString[i] = "#";
                    this.saveInputs();
                    this.checDoubles(this.inputKey[i], i, 1);
                }
            }
            if (this.mouseAxisOn)
            {
                if (Input.GetAxis("MouseUp") == 1f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey[i] = KeyCode.None;
                    this.inputBool[i] = false;
                    this.joystickActive[i] = true;
                    this.joystickString[i] = "MouseUp";
                    this.inputString[i] = "Mouse Up";
                    this.tempbool = false;
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString[i], i, 1);
                }
                if (Input.GetAxis("MouseDown") == 1f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey[i] = KeyCode.None;
                    this.inputBool[i] = false;
                    this.joystickActive[i] = true;
                    this.joystickString[i] = "MouseDown";
                    this.inputString[i] = "Mouse Down";
                    this.tempbool = false;
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString[i], i, 1);
                }
                if (Input.GetAxis("MouseLeft") == 1f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey[i] = KeyCode.None;
                    this.inputBool[i] = false;
                    this.joystickActive[i] = true;
                    this.joystickString[i] = "MouseLeft";
                    this.inputBool[i] = false;
                    this.inputString[i] = "Mouse Left";
                    this.tempbool = false;
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString[i], i, 1);
                }
                if (Input.GetAxis("MouseRight") == 1f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey[i] = KeyCode.None;
                    this.inputBool[i] = false;
                    this.joystickActive[i] = true;
                    this.joystickString[i] = "MouseRight";
                    this.inputString[i] = "Mouse Right";
                    this.tempbool = false;
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString[i], i, 1);
                }
            }
            if (this.mouseButtonsOn)
            {
                if (Input.GetAxis("MouseScrollUp") > 0f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey[i] = KeyCode.None;
                    this.inputBool[i] = false;
                    this.joystickActive[i] = true;
                    this.joystickString[i] = "MouseScrollUp";
                    this.inputBool[i] = false;
                    this.inputString[i] = "Mouse scroll Up";
                    this.tempbool = false;
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString[i], i, 1);
                }
                if (Input.GetAxis("MouseScrollDown") > 0f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey[i] = KeyCode.None;
                    this.inputBool[i] = false;
                    this.joystickActive[i] = true;
                    this.joystickString[i] = "MouseScrollDown";
                    this.inputBool[i] = false;
                    this.inputString[i] = "Mouse scroll Down";
                    this.tempbool = false;
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString[i], i, 1);
                }
            }
            if (Input.GetAxis("JoystickUp") > 0.5f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "JoystickUp";
                this.inputString[i] = "Joystick Up";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("JoystickDown") > 0.5f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "JoystickDown";
                this.inputString[i] = "Joystick Down";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("JoystickLeft") > 0.5f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "JoystickLeft";
                this.inputString[i] = "Joystick Left";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("JoystickRight") > 0.5f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "JoystickRight";
                this.inputString[i] = "Joystick Right";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_3a") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_3a";
                this.inputString[i] = "Joystick Axis 3 +";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_3b") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_3b";
                this.inputString[i] = "Joystick Axis 3 -";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_4a") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_4a";
                this.inputString[i] = "Joystick Axis 4 +";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_4b") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_4b";
                this.inputString[i] = "Joystick Axis 4 -";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_5b") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_5b";
                this.inputString[i] = "Joystick Axis 5 -";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_6b") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_6b";
                this.inputString[i] = "Joystick Axis 6 -";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_7a") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_7a";
                this.inputString[i] = "Joystick Axis 7 +";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_7b") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_7b";
                this.inputString[i] = "Joystick Axis 7 -";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_8a") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_8a";
                this.inputString[i] = "Joystick Axis 8 +";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_8b") > 0.8f && this.inputBool[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_8b";
                this.inputString[i] = "Joystick Axis 8 -";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
        }
    }

19 Source : FengCustomInputs.cs
with GNU General Public License v3.0
from aelariane

private void drawButtons1()
    {
        bool flag = false;
        for (int i = 0; i < this.DescriptionString.Length; i++)
        {
            if (!this.joystickActive[i] && this.inputKey[i] == KeyCode.None)
            {
                this.joystickString[i] = "#";
            }
            bool flag2 = this.inputBool[i];
            if (Event.current.type == EventType.KeyDown && this.inputBool[i])
            {
                this.inputKey[i] = Event.current.keyCode;
                this.inputBool[i] = false;
                this.inputString[i] = this.inputKey[i].ToString();
                this.joystickActive[i] = false;
                this.joystickString[i] = "#";
                this.saveInputs();
                this.checDoubles(this.inputKey[i], i, 1);
            }
            if (this.mouseButtonsOn)
            {
                int num = 323;
                for (int j = 0; j < 6; j++)
                {
                    if (Input.GetMouseButton(j) && this.inputBool[i])
                    {
                        num += j;
                        this.inputKey[i] = (KeyCode)num;
                        this.inputBool[i] = false;
                        this.inputString[i] = this.inputKey[i].ToString();
                        this.joystickActive[i] = false;
                        this.joystickString[i] = "#";
                        this.saveInputs();
                        this.checDoubles(this.inputKey[i], i, 1);
                    }
                }
            }
            for (int k = 350; k < 409; k++)
            {
                if (Input.GetKey((KeyCode)k) && this.inputBool[i])
                {
                    this.inputKey[i] = (KeyCode)k;
                    this.inputBool[i] = false;
                    this.inputString[i] = this.inputKey[i].ToString();
                    this.joystickActive[i] = false;
                    this.joystickString[i] = "#";
                    this.saveInputs();
                    this.checDoubles(this.inputKey[i], i, 1);
                }
            }
            if (this.mouseAxisOn)
            {
                if (Input.GetAxis("MouseUp") == 1f && this.inputBool[i])
                {
                    this.inputKey[i] = KeyCode.None;
                    this.inputBool[i] = false;
                    this.joystickActive[i] = true;
                    this.joystickString[i] = "MouseUp";
                    this.inputString[i] = "Mouse Up";
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString[i], i, 1);
                }
                if (Input.GetAxis("MouseDown") == 1f && this.inputBool[i])
                {
                    this.inputKey[i] = KeyCode.None;
                    this.inputBool[i] = false;
                    this.joystickActive[i] = true;
                    this.joystickString[i] = "MouseDown";
                    this.inputString[i] = "Mouse Down";
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString[i], i, 1);
                }
                if (Input.GetAxis("MouseLeft") == 1f && this.inputBool[i])
                {
                    this.inputKey[i] = KeyCode.None;
                    this.inputBool[i] = false;
                    this.joystickActive[i] = true;
                    this.joystickString[i] = "MouseLeft";
                    this.inputBool[i] = false;
                    this.inputString[i] = "Mouse Left";
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString[i], i, 1);
                }
                if (Input.GetAxis("MouseRight") == 1f && this.inputBool[i])
                {
                    this.inputKey[i] = KeyCode.None;
                    this.inputBool[i] = false;
                    this.joystickActive[i] = true;
                    this.joystickString[i] = "MouseRight";
                    this.inputString[i] = "Mouse Right";
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString[i], i, 1);
                }
            }
            if (this.mouseButtonsOn)
            {
                if (Input.GetAxis("MouseScrollUp") > 0f && this.inputBool[i])
                {
                    this.inputKey[i] = KeyCode.None;
                    this.inputBool[i] = false;
                    this.joystickActive[i] = true;
                    this.joystickString[i] = "MouseScrollUp";
                    this.inputBool[i] = false;
                    this.inputString[i] = "Mouse scroll Up";
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString[i], i, 1);
                }
                if (Input.GetAxis("MouseScrollDown") > 0f && this.inputBool[i])
                {
                    this.inputKey[i] = KeyCode.None;
                    this.inputBool[i] = false;
                    this.joystickActive[i] = true;
                    this.joystickString[i] = "MouseScrollDown";
                    this.inputBool[i] = false;
                    this.inputString[i] = "Mouse scroll Down";
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString[i], i, 1);
                }
            }
            if (Input.GetAxis("JoystickUp") > 0.5f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "JoystickUp";
                this.inputString[i] = "Joystick Up";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("JoystickDown") > 0.5f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "JoystickDown";
                this.inputString[i] = "Joystick Down";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("JoystickLeft") > 0.5f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "JoystickLeft";
                this.inputString[i] = "Joystick Left";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("JoystickRight") > 0.5f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "JoystickRight";
                this.inputString[i] = "Joystick Right";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_3a") > 0.8f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_3a";
                this.inputString[i] = "Joystick Axis 3 +";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_3b") > 0.8f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_3b";
                this.inputString[i] = "Joystick Axis 3 -";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_4a") > 0.8f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_4a";
                this.inputString[i] = "Joystick Axis 4 +";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_4b") > 0.8f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_4b";
                this.inputString[i] = "Joystick Axis 4 -";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_5b") > 0.8f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_5b";
                this.inputString[i] = "Joystick Axis 5 -";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_6b") > 0.8f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_6b";
                this.inputString[i] = "Joystick Axis 6 -";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_7a") > 0.8f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_7a";
                this.inputString[i] = "Joystick Axis 7 +";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_7b") > 0.8f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_7b";
                this.inputString[i] = "Joystick Axis 7 -";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_8a") > 0.8f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_8a";
                this.inputString[i] = "Joystick Axis 8 +";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (Input.GetAxis("Joystick_8b") > 0.8f && this.inputBool[i])
            {
                this.inputKey[i] = KeyCode.None;
                this.inputBool[i] = false;
                this.joystickActive[i] = true;
                this.joystickString[i] = "Joystick_8b";
                this.inputString[i] = "Joystick Axis 8 -";
                this.saveInputs();
                this.checDoubleAxis(this.joystickString[i], i, 1);
            }
            if (flag2 != this.inputBool[i])
            {
                flag = true;
            }
        }
        if (flag)
        {
            this.showKeyMap();
        }
    }

19 Source : custom_inputs.cs
with GNU General Public License v3.0
from aelariane

private void drawButtons2()
    {
        float num = this.Boxes_Y;
        float x = Input.mousePosition.x;
        float y = Input.mousePosition.y;
        Vector3 point = GUI.matrix.inverse.MultiplyPoint3x4(new Vector3(x, (float)Screen.height - y, 1f));
        GUI.skin = this.OurSkin;
        for (int i = 0; i < this.DescriptionString.Length; i++)
        {
            num += this.BoxesMargin_Y;
            Rect position = new Rect(this.InputBox2_X, num, (float)this.buttonSize, this.buttonHeight);
            GUI.Button(position, this.inputString2[i]);
            if (!this.joystickActive2[i] && this.inputKey2[i] == KeyCode.None)
            {
                this.joystickString2[i] = "#";
            }
            if (this.inputBool2[i])
            {
                GUI.Toggle(position, true, string.Empty, this.OurSkin.button);
            }
            if (position.Contains(point) && Input.GetMouseButtonUp(0) && !this.tempbool)
            {
                this.tempbool = true;
                this.inputBool2[i] = true;
                this.lastInterval = Time.realtimeSinceStartup;
            }
            if (Event.current.type == EventType.KeyDown && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = Event.current.keyCode;
                this.inputBool2[i] = false;
                this.inputString2[i] = this.inputKey2[i].ToString();
                this.tempbool = false;
                this.joystickActive2[i] = false;
                this.joystickString2[i] = "#";
                this.saveInputs();
                this.checDoubles(this.inputKey2[i], i, 2);
            }
            if (this.mouseButtonsOn)
            {
                int num2 = 323;
                for (int j = 0; j < 6; j++)
                {
                    if (Input.GetMouseButton(j) && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
                    {
                        num2 += j;
                        this.inputKey2[i] = (KeyCode)num2;
                        this.inputBool2[i] = false;
                        this.inputString2[i] = this.inputKey2[i].ToString();
                        this.joystickActive2[i] = false;
                        this.joystickString2[i] = "#";
                        this.saveInputs();
                        this.checDoubles(this.inputKey2[i], i, 2);
                    }
                }
            }
            for (int k = 350; k < 409; k++)
            {
                if (Input.GetKey((KeyCode)k) && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey2[i] = (KeyCode)k;
                    this.inputBool2[i] = false;
                    this.inputString2[i] = this.inputKey2[i].ToString();
                    this.tempbool = false;
                    this.joystickActive2[i] = false;
                    this.joystickString2[i] = "#";
                    this.saveInputs();
                    this.checDoubles(this.inputKey2[i], i, 2);
                }
            }
            if (this.mouseAxisOn)
            {
                if (Input.GetAxis("MouseUp") == 1f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey2[i] = KeyCode.None;
                    this.inputBool2[i] = false;
                    this.joystickActive2[i] = true;
                    this.joystickString2[i] = "MouseUp";
                    this.inputString2[i] = "Mouse Up";
                    this.tempbool = false;
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString2[i], i, 2);
                }
                if (Input.GetAxis("MouseDown") == 1f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey2[i] = KeyCode.None;
                    this.inputBool2[i] = false;
                    this.joystickActive2[i] = true;
                    this.joystickString2[i] = "MouseDown";
                    this.inputString2[i] = "Mouse Down";
                    this.tempbool = false;
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString2[i], i, 2);
                }
                if (Input.GetAxis("MouseLeft") == 1f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey2[i] = KeyCode.None;
                    this.inputBool2[i] = false;
                    this.joystickActive2[i] = true;
                    this.joystickString2[i] = "MouseLeft";
                    this.inputBool2[i] = false;
                    this.inputString2[i] = "Mouse Left";
                    this.tempbool = false;
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString2[i], i, 2);
                }
                if (Input.GetAxis("MouseRight") == 1f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey2[i] = KeyCode.None;
                    this.inputBool2[i] = false;
                    this.joystickActive2[i] = true;
                    this.joystickString2[i] = "MouseRight";
                    this.inputString2[i] = "Mouse Right";
                    this.tempbool = false;
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString2[i], i, 2);
                }
            }
            if (this.mouseButtonsOn)
            {
                if (Input.GetAxis("MouseScrollUp") > 0f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey2[i] = KeyCode.None;
                    this.inputBool2[i] = false;
                    this.joystickActive2[i] = true;
                    this.joystickString2[i] = "MouseScrollUp";
                    this.inputBool2[i] = false;
                    this.inputString2[i] = "Mouse scroll Up";
                    this.tempbool = false;
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString2[i], i, 2);
                }
                if (Input.GetAxis("MouseScrollDown") > 0f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
                {
                    this.inputKey2[i] = KeyCode.None;
                    this.inputBool2[i] = false;
                    this.joystickActive2[i] = true;
                    this.joystickString2[i] = "MouseScrollDown";
                    this.inputBool2[i] = false;
                    this.inputString2[i] = "Mouse scroll Down";
                    this.tempbool = false;
                    this.saveInputs();
                    this.checDoubleAxis(this.joystickString2[i], i, 2);
                }
            }
            if (Input.GetAxis("JoystickUp") > 0.5f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "JoystickUp";
                this.inputString2[i] = "Joystick Up";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("JoystickDown") > 0.5f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "JoystickDown";
                this.inputString2[i] = "Joystick Down";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("JoystickLeft") > 0.5f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "JoystickLeft";
                this.inputBool2[i] = false;
                this.inputString2[i] = "Joystick Left";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("JoystickRight") > 0.5f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "JoystickRight";
                this.inputString2[i] = "Joystick Right";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("Joystick_3a") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "Joystick_3a";
                this.inputString2[i] = "Joystick Axis 3 +";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("Joystick_3b") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "Joystick_3b";
                this.inputString2[i] = "Joystick Axis 3 -";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("Joystick_4a") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "Joystick_4a";
                this.inputString2[i] = "Joystick Axis 4 +";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("Joystick_4b") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "Joystick_4b";
                this.inputString2[i] = "Joystick Axis 4 -";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("Joystick_5b") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "Joystick_5b";
                this.inputString2[i] = "Joystick Axis 5 -";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("Joystick_6b") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "Joystick_6b";
                this.inputString2[i] = "Joystick Axis 6 -";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("Joystick_7a") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "Joystick_7a";
                this.inputString2[i] = "Joystick Axis 7 +";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("Joystick_7b") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "Joystick_7b";
                this.inputString2[i] = "Joystick Axis 7 -";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("Joystick_8a") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "Joystick_8a";
                this.inputString2[i] = "Joystick Axis 8 +";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
            if (Input.GetAxis("Joystick_8b") > 0.8f && this.inputBool2[i] && Event.current.keyCode != KeyCode.Escape)
            {
                this.inputKey2[i] = KeyCode.None;
                this.inputBool2[i] = false;
                this.joystickActive2[i] = true;
                this.joystickString2[i] = "Joystick_8b";
                this.inputString2[i] = "Joystick Axis 8 -";
                this.tempbool = false;
                this.saveInputs();
                this.checDoubleAxis(this.joystickString2[i], i, 2);
            }
        }
    }

19 Source : UICamera.cs
with GNU General Public License v3.0
from aelariane

private void Update()
    {
        if (!Application.isPlaying || !this.handlesEvents)
        {
            return;
        }
        UICamera.current = this;
        if (this.useMouse || (this.useTouch && this.mIsEditor))
        {
            this.ProcessMouse();
        }
        if (this.useTouch)
        {
            this.ProcessTouches();
        }
        if (UICamera.onCustomInput != null)
        {
            UICamera.onCustomInput();
        }
        if (this.useMouse && UICamera.mSel != null && ((this.cancelKey0 != KeyCode.None && Input.GetKeyDown(this.cancelKey0)) || (this.cancelKey1 != KeyCode.None && Input.GetKeyDown(this.cancelKey1))))
        {
            UICamera.selectedObject = null;
        }
        if (UICamera.mSel != null)
        {
            string text = Input.inputString;
            if (this.useKeyboard && Input.GetKeyDown(KeyCode.Delete))
            {
                text += "\b";
            }
            if (text.Length > 0)
            {
                if (!this.stickyTooltip && this.mTooltip != null)
                {
                    this.ShowTooltip(false);
                }
                UICamera.Notify(UICamera.mSel, "OnInput", text);
            }
        }
        else
        {
            UICamera.inputHasFocus = false;
        }
        if (UICamera.mSel != null)
        {
            this.ProcessOthers();
        }
        if (this.useMouse && UICamera.mHover != null)
        {
            float axis = Input.GetAxis(this.scrollAxisName);
            if (axis != 0f)
            {
                UICamera.Notify(UICamera.mHover, "OnScroll", axis);
            }
            if (UICamera.showTooltips && this.mTooltipTime != 0f && (this.mTooltipTime < Time.realtimeSinceStartup || Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)))
            {
                this.mTooltip = UICamera.mHover;
                this.ShowTooltip(true);
            }
        }
        UICamera.current = null;
    }

19 Source : UIInput.cs
with GNU General Public License v3.0
from aelariane

private void Append(string input)
    {
        int i = 0;
        int length = input.Length;
        while (i < length)
        {
            char c = input[i];
            if (c == '\b')
            {
                if (this.mText.Length > 0)
                {
                    this.mText = this.mText.Substring(0, this.mText.Length - 1);
                    base.SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver);
                }
            }
            else if (c == '\r' || c == '\n')
            {
                if ((UICamera.current.submitKey0 == KeyCode.Return || UICamera.current.submitKey1 == KeyCode.Return) && (!this.label.multiLine || (!Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.RightControl))))
                {
                    UIInput.current = this;
                    if (this.onSubmit != null)
                    {
                        this.onSubmit(this.mText);
                    }
                    if (this.eventReceiver == null)
                    {
                        this.eventReceiver = base.gameObject;
                    }
                    this.eventReceiver.SendMessage(this.functionName, this.mText, SendMessageOptions.DontRequireReceiver);
                    UIInput.current = null;
                    this.selected = false;
                    return;
                }
                if (this.validator != null)
                {
                    c = this.validator(this.mText, c);
                }
                if (c != '\0')
                {
                    if (c == '\n' || c == '\r')
                    {
                        if (this.label.multiLine)
                        {
                            this.mText += "\n";
                        }
                    }
                    else
                    {
                        this.mText += c;
                    }
                    base.SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver);
                }
            }
            else if (c >= ' ')
            {
                if (this.validator != null)
                {
                    c = this.validator(this.mText, c);
                }
                if (c != '\0')
                {
                    this.mText += c;
                    base.SendMessage("OnInputChanged", this, SendMessageOptions.DontRequireReceiver);
                }
            }
            i++;
        }
        this.UpdateLabel();
    }

19 Source : UIInput.cs
with GNU General Public License v3.0
from aelariane

private void Update()
    {
        if (this.selected)
        {
            if (this.selectOnTab != null && Input.GetKeyDown(KeyCode.Tab))
            {
                UICamera.selectedObject = this.selectOnTab;
            }
            if (Input.GetKeyDown(KeyCode.V) && (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)))
            {
                this.Append(NGUITools.clipboard);
            }
            if (this.mLastIME != Input.compositionString)
            {
                this.mLastIME = Input.compositionString;
                this.UpdateLabel();
            }
        }
    }

19 Source : PhotonStatsGui.cs
with GNU General Public License v3.0
from aelariane

public void Update()
    {
        if (Input.GetKeyDown(KeyCode.Tab) && Input.GetKey(KeyCode.LeftShift))
        {
            this.statsWindowOn = !this.statsWindowOn;
            this.statsOn = true;
        }
    }

19 Source : Minimap.cs
with GNU General Public License v3.0
from aelariane

private void CheckUserInput()
    {
        if (Settings.Minimap.Value && !GameModes.MinimapDisable.Enabled)
        {
            if (this.minimapIsCreated)
            {
                if (InputManager.IsInputRebind((int)InputRebinds.MinimapToggle))
                {
                    this.SetEnabled(!this.isEnabled);
                    return;
                }
                if (isEnabled)
                {
                    if (InputManager.IsInputRebindHolding((int)InputRebinds.MinimapMax))
                    {
                        if (!this.maximized)
                        {
                            this.Maximize();
                        }
                    }
                    else
                    {
                        if (maximized)
                        {
                            this.Minimize();
                        }
                    }
                    if (this.maximized)
                    {
                        bool needRecapture = false;
                        if (InputManager.IsInputRebindHolding((int)InputRebinds.MinimapReset))
                        {
                            if (this.initialPreset != null)
                            {
                                this.ManualSetCameraProperties(this.lastUsedCamera, this.initialPreset.center, this.initialPreset.orthographicSize);
                            }
                            else
                            {
                                this.AutomaticSetCameraProperties(this.lastUsedCamera);
                            }
                            needRecapture = true;
                        }
                        else
                        {
                            float num = Input.GetAxis("Mouse ScrollWheel");
                            bool flag11 = num != 0f;
                            if (flag11)
                            {
                                if (Input.GetKey(KeyCode.LeftShift))
                                {
                                    num *= 3f;
                                }
                                this.lastMinimapOrthoSize = Mathf.Max(this.lastMinimapOrthoSize + num, 1f);
                                needRecapture = true;
                            }
                            if (Input.GetKey(KeyCode.UpArrow))
                            {
                                float num2 = Time.deltaTime * ((Input.GetKey(KeyCode.LeftShift) ? 2f : 0.75f) * this.lastMinimapOrthoSize);
                                this.lastMinimapCenter.z = this.lastMinimapCenter.z + num2;
                                needRecapture = true;
                            }
                            else
                            {
                                if (Input.GetKey(KeyCode.DownArrow))
                                {
                                    float num2 = Time.deltaTime * ((Input.GetKey(KeyCode.LeftShift) ? 2f : 0.75f) * this.lastMinimapOrthoSize);
                                    this.lastMinimapCenter.z = this.lastMinimapCenter.z - num2;
                                    needRecapture = true;
                                }
                            }
                            if (Input.GetKey(KeyCode.RightArrow))
                            {
                                float num2 = Time.deltaTime * ((Input.GetKey(KeyCode.LeftShift) ? 2f : 0.75f) * this.lastMinimapOrthoSize);
                                this.lastMinimapCenter.x = this.lastMinimapCenter.x + num2;
                                needRecapture = true;
                            }
                            else
                            {
                                if (Input.GetKey(KeyCode.LeftArrow))
                                {
                                    float num2 = Time.deltaTime * ((Input.GetKey(KeyCode.LeftShift) ? 2f : 0.75f) * this.lastMinimapOrthoSize);
                                    this.lastMinimapCenter.x = this.lastMinimapCenter.x - num2;
                                    needRecapture = true;
                                }
                            }
                        }
                        if (needRecapture)
                        {
                            this.RecaptureMinimap(this.lastUsedCamera, this.lastMinimapCenter, this.lastMinimapOrthoSize);
                        }
                    }
                }
            }
        }
        else
        {
            if (this.isEnabled)
            {
                this.SetEnabled(false);
            }
        }
    }

19 Source : InputReceiverBasic.cs
with GNU Lesser General Public License v3.0
from ApexGameTools

private void Movement()
        {
            bool moveInput = false;
            if (this.rightClickSupported)
            {
                moveInput = Input.GetMouseButtonUp(1);
            }
            else
            {
                moveInput = Input.GetMouseButtonUp(0) && Input.GetKey(KeyCode.LeftControl);
            }

            if (moveInput)
            {
                var setWaypoint = Input.GetKey(KeyCode.LeftShift);

                _inputController.SetDestination(Input.mousePosition, setWaypoint);
            }
        }

19 Source : InputReceiverBasic.cs
with GNU Lesser General Public License v3.0
from ApexGameTools

private void Selection()
        {
            if (_selectRectangle == null || (!this.rightClickSupported && Input.GetKey(KeyCode.LeftControl)))
            {
                return;
            }

            var selectAppend = Input.GetKey(KeyCode.LeftShift);

            if (Input.GetMouseButtonDown(0))
            {
                _lastSelectDownPos = Input.mousePosition;
                _selectRectangle.StartSelect();
                return;
            }

            if (Input.GetMouseButton(0))
            {
                if (_selectRectangle.Hreplacedelection(_lastSelectDownPos, Input.mousePosition))
                {
                    _inputController.SelectUnitRangeTentative(_lastSelectDownPos, Input.mousePosition, selectAppend);
                }

                return;
            }

            if (Input.GetMouseButtonUp(0))
            {
                if (_selectRectangle.Hreplacedelection(_lastSelectDownPos, Input.mousePosition))
                {
                    _inputController.SelectUnitRange(_lastSelectDownPos, Input.mousePosition, selectAppend);
                }
                else
                {
                    _inputController.SelectUnit(_lastSelectDownPos, selectAppend);
                }

                _selectRectangle.EndSelect();
                return;
            }

            var selectGroup = Input.GetKey(KeyCode.LeftShift);
            var replacedignGroup = Input.GetKey(KeyCode.LeftAlt);

            for (int index = 0; index < 5; index++)
            {
                var code = KeyCode.Alpha1 + index;
                if (Input.GetKeyUp(code))
                {
                    if (selectGroup)
                    {
                        _inputController.SelectGroup(index);
                    }
                    else if (replacedignGroup)
                    {
                        _inputController.replacedignGroup(index);
                    }
                    else
                    {
                        _inputController.SelectUnit(index, false);
                    }
                }
            }
        }

19 Source : DebugChooseFormationComponent.cs
with GNU Lesser General Public License v3.0
from ApexGameTools

private void OnGUI()
        {
            var selected = GameServices.gameStateManager.unitSelection.selected;
            if (selected.groupCount <= 0 || selected.memberCount <= 0)
            {
                return;
            }

            if (guiSkin != null && GUI.skin != guiSkin)
            {
                GUI.skin = guiSkin;
            }

            float width = 150f;
            float height = Screen.height * 0.9f;
            float buttonHeight = height / 8f;

            GUILayout.BeginArea(new Rect(5f, (Screen.height / 2f) - (height / 2f), width, height));
            GUILayout.BeginVertical();

            if (GUILayout.Button("Circle Formation (F1)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKeyUp(KeyCode.F1))
            {
                SetFormation(new FormationEllipsoid(formationSpacing));
            }
            else if (GUILayout.Button("Grid Formation (F2)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKeyUp(KeyCode.F2))
            {
                SetFormation(new FormationGrid(formationSpacing));
            }
            else if (GUILayout.Button("Spiral Formation (F3)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKeyUp(KeyCode.F3))
            {
                SetFormation(new FormationSpiral(formationSpacing));
            }
            else if (GUILayout.Button("Wing Formation (F4)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKeyUp(KeyCode.F4))
            {
                SetFormation(new FormationWing(formationSpacing));
            }
            else if (GUILayout.Button("Row Formation (F5)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKeyUp(KeyCode.F5))
            {
                SetFormation(new FormationRow(formationSpacing));
            }
            else if (GUILayout.Button("Line Formation (F6)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKeyUp(KeyCode.F6))
            {
                SetFormation(new FormationLine(formationSpacing));
            }
            else if (GUILayout.Button("No Formation (F7)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKey(KeyCode.F7))
            {
                SetFormation(null);
            }

            GUILayout.EndVertical();
            GUILayout.EndArea();
        }

19 Source : RotacionaVela.cs
with MIT License
from Arcaedion

void Update()
    {
        if (Input.GetKey(KeyCode.E))
        {
            Rotaciona(0, 1, 0);
        }else if (Input.GetKey(KeyCode.Q))
        {
            Rotaciona(0, -1, 0);
        }
    }

19 Source : Splash.cs
with MIT License
from Aroueterra

void Update()
    {
        if (Input.GetKey(KeyCode.Escape))
        {
            Application.Quit();
        }
    }

19 Source : AugmentedFacesExampleController.cs
with GNU General Public License v3.0
from ARPOISE

private void _UpdateApplicationLifecycle()
        {
            // Exit the app when the 'back' button is pressed.
            if (Input.GetKey(KeyCode.Escape))
            {
                Application.Quit();
            }

            if (m_IsQuitting)
            {
                return;
            }

            // Quit if ARCore was unable to connect and give Unity some time for the toast to appear.
            if (Session.Status == SessionStatus.ErrorPermissionNotGranted)
            {
                _ShowAndroidToastMessage("Camera permission is needed to run this application.");
                m_IsQuitting = true;
                Invoke("_DoQuit", 0.5f);
            }
            else if (Session.Status.IsError())
            {
                _ShowAndroidToastMessage("ARCore encountered a problem connecting.  Please start the app again.");
                m_IsQuitting = true;
                Invoke("_DoQuit", 0.5f);
            }
        }

19 Source : CloudAnchorsExampleController.cs
with GNU General Public License v3.0
from ARPOISE

private void _UpdateApplicationLifecycle()
        {
            // Exit the app when the 'back' button is pressed.
            if (Input.GetKey(KeyCode.Escape))
            {
                Application.Quit();
            }

            var sleepTimeout = SleepTimeout.NeverSleep;

#if !UNITY_IOS
            // Only allow the screen to sleep when not tracking.
            if (Session.Status != SessionStatus.Tracking)
            {
                const int lostTrackingSleepTimeout = 15;
                sleepTimeout = lostTrackingSleepTimeout;
            }
#endif

            Screen.sleepTimeout = sleepTimeout;

            if (m_IsQuitting)
            {
                return;
            }

            // Quit if ARCore was unable to connect and give Unity some time for the toast to appear.
            if (Session.Status == SessionStatus.ErrorPermissionNotGranted)
            {
                _ShowAndroidToastMessage("Camera permission is needed to run this application.");
                m_IsQuitting = true;
                Invoke("_DoQuit", 0.5f);
            }
            else if (Session.Status.IsError())
            {
                _ShowAndroidToastMessage("ARCore encountered a problem connecting.  Please start the app again.");
                m_IsQuitting = true;
                Invoke("_DoQuit", 0.5f);
            }
        }

19 Source : ComputerVisionController.cs
with GNU General Public License v3.0
from ARPOISE

public void Update()
        {
            if (Input.GetKey(KeyCode.Escape))
            {
                Application.Quit();
            }

            _QuitOnConnectionErrors();

            // Change the CPU resolution checkbox visibility.
            LowResConfigToggle.gameObject.SetActive(EdgeDetectionBackgroundImage.enabled);
            HighResConfigToggle.gameObject.SetActive(EdgeDetectionBackgroundImage.enabled);
            m_ImageTextureToggleText.text = EdgeDetectionBackgroundImage.enabled ?
                    "Switch to GPU Texture" : "Switch to CPU Image";

            if (!Session.Status.IsValid())
            {
                return;
            }

            using (var image = Frame.CameraImage.AcquireCameraImageBytes())
            {
                if (!image.IsAvailable)
                {
                    return;
                }

                _OnImageAvailable(image.Width, image.Height, image.YRowStride, image.Y, 0);
            }

            var cameraIntrinsics = EdgeDetectionBackgroundImage.enabled
                ? Frame.CameraImage.ImageIntrinsics : Frame.CameraImage.TextureIntrinsics;
            string intrinsicsType = EdgeDetectionBackgroundImage.enabled ? "CPU Image" : "GPU Texture";
            CameraIntrinsicsOutput.text = _CameraIntrinsicsToString(cameraIntrinsics, intrinsicsType);
        }

19 Source : ObjectManipulationController.cs
with GNU General Public License v3.0
from ARPOISE

private void _UpdateApplicationLifecycle()
        {
            // Exit the app when the 'back' button is pressed.
            if (Input.GetKey(KeyCode.Escape))
            {
                Application.Quit();
            }

            // Only allow the screen to sleep when not tracking.
            if (Session.Status != SessionStatus.Tracking)
            {
                const int lostTrackingSleepTimeout = 15;
                Screen.sleepTimeout = lostTrackingSleepTimeout;
            }
            else
            {
                Screen.sleepTimeout = SleepTimeout.NeverSleep;
            }

            if (m_IsQuitting)
            {
                return;
            }

            // Quit if ARCore was unable to connect and give Unity some time for the toast to appear.
            if (Session.Status == SessionStatus.ErrorPermissionNotGranted)
            {
                _ShowAndroidToastMessage("Camera permission is needed to run this application.");
                m_IsQuitting = true;
                Invoke("_DoQuit", 0.5f);
            }
            else if (Session.Status.IsError())
            {
                _ShowAndroidToastMessage("ARCore encountered a problem connecting.  Please start the app again.");
                m_IsQuitting = true;
                Invoke("_DoQuit", 0.5f);
            }
        }

19 Source : InstantPreviewInput.cs
with GNU General Public License v3.0
from ARPOISE

public static bool GetKey(KeyCode keyCode)
        {
            return Input.GetKey(keyCode);
        }

19 Source : AugmentedImageExampleController.cs
with MIT License
from ashishgopalhattimare

public void Update()
        {
            // Exit the app when the 'back' button is pressed.
            if (Input.GetKey(KeyCode.Escape))
            {
                Application.Quit();
            }

            // Check that motion tracking is tracking.
            if (Session.Status != SessionStatus.Tracking)
            {
                return;
            }

            // Get updated augmented images for this frame.
            Session.GetTrackables<AugmentedImage>(m_TempAugmentedImages, TrackableQueryFilter.Updated);

            // Create visualizers and anchors for updated augmented images that are tracking and do not previously
            // have a visualizer. Remove visualizers for stopped images.
            foreach (var image in m_TempAugmentedImages)
            {
                AugmentedImageVisualizer visualizer = null;
                m_Visualizers.TryGetValue(image.DatabaseIndex, out visualizer);
                if (image.TrackingState == TrackingState.Tracking && visualizer == null)
                {
                    // Create an anchor to ensure that ARCore keeps tracking this augmented image.
                    Anchor anchor = image.CreateAnchor(image.CenterPose);
                    visualizer = (AugmentedImageVisualizer)Instantiate(AugmentedImageVisualizerPrefab, anchor.transform);
                    visualizer.Image = image;
                    m_Visualizers.Add(image.DatabaseIndex, visualizer);
                }
                else if (image.TrackingState == TrackingState.Stopped && visualizer != null)
                {
                    m_Visualizers.Remove(image.DatabaseIndex);
                    GameObject.Destroy(visualizer.gameObject);
                }
            }

            // Show the fit-to-scan overlay if there are no images that are Tracking.
            foreach (var visualizer in m_Visualizers.Values)
            {
                if (visualizer.Image.TrackingState == TrackingState.Tracking)
                {
                    FitToScanOverlay.SetActive(false);
                    return;
                }
            }

            FitToScanOverlay.SetActive(true);
        }

19 Source : InputOne.cs
with MIT License
from BelkinAndrey

void Update()
    {
        if (Input.GetKey(Code))
        {
            action = true;
            OnDownKey();
        }
        else 
        {
            if (action) 
            {
                action = false;
                OnUpKey();
            }
        }

        if ((Inspector == null) && (N != null)) N = null;
    }

19 Source : ManagerWorld.cs
with MIT License
from BelkinAndrey

void Update()
    {
        if (Input.GetKey(KeyCode.F1)) SetSignal(27);


        if (Input.GetKey(KeyCode.F2)) SetSignal(28);


        if (Input.GetKey(KeyCode.F3)) SetSignal(29);


        if (Input.GetKey(KeyCode.F4)) SetSignal(30);


        if (buld.OnOff) SetSignal(31);


        if (vise.OnOff) 
        {
            SetSignal(3);
            SetSignal(8);
        }
    }

19 Source : FKeyDown.cs
with MIT License
from BelkinAndrey

void Update () {

        if (Input.GetKey(code)) 
        {
            GetComponent<Text>().color = new Color32(255, 255, 0, 255);
        }
        else GetComponent<Text>().color = new Color32(255, 255, 255, 255);
	}

19 Source : KeyboardShortcut.cs
with GNU Lesser General Public License v3.0
from BepInEx

public bool IsPressed()
        {
            if (MainKey == KeyCode.None) return false;

            return Input.GetKey(MainKey) && ModifierKeyTest();
        }

19 Source : KeyboardShortcut.cs
with GNU Lesser General Public License v3.0
from BepInEx

private bool ModifierKeyTest() => AllKeyCodes.All(c =>
                                                    {
                                                        if (_allKeysLookup.Contains(c))
                                                        {
                                                            if (_allKeys[0] == c)
                                                                return true;
                                                            return Input.GetKey(c);
                                                        }
                                                        return !Input.GetKey(c);
                                                    });

19 Source : EnableFullScreenToggle.cs
with GNU General Public License v3.0
from BepInEx

internal void Update()
        {
            if ((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) && (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)))
                //This section of code is never reached on Unity builds where full screen can be toggled, it seems
                //We can safely toggle full screen without risk of it being toggled twice
                Screen.fullScreen = !Screen.fullScreen;
        }

19 Source : InputHotkeyBlock.cs
with GNU General Public License v3.0
from BepInEx

private static bool IsWhitelistedKey()
        {
            inhibit = true;
            var isWhitelistedKey = Input.GetKey(KeyCode.Tab);
            inhibit = false;
            return isWhitelistedKey;
        }

19 Source : KeyboardShortcut.cs
with GNU Lesser General Public License v2.1
from BepInEx

public bool IsPressed()
        {
            var mainKey = MainKey;
            if (mainKey == KeyCode.None) return false;

            return Input.GetKey(mainKey) && ModifierKeyTest();
        }

19 Source : KeyboardShortcut.cs
with GNU Lesser General Public License v2.1
from BepInEx

private bool ModifierKeyTest()
        {
            var allKeys = _allKeys;
            var mainKey = MainKey;

            var allModifiersPressed = allKeys.All(c => c == mainKey || Input.GetKey(c));
            if (!allModifiersPressed) return false;

            var noOtherModifiersPressed = _modifierBlockKeyCodes.All(c => !Input.GetKey(c) || allKeys.Contains(c));
            return noOtherModifiersPressed;
        }

19 Source : AoiManager.cs
with MIT License
from Bestpoker

void Update () {
        //切换实体 测试用 change control enreplacedy for test
        if (Input.GetKeyDown(KeyCode.Q))
        {
            playerEnreplacedy.isPlayer = false;
            playerEnreplacedy.mat.color = Color.white;

            playerIndex++;
            if (playerIndex >= enreplacedyCount)
            {
                playerIndex = 0;
            }
            playerEnreplacedy = allEnreplacedy[playerIndex];

            playerEnreplacedy.mat.color = Color.green;
            playerEnreplacedy.isPlayer = true;

            foreach (var item in allEnreplacedy)
            {
                if (item != playerEnreplacedy)
                {
                    item.mat.color = Color.white;
                }
            }
        }

        if (Input.GetKey(KeyCode.W))
        {
            playerEnreplacedy.go.transform.position += new Vector3(0, 0, 0.5f);
            RefreshAoi(playerEnreplacedy);
        }
        if (Input.GetKey(KeyCode.S))
        {
            playerEnreplacedy.go.transform.position += new Vector3(0, 0, -0.5f);
            RefreshAoi(playerEnreplacedy);
        }
        if (Input.GetKey(KeyCode.A))
        {
            playerEnreplacedy.go.transform.position += new Vector3(-0.5f, 0, 0);
            RefreshAoi(playerEnreplacedy);
        }
        if (Input.GetKey(KeyCode.D))
        {
            playerEnreplacedy.go.transform.position += new Vector3(0.5f, 0, 0);
            RefreshAoi(playerEnreplacedy);
        }

        for (int i = -100; i <= 99; i++)
        {
            if (i % AoiManager.FIELD == 0)
            {
                float space = AoiManager.FIELD / 2;
                Debug.DrawLine(new Vector3(i + space, 0, -100), new Vector3(i + space, 0, 100), Color.blue);
                Debug.DrawLine(new Vector3(-100, 0, i + space), new Vector3(100, 0, i + space), Color.blue);
            }
        }

        //让除了主角的所有物体行动 测试用
        for (int i = 0; i < allEnreplacedy.Length; i++)
        {
            if (allEnreplacedy[i] != playerEnreplacedy)
            {
                if (i % 2 == 0)
                {
                    allEnreplacedy[i].go.transform.position += new Vector3(allEnreplacedy[i].forward, 0, 0);
                    if (allEnreplacedy[i].go.transform.position.x >= 99 || allEnreplacedy[i].go.transform.position.x <= -99)
                    {
                        allEnreplacedy[i].forward = -allEnreplacedy[i].forward;
                    }
                    RefreshAoi(allEnreplacedy[i]);
                }
                else
                {
                    allEnreplacedy[i].go.transform.position += new Vector3(0, 0, allEnreplacedy[i].forward);
                    if (allEnreplacedy[i].go.transform.position.z >= 99 || allEnreplacedy[i].go.transform.position.z <= -99)
                    {
                        allEnreplacedy[i].forward = -allEnreplacedy[i].forward;
                    }
                    RefreshAoi(allEnreplacedy[i]);
                }
            }
        }

    }

19 Source : UnityEngine_InputWrap.cs
with MIT License
from bjfumac

[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int GetKey(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 1 && TypeChecker.CheckTypes<UnityEngine.KeyCode>(L, 1))
			{
				UnityEngine.KeyCode arg0 = (UnityEngine.KeyCode)ToLua.ToObject(L, 1);
				bool o = UnityEngine.Input.GetKey(arg0);
				LuaDLL.lua_pushboolean(L, o);
				return 1;
			}
			else if (count == 1 && TypeChecker.CheckTypes<string>(L, 1))
			{
				string arg0 = ToLua.ToString(L, 1);
				bool o = UnityEngine.Input.GetKey(arg0);
				LuaDLL.lua_pushboolean(L, o);
				return 1;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Input.GetKey");
			}
		}
		catch (Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}

19 Source : ClientBattleWorld_Tick.cs
with MIT License
from blueinsert

private void UpdatePlayerInputCodes()
        {
            for (int i = 0; i < m_playerInputMapConfigList.Count; i++)
            {
                var inputMapDic = m_playerInputMapConfigList[i];
                int keycode = 0;
                foreach (var inputPair in inputMapDic)
                {
                    if (Input.GetKey(inputPair.Value))
                    {
                        keycode = keycode | Utility.GetKeycode(inputPair.Key);
                    }
                }
                m_playerInputCodes[i] = keycode;
            }
        }

19 Source : InputModule.cs
with MIT License
from BlueMonk1107

public void Execute()
    {
        if (_keyEvent == null || _mouseEvent == null)
        {
            Debug.LogError("输入监听模块发送消息事件不能为空");
            return;
        }

        foreach (var pair in _keyCodeDic)
        {
            if (Input.GetKeyDown(pair.Key)) _keyEvent(pair.Key, InputState.DOWN);
            if (Input.GetKey(pair.Key)) _keyEvent(pair.Key, InputState.PREE);
            if (Input.GetKeyUp(pair.Key)) _keyEvent(pair.Key, InputState.UP);
        }

        foreach (var pair in _mouseDic)
        {
            if (Input.GetMouseButtonDown(pair.Key)) _mouseEvent(pair.Key, InputState.DOWN);
            if (Input.GetMouseButton(pair.Key)) _mouseEvent(pair.Key, InputState.PREE);
            if (Input.GetMouseButtonUp(pair.Key)) _mouseEvent(pair.Key, InputState.UP);
        }
    }

19 Source : InputService.cs
with MIT License
from BlueMonk1107

public bool InputPress(KeyCode code, InputButton button)
        {
            if (UnityEngine.Input.GetKey(code))
            {
                Input(button, InputState.PREE);
                _isPress = true;
                return true;
            }
            else
            {
                return false;
            }
        }

19 Source : Controller.cs
with MIT License
from BlueMonk1107

void Update()
    {
        if (Input.GetKey(KeyCode.A))
        {
            Move(Vector3.right);
        }

        if (Input.GetKey(KeyCode.D))
        {
            Move(Vector3.left);
        }

        if (Input.GetKey(KeyCode.S))
        {
            Move(Vector3.down);
        }

        if (Input.GetKey(KeyCode.W))
        {
            Move(Vector3.up);
        }

        if (Input.GetMouseButtonDown(0))
        {
            _bar.ChangeLife(-50);
        }

        if (Input.GetMouseButtonDown(1))
        {
            _bar.ChangeLife(50);
        }
    }

19 Source : PlayerController.cs
with MIT License
from BlueMonk1107

public void Update()
        {
            if (Input.GetKey(KeyCode.W))
            {
                _controller.SimpleMove(Vector3.forward * _speed);
            }
            if (Input.GetKey(KeyCode.S))
            {
                _controller.SimpleMove(Vector3.back * _speed);
            }
            if (Input.GetKey(KeyCode.A))
            {
                _controller.SimpleMove(Vector3.left * _speed);
            }
            if (Input.GetKey(KeyCode.D))
            {
                _controller.SimpleMove(Vector3.right * _speed);
            }
            if (Input.GetKey(KeyCode.K))
            {
                _enemyAgent.AgentState.Set(KeyNameEnum.INJURE.ToString(), true);
            }
        }

19 Source : OnKeyboardInputEvent.cs
with MIT License
from BrunoS3D

public void Update() {
			switch (mode.value) {
				case InputActionMode.Down:
					if (Input.GetKeyDown(key.value)) {
						Call(output);
					}
					break;
				case InputActionMode.Update:
					if (Input.GetKey(key.value)) {
						Call(output);
					}
					break;
				case InputActionMode.Up:
					if (Input.GetKeyUp(key.value)) {
						Call(output);
					}
					break;
			}
		}

See More Examples