/// <summary> /// Creates a new <see cref="Home"/> instance. /// </summary> public DesignView() { InitializeComponent(); // ServiceReference1.Service1 service1=new // properyGridScrollViewer.Content = properyGrid; _keyboardManager = new KeyboardManager(this); }
public CameraFirstPerson(Game game, float fov, float zNear, float zFar) : base(game, fov, zNear, zFar) { _keyboard = game.Services.GetService(typeof(KeyboardManager)) as KeyboardManager; _mouseManager = game.Services.GetService(typeof(MouseManager)) as MouseManager; _mouseManager.AddListener(this); }
// Use this for initialization void Start() { keyboard = FindObjectOfType<KeyboardManager>(); rend.GetComponent<Renderer>(); rend.enabled = true; rend.material = images[index]; index++; }
public CameraTrackBall(Game game, float fov, float zNear, float zFar) : base(game, fov, zNear, zFar) { _keyboard = game.Services.GetService(typeof(KeyboardManager)) as KeyboardManager; _mouseManager = game.Services.GetService(typeof(MouseManager)) as MouseManager; _mouseManager.AddListener(this); _curOrientation = _orientation; }
public NetworkedTimerContext(Image inTimerBackgroundImage, int inCountdown, String inNetworkMessage, KeyboardManager.KMKey inHotkey, String inChatMessageComplete) : this() { TimerBackgroundImage = inTimerBackgroundImage; Countdown = inCountdown; NetworkMessage = inNetworkMessage; Hotkey = inHotkey; ChatMessageComplete = inChatMessageComplete; }
/// <summary> /// /// </summary> public DesignViewLite() { InitializeComponent(); // ServiceReference1.Service1 service1=new // properyGridScrollViewer.Content = properyGrid; _keyboardManager = new KeyboardManager(this); this.nonAnthenticatedUser.OnLoginOperationCompleted += new EventHandler(LoginOperation_Completed); ; LoadContentByAuthentication(); WebContext.Current.Authentication.LoggedIn += new EventHandler<System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationEventArgs>(Authentication_LoggedIn); }
void Start() { EM = GameObject.FindObjectOfType<EngineMonitor>(); keyboard = FindObjectOfType<KeyboardManager>(); Sound = FindObjectOfType<SoundManager> (); Overheat = Text.GetComponent<Image>(); Over = Overheat.color; shieldObj.SetActive(false); laserObj.SetActive(false); }
public InputTextProcessor(Game game) { keys = new ExtendedList<Keys>(); keys.EnableRaisingEvents = false; manager = new KeyboardManager(game); manager.PressingDelay = 1000; manager.PressingFrequency = 60; manager.Pressed += OnKeyPressed; manager.Pressing += OnKeyPressing; manager.Released += OnKeyRelease; manager.EnableCapture = false; game.Components.Add(manager); this.game = game; }
// Use this for initialization void Start () { if (keyboardManager == null) { keyboardManager = this; DontDestroyOnLoad (gameObject); } else { Destroy (gameObject); } text = ""; delay = 0f; GazeManager.Instance.AddGazeListener(this); CamaraPosition = GameObject.Find ("Main Camera").GetComponent<Camera>(); nameText = GameObject.Find ("Name").GetComponent<Text>(); }
protected override void Update(GameTime gameTime) { var state = Keyboard.GetState(); if (state.IsKeyDown(Keys.Right)) { camera.Position.X += CAMERA_SPEED; } else if (state.IsKeyDown(Keys.Left)) { camera.Position.X -= CAMERA_SPEED; } else if (state.IsKeyDown(Keys.Up)) { camera.Position.Y -= CAMERA_SPEED; } else if (state.IsKeyDown(Keys.Down)) { camera.Position.Y += CAMERA_SPEED; } KeyboardManager.Update(); base.Update(gameTime); }
/// <summary> /// Handles when the user holds Control, Shift and Alt, and presses R /// </summary> private void HandleKeyPressCtrlS() { // Check for modifier keys if (!(KeyboardManager.CurrentState.IsKeyDown(Keys.LeftControl) || KeyboardManager.CurrentState.IsKeyDown(Keys.RightControl))) { return; } if (!KeyboardManager.IsUniqueKeyPress(Keys.S)) { return; } // Handle skin reloading switch (CurrentScreen.Type) { case QuaverScreenType.Menu: case QuaverScreenType.Select: Transitioner.FadeIn(); SkinManager.TimeSkinReloadRequested = GameBase.Game.TimeRunning; break; } }
public RayCaster01() { var viewportSize = new Vector2(SCREEN_WIDTH, SCREEN_HEIGHT); _graphicsDeviceManager = new GraphicsDeviceManager(this) { PreferredBackBufferWidth = (int)viewportSize.X, PreferredBackBufferHeight = (int)viewportSize.Y, SynchronizeWithVerticalRetrace = false }; _keyboardManager = new KeyboardManager(this); _mouse = new MouseManager(this); Content.RootDirectory = "Content"; // Game Objects _map = new Map(); _player = new Player(); _scene = new Scene(); _viewRenderer = new ViewRenderer(); }
/// <summary> /// Handles when the user presses the enter key. /// </summary> private void HandleKeyPressEnter() { var view = View as SelectScreenView; if (!KeyboardManager.IsUniqueKeyPress(Keys.Enter) || AvailableMapsets.Count == 0) { return; } switch (view.ActiveContainer) { case SelectContainerStatus.Mapsets: view.SwitchToContainer(SelectContainerStatus.Difficulty); break; case SelectContainerStatus.Difficulty: ExitToGameplay(); break; default: throw new ArgumentOutOfRangeException(); } }
public static void Initialize(GraphicsDevice graphics, CoroutineManager manager, ContentManager content, KeyboardManager keyboard, MouseManager mouse) { _renderInterface = new LibRocketRenderInterface(graphics, content, UseVbo); LibRocketNet.Core.RenderInterface = _renderInterface; LibRocketNet.Core.SystemInterface = new LibRocketSystemInterface(); LibRocketNet.Core.Initialize(); MainContext = LibRocketNet.Core.CreateContext("main", new LibRocketNet.Vector2i(graphics.Viewport.Width, graphics.Viewport.Height)); LibRocketNet.Core.InitDebugger(MainContext); LoadFonts(); // add keyboard hooks keyboard.KeyDown += KeyDownHandler; keyboard.KeyUp += KeyUpHandler; mouse.ButtonDown += (o, e) => MainContext.ProcessMouseButtonDown(e, GetKeyModifiers()); mouse.ButtonUp += (o, e) => MainContext.ProcessMouseButtonUp(e, GetKeyModifiers()); mouse.WheelChanged += (w) => MainContext.ProcessMouseWheel(-w, GetKeyModifiers()); mouse.Move += ProcessMouseMove; manager.StartCoroutine(UpdateUI()); }
/// <summary> /// Handles when the user presses the left key. /// </summary> /// <exception cref="ArgumentOutOfRangeException"></exception> private void HandleKeyPressLeft() { var view = View as SelectScreenView; if (!KeyboardManager.IsUniqueKeyPress(Keys.Left)) { return; } switch (view.ActiveContainer) { case SelectContainerStatus.Mapsets: view?.MapsetScrollContainer.SelectNextMapset(Direction.Backward); break; case SelectContainerStatus.Difficulty: view.DifficultyScrollContainer.SelectNextDifficulty(Direction.Backward); break; default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Handles when the user presses escape. /// </summary> /// <exception cref="ArgumentOutOfRangeException"></exception> private void HandleKeyPressEscape() { var view = View as SelectScreenView; if (!KeyboardManager.IsUniqueKeyPress(Keys.Escape)) { return; } switch (view.ActiveContainer) { case SelectContainerStatus.Mapsets: ExitToMenu(); break; case SelectContainerStatus.Difficulty: view.SwitchToContainer(SelectContainerStatus.Mapsets); break; default: throw new ArgumentOutOfRangeException(); } }
public void Start() { // Create gameobject so we can have access to a tranform thats position is "Vector3.zero". new GameObject("VisualPath", typeof(VisualPath)); GameObject go; tileSpriteController = new TileSpriteController(World); characterSpriteController = new CharacterSpriteController(World); furnitureSpriteController = new FurnitureSpriteController(World); jobSpriteController = new JobSpriteController(World, furnitureSpriteController); inventorySpriteController = new InventorySpriteController(World, inventoryUI); buildModeController = new BuildModeController(); spawnInventoryController = new SpawnInventoryController(); mouseController = new MouseController(buildModeController, furnitureSpriteController, circleCursorPrefab); keyboardManager = KeyboardManager.Instance; questController = new QuestController(); cameraController = new CameraController(); TradeController = new TradeController(); timeManager = new TimeManager(); autosaveManager = new AutosaveManager(); keyboardManager.RegisterInputAction("Pause", KeyboardMappedInputType.KeyUp, () => { IsPaused = !IsPaused; }); // Hiding Dev Mode spawn inventory controller if devmode is off. spawnInventoryController.SetUIVisibility(Settings.GetSetting("DialogBoxSettings_developerModeToggle", false)); // Initialising controllers. GameObject controllers = GameObject.Find("Controllers"); Instantiate(Resources.Load("UIController"), controllers.transform); GameObject canvas = GameObject.Find("Canvas"); go = Instantiate(Resources.Load("UI/ContextMenu"), canvas.transform.position, canvas.transform.rotation, canvas.transform) as GameObject; go.name = "ContextMenu"; }
/// <summary> /// Override OnCreate method /// </summary> /// <param name="savedInstanceState"></param> protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_sign_up); // Set the activity back button on the actionbar SupportActionBar.SetDisplayHomeAsUpEnabled(true); #region Initialization mTxtUsername = FindViewById <TextInputEditText>(Resource.Id.signUpUsername); mTxtFullName = FindViewById <TextInputEditText>(Resource.Id.signUpFullName); mTxtEmail = FindViewById <TextInputEditText>(Resource.Id.signUpEmail); mTxtDOB = FindViewById <TextInputEditText>(Resource.Id.signUpDOB); mTxtPwd = FindViewById <TextInputEditText>(Resource.Id.signUpPassword); mTxtConfPwd = FindViewById <TextInputEditText>(Resource.Id.signUpConfPassword); mUserPic = FindViewById <ImageView>(Resource.Id.userPic); mProgressBar = FindViewById <ProgressBar>(Resource.Id.signUpProgressBar); mBtnUserPicBrowse = FindViewById <Button>(Resource.Id.btnUserPicBrowse); mBtnSignUp = FindViewById <Button>(Resource.Id.btnSignUp); mSignUpPanel = FindViewById <LinearLayout>(Resource.Id.signUpPanel); mBtnUserPicBrowse.Click += BtnUserPicBrowse_Click; mBtnSignUp.Click += BtnSignUp_Click; #endregion mSignUpPanel.Click += (o, e) => KeyboardManager.CloseKeyboard(mSignUpPanel, this); // Close soft keyboard when background is clicked mTxtDOB.Click += (object sender, EventArgs e) => { // Bring up the datepicker dialog DatePickerFragment frag = DatePickerFragment.NewInstance(delegate(DateTime time) { mTxtDOB.Text = time.ToShortDateString(); }); frag.Show(FragmentManager, DatePickerFragment.TAG); }; }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="gameTime"></param> public override void Update(GameTime gameTime) { if (WaitingForKeyPress && Dialog.IsOnTop) { var keys = KeyboardManager.CurrentState.GetPressedKeys(); if (keys.Length != 0) { if (KeyboardManager.IsUniqueKeyPress(keys.First())) { Bindable.Value = keys.First(); var key = XnaKeyHelper.GetStringFromKey(keys.First()); if (Button.Text.Text != key) { Button.Text.Text = key; } if (keys.First() == Keys.Escape) { Dialog.PreventExitOnEscapeKeybindPress = true; } Button.Selected = false; WaitingForKeyPress = false; } } } else { // Important. Makes it so the dialog doesn't close when the user presses escape as a keybind. Dialog.PreventExitOnEscapeKeybindPress = false; } base.Update(gameTime); }
public override void Keyboard(KeyboardManager keyboard) { if (keyboard.IsKeyDown(Keys.G)) { _circleRadius += 0.05f; } else if (keyboard.IsKeyDown(Keys.H)) { _circleRadius -= 0.05f; } if (keyboard.IsNewKeyPress(Keys.T)) { _terrain.Decomposer++; if (_terrain.Decomposer > TriangulationAlgorithm.Seidel) { _terrain.Decomposer--; } } else if (keyboard.IsNewKeyPress(Keys.Y)) { _terrain.Decomposer--; if (_terrain.Decomposer < TriangulationAlgorithm.Bayazit) { _terrain.Decomposer++; } } else if (keyboard.IsNewKeyPress(Keys.M)) { _create = !_create; } base.Keyboard(keyboard); }
public void OnInputFieldClick(object obj, UIPointerEventArgs args) { GameObject clickedObject = args.currentTarget; if (MenuManager.Instance.menuStack.Peek() != Instance) { //this menu is not visible return; } InputField clickedInputField = clickedObject.GetComponent <InputField>(); if (clickedInputField != null) { if (clickedInputField.name.Contains("ID")) { NumPad.Show(EditID, "Set desired ID!"); } else if (clickedInputField.name.Contains("Name")) { KeyboardManager.Show(EditName, "Set desired Name!"); } } }
/// <inheritdoc /> /// <summary> /// Update /// </summary> /// <param name="dt"></param> public override void Update(GameTime gameTime) { if (MouseManager.CurrentState.LeftButton == ButtonState.Released) { MouseInHoldSequence = false; SliderAlreadyHeld = false; } if (IsHeld) { MouseHeld(); } // Handle the changing of the value for this button. if (MouseInHoldSequence) { HandleSliderValueChanges(); } else if (IsHovered) { if (KeyboardManager.IsUniqueKeyPress(Keys.Left)) { BindedValue.Value--; } if (KeyboardManager.IsUniqueKeyPress(Keys.Right)) { BindedValue.Value++; } } PreviousMouseState = Mouse.GetState(); SetProgressPosition(gameTime.ElapsedGameTime.TotalMilliseconds); base.Update(gameTime); }
public static void Init() { ColorConsole.WriteLine(ConsoleColor.White, "=> Loading driver..."); Reference.Driver = new VMWareSVGAII(); Reference.Driver.SetMode(Reference.Width, Reference.Height); // In development bool running = true; int index = 0; int defY = 50; while (running) { KeyEvent e = KeyboardManager.ReadKey(); string text = e.KeyChar.ToString(); int x = 50 + index; //if (x >= Reference.Width) defY += 10; DrawUtils.DrawString(Reference.Driver, LastText, text, x, defY, 0x255); LastText = text; index += 10; Reference.Driver.Update(0, 0, Reference.Width, Reference.Height); } }
public SampleGame() { // create the graphics device manager and set desired screen resolution _graphicsDeviceManager = new GraphicsDeviceManager(this) { PreferredBackBufferWidth = 1440, PreferredBackBufferHeight = 900 }; // give a chance to override selected graphics device settings (for example, to use a WARP adapter) _graphicsDeviceManager.PreparingDeviceSettings += HandlePreparingDeviceSettings; // initialize the camera _camera = new OrbitCamera { Radius = 2f, Target = new Vector3() }; // initialize the keyboard manager _keyboardManager = new KeyboardManager(this); Content.RootDirectory = "Content"; }
public override void Keyboard(KeyboardManager keyboardManager) { if (keyboardManager.IsNewKeyPress(Keys.A)) { _segments++; } if (keyboardManager.IsNewKeyPress(Keys.S) && _segments > 0) { _segments--; } if (keyboardManager.IsNewKeyPress(Keys.D)) { Create(0); } if (keyboardManager.IsNewKeyPress(Keys.F)) { Create(1); } base.Keyboard(keyboardManager); }
public override void keyboardButtonClicked(Microsoft.Xna.Framework.Input.Keys buttonPressed) { base.keyboardButtonClicked(buttonPressed); if (this.isTextEditAble) { if (this.IsFocused) { if (buttonPressed == Microsoft.Xna.Framework.Input.Keys.Back) { if (this.text.Length > 0) { this.text = this.text.Substring(0, this.text.Length - 1); } } else if (buttonPressed == Microsoft.Xna.Framework.Input.Keys.LeftShift || buttonPressed == Microsoft.Xna.Framework.Input.Keys.LeftAlt) { } else { this.text += KeyboardManager.TryConvertKey(buttonPressed); } } } }
public override void Keyboard(KeyboardManager keyboardManager) { if (keyboardManager.IsKeyDown(Keys.Q)) { _strength += 1f; } if (keyboardManager.IsKeyDown(Keys.A)) { _strength -= 1f; } if (keyboardManager.IsKeyDown(Keys.W)) { _simpleWind.Variation += 0.1f; } if (keyboardManager.IsKeyDown(Keys.S)) { _simpleWind.Variation -= 0.1f; } base.Keyboard(keyboardManager); }
public override void Update(GameTime gameTime) { if (isCreate) { StartButton.Update(gameTime); box[2].RemoveAll(); for (int i = 0; i < localClient.OtherPlayers.Count; i++) { box[2].WriteLine(localClient.OtherPlayers[i].name + ""); } if (gameTime.TotalGameTime.TotalMilliseconds % 500 < 10) { serveur.SendToAll(); } //box[2].WriteLine(Convert.ToString(serveur.Clients.Count)); } else { createButton.Update(gameTime); for (int i = 0; i < box.Count; i++) { if (MouseManager.IsInRectangle(box[i].Bound) && MouseManager.IsClicking()) { box[boxselect].IsSelect = false; boxselect = i; box[i].IsSelect = true; } } box[boxselect].Write(KeyboardManager.RecupClavier()); if (KeyboardManager.IsPressed(Keys.Back)) { box[boxselect].RemoveLast(); } } }
public CameraController() { // Main camera handles UI only Camera.main.farClipPlane = 9; cameraData = World.Current.CameraData; KeyboardManager keyboardManager = KeyboardManager.Instance; keyboardManager.RegisterInputAction("MoveCameraEast", KeyboardMappedInputType.Key, () => { frameMoveHorizontal++; }); keyboardManager.RegisterInputAction("MoveCameraWest", KeyboardMappedInputType.Key, () => { frameMoveHorizontal--; }); keyboardManager.RegisterInputAction("MoveCameraNorth", KeyboardMappedInputType.Key, () => { frameMoveVertical++; }); keyboardManager.RegisterInputAction("MoveCameraSouth", KeyboardMappedInputType.Key, () => { frameMoveVertical--; }); keyboardManager.RegisterInputAction("ZoomOut", KeyboardMappedInputType.Key, () => ChangeZoom(0.1f)); keyboardManager.RegisterInputAction("ZoomIn", KeyboardMappedInputType.Key, () => ChangeZoom(-0.1f)); keyboardManager.RegisterInputAction("MoveCameraUp", KeyboardMappedInputType.KeyUp, ChangeLayerUp); keyboardManager.RegisterInputAction("MoveCameraDown", KeyboardMappedInputType.KeyUp, ChangeLayerDown); keyboardManager.RegisterInputAction("ApplyCameraPreset1", KeyboardMappedInputType.KeyUp, () => ApplyPreset(cameraData.presets[0])); keyboardManager.RegisterInputAction("ApplyCameraPreset2", KeyboardMappedInputType.KeyUp, () => ApplyPreset(cameraData.presets[1])); keyboardManager.RegisterInputAction("ApplyCameraPreset3", KeyboardMappedInputType.KeyUp, () => ApplyPreset(cameraData.presets[2])); keyboardManager.RegisterInputAction("ApplyCameraPreset4", KeyboardMappedInputType.KeyUp, () => ApplyPreset(cameraData.presets[3])); keyboardManager.RegisterInputAction("ApplyCameraPreset5", KeyboardMappedInputType.KeyUp, () => ApplyPreset(cameraData.presets[4])); keyboardManager.RegisterInputAction("AssignCameraPreset1", KeyboardMappedInputType.KeyUp, () => AssignPreset(0)); keyboardManager.RegisterInputAction("AssignCameraPreset2", KeyboardMappedInputType.KeyUp, () => AssignPreset(1)); keyboardManager.RegisterInputAction("AssignCameraPreset3", KeyboardMappedInputType.KeyUp, () => AssignPreset(2)); keyboardManager.RegisterInputAction("AssignCameraPreset4", KeyboardMappedInputType.KeyUp, () => AssignPreset(3)); keyboardManager.RegisterInputAction("AssignCameraPreset5", KeyboardMappedInputType.KeyUp, () => AssignPreset(4)); // Set default zoom value on camera Camera.main.orthographicSize = zoomTarget; positionTarget = Camera.main.transform.position; TimeManager.Instance.EveryFrameNotModal += (time) => Update(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. _spriteBatch = new SpriteBatch(GraphicsDevice); var viewPort = _graphics.GraphicsDevice.Viewport; var screenConfiguration = new GameScreenConfiguration(viewPort.Height, viewPort.Width); var levelConfiguration = new LevelConfiguration(12, Color.Black, 12, 52, Color.Black, 12, 64, Color.Black, 8, Color.Black, 42, 12, 8); var textConfiguration = new TextConfiguration(Color.Black, 2); var textTexture = GetPlain2DTexture(textConfiguration.TextSize); var texture = GetPlain2DTexture(1); _eventAggregator = new EventAggregator(); _randomizer = new Randomizer.Randomizer(); _keyboardManager = new KeyboardManager(_eventAggregator, TimeSpan.Zero); _playerInput = new PlayerInput(_eventAggregator); var collisionManager = new CollisionManager(_eventAggregator); var drawer = new Drawer(_spriteBatch, texture); var textDrawer = new Drawer(_spriteBatch, textTexture); var pixelTextDrawer = new PixelTextDrawer(textDrawer); var particleManager = new ParticleManager(_eventAggregator, drawer, _randomizer); var startScreen = new StartScreen(_eventAggregator, pixelTextDrawer, screenConfiguration, textConfiguration); var levelFactory = new LevelFactory(_eventAggregator, screenConfiguration, levelConfiguration); var levelManager = new LevelManager(_eventAggregator, levelFactory, collisionManager, particleManager, drawer); var gameScreen = new GameScreen(_eventAggregator, levelManager); _screenManager = new ScreenManager(_eventAggregator, startScreen, gameScreen); _keyboardManager.Load(); _playerInput.Load(); _screenManager.Load(); }
// Use this for initialization void Start() { baseRend.GetComponent<Renderer>(); baseRend.enabled = true; baseRend.material = baseMat; keyboard = FindObjectOfType<KeyboardManager>(); }
public PlayerController(string id, ControllerType controllerType, KeyboardManager keyboardManager, CameraManager <Camera3D> cameraManager) : base(id, controllerType) { this.keyboardManager = keyboardManager; this.cameraManager = cameraManager; }
public override void Update(GameTime gameTime) { if (CanMove) { base.Update(gameTime); InternalMove(gameTime); } coord = new Vector2((int)Math.Ceiling(Position.X * 32 / 1000) - 1, (int)Math.Ceiling(Position.Y * 32 / 1000) - 1); // Pour le lancement de spells for (int i = 0; i < spells.Count; i++) { if (!KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Spell1 + i]) && !(MouseManager.IsInRectangle(spellsRect[i]) && MouseManager.IsLeftClicked())) { continue; } if (spells[i].Type == SpellType.Buff) { if (spells[i].IsActivated) { spells[i].Unbuff(); } else { spells[i].Buff(); } } else { spells[i].Cast(); } } // Change de cible if (KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Target]) || MouseManager.IsLeftClicked()) { if (Target != null) { Target.Targeter = null; } if (KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Target])) { IList <Monster> monsters = Game.Entities.OfType <Monster>().ToList(); ++targetIndex; if (targetIndex >= monsters.Count) { targetIndex = (monsters.Count > 0 ? 0 : -1); } Target = targetIndex >= 0 ? monsters[targetIndex] : null; } else { foreach (Monster monster in Game.Entities.OfType <Monster>()) { if (MouseManager.IsInRectangle(GameScreen.Camera.ScreenLocation(MouseManager.Position), monster.Bounds)) { Target = monster; } } } if (Target != null) { Target.Targeter = this; } } // Deselectionne une cible if (KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Escape])) { if (Target != null) { Target.Targeter = null; } Target = null; } // Insérer tout le cheat if (Keyboard.GetState().IsKeyDown(Keys.D0)) { Power = Stats.PowerMax; } // Update tout les spells foreach (Spell spell in spells) { spell.Update(gameTime); } Regeneration(gameTime); }
/// <summary> /// Handles changing the beat snap with the scroll wheel + shift /// and arrow keys + shift. /// </summary> private void HandleBeatSnapChanges() { if (!KeyboardManager.CurrentState.IsKeyDown(Keys.LeftShift) && !KeyboardManager.CurrentState.IsKeyDown(Keys.RightShift)) { return; } if (MouseManager.CurrentState.ScrollWheelValue > MouseManager.PreviousState.ScrollWheelValue || KeyboardManager.IsUniqueKeyPress(Keys.Up)) { ChangeBeatSnap(Direction.Forward); } if (MouseManager.CurrentState.ScrollWheelValue < MouseManager.PreviousState.ScrollWheelValue || KeyboardManager.IsUniqueKeyPress(Keys.Down)) { ChangeBeatSnap(Direction.Backward); } }
/// <summary> /// /// </summary> /// <param name="gameTime"></param> private void HandleInput(GameTime gameTime) { if (Exiting) { return; } if (DialogManager.Dialogs.Count == 0) { if (KeyboardManager.IsUniqueKeyPress(Keys.Escape)) { HandleKeyPressEscape(); } if (KeyboardManager.IsUniqueKeyPress(Keys.F1)) { OpenMetadataDialog(); } // Timing Setup if (KeyboardManager.IsUniqueKeyPress(Keys.F2)) { OpenTimingPointDialog(); } // Scroll Velocities if (KeyboardManager.IsUniqueKeyPress(Keys.F3)) { OpenScrollVelocityDialog(); } if (KeyboardManager.IsUniqueKeyPress(Keys.F4)) { ChangePreviewTime((int)AudioEngine.Track.Time); } if (KeyboardManager.IsUniqueKeyPress(Keys.F5)) { OpenGoToDialog(); } HandleAudioSeeking(); HandleCtrlInput(gameTime); HandleBeatSnapChanges(); } var view = (EditorScreenView)View; if (DialogManager.Dialogs.Count == 0 || DialogManager.Dialogs.Last() == view.TimingPointChanger.Dialog || DialogManager.Dialogs.Last() == view.ScrollVelocityChanger.Dialog) { if (KeyboardManager.IsUniqueKeyPress(ConfigManager.KeyEditorPausePlay.Value) && ActiveLayerInterface.Value != EditorLayerInterface.Editing) { HandleKeyPressSpace(); } if (DialogManager.Dialogs.Count != 0) { HandleAudioSeeking(); if (KeyboardManager.CurrentState.IsKeyDown(Keys.LeftControl) || KeyboardManager.CurrentState.IsKeyDown(Keys.RightControl)) { if (KeyboardManager.IsUniqueKeyPress(ConfigManager.KeyEditorDecreaseAudioRate.Value)) { ChangeAudioPlaybackRate(Direction.Backward); } if (KeyboardManager.IsUniqueKeyPress(ConfigManager.KeyEditorIncreaseAudioRate.Value)) { ChangeAudioPlaybackRate(Direction.Forward); } } } } }
/// <summary> /// Initilize various objects /// </summary> protected override void Initialize() { _keyboardManager = new KeyboardManager(this); Components.Add(_keyboardManager); _keyboardManager.AddListener(this); _mouseManager = new MouseManager(this); Components.Add(_mouseManager); _mouseManager.AddListener(this); //_camera = new CameraFirstPerson(this, 45, 0.01f, 100.0f); _camera = new CameraTrackBall(this, 45, 0.01f, 100.0f); _camera.Position = new Vector3(0, 0, 5); Components.Add(_camera); createVolumeRaycaster(); _gradEditor = new GradientEditor(); _gradient = new Gradient(); GradientSegment seg = new GradientSegment(); seg.Left = 0.0f; seg.Middle = 0.5f; seg.Right = 1.0f; seg.LeftColor = new Vector4(1, 0, 0, 1.0f); seg.RightColor = new Vector4(1, 0, 0, 1.0f); seg.ColType = GradientSegment.ColorType.HSV_CCW; _gradient.AddSegment(seg); //seg.LookUpTable = palette.Colors; //_gradient.AddSegment(seg); //seg = new GradientSegment(); //seg.Left = 0; //seg.Middle = 0.333f/2.0f; //seg.Right = 0.333f; //seg.LeftColor = ColorHelper.HsvToRgb(0, 1, 0, 1.0f); //seg.RightColor = ColorHelper.HsvToRgb(0, 1, 0.8f, 1.0f); //seg.ColType = GradientSegment.ColorType.HSV_CW; //_gradient.AddSegment(seg); //seg = new GradientSegment(); //seg.Left = 0.333f; //seg.Middle = 0.333f+(1.0f-0.333f) / 2.0f; //seg.Right = 1.0f; //seg.LeftColor = ColorHelper.HsvToRgb(0, 1, 0.8f, 1.0f); //seg.RightColor = ColorHelper.HsvToRgb(0.25f * 360.0f, 0, 1.0f, 1); //seg.ColType = GradientSegment.ColorType.HSV_CW; //_gradient.AddSegment(seg); _gradEditor.Gradient = _gradient; Color[] cols = _gradient.GetColors(256); _vrc.TransferFunction = cols; TransferFunction tf = new TransferFunction(); tf.Colors = cols; tf.preIntegrate(); _vrc.TransferFunctionPreInt = tf; _gradEditor.Show(); VolumeRaycasterSettings raySettings = new VolumeRaycasterSettings(_vrc); raySettings.Show(); base.Initialize(); }
void Update() { KeyboardManager.updateKey(); }
public bool GotKey(KeyboardManager.KMKey hotKey) { KeyboardManager.KMKey cancelKey = (KeyboardManager.KMKey)context.Hotkey.Clone(); cancelKey.InvertCtrlDown(); int thisCountdown = context.Countdown - TimingOffset; if (hotKey.Equals(context.Hotkey)) { // yay this.currentNetProto.SendMessage("NETTIMER " + context.NetworkMessage + " " + thisCountdown.ToString()); StartCountdown(thisCountdown); return true; } else if (hotKey.Equals(cancelKey)) { this.currentNetProto.SendMessage("NETTIMER " + context.NetworkMessage + " CANCEL"); endCountdown = DateTime.Now; EndCountdown(); return true; } return false; }
void Awake() { subRes = FindObjectOfType<Submarine_Resources>(); //Sub Res Link rb = GetComponent<Rigidbody>(); //Rigidbody Link keyboard = FindObjectOfType<KeyboardManager>(); //Keyboard Link }
//Starts When Program Runs void Start() { //Initializing keyboard = FindObjectOfType<KeyboardManager>(); //Keyboard Manager RectTransform CanvasTransform = canvas.GetComponent<RectTransform> (); //Initialize Canvas Transform Values float radarWidth = CanvasTransform.rect.width; //Initialize Radar Width _radarWidth = radarWidth; //Set Radar Width }
public bool GotKey(KeyboardManager.KMKey keyPressed) { // nothing yet return false; }
public override void Update(GameTime gameTime) { MouseManager.Poll(gameTime); KeyboardManager.Poll(gameTime); }
public override void Ready() { base.Ready(); manager = GetManager<KeyboardManager>(); moveUp.Key = Up; moveDown.Key = Down; moveLeft.Key = Left; moveRight.Key = Right; manager.RegisterIKeyChange(moveUp); manager.RegisterIKeyChange(moveDown); manager.RegisterIKeyChange(moveLeft); manager.RegisterIKeyChange(moveRight); manager.Add(this); }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="gameTime"></param> protected override void HandleInput(GameTime gameTime) { if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.PageUp)) { ConfigManager.EditorScrollSpeedKeys.Value++; } if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.PageDown)) { ConfigManager.EditorScrollSpeedKeys.Value--; } if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.Delete)) { DeleteSelectedHitObjects(); } // Clever way of handing key input with num keys since the enum values are 1 after each other. for (var i = 0; i < WorkingMap.GetKeyCount(); i++) { if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.D1 + i)) { PlaceObject(CompositionInputDevice.Keyboard, i + 1, AudioEngine.Track.Time); } } // Change between composition tools (only when shift isn't held down). // if shift is held down, then it'll change the beat snap. if (KeyboardManager.CurrentState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.LeftShift) && KeyboardManager.CurrentState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.RightShift)) { var index = (int)CompositionTool.Value; if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.Up)) { if (index - 1 >= 0) { CompositionTool.Value = (EditorCompositionTool)index - 1; } } if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.Down)) { if (index + 1 < Enum.GetNames(typeof(EditorCompositionTool)).Length) { CompositionTool.Value = (EditorCompositionTool)index + 1; } } SwitchGraphs(); } // Select all if (KeyboardManager.CurrentState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) || KeyboardManager.CurrentState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightControl)) { if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.A)) { SelectAllHitObjects(); } if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.C)) { CopySelectedHitObjects(); } if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.V)) { PasteHitObjects(); } if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.X)) { CutHitObjects(); } if (KeyboardManager.IsUniqueKeyPress(Microsoft.Xna.Framework.Input.Keys.H)) { FlipHitObjectsHorizontally(); } } HandleHitObjectSelection(); switch (CompositionTool.Value) { case EditorCompositionTool.Select: break; case EditorCompositionTool.Note: case EditorCompositionTool.LongNote: case EditorCompositionTool.Mine: HandleHitObjectMouseInput(); break; default: throw new ArgumentOutOfRangeException(); } // Right click/delete object. if (MouseManager.IsUniqueClick(MouseButton.Right) && !View.MenuBar.IsActive) { DeleteHoveredHitObject(); } }
protected override void AddGameObjects(int entranceId) { AddObject(new EmptyGameObject().AddScript((scene, o, arg3) => { if (KeyboardManager.IsKeyPressed(Keys.Escape)) { SceneManager.CloseScene(); } if (KeyboardManager.IsKeyPressed(Keys.O)) { SceneManager.ChangeScene("collision-test"); } if (KeyboardManager.IsKeyPressed(Keys.F4)) { SceneManager.ClearStack(); } })); AddObject(new BasicCamera().Set3DEnabled(true).SetCameraTarget(new Vector3(0, 0, 1)).SetPosition(0, 1, -50).SetEnableCollision(false)); // build the cube var planeCollision = new BoundPlaneCollision(new Vector3(), new Vector3(8, 0, 0), new Vector3(0, 0, 8), (f1, f2) => - 1 <= f1 && f1 <= 1 && -1 <= f2 && f2 <= 1); AddObject( new CollidableModelObject("planes/plane1") .SetPosition(-8, 0, 0) .SetCollision(planeCollision) .SetRotation(0, 0, -MathHelper.PiOver2) ); AddObject( new CollidableModelObject("planes/plane1") .SetPosition(8, 0, 0) .SetCollision(planeCollision) .SetRotation(0, 0, MathHelper.PiOver2) ); AddObject( new CollidableModelObject("planes/plane1") .SetPosition(0, 8, 0) .SetCollision(planeCollision) .SetRotation(0, 0, MathHelper.Pi) ); AddObject( new CollidableModelObject("planes/plane1") .SetPosition(0, -8, 0) .SetCollision(planeCollision) .SetRotation(0, 0, 0) ); AddObject( new CollidableModelObject("planes/plane1") .SetPosition(0, 0, 8) .SetCollision(planeCollision) .SetRotation(-MathHelper.PiOver2, 0, 0) ); AddObject( new CollidableModelObject("planes/plane1") .SetPosition(0, 0, -8) .SetCollision(planeCollision) .SetRotation(MathHelper.PiOver2, 0, 0) ); // add some objects to the cube // add balls Random random = new Random(); for (int i = 0; i <= 20; i++) { AddObject(new TestBallObject().SetInertia((float)(5f * random.NextDouble()), 0, (float)(5f * random.NextDouble())).SetPosition((float)(5f * random.NextDouble()), (float)(5f * random.NextDouble()), (float)(5f * random.NextDouble()))); } //for (float x = 15; x >= -15; x -= 2.5f) // AddObject(new TestBallObject().SetPosition(x, 10 + Math.Abs(x) / 2.0f, 0)); }
public void InitializeDesignMode() { _keyboardManager = new KeyboardManager(this); DesignViewModel = new DesignViewViewModel(this); Model.SelectedItem += Model_SelectedItem; Model.Initialize(); var mediator = Mediator.Instance; //new Mediator(Model); mediator.DesignView = this; mediator.Initialize3DController(); MenuManager = new Controllers.MenuManager(mediator.Controller3D); mediator.Add3DView(projectpreview.mainView3D); //if(this.mainview2D.DrawingControl!=null) //mediator.Add2DView(this.mainview2D); }
public override void Keyboard(KeyboardManager keyboardManager) { // Add Circles if (keyboardManager.IsNewKeyPress(Keys.Q)) { AddCircle(3, 8); } // Add Circles if (keyboardManager.IsNewKeyPress(Keys.W)) { AddCircle(4, 16); } // Add Circles if (keyboardManager.IsNewKeyPress(Keys.E)) { AddCircle(5, 32); } // Add Rectangle if (keyboardManager.IsNewKeyPress(Keys.A)) { AddRectangle(4, 8); } // Add Rectangle if (keyboardManager.IsNewKeyPress(Keys.S)) { AddRectangle(5, 2); } // Add Rectangle if (keyboardManager.IsNewKeyPress(Keys.D)) { AddRectangle(2, 5); } // Perform a Union if (keyboardManager.IsNewKeyPress(Keys.Space)) { if (_subject != null && _clip != null) { DoBooleanOperation(YuPengClipper.Union(_subject, _clip, out _err)); } } // Perform a Subtraction if (keyboardManager.IsNewKeyPress(Keys.Back)) { if (_subject != null && _clip != null) { DoBooleanOperation(YuPengClipper.Difference(_subject, _clip, out _err)); } } // Perform a Intersection if (keyboardManager.IsNewKeyPress(Keys.LeftShift)) { if (_subject != null && _clip != null) { DoBooleanOperation(YuPengClipper.Intersect(_subject, _clip, out _err)); } } // Select Subject if (keyboardManager.IsNewKeyPress(Keys.D1)) { if (_selected != null) { if (_clip == _selected) { _clip = null; } _subject = _selected; } } // Select Clip if (keyboardManager.IsNewKeyPress(Keys.D2)) { if (_selected != null) { if (_subject == _selected) { _subject = null; } _clip = _selected; } } }
public static String ReadLine() { var xConsole = GetConsole(); if (xConsole == null) { // for now: return(null); } List <char> chars = new List <char>(32); KeyEvent current; int currentCount = 0; bool firstdown = false; string CMDToComplete = ""; xConsole.CursorVisible = true; while ((current = KeyboardManager.ReadKey()).Key != ConsoleKeyEx.Enter) { if (current.Key == ConsoleKeyEx.NumEnter) { break; } //Check for "special" keys if (current.Key == ConsoleKeyEx.Backspace) // Backspace { CMDToComplete = ""; if (currentCount > 0) { int curCharTemp = GetConsole().X; chars.RemoveAt(currentCount - 1); GetConsole().X = GetConsole().X - 1; //Move characters to the left for (int x = currentCount - 1; x < chars.Count; x++) { Write(chars[x]); } Write(' '); GetConsole().X = curCharTemp - 1; currentCount--; } else { Aura_OS.Kernel.speaker.beep(); } continue; } else if (current.Key == ConsoleKeyEx.LeftArrow) { if (currentCount > 0) { GetConsole().X = GetConsole().X - 1; currentCount--; } continue; } else if (current.Key == ConsoleKeyEx.RightArrow) { if (currentCount < chars.Count) { GetConsole().X = GetConsole().X + 1; currentCount++; } continue; } else if (current.Key == ConsoleKeyEx.Tab) { if (currentCount >= 1) { int index = -1; foreach (char ch in chars) { CMDToComplete = CMDToComplete + ch.ToString(); } foreach (string c in CommandManager.CMDs) { index++; if (c.StartsWith(CMDToComplete)) { CommandsHistory.ClearCurrentConsoleLine(); currentCount = 0; chars.Clear(); Aura_OS.Kernel.BeforeCommand(); foreach (char chr in c) { chars.Add(chr); Write(chr); currentCount++; } } } continue; } } else if (current.Key == ConsoleKeyEx.C && KeyboardManager.ControlPressed) { CMDToComplete = ""; if (Aura_OS.Kernel.AConsole.writecommand) { CommandsHistory.ClearCurrentConsoleLine(); currentCount = 0; chars.Clear(); Aura_OS.Kernel.BeforeCommand(); } } else if (current.Key == ConsoleKeyEx.UpArrow) //COMMAND HISTORY UP { if (Aura_OS.Kernel.AConsole.writecommand) //IF SHELL { CMDToComplete = ""; if (CommandsHistory.CHIndex >= 0) { CommandsHistory.ClearCurrentConsoleLine(); currentCount = 0; chars.Clear(); Aura_OS.Kernel.BeforeCommand(); string Command = Aura_OS.Kernel.AConsole.commands[CommandsHistory.CHIndex]; CommandsHistory.CHIndex = CommandsHistory.CHIndex - 1; foreach (char chr in Command) { if (currentCount == chars.Count) { chars.Add(chr); Write(chr); currentCount++; } else { //Insert the new character in the correct location //For some reason, List.Insert() doesn't work properly //so the character has to be inserted manually List <char> temp = new List <char>(); for (int x = 0; x < chars.Count; x++) { if (x == currentCount) { temp.Add(chr); } temp.Add(chars[x]); } chars = temp; //Shift the characters to the right for (int x = currentCount; x < chars.Count; x++) { Write(chars[x]); } Aura_OS.Kernel.AConsole.X -= (chars.Count - currentCount) - 1; currentCount++; } } } } continue; } else if (current.Key == ConsoleKeyEx.DownArrow) //COMMAND HISTORY UP { if (Aura_OS.Kernel.AConsole.writecommand) //IF SHELL { CMDToComplete = ""; if (CommandsHistory.CHIndex < Aura_OS.Kernel.AConsole.commands.Count - 1) { CommandsHistory.ClearCurrentConsoleLine(); currentCount = 0; chars.Clear(); Aura_OS.Kernel.BeforeCommand(); CommandsHistory.CHIndex = CommandsHistory.CHIndex + 1; if (!firstdown) { CommandsHistory.CHIndex = CommandsHistory.CHIndex + 1; firstdown = true; } string Command = Aura_OS.Kernel.AConsole.commands[CommandsHistory.CHIndex]; foreach (char chr in Command) { if (currentCount == chars.Count) { chars.Add(chr); Write(chr); currentCount++; } else { //Insert the new character in the correct location //For some reason, List.Insert() doesn't work properly //so the character has to be inserted manually List <char> temp = new List <char>(); for (int x = 0; x < chars.Count; x++) { if (x == currentCount) { temp.Add(chr); } temp.Add(chars[x]); } chars = temp; //Shift the characters to the right for (int x = currentCount; x < chars.Count; x++) { Write(chars[x]); } Aura_OS.Kernel.AConsole.X -= (chars.Count - currentCount) - 1; currentCount++; } } } } continue; } if (current.KeyChar == '\0') { continue; } //Write the character to the screen if (currentCount == chars.Count) { chars.Add(current.KeyChar); Write(current.KeyChar); currentCount++; } else { //Insert the new character in the correct location //For some reason, List.Insert() doesn't work properly //so the character has to be inserted manually List <char> temp = new List <char>(); for (int x = 0; x < chars.Count; x++) { if (x == currentCount) { temp.Add(current.KeyChar); } temp.Add(chars[x]); } chars = temp; //Shift the characters to the right for (int x = currentCount; x < chars.Count; x++) { Write(chars[x]); } GetConsole().X -= (chars.Count - currentCount) - 1; currentCount++; } } WriteLine(); xConsole.CursorVisible = false; char[] final = chars.ToArray(); return(new string(final)); }
void Start() { keyboard = FindObjectOfType<KeyboardManager>(); Sound = FindObjectOfType<SoundManager> (); exteriorLights.SetActive(false); interiorLights.SetActive(false); minThrustValue = -maxThrustValue/2; }