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


C# InputHandler.MouseLoc方法代码示例

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


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

示例1: HandleInput

 public override void HandleInput(InputHandler input)
 {
     if (input.MousePressed(1))
     {
         if (closeButton.Contains(input.MouseLoc()))
         {
             Exit();
         }
     }
     base.HandleInput(input);
 }
开发者ID:Zieroc,项目名称:Poorly_Drawn_Dungeons,代码行数:11,代码来源:MessageBox.cs

示例2: HandleInput

        public override void HandleInput(InputHandler input)
        {
            if (hasFocus)
            {
                if (input.MousePressed(1))
                {
                    Point mouseLoc = input.MouseLoc();
                    if (rectangles[0].Contains(mouseLoc) && numShown > 0)
                    {
                        OnSelectItem(0);
                    }
                    else if (rectangles[1].Contains(mouseLoc) && numShown > 1)
                    {
                        OnSelectItem(1);
                    }
                    else if (rectangles[2].Contains(mouseLoc) && numShown > 2)
                    {
                        OnSelectItem(2);
                    }
                    else if (rectangles[3].Contains(mouseLoc) && numShown > 3)
                    {
                        OnSelectItem(3);
                    }
                    else if (arrowRectangles[0].Contains(mouseLoc) && drawTopArrow)
                    {
                        topIndex -= 2;
                        numShown = Math.Min(numItems - topIndex, 4);
                    }
                    else if (arrowRectangles[1].Contains(mouseLoc) && drawBottomArrow)
                    {
                        topIndex += 2;
                        numShown = Math.Min(numItems - topIndex, 4);
                    }
                    else if (arrowRectangles[2].Contains(mouseLoc))
                    {
                        OnCancel(this, new EventArgs());
                    }
                }

                if (input.MouseMoved())
                {
                    Point mouseLoc = input.MouseLoc();
                    if (rectangles[0].Contains(mouseLoc) && numShown > 0)
                    {
                        selectedIndex = 0 + topIndex;
                    }
                    else if (rectangles[1].Contains(mouseLoc) && numShown > 1)
                    {
                        selectedIndex = 1 + topIndex;
                    }
                    else if (rectangles[2].Contains(mouseLoc) && numShown > 2)
                    {
                        selectedIndex = 2 + topIndex;
                    }
                    else if (rectangles[3].Contains(mouseLoc) && numShown > 3)
                    {
                        selectedIndex = 3 + topIndex;
                    }
                }
            }
        }
开发者ID:Zieroc,项目名称:Poorly_Drawn_Dungeons,代码行数:61,代码来源:ItemMenu.cs

示例3: HandleInput

        public override void HandleInput(InputHandler input)
        {
            if (hasFocus && battle.Turn == 1)
            {
                if (input.MousePressed(1))
                {
                    Point mouseLoc = input.MouseLoc();
                    if (attackRec.Contains(mouseLoc))
                    {
                        OnSelectItem(0);
                    }
                    else if (fleeRec.Contains(mouseLoc))
                    {
                        OnSelectItem(1);
                    }
                    else if (magicRec.Contains(mouseLoc))
                    {
                        OnSelectItem(2);
                    }
                    else if (itemRec.Contains(mouseLoc))
                    {
                        OnSelectItem(3);
                    }
                    else if (endTurnRec.Contains(mouseLoc))
                    {
                        battle.EndTurn();
                    }
                }

                if (input.MouseMoved())
                {
                    Point mouseLoc = input.MouseLoc();
                    if (attackRec.Contains(mouseLoc))
                    {
                        selectedIndex = 0;
                    }
                    else if (fleeRec.Contains(mouseLoc))
                    {
                        selectedIndex = 1;
                    }
                    else if (magicRec.Contains(mouseLoc))
                    {
                        selectedIndex = 2;
                    }
                    else if (itemRec.Contains(mouseLoc))
                    {
                        selectedIndex = 3;
                    }
                }

                base.HandleInput(input);
            }
        }
开发者ID:Zieroc,项目名称:Poorly_Drawn_Dungeons,代码行数:53,代码来源:BattleMenu.cs


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