当前位置: 首页>>代码示例>>C#>>正文


C# InputHandler.CheckMouseIn方法代码示例

本文整理汇总了C#中InputHandler.CheckMouseIn方法的典型用法代码示例。如果您正苦于以下问题:C# InputHandler.CheckMouseIn方法的具体用法?C# InputHandler.CheckMouseIn怎么用?C# InputHandler.CheckMouseIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InputHandler的用法示例。


在下文中一共展示了InputHandler.CheckMouseIn方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetInteracting

 public override DragDropElement GetInteracting(InputHandler handler)
 {
     if(handler.CheckMouseIn(holder))
     {
         return holder.GetInteracting(handler);
     }
     return this;
 }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:8,代码来源:GetVariableDragDrop.cs

示例2: Update

        public void Update(InputHandler handler)
        {
            if(handler.CheckMouseIn(this))
            {
                col = Color.Gold;

            } else
            {
                col = Color.Yellow;
            }
        }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:11,代码来源:MainMenuButton.cs

示例3: GetInteracting

 public override DragDropElement GetInteracting(InputHandler handler)
 {
     if(handler.CheckMouseIn(holderA))
     {
         holderB.TellSelected(false);
         return holderA.GetInteracting(handler);
     }
     else
     if(handler.CheckMouseIn(holderB))
     {
         holderA.TellSelected(false);
         return holderB.GetInteracting(handler);
     }
     return this;
 }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:15,代码来源:BooleanMethod.cs

示例4: GetTopInteracting

 public override DragDropElement GetTopInteracting(InputHandler handler)
 {
     if (handler.CheckMouseIn(holderA))
     {
         return holderA;
     }
     else
         if (handler.CheckMouseIn(holderB))
         {
             return holderB;
         }
     return this;
 }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:13,代码来源:BooleanMethod.cs

示例5: Update

        public override void Update(InputHandler handler)
        {
            this.height = GetWidth();

            if (editing)
            {

                point.SetX(this.GetX() + this.GetWidth());
                point.SetY(this.GetY());

                if(handler.CheckLeftMouseJustPressed() && handler.CheckMouseIn(point))
                {
                    dragging = true;
                    original = point.GetPoint();
                    oRadius = GetRadius();
                }

                if(handler.CheckLeftMouseJustReleased())
                {
                    dragging = false;

                }
                else
                if(dragging)
                {
                    point.SetX(original.X + handler.LeftMouseDraggedBy().X);
                    this.SetRadius(oRadius + handler.LeftMouseDraggedBy().X);
                }

            }
        }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:31,代码来源:LevelCircle.cs

示例6: Update

        public void Update(InputHandler handler, int x, int y)
        {
            if (!neverEditAgain)
            {
                if (handler.CheckJustPressedKey(Keys.H))
                {
                    showMode = !showMode;
                }

                if (handler.CheckLeftMouseJustPressed())
                {
                    if (handler.CheckMouseIn(c.ScalePosition(start)))
                    {
                        dragPointC = true;
                        original = c.GetPoint();
                    }
                    else
                        if (handler.CheckMouseIn(b.ScalePosition(start)))
                        {
                            dragPointB = true;

                            original = b.GetPoint();
                        }
                        else
                            if (handler.CheckMouseIn(a.ScalePosition(start)))
                            {
                                dragPointA = true;

                                original = a.GetPoint();
                            }
                }
                else
                    if (handler.CheckLeftMouseJustReleased())
                    {
                        dragPointA = dragPointB = dragPointC = false;
                    }

                    if (dragPointA)
                    {
                        a.SetPoint(original + handler.LeftMouseDraggedBy());
                    }
                    else
                        if (dragPointB)
                        {

                            b.SetPoint(original + handler.LeftMouseDraggedBy());
                        }
                        else
                            if (dragPointC)
                            {

                                c.SetPoint(original + handler.LeftMouseDraggedBy());
                            }
            }
            start.X = x;
            start.Y = y;
        }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:57,代码来源:ArmTool.cs

示例7: GetTopInteracting

        public override DragDropElement GetTopInteracting(InputHandler handler)
        {
            if(handler.CheckMouseIn(holder))
            return holder;

            return this;
            //throw new NotImplementedException();
        }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:8,代码来源:GetVariableDragDrop.cs

示例8: UpdateScrolling

        private void UpdateScrolling(InputHandler handler)
        {
            #region Check if the Mouse was pressed in the button.
            if (handler.CheckLeftMouseJustPressed())
            {
                if(handler.CheckMouseIn(scrollUp))
                {
                    scrollUp.TellSelected(true);
                }
                else
                if(handler.CheckMouseIn(scrollDown))
                {
                    scrollDown.TellSelected(true);
                }
            }
            #endregion

            #region If mouse released, it knows both buttons are not pressed.
            if (handler.CheckLeftMouseJustReleased())
            {
                scrollDown.TellSelected(false);
                scrollUp.TellSelected(false);
            }
            #endregion
        }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:25,代码来源:DragDropInterface.cs

示例9: UpdateSuggestions

        private void UpdateSuggestions(InputHandler handler)
        {
            if (draggedElement != null) return;

            if(handler.CheckLeftMouseJustPressed())
            foreach(LooseDragDropLink link in suggestions)
            {
                if(handler.CheckMouseIn(link))
                {
                    suggestedElement = link;
                    break;
                }
            }

            if (handler.CheckLeftMouseJustReleased())
            {
                suggestedElement = null;
            }

            if(suggestedElement != null)
            if (!(handler.LeftMouseDraggedBy().X == 0 && handler.LeftMouseDraggedBy().Y == 0))
            {
                elements.Add(new LooseDragDropLink(suggestedElement.GetElement().Clone()));
                draggedElement = elements[elements.Count - 1];
                Point XY = handler.GetMouseXY();
                originalPoint = XY;
                elements[elements.Count - 1].SetPoint(ref XY);
            }
        }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:29,代码来源:DragDropInterface.cs

示例10: UpdateMode

 private void UpdateMode(InputHandler inputHandler)
 {
     if(inputHandler.CheckLeftMouseJustPressed())
     {
         foreach (ModeToggleButton button in modes)
         {
             if (inputHandler.CheckMouseIn(button))
             {
                 selectedMode.TellSelected(false);
                 button.TellSelected(true);
                 selectedMode = button;
                 break;
             }
         }
     }
 }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:16,代码来源:DragDropInterface.cs

示例11: UpdateInteraction

        private void UpdateInteraction(InputHandler handler)
        {
            #region Check if released element is in the same area as another element
            foreach (LooseDragDropLink element in elements)
            {

                if (element == draggedElement) continue;

                if (handler.CheckMouseIn(element))
                {
                    #region If the Current Element Dropped in is a Variable Placeholder
                    if (element.GetElement() is DragDropVariablePlaceholder)
                    {
                        bool rep = ((DragDropVariablePlaceholder)element.GetElement()).AddVariable(draggedElement);
                        if (rep)
                        {
                            elements.Remove(draggedElement);
                            draggedElement = null;
                        }

                    }
                    #endregion
                    else
                    #region If the Current Element being Interacted with is a Variable Placeholder
                    if (element.GetElement().GetInteracting(handler) is DragDropVariablePlaceholder)
                    {
                        bool rep = ((DragDropVariablePlaceholder)element.GetElement().GetInteracting(handler)).AddVariable(draggedElement);
                        if (rep)
                        {
                            elements.Remove(draggedElement);
                            draggedElement = null;
                        }
                    }
                    #endregion
                    break;
                }
            }
            #endregion
        }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:39,代码来源:DragDropInterface.cs

示例12: UpdateElements

        private void UpdateElements(InputHandler handler)
        {
            if (draggedElement == null)
            {
                #region If Mouse Pressed
                if (handler.CheckLeftMouseJustPressed())
                {
                    #region Check if an Element was Clicked
                    for (int i = 0;i < elements.Count; i++)
                    {
                        var element = elements[elements.Count - i - 1];
                        if (handler.CheckMouseIn(element))
                        {
                            #region Set as Dragged Object
                            draggedElement = element;
                            originalPoint = element.GetPoint();
                            elements.Remove(element);
                            elements.Add(element);
                            #endregion
                            break;
                        }
                    }
                    #endregion

                }
                #endregion
            }
            else
            {
                if (dragging)
                {

                    if (handler.CheckLeftMouseJustReleased())
                    {
                        //Just in case stuff needs to be done.
                        #region Release Dragged Object
                        UpdateInteraction(handler);
                        if (draggedElement != null && draggedElement.GetX() < widthOfMenu)
                        {
                            RemoveElement(draggedElement);
                        }
                        draggedElement = null;
                        dragging = false;

                        #endregion
                    }
                    else
                    {
                        #region Set the X and Y of the Dragged Object
                        draggedElement.SetX(originalPoint.X + handler.LeftMouseDraggedBy().X);
                        draggedElement.SetY(originalPoint.Y + handler.LeftMouseDraggedBy().Y);
                        #endregion
                    }
                }
                else
                {
                    #region Detect if Dragged Piece was actually moved.
                    if (!(handler.LeftMouseDraggedBy().X == 0 && handler.LeftMouseDraggedBy().Y == 0))
                    {
                        dragging = true;
                        #region Removes the element from a slot.
                        if (draggedElement.GetElement() is DragDropVariablePlaceholder)
                        {
                            if (((DragDropVariablePlaceholder)draggedElement.GetElement()).HasVariable())
                            {
                                elements.Add(((DragDropVariablePlaceholder)draggedElement.GetElement()).PopVariable());
                                draggedElement = elements[elements.Count - 1];
                                originalPoint = handler.GetMouseXY();
                            }
                        }
                        #endregion
                        else
                        #region Removes the element from a slot that is contained in another piece
                        if (draggedElement.GetElement().GetTopInteracting(handler) is DragDropVariablePlaceholder)
                        {
                            DragDropVariablePlaceholder slot = (DragDropVariablePlaceholder)((DragDropVariablePlaceholder)draggedElement.GetElement().GetTopInteracting(handler)).GetInnerMostDragDrop(handler);

                            if ((slot).HasVariable())
                            {
                                elements.Add((slot).PopVariable());
                                draggedElement = elements[elements.Count - 1];

                                originalPoint = handler.GetMouseXY();
                            }
                        }
                        #endregion
                    }
                    #endregion
                    else
                    #region If the piece is released, select it.
                        if (handler.CheckLeftMouseJustReleased())
                        {
                            if (selectedElement != null && selectedElement != draggedElement) selectedElement.GetElement().TellSelected(false);
                            draggedElement.GetElement().GetInteracting(handler).TellSelected(true);
                            selectedElement = draggedElement;
                            draggedElement = null;
                        }
                    #endregion
                }

//.........这里部分代码省略.........
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:101,代码来源:DragDropInterface.cs

示例13: Update


//.........这里部分代码省略.........
                    }
                    if (handler.CheckJustPressedKey(Keys.G))
                    {
                        //Load an animation onto a person.
                        //loop it to test.

                        if (couldDrag != null && couldDrag is LevelPerson)
                        {
                            fileMode = 3;
                            textBox.TellSelected(true);
                        }
                    }

                    if (handler.CheckJustPressedKey(Keys.C))
                        if (!modifyingOne && couldDrag != null && !dragging && colorize == null)
                        {
                            originX = handler.GetMouseX();
                            originY = handler.GetMouseY();

                            r.SetX(originX);
                            g.SetX(originX);
                            b.SetX(originX);

                            r.SetY(originY);
                            g.SetY(originY);
                            b.SetY(originY);
                            colorize = couldDrag;
                        }

                }

                if (handler.CheckLeftMouseJustPressed())
                {
                    if (handler.CheckMouseIn(r))
                    {
                        draggingColor = 1;
                        original = r.GetPoint();
                    }
                    else
                        if (handler.CheckMouseIn(g))
                        {
                            draggingColor = 2;

                            original = g.GetPoint();
                        }
                        else
                            if (handler.CheckMouseIn(b))
                            {
                                draggingColor = 3;

                                original = b.GetPoint();
                            }
                            else
                                if (!modifyingOne && couldDrag != null && !dragging && draggingColor == 0 && colorize == null)
                                {
                                    dragging = true;
                                    original = couldDrag.GetPoint();
                                    dragged = couldDrag;

                                    if (bringToFront)
                                    {
                                        objects.Remove(dragged);
                                        objects.Add(dragged);
                                    }
                                    dragged.SetEditing(!hideEditing);
                                }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:67,代码来源:WorldEditor.cs

示例14: Update


//.........这里部分代码省略.........
                    lleft.LoadFrame(ff);
                }

                if (handler.CheckPressedKey(Keys.LeftShift) || handler.CheckPressedKey(Keys.RightShift))
                {
                    if (handler.CheckPressedKey(Keys.Down))
                    {
                        testingRectangle.ModifyHeight(SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Up))
                    {
                        testingRectangle.ModifyHeight(-SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Left))
                    {
                        testingRectangle.ModifyWidth(-SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Right))
                    {
                        testingRectangle.ModifyWidth(SPEED);
                    }
                }
                else
                {
                    if (handler.CheckPressedKey(Keys.Down))
                    {
                        testingRectangle.ModifyY(SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Up))
                    {
                        testingRectangle.ModifyY(-SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Left))
                    {
                        testingRectangle.ModifyX(-SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Right))
                    {
                        testingRectangle.ModifyX(SPEED);
                    }
                }

                #region Check if the mouse is in the body.
                if (dragBody)
                    if (handler.CheckMouseIn(testingRectangle))
                    {

                        if (handler.CheckLeftMousePressed())
                        {
                            if (!dragging && handler.LeftMouseDraggedBy().X == 0 && handler.LeftMouseDraggedBy().Y == 0)
                            {
                                this.originalPoint = testingRectangle.GetPoint();
                                if (mode) this.originalPoint = testingRectangle.GetSize();
                                dragging = true;
                            }

                        }
                        else
                        {
                            color = Color.Red;
                            dragging = false;
                        }

                    }
                    else
                    {
                        color = Color.DarkGray;
                    }

                if (dragging)
                {
                    color = Color.DarkRed;
                    Point fix = originalPoint + handler.LeftMouseDraggedBy();
                    if (mode)
                    {
                        testingRectangle.SetSize(ref fix);

                    }
                    else
                    {

                        testingRectangle.SetPoint(ref fix);
                    }
                }

                #endregion

                blink++;
            } catch (Exception ex)
            {
                Logger.WriteLine(ex.ToString());
                fileMode = 0;
            }
        }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:101,代码来源:AnimationTool.cs


注:本文中的InputHandler.CheckMouseIn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。