public object AquireLogicInputEvent(ELogicInputEventType eventType) { ELogicInputMetaType metaType = InputUtil.GetMetaTypeOfLogicEvent(eventType); ILogicInputEventProvider provider = null; if (logicEventProviders.TryGetValue(metaType, out provider)) { return(provider.AquireLogicInputEvent(eventType)); } return(null); }
private void UpdateState(ref XboxGamePadState state) { if (_gamepadIndex < 0) { state.LeftX = Input.GetAxis(ID_LEFT_X); state.LeftY = Input.GetAxis(ID_LEFT_Y); state.LeftTrigger = Input.GetAxis(ID_TRIGGER_LEFT); state.RightX = Input.GetAxis(ID_RIGHT_X); state.RightY = Input.GetAxis(ID_RIGHT_Y); state.RightTrigger = Input.GetAxis(ID_TRIGGER_RIGHT); state.DPadUp = InputUtil.GetNextButtonState(state.DPadUp, Input.GetButton(ID_DPAD_UP)); state.DPadRight = InputUtil.GetNextButtonState(state.DPadRight, Input.GetButton(ID_DPAD_RIGHT)); state.DPadDown = InputUtil.GetNextButtonState(state.DPadDown, Input.GetButton(ID_DPAD_DOWN)); state.DPadLeft = InputUtil.GetNextButtonState(state.DPadLeft, Input.GetButton(ID_DPAD_LEFT)); state.A = InputUtil.GetNextButtonState(state.A, Input.GetButton(ID_BTN_A)); state.B = InputUtil.GetNextButtonState(state.B, Input.GetButton(ID_BTN_B)); state.X = InputUtil.GetNextButtonState(state.X, Input.GetButton(ID_BTN_X)); state.Y = InputUtil.GetNextButtonState(state.Y, Input.GetButton(ID_BTN_Y)); state.LB = InputUtil.GetNextButtonState(state.LB, Input.GetButton(ID_BTN_LB)); state.RB = InputUtil.GetNextButtonState(state.RB, Input.GetButton(ID_BTN_RB)); state.Start = InputUtil.GetNextButtonState(state.Start, Input.GetButton(ID_BTN_START)); state.Back = InputUtil.GetNextButtonState(state.Back, Input.GetButton(ID_BTN_BACK)); state.LeftStickClick = InputUtil.GetNextButtonState(state.LeftStickClick, Input.GetButton(ID_BTN_LEFTSTICK)); state.RightStickClick = InputUtil.GetNextButtonState(state.RightStickClick, Input.GetButton(ID_BTN_RIGHTSTICK)); } else { state.LeftX = Input.GetAxis(_axleToId[XboxAxleInputs.LeftStickX]); state.LeftY = Input.GetAxis(_axleToId[XboxAxleInputs.LeftStickY]); state.LeftTrigger = Input.GetAxis(_axleToId[XboxAxleInputs.LeftTrigger]); state.RightX = Input.GetAxis(_axleToId[XboxAxleInputs.RightStickX]); state.RightY = Input.GetAxis(_axleToId[XboxAxleInputs.RightStickY]); state.RightTrigger = Input.GetAxis(_axleToId[XboxAxleInputs.RightTrigger]); state.DPadUp = InputUtil.GetNextButtonState(state.DPadUp, Input.GetButton(_btnToId[XboxButtons.DPadUp])); state.DPadRight = InputUtil.GetNextButtonState(state.DPadRight, Input.GetButton(_btnToId[XboxButtons.DPadRight])); state.DPadDown = InputUtil.GetNextButtonState(state.DPadDown, Input.GetButton(_btnToId[XboxButtons.DPadDown])); state.DPadLeft = InputUtil.GetNextButtonState(state.DPadLeft, Input.GetButton(_btnToId[XboxButtons.DPadLeft])); state.A = InputUtil.GetNextButtonState(state.A, Input.GetButton(_btnToId[XboxButtons.A])); state.B = InputUtil.GetNextButtonState(state.B, Input.GetButton(_btnToId[XboxButtons.B])); state.X = InputUtil.GetNextButtonState(state.X, Input.GetButton(_btnToId[XboxButtons.X])); state.Y = InputUtil.GetNextButtonState(state.Y, Input.GetButton(_btnToId[XboxButtons.Y])); state.LB = InputUtil.GetNextButtonState(state.LB, Input.GetButton(_btnToId[XboxButtons.LB])); state.RB = InputUtil.GetNextButtonState(state.RB, Input.GetButton(_btnToId[XboxButtons.RB])); state.Start = InputUtil.GetNextButtonState(state.Start, Input.GetButton(_btnToId[XboxButtons.Start])); state.Back = InputUtil.GetNextButtonState(state.Back, Input.GetButton(_btnToId[XboxButtons.Back])); state.LeftStickClick = InputUtil.GetNextButtonState(state.LeftStickClick, Input.GetButton(_btnToId[XboxButtons.LeftStick])); state.RightStickClick = InputUtil.GetNextButtonState(state.RightStickClick, Input.GetButton(_btnToId[XboxButtons.RightStick])); } }
private void InitializeKeybinds() { cb_Skill1.DataSource = InputUtil.KeyboardKeys(); cb_Skill1.SelectedItem = Keybinds[(int)ActionKey.Skill1]; cb_Skill1.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Skill1, cb_Skill1); cb_Skill2.DataSource = InputUtil.KeyboardKeys(); cb_Skill2.SelectedItem = Keybinds[(int)ActionKey.Skill2]; cb_Skill2.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Skill2, cb_Skill2); cb_Skill3.DataSource = InputUtil.KeyboardKeys(); cb_Skill3.SelectedItem = Keybinds[(int)ActionKey.Skill3]; cb_Skill3.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Skill3, cb_Skill3); cb_Skill4.DataSource = InputUtil.KeyboardKeys(); cb_Skill4.SelectedItem = Keybinds[(int)ActionKey.Skill4]; cb_Skill4.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Skill4, cb_Skill4); cb_ForceStand.DataSource = InputUtil.KeyboardKeys(); cb_ForceStand.SelectedItem = Keybinds[(int)ActionKey.Unknown]; cb_ForceStand.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Unknown, cb_ForceStand); cb_ForceMove.DataSource = InputUtil.KeyboardKeys().Concat(InputUtil.MouseKeys()).ToList(); cb_ForceMove.SelectedItem = Keybinds[(int)ActionKey.Move]; cb_ForceMove.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Move, cb_ForceMove); cb_CloseWindows.DataSource = InputUtil.KeyboardKeys(); cb_CloseWindows.SelectedItem = Keybinds[(int)ActionKey.Close]; cb_CloseWindows.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Close, cb_CloseWindows); cb_Map.DataSource = InputUtil.KeyboardKeys(); cb_Map.SelectedItem = Keybinds[(int)ActionKey.Map]; cb_Map.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Map, cb_Map); cb_Potion.DataSource = InputUtil.KeyboardKeys(); cb_Potion.SelectedItem = Keybinds[(int)ActionKey.Heal]; cb_Potion.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig((int)ActionKey.Heal, cb_Potion); cb_Qol.DataSource = InputUtil.KeyboardKeys().Concat(InputUtil.MouseKeys()).ToList(); cb_Qol.SelectedItem = Keybinds[ConfigPersistence.QOL_KEY_INDEX]; cb_Qol.SelectedIndexChanged += (sender, args) => ConfigPersistence.SetKeybindAndSaveConfig(ConfigPersistence.QOL_KEY_INDEX, cb_Qol); }
public override void Update() { Vector2 v = new Vector2(Input.GetAxis(_xAxisId), Input.GetAxis(_yAxisId)); if (this.RadialNormalizeButtonInput && (Input.GetButton(_xAxisId) || Input.GetButton(_yAxisId))) { if (v.sqrMagnitude > 1f) { v.Normalize(); } } _current = InputUtil.CutoffDualAxis(v, this.AxleDeadZone, this.AxleCutoff, this.RadialDeadZone, this.RadialCutoff); }
// Update is called once per frame void Update() { if (InputUtil.GetButtonDown(0)) { Screen.fullScreen = false; Application.ExternalCall("recruit"); Destroy(gameObject); } else if (InputUtil.GetButtonDown(1)) { Destroy(gameObject); } }
//检测点击移动角色 void CheckClickMove() { Ray r = Camera.main.ScreenPointToRay(InputUtil.get_touch_pos()); RaycastHit hitInfo; if (!Physics.Raycast(r, out hitInfo, 100f, ~LayerMask.NameToLayer("Ground"))) { return; } GameManager.MainPlayer.Move.MoveTo(hitInfo.point); }
private void UpdateMouseOnOrOffScreen() { bool onScreen = InputUtil.IsMouseOnScreen(); if (onScreen != this.m_mouseOnScreen) { this.m_mouseOnScreen = onScreen; foreach (MouseOnOrOffScreenCallback callback in this.m_mouseOnOrOffScreenListeners.ToArray()) { callback(onScreen); } } }
private void Update() { //movement _currentKeys = InputUtil.GetIfKeysHeld(_controls); UpdateAnimator(); Vector3 targetMoveVector = GetMovementVector(_currentKeys, MoveForce); _currentMoveVector = Vector3.SmoothDamp(_currentMoveVector, targetMoveVector, ref _internalVelocity, _smoothTime); targetMoveVector = GravityVector3 + _currentMoveVector; OriginShifter.MoveOriginBy(targetMoveVector * Time.deltaTime); }
static int DoAction(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); InputUtil.DoAction(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void ViewAddTodoList() { Console.WriteLine("MENAMBAH TODOLIST"); var todo = InputUtil.Input("Todo (x Jika Batal)"); if (todo.Equals("x")) { } else { _todoService.AddTodoList(todo); } }
static int AddJoystick(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); InputUtil.Joystick arg0 = (InputUtil.Joystick)ToLua.CheckDelegate <InputUtil.Joystick>(L, 1); InputUtil.AddJoystick(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public override void Update() { base.Update(); float v = base.CurrentState.sqrMagnitude; float dz = this.AxisButtonDeadZone; _current = InputUtil.GetNextButtonState(_current, v >= (dz * dz)); if (_current == ButtonState.Down) { _lastDown = Time.realtimeSinceStartup; } }
static int AddAction(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); InputUtil.OnAction arg0 = (InputUtil.OnAction)ToLua.CheckDelegate <InputUtil.OnAction>(L, 1); InputUtil.AddAction(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void ViewRemoveTodoList() { Console.WriteLine("MENGHAPUS TODOLIST"); var no = InputUtil.Input("Nomor yang Dihapus (x Jika Batal)"); if (no.Equals("x")) { } else { _todoService.RemoveTodoList(int.Parse(no)); } }
/// <summary> /// Checks for the user resetting the level. /// </summary> private void Update() { if (!_levelRequested && InputUtil.GetKeyDown(KeyCode.G) && Input.GetKey(KeyCode.LeftShift)) { GetComponent <LevelCreator>().RequestLevel(); } if (isPlaying && !PauseHandler.instance.paused) { if (!_isCountingDown) { _currentTime += Time.deltaTime; } if (Input.GetButton("Reset")) { if (InputUtil.GetKey(KeyCode.LeftShift)) { RestartScene(); } else { ResetLevel(); } } else if (CountLemmings() == 0 && lemmingSpawner != null && lemmingSpawner.IsFinished() && !pathRenderer.visible) { numDeaths++; if (showPath) { pathRenderer.visible = true; PlayerMover.instance.noClip = true; isPlaying = false; } else { ResetLevel(); } } if (InputUtil.GetKeyDown(KeyCode.O)) { _freezeLemmings = !freezeLemmings; } } }
protected void ControlSpinByKey() { var code = InputUtil.GetInputtingKeyCode(); var spin = transform.eulerAngles; if (code == KeyCode.D) { spin.y += 1f; } else if (code == KeyCode.A) { spin.y -= 1f; } transform.eulerAngles = spin; }
static int SetJoystick(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); float arg0 = (float)LuaDLL.luaL_checknumber(L, 1); float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); float arg2 = (float)LuaDLL.luaL_checknumber(L, 3); InputUtil.SetJoystick(arg0, arg1, arg2); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public override void Update() { ////use classic way of determining //if (Input.GetKeyDown(this.Key)) // _current = ButtonState.Down; //else if (Input.GetKeyUp(this.Key)) // _current = ButtonState.Released; //else if (Input.GetKey(this.Key)) // _current = ButtonState.Held; //else // _current = ButtonState.None; //determine based on history _current = InputUtil.GetNextButtonState(_current, Input.GetKey(this.Key)); }
/// <summary> /// Takes user input to manipulate blocks. /// </summary> private void Update() { placeTimer -= Time.deltaTime; if (!PauseHandler.instance.paused && !GameManager.instance.isCountingDown) { SwitchBlock(); if (InputUtil.GetLeftMouse()) { PlaceBlock(); } else if (InputUtil.GetRightMouseDown()) { RemoveBlock(); } } }
// This will take no parameter and pass CountryDb into the CountryListView class. // Then, it will print “Hello, welcome to the country app. Please select a country from the following list:” // Then it will call Display() on the CountryListView. // Next allow the user to select a country by index. // Upon getting the country out of CountryDb, pass that country along to the CountryAction() method. // After that’s done, ask if the user would like to learn about another country. public void WelcomeAction() { CountryListView clv = new CountryListView(this.CountryDb); bool continueApp = true; while (continueApp) { Console.Clear(); Console.WriteLine("Hello, welcome to the country app. Please select a country from the following list:"); clv.Display(); int countryIndex = InputUtil.ReadInteger("Please select a country", 0, clv.Countries.Count - 1); Country choice = clv.Countries[countryIndex]; this.CountryAction(choice); continueApp = InputUtil.GetYesNo("\nWould you like to learn about another country? (y/n)"); } }
private bool IsOver(GameObject go) { if (go == null) { return(false); } if (!InputUtil.IsPlayMakerMouseInputAllowed(go)) { return(false); } if (!UniversalInputManager.Get().InputIsOver(go)) { return(false); } return(true); }
public void RegisterLogicInputEventHandler(ILogicInputEventProvider provider) { ELogicInputMetaType metaType = InputUtil.GetMetaTypeOfLogicEventProvider(provider); if (metaType != ELogicInputMetaType.Unknown) { if ((metaType & ELogicInputMetaType.MainJoytick) != 0) { logicEventProviders[ELogicInputMetaType.MainJoytick] = provider; } if ((metaType & ELogicInputMetaType.SecondaryJoystick) != 0) { logicEventProviders[ELogicInputMetaType.SecondaryJoystick] = provider; } } }
/// <summary> /// Draws lines representing entity paths. /// </summary> private void DrawLines() { if (drawn) { RemoveLines(); } drawn = true; List <Vector3> playerPositions; List <Vector3>[] lemmingPositions; if (logFile == null) { playerPositions = logger.playerPositions; lemmingPositions = logger.lemmingPositions; } else { string logText = logFile.text; int currentIndex = InputUtil.GetIndexAfter(logText, "Player:\n"); playerPositions = InputUtil.ParseVectorList(logText, ref currentIndex); List <List <Vector3> > lemmingPositionsList = new List <List <Vector3> >(); while (currentIndex < logText.Length && logText[currentIndex] == 'L') { currentIndex = logText.IndexOf('(', currentIndex); lemmingPositionsList.Add(InputUtil.ParseVectorList(logText, ref currentIndex)); } int numLemmings = lemmingPositionsList.Count; lemmingPositions = new List <Vector3> [numLemmings]; for (int i = 0; i < numLemmings; i++) { lemmingPositions[i] = lemmingPositionsList[i]; } } DrawLine(playerPositions, playerPathColor, true); if (lemmingPositions != null) { foreach (List <Vector3> lemmingPath in lemmingPositions) { DrawLine(lemmingPath, lemmingPathColor); } } }
// Update is called once per frame void Update() { if (!this.isActiveAndEnabled) { return; } if (Input.touchCount < 2) { if (Input.GetMouseButtonDown(0)) { if (!m_isDown && !InputUtil.isOnUI) { if (dragCheckUGUI && InputUtil.CheckMouseOnUI()) { return; } RaycastHit2D[] hits = Physics2D.RaycastAll(rayCastCamera.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, 0, dragRayCastMask); if (hits != null && hits.Length > 0) { foreach (RaycastHit2D hit in hits) { if (hit.collider.gameObject == gameObject) { m_isDown = true; m_downTime = Time.realtimeSinceStartup; m_mousePressPosition = Input.mousePosition; break; } if (dragIgnoreTop) { break; } } } } } else if (m_isDown && Input.GetMouseButton(0)) { OnMouseDragHandler(); } else if (m_isDown && Input.GetMouseButtonUp(0)) { OnMouseUpHandler(); } } }
/// <summary> /// Gets a level from the server. /// </summary> /// <param name="OnGet">The process to run on the level JSON.</param> public void GetLevel(HandleResponse OnGet) { Settings settings = Settings.instance; settings.LoadSettings(); PlayerMover player = PlayerMover.instance; WWWForm settingsForm = new WWWForm(); settingsForm.AddField(Settings.PATH_KEY, settings.pathSetting.ToString()); settingsForm.AddField(Settings.MOVEMENT_KEY, settings.movementSetting.ToString()); settingsForm.AddField(Settings.DIFFICULTY_KEY, settings.difficultySetting.ToString()); settingsForm.AddField(PlayerMover.POSITION_KEY, InputUtil.ConvertVectorToPOST(player.transform.position)); settingsForm.AddField("numDeaths", GameManager.numDeaths); ProcessStringFromURL(levelURL, OnGet, settingsForm); }
public override void main() { //Test Test.assertTrue(getGrade(90), "Grade A"); Console.WriteLine("Enter score:"); string input = Console.ReadLine(); int n = InputUtil.parseInt(input); if (n == -1 || n > 100) { Console.WriteLine("Sorry! Wrong input."); return; } Console.WriteLine(getGrade(n)); }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { Key key; ModifierKeys modifierKeys; InputUtil.GetWindowsKey(keyData, out key, out modifierKeys); IInteractor interactor = new ShowPositionInteractor(); Point p = PointToClient(MousePosition); bool handled = interactor.ProcessKeyDown( new CanonicalMouseEventArgs(new MouseEventArgs(MouseButtons.None, 0, p.X, p.Y, 0)), key, modifierKeys, GetInteractionContext() ); return(base.ProcessCmdKey(ref msg, keyData)); }
public override void main() { Console.WriteLine("Enter number:"); string input = Console.ReadLine(); int n = InputUtil.parseInt(input); if (n == -1) { Console.WriteLine("Sorry! Wrong input."); } else { string output = n % 2 == 0 ? "Number is even." : "Number is odd."; Console.WriteLine(output); } }
protected override void OnUpdate() { _input = World.GetExistingSystem <InputSystem>(); var physicsWorld = World.GetExistingSystem <PhysicsWorldSystem>().PhysicsWorld; if (InputUtil.GetInputUp(_input)) { float2 pos = CameraUtil.ScreenPointToWorldPoint(World, InputUtil.GetInputPosition(_input)); Entity entity = DrawBordersSystem.GetInputEntity(physicsWorld, pos); if (entity == Entity.Null) { return; } ButtonsType buttonsType = EntityManager.GetComponentData <ButtonsComponent>(entity).ButtonsType; Button(buttonsType); } }
protected void ControlByKey() { var code = InputUtil.GetInputtingKeyCode(); var motion = this._characterController.velocity; if (code == KeyCode.W) { motion = transform.forward; _animator.SetBool("walk", true); } else { motion = this._noSpeed; _animator.SetBool("walk", false); } motion *= this._moveSpeed; _characterController.Move(motion); }