Beispiel #1
0
        public override void DrawNewFrame(TCODConsole screen)
        {
            if (m_enabled)
            {
                screen.printFrame(EquipmentWindowOffset, EquipmentWindowTopY, EquipmentItemWidth, EquipmentItemHeight, true, TCODBackgroundFlag.Set, "Equipment");

                screen.printFrame(EquipmentWindowOffset + 1, EquipmentWindowTopY + EquipmentItemHeight - 6, EquipmentItemWidth - 2, 5, true);

                string weaponString = string.Format("Damage: {0}     Evade: {1}      Stamina Bonus: {2}", m_player.CurrentWeapon.Damage, m_player.Evade, GetStaminaTotalBonus());
                screen.print(EquipmentWindowOffset + 3, EquipmentWindowTopY + EquipmentItemHeight - 4, weaponString);

                List<INamedItem> equipmentList = CreateEquipmentListFromPlayer();

                m_dialogColorHelper.SaveColors(screen);
                for (int i = 0; i < equipmentList.Count; ++i)
                {
                    m_dialogColorHelper.SetColors(screen, i == m_cursorPosition, true);
                    screen.print(EquipmentWindowOffset + 2, EquipmentWindowTopY + (2 * i) + 2, m_equipmentListTypes[i] + ":");
                    if (equipmentList[i] != null && !(equipmentList[i].DisplayName == "Melee" && m_equipmentListTypes[i] == "Secondary Weapon"))
                        screen.print(EquipmentWindowOffset + 22, EquipmentWindowTopY + (2 * i) + 2, equipmentList[i].DisplayName);
                    else
                        screen.print(EquipmentWindowOffset + 22, EquipmentWindowTopY + (2 * i) + 2, "None");
                }
                m_dialogColorHelper.ResetColors(screen);
            }   
        }
Beispiel #2
0
        public override void DrawNewFrame(TCODConsole screen)
        {
            const int WelcomeScreenOffset = 13;
            if (m_enabled)
            {
                m_yesEnabled = TCODSystem.getElapsedSeconds() > m_timeToEnableYes;

                if (Preferences.Instance.DebuggingMode)
                    m_yesEnabled = true;

                m_dialogColorHelper.SaveColors(screen);
                screen.printFrame(WelcomeScreenOffset, WelcomeScreenOffset + 5, UIHelper.ScreenWidth - (2 * WelcomeScreenOffset), 11, true);
                string saveString = "Saving the game will end your current session and allow you to pickup playing later.";
                screen.printRectEx(UIHelper.ScreenWidth / 2, 7 + WelcomeScreenOffset, UIHelper.ScreenWidth - 4 - (2 * WelcomeScreenOffset), UIHelper.ScreenHeight - (2 * WelcomeScreenOffset), TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, saveString);

                screen.printEx(UIHelper.ScreenWidth / 2, 11 + WelcomeScreenOffset, TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, "Really Save?");

                m_dialogColorHelper.SetColors(screen, m_yesSelected, m_yesEnabled);
                screen.print((UIHelper.ScreenWidth / 2) - 6, 13 + WelcomeScreenOffset, "Yes");
                m_dialogColorHelper.SetColors(screen, !m_yesSelected, true);
                screen.print((UIHelper.ScreenWidth / 2) + 4, 13 + WelcomeScreenOffset, "No");

                m_dialogColorHelper.ResetColors(screen);
            }
        }
        public override void DrawNewFrame(TCODConsole screen)
        {
            if (m_enabled)
            {
                screen.printFrame(SelectedItemOffsetX, SelectedItemOffsetY, SelectedItemWidth, SelectedItemHeight, true);

                // Draw Header.
                screen.hline(SelectedItemOffsetX + 1, SelectedItemOffsetY + 2, SelectedItemWidth - 2);
                screen.putChar(SelectedItemOffsetX, SelectedItemOffsetY + 2, (int)TCODSpecialCharacter.TeeEast);
                screen.putChar(SelectedItemOffsetX + SelectedItemWidth - 1, SelectedItemOffsetY + 2, (int)TCODSpecialCharacter.TeeWest);
                screen.printEx(SelectedItemOffsetX + (SelectedItemWidth / 2), SelectedItemOffsetY + 1, TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, m_selectedItem.DisplayName);

                // Split in half for description.
                screen.vline(SelectedItemOffsetX + (SelectedItemWidth / 3), SelectedItemOffsetY + 2, SelectedItemHeight - 3);
                screen.putChar(SelectedItemOffsetX + (SelectedItemWidth / 3), SelectedItemOffsetY + 2, (int)TCODSpecialCharacter.TeeSouth);
                screen.putChar(SelectedItemOffsetX + (SelectedItemWidth / 3), SelectedItemOffsetY + SelectedItemHeight - 1, (int)TCODSpecialCharacter.TeeNorth);

                DrawItemInRightPane(screen);

                m_dialogColorHelper.SaveColors(screen);
                
                // Print option list.
                for (int i = 0; i < m_optionList.Count; ++i)
                {
                    m_dialogColorHelper.SetColors(screen, i == m_cursorPosition, m_optionList[i].Enabled);
                    screen.print(SelectedItemOffsetX + 2, SelectedItemOffsetY + 4 + (i * 2), m_optionList[i].Option);
                }

                m_dialogColorHelper.ResetColors(screen);
            }   
        }
Beispiel #4
0
        public override void DrawNewFrame(TCODConsole screen)
        {
            const int WelcomeScreenOffset = 13;
            if (m_enabled)
            {
                m_yesEnabled = TCODSystem.getElapsedSeconds() > m_timeToEnableYes;

                // Don't make debugger wait
                if (Preferences.Instance.DebuggingMode)
                    m_yesEnabled = true;

                m_dialogColorHelper.SaveColors(screen);
                screen.printFrame(WelcomeScreenOffset, WelcomeScreenOffset + 5, UIHelper.ScreenWidth - (2 * WelcomeScreenOffset), 11, true);
                string quitString;
                if (m_quitReason == QuitReason.quitAction)
                    quitString = "Quitting the game will delete your current character. To stop playing now and continue your adventure later, use save instead.";
                else
                    quitString = "Leaving the dungeon will end the game early and delete your current character. To stop playing now and continue your adventure later, use save instead.";

                screen.printRectEx(UIHelper.ScreenWidth / 2, 7 + WelcomeScreenOffset, UIHelper.ScreenWidth - 4 - (2 * WelcomeScreenOffset), UIHelper.ScreenHeight - (2 * WelcomeScreenOffset), TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, quitString);

                screen.printEx(UIHelper.ScreenWidth / 2, 11 + WelcomeScreenOffset, TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, "Really Quit?");

                m_dialogColorHelper.SetColors(screen, m_yesSelected, m_yesEnabled);
                screen.print((UIHelper.ScreenWidth / 2) - 6, 13 + WelcomeScreenOffset, "Yes");
                m_dialogColorHelper.SetColors(screen, !m_yesSelected, true);
                screen.print((UIHelper.ScreenWidth / 2) + 4, 13 + WelcomeScreenOffset, "No");

                m_dialogColorHelper.ResetColors(screen);
            }
        }
Beispiel #5
0
        internal LoadingScreen(TCODConsole console, string text)
        {
            console.printFrame(0, 0, UIHelper.ScreenWidth, UIHelper.ScreenHeight, true);
            console.printRectEx(UIHelper.ScreenWidth / 2, UIHelper.ScreenHeight / 2, UIHelper.ScreenWidth, UIHelper.ScreenHeight, TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, text);
            TCODConsole.flush();

            m_timer = new Timer(OnTick, null, 0, 50);
        }
        public override void DrawNewFrame(TCODConsole screen)
        {
            if (m_enabled)
            {
                m_higherRange = m_isScrollingNeeded ? m_lowerRange + NumberOfLinesDisplayable : m_itemList.Count;
                screen.printFrame(InventoryWindowOffset, InventoryWindowOffset, InventoryItemWidth, InventoryItemHeight, true, TCODBackgroundFlag.Set, m_title);
                
                // Start lettering from our placementOffset.
                char currentLetter = 'a';

                if (m_useCharactersNextToItems)
                {
                    for (int i = 0; i < m_lowerRange; ++i)
                        currentLetter = IncrementLetter(currentLetter);
                }

                int positionalOffsetFromTop = 0;
                m_dialogColorHelper.SaveColors(screen);

                int farRightPaddingAmount = DetermineFarRightPaddingForMagicList();

                for (int i = m_lowerRange; i < m_higherRange; ++i)
                {
                    string displayString = m_itemList[i].DisplayName;
                    m_dialogColorHelper.SetColors(screen, i == m_cursorPosition, m_shouldBeSelectedDelegate(m_itemList[i]));
                    if (displayString.Contains('\t'.ToString()))
                    {
                        // This is the case for Tab Seperated Spaces, used for magic lists and such
                        string[] sectionArray = displayString.Split(new char[] { '\t' }, 3);

                        screen.print(InventoryWindowOffset + 1, InventoryWindowOffset + 1 + positionalOffsetFromTop, currentLetter + " - " + sectionArray[0]);
                        if (sectionArray.Length > 1)
                        {
                            screen.print(InventoryWindowOffset + (InventoryItemWidth / 2), InventoryWindowOffset + 1 + positionalOffsetFromTop, sectionArray[1]);
                            if (sectionArray.Length > 2)
                            {
                                screen.printEx(InventoryWindowOffset - 2 + InventoryItemWidth, InventoryWindowOffset + 1 + positionalOffsetFromTop, TCODBackgroundFlag.Set, TCODAlignment.RightAlignment, sectionArray[2].PadRight(farRightPaddingAmount));
                            }
                        }
                    }
                    else
                    {
                        string printString;
                        if (m_useCharactersNextToItems)
                            printString = string.Format("{0} - {1}", currentLetter, displayString);
                        else
                            printString = " - " + displayString;
                        screen.print(InventoryWindowOffset + 1, InventoryWindowOffset + 1 + positionalOffsetFromTop, printString);
                    }

                    currentLetter = IncrementLetter(currentLetter);
                    positionalOffsetFromTop++;
                }
                m_dialogColorHelper.ResetColors(screen);
            }
        }
Beispiel #7
0
 public override void DrawNewFrame(TCODConsole screen)
 {
     const int WelcomeScreenOffset = 13;
     if (Enabled)
     {
         screen.printFrame(WelcomeScreenOffset, WelcomeScreenOffset + 5, UIHelper.ScreenWidth - (2 * WelcomeScreenOffset), 14, true);
         string welcomeString = "In the beginning the Creator created many worlds. Some, like this World, are malleable enough to allow sentient beings to force their will upon matter in limited ways. This is the foundation of magic.\n\nFor some unexplainable reason, you find yourself entering a small dungeon. Armed little beyond your wits, you've been drawn here to conquer.\n\n--Press Any Key to Begin--";
         screen.printRectEx(UIHelper.ScreenWidth / 2, 6 + WelcomeScreenOffset, UIHelper.ScreenWidth - 4 - (2 * WelcomeScreenOffset), UIHelper.ScreenHeight - (2 * WelcomeScreenOffset), TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, welcomeString);
     }
 }
Beispiel #8
0
        private static void RenderPlayConsole(Game gameInstance, TCODConsole console, TCODColor fogOfWarColour, Rectangle bounds)
        {
            console.clear();
            console.setForegroundColor(ColorPresets.White);
            console.printFrame(0, 0, bounds.Width, bounds.Height, true);


            for (int y = 0; y < gameInstance.Terrain.Height; y++)
            {
                for (int x = 0; x < gameInstance.Terrain.Width; x++)
                {
                    if (gameInstance.Player.VisibilityMap[x, y].WasSeen)
                    {
                        TCODColor lightColour = new TCODColor(gameInstance.LightMap[x, y].Colour.R,
                                                              gameInstance.LightMap[x, y].Colour.G,
                                                              gameInstance.LightMap[x, y].Colour.B);

                        if (lightColour.getValue() < fogOfWarColour.getValue())
                        {
                            lightColour = fogOfWarColour;
                        }

                        console.setForegroundColor(gameInstance.Player.VisibilityMap[x, y].IsVisible
                                                      ? lightColour
                                                      : fogOfWarColour);
                        console.putChar(x + 1, y + 1, gameInstance.Terrain[x, y].Symbol);
                    }
                }
            }

            console.setForegroundColor(
                new TCODColor(gameInstance.LightMap[gameInstance.Player.Location.Coordinate].Colour.R,
                              gameInstance.LightMap[gameInstance.Player.Location.Coordinate].Colour.G,
                              gameInstance.LightMap[gameInstance.Player.Location.Coordinate].Colour.B));
            console.putChar(gameInstance.Player.Location.Coordinate.X + 1, gameInstance.Player.Location.Coordinate.Y + 1,
                            '@');

            foreach (IActor actor in gameInstance.Actors.Where(x => x != gameInstance.Player))
            {
                if (gameInstance.Player.VisibilityMap[actor.Location.Coordinate].IsVisible)
                {
                    TCODColor lightColour = new TCODColor(gameInstance.LightMap[actor.Location.Coordinate].Colour.R,
                                                          gameInstance.LightMap[actor.Location.Coordinate].Colour.G,
                                                          gameInstance.LightMap[actor.Location.Coordinate].Colour.B);

                    if (lightColour.getValue() < fogOfWarColour.getValue())
                    {
                        lightColour = fogOfWarColour;
                    }

                    console.setForegroundColor(lightColour);
                    console.putChar(actor.Location.Coordinate.X + 1, actor.Location.Coordinate.Y + 1, actor.Race.Symbol);
                }
            }
        }
Beispiel #9
0
        private static void RenderPlayerConsole(IActor player, TCODConsole console, Rectangle bounds)
        {
            console.clear();
            console.setForegroundColor(ColorPresets.White);
            console.printFrame(0, 0, bounds.Width, bounds.Height, true, TCODBackgroundFlag.Set, "Player");


            console.printEx(1, 2, TCODBackgroundFlag.Set, TCODAlignment.LeftAlignment, string.Format("Health : {0}", player.Health));
            console.printEx(1, 4, TCODBackgroundFlag.Set, TCODAlignment.LeftAlignment, string.Format("Damage : {0}", player.Damage));
            console.printEx(1, 6, TCODBackgroundFlag.Set, TCODAlignment.LeftAlignment, string.Format("Kills : {0}", player.Kills.Count));
        }
Beispiel #10
0
        private static void RenderThreatConsole(IActor player, IList <IActor> monsters, TCODConsole console, Rectangle bounds)
        {
            console.clear();
            console.setForegroundColor(ColorPresets.White);
            console.printFrame(0, 0, bounds.Width, bounds.Height, true, TCODBackgroundFlag.Set, "Threats");

            List <IActor> threats = player.Intellect.IdentifyThreats(monsters).ToList();

            for (int i = 1; i < threats.Count; i++)
            {
                console.printEx(1, (i * 2) + 1, TCODBackgroundFlag.Set, TCODAlignment.LeftAlignment, string.Format("{0} : {1}", threats[i].Race.Symbol, threats[i]));
            }
        }
Beispiel #11
0
        public void Render(TCODConsole con)
        {
            int maxchars = con.getWidth() - 4;
            int y = 2;

            con.setForegroundColor(TCODColor.darkerAzure);
            con.printFrame(0, 0, con.getWidth(), con.getHeight());
            con.setForegroundColor(TCODColor.white);

            foreach (String line in wrapLine(Text, maxchars))
            {
                con.print(2, y, line);
                y++;
            }
        }
Beispiel #12
0
        public override void DrawNewFrame(TCODConsole screen)
        {
            const int DialogOffset = 13;
            if (Enabled)
            {
                m_dialogColorHelper.SaveColors(screen);
                screen.printFrame(DialogOffset, DialogOffset + 5, UIHelper.ScreenWidth - (2 * DialogOffset), 11, true);

                screen.printRectEx(UIHelper.ScreenWidth / 2, 7 + DialogOffset, UIHelper.ScreenWidth - 4 - (2 * DialogOffset), UIHelper.ScreenHeight - (2 * DialogOffset), TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, Text);

                m_dialogColorHelper.SetColors(screen, true, true);
                screen.printEx(UIHelper.ScreenWidth / 2, 13 + DialogOffset, TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, "OK");

                m_dialogColorHelper.ResetColors(screen);
            }
        }
Beispiel #13
0
        private static void RenderCompetitorConsole(Game gameInstance, TCODConsole console, Rectangle bounds)
        {
            console.clear();
            console.setForegroundColor(ColorPresets.White);
            console.printFrame(0, 0, bounds.Width, bounds.Height, true, TCODBackgroundFlag.Set, "Competitors");


            List <IActor> competitors = gameInstance.AllActors.Where(x => x != gameInstance.Player).ToList();

            for (int i = 0; i < competitors.Count; i++)
            {
                console.setForegroundColor(competitors[i].IsAlive ? ColorPresets.White : ColorPresets.Red);
                console.printEx(1, (i * 2) + 1, TCODBackgroundFlag.Set, TCODAlignment.LeftAlignment, string.Format("{0} is {1} with {2} kills", competitors[i], competitors[i].IsAlive ? "Alive" : "Dead",
                                                                                                                   competitors[i].Kills.Count));
            }
        }
Beispiel #14
0
        public void Draw()
        {
            TCODConsole r = TCODConsole.root;

            r.clear();

            // world box
            r.printFrame(0, 0, 47, 47);
            r.print(2, 0, "Z-DAY v0.01");
            Point offset = new Point(Player.Position.X - 23, Player.Position.Y - 23);

            Area.Current.Map.computeFov(Player.Position.X, Player.Position.Y, Player.ViewRadius, true, TCODFOVTypes.BasicFov);
            foreach (Terrain t in Area.Current.Terrain)
            {
                if (Area.Current.Map.isInFov(t.Position.X, t.Position.Y))
                {
                    t.Draw(TCODConsole.root, offset);
                }
            }
            foreach (Decal d in Area.Current.Decals)
            {
                if (Area.Current.Map.isInFov(d.Position.X, d.Position.Y))
                {
                    d.Draw(TCODConsole.root, offset);
                }
            }
            foreach (Item i in Area.Current.Items)
            {
                if (Area.Current.Map.isInFov(i.Position.X, i.Position.Y))
                {
                    i.Draw(TCODConsole.root, offset);
                }
            }
            foreach (Character c in Area.Current.Characters)
            {
                if (Area.Current.Map.isInFov(c.Position.X, c.Position.Y))
                {
                    c.Draw(TCODConsole.root, offset);
                }
            }

            DrawHUD();
            TCODConsole.flush();
        }
Beispiel #15
0
        private static void RenderEventsConsole(Game gameInstance, TCODConsole console, Rectangle bounds)
        {
            console.clear();
            console.setForegroundColor(ColorPresets.White);
            console.printFrame(0, 0, bounds.Width, bounds.Height, true, TCODBackgroundFlag.Set, "Events");

            int j = gameInstance.GameEvents.Count - 1;
            int i = 1;

            if (!gameInstance.IsActive)
            {
                console.setForegroundColor(gameInstance.AllMonstersAreDead() ? ColorPresets.Gold : ColorPresets.Red);
                console.printEx(
                    1,
                    i, TCODBackgroundFlag.Set, TCODAlignment.LeftAlignment, gameInstance.AllMonstersAreDead() ? "You are the last man standing!" : "You have been eliminated");
                i++;
            }

            for (; i < bounds.Height; i++)
            {
                console.setForegroundColor(ColorPresets.White);

                if ((j < 0) || (j >= gameInstance.GameEvents.Count))
                {
                    break;
                }

                while ((j >= 0) &&
                       !(gameInstance.GameEvents[j].Command is AttackCommand ||
                         gameInstance.GameEvents[j].Command is OpenDoorCommand))
                {
                    j--;
                }

                if ((j < 0) || (j >= gameInstance.GameEvents.Count))
                {
                    break;
                }
                console.printEx(1, i, TCODBackgroundFlag.Set, TCODAlignment.LeftAlignment, gameInstance.GameEvents[j].Result.Message);
                j--;
            }
        }
Beispiel #16
0
        public override void DrawNewFrame(TCODConsole screen)
        {
            if (m_isSelectionCursor)
            {
                screen.setCharBackground(ScreenCenter.X + 1, ScreenCenter.Y + 1, TCODColor.darkYellow);

                if (ToolTipsEnabled)
                {
                    if (TCODSystem.getElapsedMilli() - m_lastCursorMovedTime > TimeUntilToolTipPopup)
                    {
                        if (m_currentToolTips.Count > 0)
                        {
                            const int MaxNumberOfLinesToShow = 3;
                            int numberOfLinesToShow = System.Math.Min(m_currentToolTips.Count, MaxNumberOfLinesToShow);

                            int longestLine = 0;
                            for (int i = 0; i < numberOfLinesToShow; ++i)
                                longestLine = System.Math.Max(longestLine, m_currentToolTips[i].Length);

                            // If we're going to need to print "...more..." make sure we have the width
                            if (m_currentToolTips.Count > MaxNumberOfLinesToShow)
                                longestLine = System.Math.Max(longestLine, 10);

                            screen.setBackgroundColor(ColorPresets.DarkGray);

                            int frameHeight = m_currentToolTips.Count > MaxNumberOfLinesToShow ? 3 + numberOfLinesToShow : 2 + numberOfLinesToShow;
                            screen.printFrame(ScreenCenter.X + 2, ScreenCenter.Y - 2, longestLine + 2, frameHeight, false, TCODBackgroundFlag.Multiply);

                            for (int i = 0; i < numberOfLinesToShow; ++i)
                                screen.printEx(ScreenCenter.X + 3, ScreenCenter.Y - 1 + i, TCODBackgroundFlag.Multiply, TCODAlignment.LeftAlignment, m_currentToolTips[i]);

                            if (m_currentToolTips.Count > MaxNumberOfLinesToShow)
                                screen.printEx(ScreenCenter.X + 3, ScreenCenter.Y - 1 + MaxNumberOfLinesToShow, TCODBackgroundFlag.Multiply, TCODAlignment.LeftAlignment, "...more...");

                            screen.setBackgroundColor(ColorPresets.Black);
                        }
                    }
                }
            }
        }
Beispiel #17
0
        public override void DrawNewFrame(TCODConsole screen)
        {
            const int DialogOffset = 13;
            if (Enabled)
            {
                m_leftEnabled = TCODSystem.getElapsedSeconds() > m_timeToEnableYes;

                if (Preferences.Instance.DebuggingMode)
                    m_leftEnabled = true;

                m_dialogColorHelper.SaveColors(screen);
                screen.printFrame(DialogOffset, DialogOffset + 5, UIHelper.ScreenWidth - (2 * DialogOffset), 9, true);

                screen.printRectEx(UIHelper.ScreenWidth / 2, 7 + DialogOffset, UIHelper.ScreenWidth - 4 - (2 * DialogOffset), UIHelper.ScreenHeight - (2 * DialogOffset) - 2, TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, Text);

                m_dialogColorHelper.SetColors(screen, m_leftSelected, m_leftEnabled);
                screen.print((UIHelper.ScreenWidth / 2) - 13, 11 + DialogOffset, m_leftButton);
                m_dialogColorHelper.SetColors(screen, !m_leftSelected, true);
                screen.print((UIHelper.ScreenWidth / 2) + 5, 11 + DialogOffset, m_rightButton);

                m_dialogColorHelper.ResetColors(screen);
            }
        }
Beispiel #18
0
        public void Draw(TCODConsole screen)
        {
            const int LinesInTextConsole = TextBoxHeight - 2;
            screen.printFrame(0, TextBoxYPosition, TextBoxWidth, TextBoxHeight, true);

            if (m_textList.Count == 0)
                return;        // No Text == Nothing to Draw.

            // Draw either all the text, or all that will fit
            int numberToDraw = ((m_textList.Count - m_textBoxPosition) < LinesInTextConsole) ?
                (m_textList.Count - m_textBoxPosition) : LinesInTextConsole;

            int currentElement = 0;
            for (int i = 0; i < LinesInTextConsole; ++i)
            {
                if (currentElement == numberToDraw)
                    break;
                
                string currentString = m_textList[m_textBoxPosition + currentElement];
                
                // If it's over 1 line long, we treat it special. See if it will be early.
                int numberOfLinesLong = screen.getHeightRect(1, TextBoxYPosition, TextBoxWidth - 2, 8, currentString);

                if (numberOfLinesLong > 1)
                {
                    i += numberOfLinesLong - 1;
                    if (i >= LinesInTextConsole)
                        break;
                    screen.printRect(1, TextBoxYPosition + LinesInTextConsole - i, TextBoxWidth - 2, numberOfLinesLong, currentString);
                }
                else
                {
                    screen.print(1, TextBoxYPosition + LinesInTextConsole - i, currentString);
                }
                currentElement++;
            }
        }
Beispiel #19
0
        public override void DrawNewFrame(TCODConsole screen)
        {
            const int LeftThird = UIHelper.ScreenWidth / 6;
            const int RightThird = 4 * UIHelper.ScreenWidth / 6;

            if (m_enabled)
            {
                screen.clear();

                if (m_firstFrame)
                {
                    TCODConsole.resetCredits();
                    m_firstFrame = false;
                }

                if (!m_creditsDone)
                {
                    m_dialogColorHelper.SaveColors(screen);
                    m_creditsDone = TCODConsole.renderCredits(RightThird + 10, 54, true);
                    m_dialogColorHelper.ResetColors(screen);
                }

                screen.printFrame(0, 0, UIHelper.ScreenWidth, UIHelper.ScreenHeight, false, TCODBackgroundFlag.Set, "Help");

                screen.printRect(RightThird - 19, 52, 45, 7, "Copyright Chris Hamons 2010.\nThank you Ben for\nearly development help.\n\nSoli Deo Gloria");

                const int SymbolStartY = 3;
                const int SymbolVerticalOffset = -8;
                screen.print(LeftThird + SymbolVerticalOffset, SymbolStartY, "Map Symbols");
                screen.print(LeftThird + SymbolVerticalOffset, SymbolStartY + 1, "------------------------");
                screen.print(LeftThird + SymbolVerticalOffset, SymbolStartY + 2, "@ - You");
                screen.print(LeftThird + SymbolVerticalOffset, SymbolStartY + 3, "; - Open Door");
                screen.print(LeftThird + SymbolVerticalOffset, SymbolStartY + 4, ": - Closed Door");
                screen.print(LeftThird + SymbolVerticalOffset, SymbolStartY + 5, "_ - Cosmetic");
                screen.print(LeftThird + SymbolVerticalOffset, SymbolStartY + 6, "& - Item on Ground");
                screen.print(LeftThird + SymbolVerticalOffset, SymbolStartY + 7, "%% - Stack of Items");

                const int ActionStartY = SymbolStartY + 10;
                const int ActionVerticalOffset = -8;
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY, "Action Keys");
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 1, "------------------------");
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 2, "Attack (or reload) - " + m_keyMappings["Attack"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 3, "Get Item           - " + m_keyMappings["GetItem"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 4, "Cast Spell         - " + m_keyMappings["CastSpell"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 5, "Inventory          - " + m_keyMappings["Inventory"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 6, "Equipment          - " + m_keyMappings["Equipment"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 7, "Skill Tree         - " + m_keyMappings["ShowSkillTree"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 8, "Show Status Effects- " + m_keyMappings["ShowEffects"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 9, "Operate            - " + m_keyMappings["Operate"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 10, "Wait               - " + m_keyMappings["Wait"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 11, "Rest Until Healed  - " + m_keyMappings["RestTillHealed"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 12, "Move To Location   - " + m_keyMappings["MoveToLocation"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 13, "View Mode          - " + m_keyMappings["ViewMode"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 14, "Down Stairs        - " + m_keyMappings["DownStairs"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 15, "Up Stairs          - " + m_keyMappings["UpStairs"]);
                screen.print(LeftThird + ActionVerticalOffset, ActionStartY + 16, "Swap Weapons       - " + m_keyMappings["SwapWeapon"]);

                const int RebindingStartY = SymbolStartY;
                string rebindingText = "To change keystroke bindings, edit KeyMappings.xml and restart magecrawl.\n\nA list of possible keys can be found at: http://tinyurl.com/ya5l8sj\n\nOther preferences can be found in Preferences.xml";
                screen.printFrame(RightThird - 12, RebindingStartY, 31, 12, true);
                screen.printRect(RightThird - 11, RebindingStartY + 1, 29, 10, rebindingText);

                const int DirectionStartY = ActionStartY + 19;
                const int DirectionVerticalOffset = -8;
                screen.print(LeftThird + DirectionVerticalOffset, DirectionStartY, string.Format("Direction Keys (+{0} to Run)", (bool)Preferences.Instance["UseAltInsteadOfCtrlForRunning"] ? "Alt" : "Ctrl"));
                screen.print(LeftThird + DirectionVerticalOffset, DirectionStartY + 1, "------------------------");
                screen.print(LeftThird + DirectionVerticalOffset, DirectionStartY + 2, "North      - " + m_keyMappings["North"]);
                screen.print(LeftThird + DirectionVerticalOffset, DirectionStartY + 3, "West       - " + m_keyMappings["West"]);
                screen.print(LeftThird + DirectionVerticalOffset, DirectionStartY + 4, "East       - " + m_keyMappings["East"]);
                screen.print(LeftThird + DirectionVerticalOffset, DirectionStartY + 5, "South      - " + m_keyMappings["South"]);
                screen.print(LeftThird + DirectionVerticalOffset, DirectionStartY + 6, "North West - " + m_keyMappings["Northwest"]);
                screen.print(LeftThird + DirectionVerticalOffset, DirectionStartY + 7, "North East - " + m_keyMappings["Northeast"]);
                screen.print(LeftThird + DirectionVerticalOffset, DirectionStartY + 8, "South West - " + m_keyMappings["Southwest"]);
                screen.print(LeftThird + DirectionVerticalOffset, DirectionStartY + 9, "South East - " + m_keyMappings["Southeast"]);

                const int OtherKeysStartY = ActionStartY + 4;
                const int OtherKeysVerticalOffset = -12;
                screen.print(RightThird + OtherKeysVerticalOffset, OtherKeysStartY, "Other Keys");
                screen.print(RightThird + OtherKeysVerticalOffset, OtherKeysStartY + 1, "----------------------------");
                screen.print(RightThird + OtherKeysVerticalOffset, OtherKeysStartY + 2, "Text Box Page Up   - " + m_keyMappings["TextBoxPageUp"]);
                screen.print(RightThird + OtherKeysVerticalOffset, OtherKeysStartY + 3, "Text Box Page Down - " + m_keyMappings["TextBoxPageDown"]);
                screen.print(RightThird + OtherKeysVerticalOffset, OtherKeysStartY + 4, "Text Box Clear     - " + m_keyMappings["TextBoxClear"]);
                screen.print(RightThird + OtherKeysVerticalOffset, OtherKeysStartY + 5, "Escape             - " + m_keyMappings["Escape"]);
                screen.print(RightThird + OtherKeysVerticalOffset, OtherKeysStartY + 6, "Select             - " + m_keyMappings["Select"]);
                screen.print(RightThird + OtherKeysVerticalOffset, OtherKeysStartY + 7, "Save               - " + m_keyMappings["Save"]);
                screen.print(RightThird + OtherKeysVerticalOffset, OtherKeysStartY + 8, "Help               - " + m_keyMappings["Help"]);
                screen.print(RightThird + OtherKeysVerticalOffset, OtherKeysStartY + 9, "Quit               - " + m_keyMappings["Quit"]);
            }
        }
Beispiel #20
0
        public void DrawHUD()
        {
            TCODConsole r                  = TCODConsole.root;
            int         sidebarWidth       = 33;
            int         windowWidth        = 80;
            int         windowHeight       = 50;
            int         vWidth             = 47;
            int         vHeight            = 47;
            int         weaponBoxWidth     = 16;
            int         weaponBoxHeight    = 4;
            int         characterBoxHeight = 11;


            // bottom bar
            r.printFrame(0, windowHeight - 3, windowWidth - sidebarWidth, 3);
            r.printEx(vHeight / 2 + 1, windowHeight - 2, TCODBackgroundFlag.Default, TCODAlignment.CenterAlignment, Area.Current.DescribeTile(Player.Position));


            // character box
            r.printFrame(vWidth, 0, windowWidth - vWidth, characterBoxHeight);
            r.print(vWidth + 2, 0, "CHARACTER");
            r.print(vWidth + 2, 2, "Adam");
            r.print(vWidth + 2, 3, "LVL: " + Convert.ToString(Player.Level));
            r.print(vWidth + 2, 4, "ATK: " + (Player.AttackMultiplier > 1 ? Player.AttackMultiplier.ToString() : "") + "d" + Player.AttackDie.ToString() + (Player.AttackModifier > 0 ? "+" + Player.AttackModifier.ToString() : ""));

            float barHP      = ((float)Player.HP / (float)Player.MaxHP) * (windowWidth - vWidth - 4);
            float barStamina = ((float)Player.Stamina / (float)Player.MaxStamina) * (windowWidth - vWidth - 4);
            float barXP      = ((float)(Player.XP - Character.LevelXP(Player.Level)) / (float)(Character.LevelXP(Player.Level + 1) - Character.LevelXP(Player.Level))) * (windowWidth - vWidth - 4);

            r.setBackgroundFlag(TCODBackgroundFlag.Set);
            r.setBackgroundColor(TCODColor.darkGreen);
            r.rect(vWidth + 2, 6, (int)barHP, 1, false);
            r.setBackgroundColor(TCODColor.grey);
            r.printEx(vWidth + 2 + ((windowWidth - vWidth - 4) / 2), 6, TCODBackgroundFlag.Darken, TCODAlignment.CenterAlignment, " HP: " + Convert.ToString(Player.HP) + "/" + Convert.ToString(Player.MaxHP) + " ");
            r.setBackgroundColor(TCODColor.darkBlue);
            r.rect(vWidth + 2, 7, (int)barStamina, 1, false);
            r.setBackgroundColor(TCODColor.grey);
            r.printEx(vWidth + 2 + ((windowWidth - vWidth - 4) / 2), 7, TCODBackgroundFlag.Darken, TCODAlignment.CenterAlignment, " STM: " + Convert.ToString(Math.Round((float)Player.Stamina / (float)Player.MaxStamina * 100)) + "%% ");
            r.setBackgroundColor(TCODColor.darkYellow);
            r.rect(vWidth + 2, 8, (int)barXP, 1, false);
            r.setBackgroundColor(TCODColor.grey);
            r.printEx(vWidth + 2 + ((windowWidth - vWidth - 4) / 2), 8, TCODBackgroundFlag.Darken, TCODAlignment.CenterAlignment, " XP: " + Convert.ToString(Player.XP) + " / " + Convert.ToString(Character.LevelXP(Player.Level + 1)) + " ");
            r.setBackgroundColor(TCODColor.black);

            r.print(vWidth + 16, 2, "STR: " + Convert.ToString(Player.Strength));
            r.print(vWidth + 16, 3, "DEX: " + Convert.ToString(Player.Dexterity));
            r.print(vWidth + 24, 2, "CON: " + Convert.ToString(Player.Constitution));
            r.print(vWidth + 24, 3, "INT: " + Convert.ToString(Player.Intelligence));
            r.print(vWidth + 16, 4, "DEF: " + Convert.ToString(Player.Defense));
            r.print(vWidth + 24, 4, "SPD: " + Convert.ToString(Player.Speed));



            // console box
            r.printFrame(vWidth, characterBoxHeight, windowWidth - vWidth, windowHeight - weaponBoxHeight - characterBoxHeight);
            r.print(vWidth + 2, characterBoxHeight, "CONSOLE");
            int remainingLines = windowHeight - weaponBoxHeight - characterBoxHeight - 2;
            int i = Console.Lines.Count - 1;

            while (remainingLines > 0 && i > -1)
            {
                string         text      = Console.Lines[i].Text;
                Queue <string> lines     = new Queue <string>();
                int            maxLength = windowWidth - vWidth - 2;
                while (text.Length > maxLength)
                {
                    string split = text.Substring(0, maxLength);
                    if (text.Substring(maxLength, 1) != " ")
                    {
                        split = split.Substring(0, split.LastIndexOf(" ")).TrimEnd();
                    }
                    split = split.TrimEnd();
                    lines.Enqueue(split);
                    text = " " + text.Substring(split.Length).Trim();
                }
                lines.Enqueue(text);
                remainingLines -= lines.Count;
                int j = 0;
                while (lines.Count > 0)
                {
                    string line = lines.Dequeue();
                    if (characterBoxHeight + 1 + remainingLines + j > characterBoxHeight)
                    {
                        r.print(vWidth + 1, characterBoxHeight + 1 + remainingLines + j, line);
                    }
                    j++;
                }

                i -= 1;
            }



            // weapon box
            r.printFrame(vWidth, windowHeight - weaponBoxHeight, weaponBoxWidth, weaponBoxHeight);
            r.print(vWidth + 1, windowHeight - weaponBoxHeight + 1, Player.Weapon == null ? "unarmed" : Player.Weapon.ToString());


            // time box
            r.printFrame(vWidth + weaponBoxWidth, windowHeight - weaponBoxHeight, windowWidth - vWidth - weaponBoxWidth, weaponBoxHeight);
            string strKilled = Convert.ToString(Player.Kills) + " KILLED";
            string strTime   = "DAY 1 00:00.00";

            r.print(80 - strKilled.Length - 1, 48, strKilled);
            r.print(80 - strTime.Length - 1, 47, strTime);
        }
Beispiel #21
0
 public static void DrawWindowFrame(IntVector2 position, IntVector2 size)
 {
     displayConsole.printFrame(position.X, position.Y, size.X, size.Y);
 }
Beispiel #22
0
        public new void Render(TCODConsole con)
        {
            int maxchars = con.getWidth() - 4;
            int y = 2;
            int cap_lines = 0;

            con.setBackgroundColor(TCODColor.black);
            con.setBackgroundFlag(TCODBackgroundFlag.Set);
            con.clear();
            con.setBackgroundFlag(TCODBackgroundFlag.Default);

            con.setForegroundColor(TCODColor.darkerAzure);
            con.printFrame(0, 0, con.getWidth(), con.getHeight());
            con.setForegroundColor(TCODColor.white);

            List<string> lines = new List<string>();

            lines.AddRange(wrapLine(Text, maxchars));
            cap_lines = lines.Count;

            foreach (KeyValuePair<char, string> kv in responses)
            {
                lines.Add(kv.Key + ") " + kv.Value);
            }

            for (int i = 0; i < lines.Count; i++)
            {
                con.setBackgroundFlag(TCODBackgroundFlag.Set);
                if (i - cap_lines == selectedIndex)
                    con.setBackgroundColor(TCODColor.sepia);
                else
                    con.setBackgroundColor(TCODColor.black);

                con.print(2, y+i, lines[i]);
                con.setBackgroundFlag(TCODBackgroundFlag.Default);
            }
        }
Beispiel #23
0
        public override void DrawNewFrame(TCODConsole screen)
        {
            screen.printFrame(StartingX, 0, InfoWidth, InfoHeight, true);
            screen.printEx(SectionCenter, 1, TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, m_name);

            // The 7 and 18 here are psydo-magical, since they place the text overlap just so it fits and doesn't go over for sane values
            screen.printEx(StartingX + 7, 2, TCODBackgroundFlag.None, TCODAlignment.CenterAlignment, m_healthString);
            screen.printEx(StartingX + 18, 2, TCODBackgroundFlag.None, TCODAlignment.CenterAlignment, m_staminaString);
            for (int j = 0; j < BarLength; ++j)
                screen.setCharBackground(StartingX + 2 + j, 2, PlayerHealthBarColorAtPosition(j));

            screen.printEx(StartingX + 13, 3, TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, m_manaString);
            for (int j = 0; j < BarLength; ++j)
                screen.setCharBackground(StartingX + 2 + j, 3, PlayerManaBarColor(j));

            int nextAvailablePosition = 6;

            string skillPointString = "Skill Points: " + m_skillPoints;
            screen.print(StartingX + 2, nextAvailablePosition, skillPointString);
            nextAvailablePosition += 2;

            int linesTaken = screen.printRect(StartingX + 2, nextAvailablePosition, UIHelper.ScreenWidth - StartingX - 3, 5, m_weaponString);
            nextAvailablePosition += linesTaken + 1;

            m_colorHelper.SaveColors(screen);
            if (m_statusEffects.Count() > 0)
            {
                screen.print(StartingX + 2, nextAvailablePosition, "Status Effects:");
                int currentX = StartingX + 2 + 1 + 15;
                foreach (IStatusEffect s in m_statusEffects)
                {
                    if (currentX + s.Name.Length >= UIHelper.ScreenWidth)
                    {
                        currentX = StartingX + 2;
                        nextAvailablePosition++;
                    }
                    screen.setForegroundColor(s.IsPositiveEffect ? ColorCache.Instance["DarkGreen"] : ColorCache.Instance["DarkRed"] );
                    screen.print(currentX, nextAvailablePosition, s.Name);
                    currentX += s.Name.Length + 1;
                }
                nextAvailablePosition += 2;
            }
            m_colorHelper.ResetColors(screen);

            m_colorHelper.SaveColors(screen);
            if (m_monstersNearby.Count > 0)
            {
                screen.print(StartingX + 2, nextAvailablePosition, m_nearbyEnemyString);
                
                // Show at most 8 monsters
                int numberOfMonstersToShow = m_monstersNearby.Count > 8 ? 8 : m_monstersNearby.Count;
                for (int i = 0; i < numberOfMonstersToShow; ++i)
                {
                    ICharacter currentMonster = m_monstersNearby[i];
                    if (MapCursorEnabled)
                    {
                        if (currentMonster.Position == CursorSpot)
                            screen.setForegroundColor(ColorCache.Instance["DarkYellow"]);
                        else
                            screen.setForegroundColor(UIHelper.ForegroundColor);
                    }

                    screen.printEx(StartingX + 12, nextAvailablePosition + 1 + i, TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, currentMonster.Name);
                    for (int j = 0; j < HealthBarLength(currentMonster, true); ++j)
                        screen.setCharBackground(StartingX + 2 + j, nextAvailablePosition + 1 + i, EnemyHealthBarColor(currentMonster));
                }
                nextAvailablePosition += 2;
            }
            m_colorHelper.ResetColors(screen);

            if (Preferences.Instance.DebuggingMode)
            {
                screen.print(54, 39, "Turn Count - " + m_turnCount.ToString());

                screen.print(54, 40, "Danger - " + m_inDanger.ToString());

                string level = (m_currentLevel + 1).ToString();
                screen.print(54, 41, "Level - " + level);

                string position = m_position.ToString();
                screen.print(54, 42, position);

                string fps = TCODSystem.getFps().ToString();
                screen.print(54, 43, fps);
            }
        }
Beispiel #24
0
        private void DrawSkillPopup(TCODConsole console, List<ISkill> selectedSkillList, int skillPointsLeft, SkillSquare cursorSkillSquare, ISkill cursorOverSkill, Point cursorPosition)
        {
            Point drawUpperLeft = ConvertGridToDrawCoord(cursorSkillSquare.UpperRight + new Point(1, 1), cursorPosition);
            
            int numberOfDependencies = cursorSkillSquare.DependentSkills.Count();
            int dialogHeight = ExplainPopupHeight;
            if (numberOfDependencies > 0)
            {
                int linesOfDependencies = numberOfDependencies;
                foreach (string dependentSkillName in cursorSkillSquare.DependentSkills)
                    linesOfDependencies += console.getHeightRect(drawUpperLeft.X + 2 + 3, 0, 20, 2, dependentSkillName);
                
                dialogHeight += 2 + linesOfDependencies;
                drawUpperLeft += new Point(0, 2 + linesOfDependencies);
            }

            string title = cursorOverSkill.Name;
            if (title.Length > 22)
                title = title.Substring(0, 22);

            console.printFrame(drawUpperLeft.X, drawUpperLeft.Y - dialogHeight, ExplainPopupWidth, dialogHeight, true, TCODBackgroundFlag.Set, title);

            int textX = drawUpperLeft.X + 2;
            int textY = drawUpperLeft.Y - dialogHeight + 2;

            // If we can't afford it and it isn't already selected, show the cost in red
            if (!selectedSkillList.Contains(cursorOverSkill) && cursorOverSkill.Cost > skillPointsLeft)
            {
                m_dialogHelper.SaveColors(console);
                console.setForegroundColor(TCODColor.red);
                console.print(textX, textY, string.Format("Skill Point Cost: {0}", cursorOverSkill.Cost));
                m_dialogHelper.ResetColors(console);
            }
            else
            {
                console.print(textX, textY, string.Format("Skill Point Cost: {0}", cursorOverSkill.Cost));
            }
            textY++;

            if (numberOfDependencies > 0)
            {
                textY++;
                console.print(textX, textY, "Dependencies:");
                textY++;
                m_dialogHelper.SaveColors(console);
                foreach (string dependentSkillName in cursorSkillSquare.DependentSkills)
                {
                    if (SkillTreeModelHelpers.IsSkillSelected(selectedSkillList, dependentSkillName))
                        m_dialogHelper.SetColors(console, false, true);
                    else
                        m_dialogHelper.SetColors(console, false, false);

                    console.printRect(textX + 3, textY, 20, 2, dependentSkillName);
                    textY++;
                }
                m_dialogHelper.ResetColors(console);
            }
            textY++;

            console.printRectEx(textX, textY, ExplainPopupWidth - 4, ExplainPopupHeight - 6, TCODBackgroundFlag.Set, TCODAlignment.LeftAlignment, cursorOverSkill.Description);
        }
Beispiel #25
0
        public void RenderInventory(TCODConsole con, int con_x, int con_y, int width, int height)
        {
            con.setForegroundColor(TCODColor.darkAzure);
            con.setBackgroundColor(TCODColor.darkestBlue);
            con.setBackgroundFlag(TCODBackgroundFlag.Set);

            con.printFrame(con_x + 1, con_y + 1, width - 2, height - 2);

            con.setBackgroundFlag(TCODBackgroundFlag.Default);

            con.vline(width / 2, con_y + 2 + 5, height - 4 - 5);
            con.hline(con_x + 2, con_y + 1 + 5, width - 4);

            con.print(con_x + 2, con_y + 2, "GRZ64 INTEGRATED BACKPACK INTERFACE V1.14 REV 1984");
            con.print(con_x + 2, con_y + 3, "UNREGISTERED TRIAL VERSION");

            con.print(con_x + 2, con_y + 5, "LOADING INVENTORY DATA...");

            if (player.Inventory.Count > 0)
            {
                int cap = (height - 5) - (con_y + 7);
                int count = player.Inventory.Count;

                if (menu_selection >= count)
                    menu_selection = (menu_selection - count);

                if (menu_selection < 0)
                    menu_selection = count - 1;

                int top = menu_selection > cap ? (menu_selection - cap) : 0;
                int bottom = top + count > cap ? cap : top + count;

                int it = 0;

                List<Item> item_list = player.Inventory.GetItemList();
                Item sel_item = item_list[menu_selection];

                //Item list
                for (int i = top; i < bottom; i++)
                {
                    con.setBackgroundFlag(TCODBackgroundFlag.Default);

                    if (i == menu_selection)
                    {
                        //con.setBackgroundFlag(TCODBackgroundFlag.Set);
                        //con.setBackgroundColor(TCODColor.azure);
                        con.setForegroundColor(TCODColor.azure);
                    }
                    if (i == menu_selection + 1)
                    {
                        con.setForegroundColor(TCODColor.darkAzure);
                    }

                    if (item_list[i].GetType().IsSubclassOf(typeof(EquippableItem)))
                    {
                        EquippableItem ei = (EquippableItem)item_list[i];
                        if (ei.IsEquipped())
                        {
                            con.setBackgroundFlag(TCODBackgroundFlag.Set);
                            con.setBackgroundColor(TCODColor.lightAzure);
                        }
                    }

                    con.print(con_x + 3, con_y + 7 + it, item_list[i].Name);
                    it++;
                }

                con.setBackgroundFlag(TCODBackgroundFlag.Default);

                con.setForegroundColor(TCODColor.darkAzure);
                int left_offset = width / 2 + 1;
                int top_offset = con_y + 7;

                //Item stats
                con.print(left_offset, top_offset + 0, "NAME         : " + sel_item.Name);
                con.print(left_offset, top_offset + 1, "WEIGHT       : " + sel_item.Weight);

                // type specifics
                if (sel_item.GetType() == typeof(Firearm))
                {
                    Firearm f = (Firearm)sel_item;
                    con.print(left_offset, top_offset + 3, "TYPE         : Firearm");
                    con.print(left_offset, top_offset + 5, "CLASS        : " + f.type.ToString());

                    String fm_str = "";

                    foreach (FireMode fm in f.modes)
                    {
                        fm_str += fm.ToString() + " ";
                    }
                    con.print(left_offset, top_offset + 6, "FIREMODES    : " + fm_str);

                    con.print(left_offset, top_offset + 8, "CALIBER      : " + f.caliber.ToString());
                    con.print(left_offset, top_offset + 9, "MAG. CAPACITY: " + f.MagazineCapacity);

                }

                //Item description
                List<String> lines = wrap(sel_item.Description, width / 2 - 2);
                top_offset = con_y + (int)(height * 0.45d);

                for (int j = 0; j < lines.Count; j++)
                {
                    con.print(left_offset, top_offset + j, lines[j]);
                }

                con.hline(left_offset, top_offset - 1, width / 2 - 2);

                //Item actions
                con.hline(width / 2 + 1, height - 4 - 5, width / 2 - 2);
                //con.print(width / 2 + 2, height - 4 - 4, "R/M/T - Equip Rngd/Mlee/Thrwn");
                //con.print(width / 2 + 2, height - 4 - 3, "  E/L - Equip Armor/Lightsrc");
                con.print(width / 2 + 2, height - 4 - 4, "    E - Equip");
                con.print(width / 2 + 2, height - 4 - 3, "    U - Unequip");
                con.print(width / 2 + 2, height - 4 - 2, "    D - Drop Item");
                con.print(width / 2 + 2, height - 4 - 1, "    Q - Quit");
                con.print(width / 2 + 2, height - 4 + 0, "  +,- - Select");
                con.print(width / 2 + 2, height - 4 + 1, "    C - Consume");
                con.print(width / 2 + 2, height - 4 + 2, "    U - Use");
            }
        }
Beispiel #26
0
        public override bool use(Actor actor, Actor owner, Engine engine)
        {
            if (!used)
            {
                string message = "";
                TCODConsole con = new TCODConsole(Globals.INV_WIDTH, Globals.INV_HEIGHT);
                con.setForegroundColor(new TCODColor(200, 200, 150));
                con.printFrame(0, 0, Globals.INV_WIDTH, Globals.INV_HEIGHT, true, TCODBackgroundFlag.Default, "Story");
                if (triggernum == '(')
                {
                    message = Globals.story[engine.gameState.curLevel, 9];
                }
                else if (triggernum == ')')
                {
                    message = Globals.story[engine.gameState.curLevel, 10];
                }
                else
                {
                    message = Globals.story[engine.gameState.curLevel, (int)Char.GetNumericValue(triggernum) - 1];
                }
                if (message.Length > 41)
                {
                    string sub1 = message.Substring(0, 41);
                    string sub2 = message.Substring(41, message.Length - 41);
                    if (sub2.Length > 41)
                    {
                        string sub3 = sub2.Substring(0, 41);
                        sub2 = sub2.Substring(41, sub2.Length - 41);

                        con.print(3, 3, sub1);
                        con.print(3, 4, sub3);
                        con.print(3, 5, sub2);
                    }
                    else
                    {
                        con.print(3, 3, sub1);
                        con.print(3, 4, sub2);
                    }
                }
                else
                {
                    con.print(3, 3, message);
                }

                con.print(13, 15, "Press Enter to Continue");

                TCODConsole.blit(con, 0, 0, Globals.INV_WIDTH, Globals.INV_HEIGHT, TCODConsole.root, Globals.WIDTH / 2 - Globals.INV_WIDTH / 2, Globals.HEIGHT / 2 - Globals.INV_HEIGHT / 2);
                TCODConsole.flush();

                while(true)
                {
                    TCODKey key = TCODConsole.checkForKeypress();
                    if(key.KeyCode == TCODKeyCode.Enter){
                        break;
                    }
                }

                used = true;
                return used;
            }

            return false;
        }
Beispiel #27
0
 private void DrawSkillPointTotalFrame(TCODConsole screen)
 {
     screen.printFrame(5, 48, 16, 7, true);
     screen.putChar(5, 48, (int)TCODSpecialCharacter.TeeEast);
     screen.putChar(20, 54, (int)TCODSpecialCharacter.TeeNorth);
     screen.print(6, 49, "Skill Points:");
     screen.print(6, 51, "SP Earned:" + m_engine.Player.SkillPoints.ToString());
     int selectedSkillCost = NewlySelectedSkills.Sum(x => x.Cost);
     screen.print(6, 52, "SP Spent: " + selectedSkillCost);
     screen.print(6, 53, "SP Left:  " + (m_engine.Player.SkillPoints - selectedSkillCost).ToString());
 }
Beispiel #28
0
        public Actor inventory(Actor player)
        {
            TCODConsole con = new TCODConsole(Globals.INV_WIDTH, Globals.INV_HEIGHT);
            con.setForegroundColor(new TCODColor(200,180,150));
            con.printFrame(0, 0, Globals.INV_WIDTH, Globals.INV_HEIGHT, true, TCODBackgroundFlag.Default, "Backpack");

            int y = 1;
            char shortcut = 'a';
            int itemIndex = 0;

            foreach(Actor item in player.contain.inventory)
            {
                con.print(2, y, String.Format("({0}) {1}", shortcut, item.name));
                y++;
                shortcut++;
            }
            TCODConsole.blit(con, 0, 0, Globals.INV_WIDTH, Globals.INV_HEIGHT, TCODConsole.root, Globals.WIDTH / 2 - Globals.INV_WIDTH / 2, Globals.HEIGHT / 2 - Globals.INV_HEIGHT / 2);
            TCODConsole.flush();

            TCODKey key = TCODConsole.waitForKeypress(false);

            if (key.Character >= 97 && key.Character <= 122)
            {
                itemIndex = key.Character - 'a';

                if (itemIndex >= 0 && itemIndex < player.contain.inventory.Count())
                {
                    return player.contain.inventory[itemIndex];
                }
            }
            return null;
        }