|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.commands.MouseCommand
This is the default handler for mouse commands. It does various semi-intelligent things based on the button & modifiers:
Method Summary | |
void |
addCommands(java.util.Map commands,
CommandList list)
Construct the command with the specified player. |
boolean |
attemptExamine(MouseCommandEvent event,
Commandable agent)
Attempts to examine whatever was clicked. |
boolean |
attemptFire(MouseCommandEvent event,
Commandable agent)
Attempts to "fire" the player's readied object. |
boolean |
attemptMove(MouseCommandEvent event,
Commandable agent)
Tries to move the player to where they clicked. |
CommandEvent |
createEvent(CommandEvent initial)
Implements Command.createEvent() |
CommandEvent |
createSelectEvent(CommandEvent event)
Parses the arguments to a ground/inv selection. |
boolean |
doShiftClick(GameObject obj,
Commandable agent)
Decides what to do with an object on shift-click. |
boolean |
execute(CommandEvent e)
Implements Command.execute() |
boolean |
executeSelect(CommandEvent event)
Handles a mouse event in the ground/inventory lists. |
static MouseCommand |
getImpl()
|
GameObject |
getInvRef(int index,
CommandEvent event)
Returns the object in inventory at the specified index, or null if not found. |
boolean |
handleGroundDisplay(int index,
int mods,
java.lang.String button,
CommandEvent event)
Handles mouse-click in ground display. |
boolean |
handlePopupCommand(int index,
java.lang.String display,
java.lang.String command,
CommandEvent event)
Handles user choosing a popup menu command for an item on the ground or in inventory. |
boolean |
knowsCommand(java.lang.String command)
We don't have any way of determining that we don't know how to handle the command based just on its arguments. |
static void |
main(java.lang.String[] args)
Prints event modifiers. |
boolean |
mousebind(CommandEvent event)
Turns on or off the old-style mouse left-button behavior of dropping or picking up the item. |
void |
moveOneStep(Point start,
Point end,
Commandable agent,
CommandEvent event)
This is the old way we handled mouse clicks - the agent would take one step in the direction of the click. |
boolean |
readyObject(GameObject obj,
Commandable agent)
Readies or unreadies the selected obj. |
void |
translateModifiers(int mods,
CommandEvent event)
Sets a property in the event called "button", where the value is one of "left", "middle" or "right". |
static void |
translateToPlayer(Point p,
Commandable agent)
Translates a point from a viewport coordinate to a coordinate relative to the passed player. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static MouseCommand getImpl()
public void addCommands(java.util.Map commands, CommandList list)
addCommands
in interface BuiltInCommand
commands
- the map to add commands tolist
- the player getting the commandspublic boolean knowsCommand(java.lang.String command)
knowsCommand
in interface Command
command
- the entire command string, including arguments
public CommandEvent createEvent(CommandEvent initial)
createEvent
in interface Command
initial
- a "blank" CommandEvent containing only the
command text and the agent who's performing the command. This
initial event is created by the originator of the event (e.g.
the AI or player's command preprocessor).
Command.createEvent(wyvern.lib.CommandEvent)
public static void translateToPlayer(Point p, Commandable agent)
p
- the point to translateagent
- the agent to translate topublic CommandEvent createSelectEvent(CommandEvent event)
event
- the initial "sel" eventpublic boolean execute(CommandEvent e)
execute
in interface Command
e
- the CommandEvent to execute
Command.execute(wyvern.lib.CommandEvent)
public void translateModifiers(int mods, CommandEvent event)
mods
- the java.awt.event.MouseEvent modifiersevent
- the event to set the button in (from the modifiers)public boolean executeSelect(CommandEvent event)
event
- the eventpublic boolean handleGroundDisplay(int index, int mods, java.lang.String button, CommandEvent event)
index
- the index of the object to examinemods
- the java.awt.event.MouseEvent.getModifiers()button
- "left", "right" or "middle"event
- the event we're executingpublic GameObject getInvRef(int index, CommandEvent event)
public boolean doShiftClick(GameObject obj, Commandable agent)
public boolean readyObject(GameObject obj, Commandable agent)
public boolean handlePopupCommand(int index, java.lang.String display, java.lang.String command, CommandEvent event)
public boolean attemptMove(MouseCommandEvent event, Commandable agent)
event
- the MouseCommandEvent containing the event paramsagent
- the agent who clicked the mousepublic void moveOneStep(Point start, Point end, Commandable agent, CommandEvent event)
public boolean attemptExamine(MouseCommandEvent event, Commandable agent)
event
- the mouse command eventagent
- the agent who clicked the mouse
public boolean attemptFire(MouseCommandEvent event, Commandable agent)
event
- eventagent
- the player
public boolean mousebind(CommandEvent event)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |