/// <summary> /// Displays the text for the player looking around /// </summary> /// <param name="location"></param> public void DisplayLocationLookAround(Universe universe, Location location) { ClearWindow(mainWindow); mainWindow.ResetCursorPos(); DrawScrollingTextLine(mainWindow, "Location Contents\n"); if (universe.GetObjectsAtLocation(location).Count > 0) { DrawScrollingTextLine(mainWindow, "Objects"); foreach (GameObject gameObject in universe.GetObjectsAtLocation(location)) { DrawScrollingTextLine(mainWindow, " " + gameObject.Name); } DrawTextLine(mainWindow, ""); } else { DrawScrollingTextLine(mainWindow, "No Notable Objects in Area"); DrawTextLine(mainWindow, ""); } if (universe.GetNpcsAtLocation(location).Count > 0) { DrawScrollingTextLine(mainWindow, "Entities"); foreach (Npc npc in universe.GetNpcsAtLocation(location)) { DrawScrollingTextLine(mainWindow, " " + npc.Name); } DrawTextLine(mainWindow, ""); } else { DrawScrollingTextLine(mainWindow, "No Notable Entities in Area"); DrawTextLine(mainWindow, ""); } DisplayContinuePrompt(); }
/// <summary> /// Draws a screen to select an object to interact with /// </summary> /// <param name="universe"></param> /// <param name="location"></param> /// <returns></returns> public GameObject DisplayInteractObject(Universe universe, Location location) { int gameObjectIndex; // // we use two lists here to make sure there is a consistent mapping of string->gameobject // List <string> gameObjectNames = new List <string>(); List <GameObject> gameObjects = universe.GetObjectsAtLocation(location); ClearWindow(mainWindow); mainWindow.ResetCursorPos(); if (gameObjects.Count > 0) { DrawScrollingTextLine(mainWindow, "Location Contents"); foreach (GameObject gameObject in gameObjects) { gameObjectNames.Add(gameObject.Name); } gameObjectNames.Add("Back"); // // turn the list of game objects into a menu window to select an object // gameObjectIndex = DrawGetOption(mainWindow, gameObjectNames.ToArray()); if (gameObjectIndex < gameObjects.Count) { return(gameObjects[gameObjectIndex]); } else { return(null); } } else { // // if there are no objects, dont display a menu, just return // DrawScrollingTextLine(mainWindow, "Analysis: No notable objects in this area"); DisplayContinuePrompt(); return(null); } }