示例#1
0
        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);
            }   
        }
示例#2
0
文件: Game.cs 项目: bilwis/SH2RL
        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");
            }
        }
示例#3
0
 public void DrawVerticalLine(int x, int y, int length)
 {
     _console.vline(x, y, length);
 }