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; } } } }
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); } }