private void Start() { _point = Instantiate(Resources.Load <GameObject>("Prefabs/Point"), new Vector3(1000, 1000), Quaternion.identity) as GameObject; detector = FindObjectOfType <MouseClickDetector>(); MouseClickDetector.onMissClick += () => SetDestination(World.GetMousePosition(), true); World.ship = this; }
/// <summary> /// Handles the LeftClickMouseDown event of the Control object. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param> private static void Control_LeftClickMouseDown(object sender, MouseButtonEventArgs e) { FrameworkElement element = sender as FrameworkElement; // Silverlight doesn't give us quite as much help here as WPF does. #if SILVERLIGHT if (MouseClickDetector.IsDoubleClick(sender, e) || element == null /* TODO Ensure it's left button */) { return; } #else if (e.ClickCount != 1 || e.LeftButton != MouseButtonState.Pressed || element == null) { return; } #endif ICommand command = GetLeftClickCommand(element); object param = GetLeftClickCommandParameter(element); if (command != null && command.CanExecute(param)) { command.Execute(param); e.Handled = true; } }
protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } MouseClickDetector.Update(); ScenesManager.Update(gameTime.ElapsedGameTime.Milliseconds); base.Update(gameTime); }
public void ButtonClickOK() { GameAnalytics.Instance.Reset(); MouseClickDetector.Clear(); ScenesManager.ChangeScene <StartScene>(); }