Beispiel #1
0
        /// <summary>
        /// public method to call when the mouse is pressed
        /// </summary>
        /// <param name="evt">MouseEventArgs</param>
        /// <param name="id">MouseButtonID</param>
        public void MousePressed(SharpInputSystem.MouseEventArgs evt, SharpInputSystem.MouseButtonID id)
        {
            if (id == SharpInputSystem.MouseButtonID.Left)
            {
                this.Selecting = true;
                Clear();
                switch (this.SelectionMode)
                {
                case SelectionModeType.SelectionBox:
                    Log("MouseSelector: Selection starting for " + this._name);
                    Clear();
                    this._start = new Vector2(evt.State.X.Absolute / (float)this._Camera.Viewport.ActualWidth,
                                              evt.State.Y.Absolute / (float)this._Camera.Viewport.ActualHeight);
                    this._stop           = this._start;
                    this._rect.IsVisible = true;
                    Log("MouseSelector: " + this._name + " selecting from top(" + this._start.x.ToString() + ";" +
                        this._start.y.ToString() + ")");
                    this._rect.SetCorners(this._start, this._stop);
                    break;

                case SelectionModeType.MouseClick:
                    this._start = new Vector2(evt.State.X.Absolute / (float)this._Camera.Viewport.ActualWidth,
                                              evt.State.Y.Absolute / (float)this._Camera.Viewport.ActualHeight);
                    break;
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// mouse pressed event override from SdkSample, calls MouseSelector's MousePressed method to start selection
 /// </summary>
 /// <param name="evt">MouseEventArgs</param>
 /// <param name="id">MouseButtonID</param>
 /// <returns>bool</returns>
 public override bool MousePressed(SharpInputSystem.MouseEventArgs evt, SharpInputSystem.MouseButtonID id)
 {
     if (this.initialized)
     {
         this._MouseSelector.MousePressed(evt, id);
     }
     return base.MousePressed(evt, id);
 }
Beispiel #3
0
 /// <summary>
 /// public method to call when the mouse is moved
 /// </summary>
 /// <param name="evt"></param>
 public void MouseMoved(SharpInputSystem.MouseEventArgs evt)
 {
     if ((this.SelectionMode == SelectionModeType.SelectionBox) && this.Selecting == true)
     {
         this._stop = new Vector2(evt.State.X.Absolute / (float)this._Camera.Viewport.ActualWidth,
                                  evt.State.Y.Absolute / (float)this._Camera.Viewport.ActualHeight);
         this._rect.SetCorners(this._start, this._stop);
     }
 }
Beispiel #4
0
 public override bool MouseReleased(SharpInputSystem.MouseEventArgs evt, SharpInputSystem.MouseButtonID id)
 {
     if (TrayManager.InjectMouseUp(evt, id))
     {
         return(true);
     }
     this.mWiping = false; // stop wiping frost if user releases LMB
     return(true);
 }
Beispiel #5
0
 public override bool MousePressed(SharpInputSystem.MouseEventArgs evt, SharpInputSystem.MouseButtonID id)
 {
     if (TrayManager.InjectMouseDown(evt, id))
     {
         return(true);
     }
     this.mWiping = true; // wipe frost if user left clicks in the scene
     return(true);
 }
Beispiel #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="evt"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public override bool MousePressed(SharpInputSystem.MouseEventArgs evt, SharpInputSystem.MouseButtonID id)
        {
            // relay input events to character controller
            if (!TrayManager.IsDialogVisible)
            {
                this.chara.InjectMouseDown(evt, id);
            }

            return(base.MousePressed(evt, id));
        }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="evt"></param>
        /// <returns></returns>
        public override bool MouseMoved(SharpInputSystem.MouseEventArgs evt)
        {
            // relay input events to character controller
            if (!TrayManager.IsDialogVisible)
            {
                this.chara.InjectMouseMove(evt);
            }

            return(base.MouseMoved(evt));
        }
Beispiel #8
0
 /// <summary>
 /// mouse moved event override from SdkSample, calls the MouseSelector's MouseMoved event for SelectionBox
 /// </summary>
 /// <param name="evt">MouseEventArgs</param>
 /// <returns>bool</returns>
 public override bool MouseMoved(SharpInputSystem.MouseEventArgs evt)
 {
     if (this.initialized)
     {
         this._MouseSelector.MouseMoved(evt);
         this.MouseLocationLabel.Caption = "(x:y) " + (evt.State.X.Absolute / (float)Camera.Viewport.ActualWidth).ToString() +
                                           ":" +
                                           (evt.State.Y.Absolute / (float)Camera.Viewport.ActualHeight).ToString();
     }
     return base.MouseMoved(evt);
 }
Beispiel #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 /// <param name="id"></param>
 public void InjectMouseDown(SharpInputSystem.MouseEventArgs e, SharpInputSystem.MouseButtonID id)
 {
     if (this.swordsDrawn && (this.topAnimID == AnimationID.IdleTop || this.topAnimID == AnimationID.RunTop))
     {
         // if swords are out, and character's not doing something weird, then SLICE!
         if (id == SharpInputSystem.MouseButtonID.Left)
         {
             SetTopAnimation(AnimationID.SliceVertical, true);
         }
         else if (id == SharpInputSystem.MouseButtonID.Right)
         {
             SetTopAnimation(AnimationID.SliceHorizontal, true);
         }
         this.timer = 0;
     }
 }
Beispiel #10
0
        /// <summary>
        /// public method to call when the mouse button is released
        /// </summary>
        /// <param name="evt"></param>
        /// <param name="id"></param>
        public void MouseReleased(SharpInputSystem.MouseEventArgs evt, SharpInputSystem.MouseButtonID id)
        {
            if (id == SharpInputSystem.MouseButtonID.Left && this.Selecting == true)
            {
                switch (this.SelectionMode)
                {
                case SelectionModeType.SelectionBox:
                    Log("MouseSelector: " + this._name + " selecting to bottom(" + this._stop.x.ToString() + ";" +
                        this._stop.y.ToString() + ")");
                    PerformSelectionWithSelectionBox(this._start, this._stop);
                    this.Selecting       = false;
                    this._rect.IsVisible = false;
                    Log("MouseSelector: " + this._name + " selection complete.");
                    break;

                case SelectionModeType.MouseClick:
                    PerformSelectionWithMouseClick();
                    break;
                }
                this.Selecting = false;
            }
        }
Beispiel #11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 public void InjectMouseMove(SharpInputSystem.MouseEventArgs e)
 {
     // update camera goal based on mouse movement
     UpdateCameraGoal(-0.05f * e.State.X.Relative, -0.05f * e.State.Y.Relative, -0.0005f * e.State.Z.Relative);
 }