Exemple #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;
                }
            }
        }
Exemple #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);
 }
Exemple #3
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);
 }
Exemple #4
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);
 }
Exemple #5
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));
        }
Exemple #6
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;
     }
 }
Exemple #7
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;
            }
        }