public override void KeyPress(KeyboardState state, KeyMapper mapper) { if(mapper.HasState("arrowDown", state) && selectedItem != listContent.Count - 1) { selectedItem++; if (firstDisplayedItem + numDisplayableItems - 1 < selectedItem) firstDisplayedItem++; } if (mapper.HasState("arrowUp", state) && selectedItem != 0) { selectedItem--; if (firstDisplayedItem > selectedItem) firstDisplayedItem--; } if(mapper.HasState("enter", state)) selectedAction(selectedItem); base.KeyPress(state, mapper); }
public bool OnKeyPress(KeyMapper keyMapper, KeyboardState state) { int tempX = x; int tempY = y; bool walked = false; if(keyMapper.HasState("moveSW", state)) { tempX--; tempY++; walked = true; } else if(keyMapper.HasState("moveS", state)) { tempY++; walked = true; } else if(keyMapper.HasState("moveSE", state)) { tempX++; tempY++; walked = true; } else if(keyMapper.HasState("moveW", state)) { tempX--; walked = true; } else if(keyMapper.HasState("wait1", state)) { walked = true; } else if(keyMapper.HasState("moveE", state)) { tempX++; walked = true; } else if(keyMapper.HasState("moveNW", state)) { tempX--; tempY--; walked = true; } else if(keyMapper.HasState("moveN", state)) { tempY--; walked = true; } else if(keyMapper.HasState("moveNE", state)) { tempX++; tempY--; walked = true; } else { walked = false; } if(walked) { if (map.inMap(tempX, tempY)) { if (map[tempX, tempY].walkable) { move(tempX, tempY); GameObject.newTurn(); return true; } else { if (delia) { if (trogRage > 10) { GameLog.newMessage("You bump into the wall. Nothing happens."); GameLog.newMessage("All nearby enemies in the dungeon spend a turn laughing at your stupidity.", Color.LightBlue); } if (trogRage == 10) { GameLog.newMessage("You bump into the wall. You explode and die."); GameLog.newMessage("Trog intervenes to save you. He says:", Color.Gold); GameLog.newMessage(" I'm tired of saving you....therefore im taking all the explosions from you.", Color.Goldenrod); GameLog.newMessage(" MUHAHAHAHAHAHAHAHAH", Color.Red); trogRage++; } if (trogRage < 10) { GameLog.newMessage("You bump into the wall. You explode and die."); GameLog.newMessage("Trog intervenes to save you. His advice:", Color.Gold); GameLog.newMessage(" Maybe next time you don't do that. Reverting time.....", Color.Goldenrod); trogRage++; } } } } } return false; }
public virtual void KeyPress(KeyboardState state, KeyMapper mapper) { }