private void Instance_GameInputReceived(GameInputEventArgs e) { var dict = Paused ? backupKeys : activeKeys; dict[e.Input] = e.Pressed; if (!Paused && !Parent.Paused) { switch (e.Input) { case GameInput.Shoot: Shoot = e.Pressed; break; case GameInput.Jump: Jump = e.Pressed; break; case GameInput.Start: StartKey = e.Pressed; break; case GameInput.Select: Select = e.Pressed; break; } } }
protected override void GameInputReceived(GameInputEventArgs e) { if (waiting) { if (e.Input == GameInput.Shoot || e.Input == GameInput.Jump || e.Input == GameInput.Start) { waiting = false; } } else if (info.CanSkip && e.Pressed && e.Input == GameInput.Start) { Finish(info.NextHandler); } }
protected abstract void GameInputReceived(GameInputEventArgs e);
protected override void GameInputReceived(GameInputEventArgs e) { if (!e.Pressed) { return; } int id = selectedId; int min = int.MaxValue; if (e.Input == GameInput.Start) { var select = this.options[selectedId].SelectEvent; if (select != null) { RunCommands(select); } } else if (e.Input == GameInput.Down) { for (var i = 0; i < options.Count; i++) { if (i == selectedId) { continue; } var info = options[i]; int ydist = info.Y - currentPos.Y; if (ydist == 0) { continue; } if (ydist < 0) { ydist += Game.CurrentGame.PixelsDown; // wrapping around bottom } // weight x distance worse than y distance int dist = 2 * Math.Abs(info.X - currentPos.X) + ydist; if (dist < min) { min = dist; id = i; } } } else if (e.Input == GameInput.Up) { for (var i = 0; i < options.Count; i++) { if (i == selectedId) { continue; } var info = options[i]; int ydist = currentPos.Y - info.Y; if (ydist == 0) { continue; } if (ydist < 0) { ydist += Game.CurrentGame.PixelsDown; // wrapping around bottom } // weight x distance worse than y distance int dist = 2 * Math.Abs(info.X - currentPos.X) + ydist; if (dist < min) { min = dist; id = i; } } } else if (e.Input == GameInput.Right) { for (var i = 0; i < options.Count; i++) { if (i == selectedId) { continue; } var info = options[i]; int xdist = info.X - currentPos.X; if (xdist == 0) { continue; } if (xdist < 0) { xdist += Game.CurrentGame.PixelsAcross; // wrapping around bottom } int dist = 2 * Math.Abs(info.Y - currentPos.Y) + xdist; if (dist < min) { min = dist; id = i; } } } else if (e.Input == GameInput.Left) { for (var i = 0; i < options.Count; i++) { if (i == selectedId) { continue; } var info = options[i]; int xdist = currentPos.X - info.X; if (xdist == 0) { continue; } if (xdist < 0) { xdist += Game.CurrentGame.PixelsAcross; // wrapping around bottom } int dist = 2 * Math.Abs(info.Y - currentPos.Y) + xdist; if (dist < min) { min = dist; id = i; } } } if (id != selectedId) { SelectOption(id); } }
private void Instance_GameInputReceived(GameInputEventArgs e) { var dict = Paused ? backupKeys : activeKeys; dict[e.Input] = e.Pressed; globalKeys[e.Input] = e.Pressed; if (!Paused && !Parent.Paused) { switch (e.Input) { case GameInput.Shoot: Shoot = e.Pressed; break; case GameInput.Jump: Jump = e.Pressed; break; case GameInput.Start: StartKey = e.Pressed; break; case GameInput.Select: Select = e.Pressed; break; } } }
protected override void GameInputReceived(GameInputEventArgs e) { if (updateFunc == null || (Player.GetComponent<InputComponent>()).Paused) return; }
protected override void GameInputReceived(GameInputEventArgs e) { if (!e.Pressed) return; int id = selectedId; int min = int.MaxValue; if (e.Input == GameInput.Start) { var select = this.options[selectedId].SelectEvent; if (select != null) { RunCommands(select); } } else if (e.Input == GameInput.Down) { for (var i = 0; i < options.Count; i++) { if (i == selectedId) continue; var info = options[i]; int ydist = info.Y - currentPos.Y; if (ydist == 0) continue; if (ydist < 0) ydist += Game.CurrentGame.PixelsDown; // wrapping around bottom // weight x distance worse than y distance int dist = 2 * Math.Abs(info.X - currentPos.X) + ydist; if (dist < min) { min = dist; id = i; } } } else if (e.Input == GameInput.Up) { for (var i = 0; i < options.Count; i++) { if (i == selectedId) continue; var info = options[i]; int ydist = currentPos.Y - info.Y; if (ydist == 0) continue; if (ydist < 0) ydist += Game.CurrentGame.PixelsDown; // wrapping around bottom // weight x distance worse than y distance int dist = 2 * Math.Abs(info.X - currentPos.X) + ydist; if (dist < min) { min = dist; id = i; } } } else if (e.Input == GameInput.Right) { for (var i = 0; i < options.Count; i++) { if (i == selectedId) continue; var info = options[i]; int xdist = info.X - currentPos.X; if (xdist == 0) continue; if (xdist < 0) xdist += Game.CurrentGame.PixelsAcross; // wrapping around bottom int dist = 2 * Math.Abs(info.Y - currentPos.Y) + xdist; if (dist < min) { min = dist; id = i; } } } else if (e.Input == GameInput.Left) { for (var i = 0; i < options.Count; i++) { if (i == selectedId) continue; var info = options[i]; int xdist = currentPos.X - info.X; if (xdist == 0) continue; if (xdist < 0) xdist += Game.CurrentGame.PixelsAcross; // wrapping around bottom int dist = 2 * Math.Abs(info.Y - currentPos.Y) + xdist; if (dist < min) { min = dist; id = i; } } } if (id != selectedId) { SelectOption(id); } }