public override Option <ICommand> HandleKeyInput(int key) { switch (InputMapping.GetInventoryInput(key)) { case InventoryInput.MoveDown: if (_currIndex < _subinv.TypeCount - 1) { CurrKey++; } return(Option.None <ICommand>()); case InventoryInput.MoveUp: if (_currIndex > 0) { CurrKey--; } return(Option.None <ICommand>()); case InventoryInput.Open: Item item = _subinv.GetItem(_currIndex); return(ResolveInput(item)); case InventoryInput.OpenLetter: char charKey = key.ToChar(); if (_subinv.HasIndex(charKey - 'a')) { CurrKey = charKey; goto case InventoryInput.Open; } else { return(Option.None <ICommand>()); } default: return(Option.None <ICommand>()); } }
public virtual Option <ICommand> HandleKeyInput(int key) { switch (InputMapping.GetInventoryInput(key)) { case InventoryInput.MoveDown: if (CurrKey < Game.Player.Inventory.LastKey) { CurrKey++; } return(Option.None <ICommand>()); case InventoryInput.MoveUp: if (CurrKey > 'a') { CurrKey--; } return(Option.None <ICommand>()); case InventoryInput.Open: return(HandleOpen()); case InventoryInput.OpenLetter: char charKey = key.ToChar(); if (Game.Player.Inventory.HasKey(charKey)) { CurrKey = charKey; goto case InventoryInput.Open; } else { return(Option.None <ICommand>()); } default: return(Option.None <ICommand>()); } }