Add a very basic inventory panel
Add a very basic inventory panel to the game opened by pressing `i`, which displays the contents of the player's inventory in a basic list.
This commit is contained in:
		
							parent
							
								
									71b628c604
								
							
						
					
					
						commit
						65b1352ef2
					
				
					 8 changed files with 79 additions and 39 deletions
				
			
		|  | @ -34,7 +34,7 @@ import           Xanthous.Game.State | |||
| import           Xanthous.Game.Draw (drawGame) | ||||
| import           Xanthous.Game.Prompt | ||||
| import           Xanthous.Monad | ||||
| import           Xanthous.Resource (Name) | ||||
| import           Xanthous.Resource (Name, Panel(..)) | ||||
| import qualified Xanthous.Messages as Messages | ||||
| import           Xanthous.Util.Inflection (toSentence) | ||||
| -------------------------------------------------------------------------------- | ||||
|  | @ -231,6 +231,8 @@ handleCommand Read = do | |||
|             in readAndContinue msgs | ||||
|   continue | ||||
| 
 | ||||
| handleCommand Inventory = showPanel InventoryPanel >> continue | ||||
| 
 | ||||
| handleCommand Save = do | ||||
|   -- TODO default save locations / config file? | ||||
|   prompt_ @'StringPrompt ["save", "location"] Cancellable | ||||
|  | @ -439,4 +441,9 @@ entityMenu_ = mkMenuItems @[_] . map entityMenuItem | |||
| -- entityMenu :: Entity entity => [entity] -> Map Char (MenuOption entity) | ||||
| -- entityMenu = map (map runIdentity) . entityMenu_ . fmap Identity | ||||
| 
 | ||||
| -------------------------------------------------------------------------------- | ||||
| showPanel :: Panel -> AppM () | ||||
| showPanel panel = do | ||||
|   activePanel ?= panel | ||||
|   prompt_ @'Continue ["generic", "continue"] Uncancellable | ||||
|     . const | ||||
|     $ activePanel .= Nothing | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue