Exemple #1
0
        /// <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();
        }
Exemple #2
0
        /// <summary>
        /// Draws a screen to select an npc to interact with
        /// </summary>
        /// <param name="universe"></param>
        /// <param name="location"></param>
        /// <returns></returns>
        public Npc DisplayInteractNpc(Universe universe, Location location)
        {
            int npcIndex;

            //
            // we use two lists here to make sure there is a consistent mapping of string->npc
            //
            List <string> npcNames = new List <string>();
            List <Npc>    npcs     = universe.GetNpcsAtLocation(location);

            ClearWindow(mainWindow);
            mainWindow.ResetCursorPos();

            if (npcs.Count > 0)
            {
                DrawScrollingTextLine(mainWindow, "Location Entities");

                foreach (Npc npc in npcs)
                {
                    npcNames.Add(npc.Name);
                }
                npcNames.Add("Back");
                //
                // turn the list of npcs into a menu window to select an npc
                //
                npcIndex = DrawGetOption(mainWindow, npcNames.ToArray());

                if (npcIndex < npcs.Count)
                {
                    return(npcs[npcIndex]);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                //
                // if there are no npcs, dont display a menu, just return
                //
                DrawScrollingTextLine(mainWindow, "Analysis: No entities in this area");

                DisplayContinuePrompt();

                return(null);
            }
        }