示例#1
0
        public HomeBaseScene(Game game) : base(game)
        {
            roomLabelsEnabled = false;

            homeBase             = new HomeBase(25, 25);
            homeBase.Rooms[1, 2] = new Room(homeBase, 1, 2, RoomType.LivingQuarters);
            homeBase.Rooms[2, 2] = new Room(homeBase, 2, 2, RoomType.Kitchen);
            homeBase.Rooms[3, 2] = new Room(homeBase, 3, 2, RoomType.Gym);
            homeBase.Rooms[2, 1] = new Room(homeBase, 2, 1, RoomType.FiringRange);
            homeBase.Rooms[2, 3] = new Room(homeBase, 2, 3, RoomType.Generator);

            homeBase.Rooms[1, 2].AddExit(Direction.East, homeBase.Rooms[2, 2]);
            homeBase.Rooms[3, 2].AddExit(Direction.West, homeBase.Rooms[2, 2]);
            homeBase.Rooms[2, 1].AddExit(Direction.South, homeBase.Rooms[2, 2]);
            homeBase.Rooms[2, 3].AddExit(Direction.North, homeBase.Rooms[2, 2]);


            baseImage = RexPaintImageLoader
                        .LoadImage("Assets/HomeBase/base.xp");
            labels = RexPaintImageLoader
                     .LoadImage("Assets/HomeBase/labels.xp");
            cameraX        = cameraY = 0;
            roomSelectionX = 1;
            roomSelectionY = 1;
            MoveRoomSelection(0, 0);
        }
示例#2
0
 public static void InitDisplay()
 {
     TCODConsole.setCustomFont(font2, (int)TCODFontFlags.LayoutAsciiInRow, 16, 16);                       //Init font
     TCODSystem.setFps(30);                                                                               //Set draw speed
     TCODConsole.initRoot(CONSOLE_WIDTH, CONSOLE_HEIGHT, "Wizard's Peril", false, TCODRendererType.GLSL); //Init the console
     displayConsole = TCODConsole.root;
 }
示例#3
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);
            }   
        }
示例#4
0
        public Engine(TCODConsole mainConsole)
        {
            instance  = this;
            isRunning = false;

            this.mainConsole = mainConsole;
            consoleWidth     = mainConsole.getWidth();
            consoleHeight    = mainConsole.getHeight();

            // Frame rate intialization
            TCODSystem.setFps(FRAME_RATE);
            internalTimer = new Stopwatch();
            MS_PER_UPDATE = 1000 / FRAME_RATE;

            renderer   = new Renderer();
            mainCamera = new Camera(20, 2, consoleWidth - 40, consoleHeight - 12);

            // Load blueprint data files
            data = new DataManager();
            data.LoadContent();

            // load data tables
            dataTables = new TableManager();
            dataTables.LoadData(TableManager.LoadDataFileList("DataTables.dir"));

#if ENTRY_GAME
            StartNewGame(null);
#else
            OpenMenu(new WindowMainMenu(0, 0, consoleWidth, consoleHeight, null, Window.EBorderStyle.NONE, null, null));
#endif
        }
示例#5
0
        public bool Show()
        {
            var x      = (TCODConsole.root.getWidth() / 2) - (Message.Length / 2 + 2);
            var width  = Math.Max(13, Message.Length + 4);            // Two for padding and two for the border
            var y      = (TCODConsole.root.getHeight() / 2) - 3;
            var height = 6;

            TCODConsole.root.setForegroundColor(Foreground);
            TCODConsole.root.setBackgroundColor(Background);
            TCODConsole.root.printFrame(x, y, width, height, true, TCODBackgroundFlag.Set);
            TCODConsole.root.print(x + 2, y + 2, Message);
            TCODConsole.root.print(x + (width / 2) - 4, y + 3, "[Y] / [N]");
            TCODConsole.flush();

            TCODKey key       = null;
            var     character = 'N';

            do
            {
                key       = TCODConsole.waitForKeypress(true);
                character = char.ToUpper(key.Character);
            } while(character != 'Y' && character != 'N');

            return(character == 'Y');
        }
示例#6
0
        // /////////////////////////////////////////////////////////////////////////////////

        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Blits this Canvas to the screen at the given coordinates and using the provided
        /// foreground and background alpha values.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="fgAlpha"></param>
        /// <param name="bgAlpha"></param>
        public void ToScreenAlpha(int x, int y, float fgAlpha, float bgAlpha)
        {
            int maxWidth  = Application.ScreenSize.Width - x;
            int maxHeight = Application.ScreenSize.Height - y;

            if (maxWidth < 1 || maxHeight < 1)
            {
                return;
            }

            int finalWidth  = Size.Width;
            int finalHeight = Size.Height;

            if (finalWidth > maxWidth)
            {
                finalWidth = maxWidth;
            }
            if (finalHeight > maxHeight)
            {
                finalHeight = maxHeight;
            }

            Size finalSize = new Size(finalWidth, finalHeight);

            TCODConsole.blit(Console,
                             0, 0,
                             finalSize.Width,
                             finalSize.Height,
                             TCODConsole.root,
                             x,
                             y,
                             fgAlpha,
                             bgAlpha);
        }
示例#7
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);
            }   
        }
示例#8
0
        private int Run()
        {
            if (StateCount <= 0)
            {
                Window win = new Window(new WindowTemplate());
                Push(win);
            }

            while (!TCODConsole.isWindowClosed() && !IsQuitting)
            {
                var newUpdateMilli    = TCODSystem.getElapsedMilli();
                var elapsedUpdateTime = newUpdateMilli - _lastUpdateMilli;
//				if (elapsedUpdateTime > upsFrameLength) {
                _lastUpdateMilli = newUpdateMilli;
                Update(elapsedUpdateTime);
//				}

                var newDrawMilli    = TCODSystem.getElapsedMilli();
                var elapsedDrawTime = newDrawMilli - _lastDrawMilli;
//				if (elapsedDrawTime > fpsFrameLength) {
                _lastDrawMilli = newDrawMilli;
                Draw(elapsedDrawTime);
//				}
            }

            return(0);
        }
示例#9
0
        /// <summary>
        /// Called after Application.Start has been called.  Override and place application specific
        /// setup code here after calling base method.
        /// </summary>
        /// <param name="info"></param>
        protected virtual void Setup(ApplicationInfo info)
        {
            if (!string.IsNullOrEmpty(info.Font))
            {
                TCODConsole.setCustomFont(info.Font, (int)info.FontFlags);
            }

            FpsLimit        = info.FpsLimit;
            _fpsFrameLength = FpsLimit == 0 ? 0 : MilliSecondsPerSecond / FpsLimit;
            _lastDrawMilli  = 0;

            UpdatesPerSecondLimit = info.UpdatesPerSecondLimit;
            _upsFrameLength       = UpdatesPerSecondLimit == 0 ? 0 : MilliSecondsPerSecond / UpdatesPerSecondLimit;
            _lastUpdateMilli      = 0;

            _delayFps = FpsLimit > UpdatesPerSecondLimit;

            TCODSystem.setFps(FpsLimit);

            TCODConsole.initRoot(info.ScreenSize.Width, info.ScreenSize.Height, info.Title,
                                 info.Fullscreen, info.RendererType);
            TCODConsole.setKeyboardRepeat(info.InitialDelay, info.IntervalDelay);

            TCODMouse.showCursor(true);

            if (SetupEventHandler != null)
            {
                SetupEventHandler(this, EventArgs.Empty);
            }

            Pigments = new PigmentMap(DefaultPigments.FrameworkDefaults,
                                      info.Pigments);
        }
示例#10
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);
            }
        }
示例#11
0
        /// <summary>
        /// Draw a cricle, which optionally fades out towards the edges. Only sets cell backgrounds
        /// </summary>
        public static void DrawCircle(TCODConsole console, Vector2 center, float radius, TCODColor color, bool fade = true)
        {
            TCODColor currentCol;
            Vector2   pos;
            int       e = (int)(center.x + radius);
            int       w = (int)(center.x - radius);
            int       n = (int)(center.y - radius);
            int       s = (int)(center.y + radius);

            // small optimization so that the distance doesnt have to be calculated for each tile
            float radSqr = radius * radius;

            for (int x = w; x <= e; x++)
            {
                for (int y = n; y <= s; y++)
                {
                    pos.x = x;
                    pos.y = y;

                    float sqrDist = (center - pos).SqrMagnitude();
                    if (sqrDist > radSqr)
                    {
                        continue;
                    }

                    float mag = fade ? 1.0f - (sqrDist / radSqr) : 1.0f;

                    currentCol = console.getCharBackground(x, y);
                    console.setCharBackground(x, y, CrossFadeColor(color, currentCol, mag));
                }
            }
        }
示例#12
0
        public string Show()
        {
            LongestLine = Math.Max(Message.Length, Options.Max(line => line.Length));
            X           = (TCODConsole.root.getWidth() / 2) - (Message.Length / 2 + 2);
            Width       = Math.Max(13, LongestLine + 4); // Two for padding and two for the border
            Y           = (TCODConsole.root.getHeight() / 2) - 3;
            Height      = Options.Length + 6;            // 2 for border, 2 for padding, 2 for title w/ padding

            TCODKey key = null;

            Render();
            do
            {
                key = TCODConsole.waitForKeypress(true);
                if (key.KeyCode == TCODKeyCode.Up)
                {
                    SelectedIndex -= 1;
                    if (SelectedIndex < 0)
                    {
                        SelectedIndex = Options.Length - 1;
                    }
                }
                else if (key.KeyCode == TCODKeyCode.Down)
                {
                    SelectedIndex += 1;
                    if (SelectedIndex >= Options.Length)
                    {
                        SelectedIndex = 0;
                    }
                }
                Render();
            } while(key.KeyCode != TCODKeyCode.Enter && key.KeyCode != TCODKeyCode.Escape);

            return(key.KeyCode == TCODKeyCode.Enter ? Options[SelectedIndex] : null);
        }
示例#13
0
        public void render(bool flush)
        {
            TCODConsole.root.clear();
            if (gameStatus == GameStatus.LOADING)
            {
                loadingGui.render();
            }
            else if (gameStatus == GameStatus.DEFEAT)
            {
                defeatGui.render();
            }
            else
            {
                currentLevel.render();
                if (player != null)
                {
                    player.render();
                }
                if (player != null)
                {
                    TCODConsole.root.print(1, screenHeight - 2, string.Format("HP : {0}/{1}",
                                                                              (int)player.getDestructible().hp, (int)player.getDestructible().maxHp));
                }
                gui.render();
                messageGui.render();
                currentLevel.renderGui();

                menuGui.render();
            }

            TCODConsole.flush();
        }
示例#14
0
文件: Entity.cs 项目: rezich/zday
 public void Draw(TCODConsole console, Point offset)
 {
     if (Position.X > offset.X && Position.X <= offset.X + 45 && Position.Y > offset.Y && Position.Y <= offset.Y + 45)
     {
         console.putCharEx(Position.X - offset.X, Position.Y - offset.Y, Symbol, ForegroundColor, BackgroundColor == null ? TCODColor.black : BackgroundColor);
     }
 }
示例#15
0
 public MapPainter()
 {
     m_offscreenConsole = new TCODConsole(OffscreenWidth, OffscreenHeight);
     m_offscreenConsole.setForegroundColor(UIHelper.ForegroundColor);
     m_honorFOV = true;
     LoadMonsterSymbols();
 }
示例#16
0
        public override void Render(float deltaTime)
        {
            TCODConsole.root.setForegroundColor(Game.Settings.UiForeground);
            TCODConsole.root.setBackgroundColor(backgroundColor);
            TCODConsole.root.setBackgroundFlag(TCODBackgroundFlag.Set);
            TCODConsole.root.clear();

            // Render stars and clouds
            starfield.ForEach(s => s.Render(backgroundColor));
            clouds.ForEach(c => c.Render());

            // Render buildings.
            TCODConsole.blit(background, 0, 0, background.getWidth(), background.getHeight(),
                             TCODConsole.root, 0, 0);

            // Render credits.
            if (!creditsDoneRendering)
            {
                creditsDoneRendering =
                    TCODConsole.renderCredits(1, TCODConsole.root.getHeight() - 3, true);
            }

            // Reset colors and render menu
            TCODConsole.root.setForegroundColor(Game.Settings.UiForeground);
            TCODConsole.root.setBackgroundColor(Game.Settings.UiBackground);
            TCODConsole.root.printFrame(9, 13, 15, 13, true);
            TCODConsole.root.print(11, 15, "[N]ew Game");
            TCODConsole.root.print(11, 17, "[L]oad Game");
            TCODConsole.root.print(11, 19, "[O]ptions");
            TCODConsole.root.print(11, 21, "[C]redits");
            TCODConsole.root.print(11, 23, "[Q]uit");
        }
示例#17
0
        public new void Draw(TCODConsole console, Point offset)
        {
            switch (DrawMode)
            {
            case DrawModes.Normal:
                if (Area.SolidTerrainAt(Position))
                {
                    goto case DrawModes.OnlyForegroundColor;
                }
                base.Draw(console, offset);
                break;

            case DrawModes.OnlyForegroundColor:
                if (Position.X > offset.X && Position.X <= offset.X + 45 && Position.Y > offset.Y && Position.Y <= offset.Y + 45)
                {
                    console.setCharForeground(Position.X - offset.X, Position.Y - offset.Y, ForegroundColor);
                }
                break;

            case DrawModes.OnlyBackgroundColor:
                if (Position.X > offset.X && Position.X <= offset.X + 45 && Position.Y > offset.Y && Position.Y <= offset.Y + 45)
                {
                    console.setCharBackground(Position.X - offset.X, Position.Y - offset.Y, BackgroundColor);
                }
                break;
            }
        }
示例#18
0
        public static void Main(string[] args)
        {
            TCODConsole.initRoot(80, 60, "ULR", false);
            Control con = new Control();

            con.run();
        }
示例#19
0
 public static void fillRect(this TCODConsole console, int x, int y, int w, int h, char c)
 {
     for (int i = 0; i < h; ++i)
     {
         console.hline(x, y + i, w, c);
     }
 }
示例#20
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);
            }
        }
示例#21
0
        public override void DrawNewFrame(TCODConsole screen)
        {
            if (m_enabled)
            {
                int lowX = m_cursorPosition.X - (MapDrawnWidth / 2);
                int lowY = m_cursorPosition.Y - (MapDrawnHeight / 2);
                for (int i = lowX; i < lowX + MapDrawnWidth; ++i)
                {
                    for (int j = lowY; j < lowY + MapDrawnHeight; ++j)
                    {
                        int screenPlacementX = m_mapCorner.X + i + 1;
                        int screenPlacementY = m_mapCorner.Y + j + 1;

                        if (IsDrawableTile(screenPlacementX, screenPlacementY))
                        {
                            if (m_map.IsPointOnMap(new Point(i, j)))
                            {
                                TileVisibility isVisible = m_tileVisibility[i, j];
                                if (isVisible == TileVisibility.Unvisited)
                                {
                                    // If it's unvisisted, nuke the square completed black
                                    screen.setCharBackground(screenPlacementX, screenPlacementY, ColorPresets.Black);
                                    screen.setCharForeground(screenPlacementX, screenPlacementY, ColorPresets.Black);
                                    screen.putChar(screenPlacementX, screenPlacementY, ' ');
                                }
                            }
                        }
                    }
                }
            }
        }
示例#22
0
 public static void hline(this TCODConsole console, int x, int y, int l, char c)
 {
     for (int i = 0; i < l; ++i)
     {
         console.putChar(x + i, y, c);
     }
 }
示例#23
0
        private void DrawStream(TCODConsole screen, uint frameNumber)
        {
            if ((m_points.Count + 8) <= frameNumber)
            {
                FinishAnimation();
            }
            else
            {
                int endingFrame = (int)System.Math.Min(m_points.Count - 1, frameNumber);

                // If we've drawn out the entire stream, show it flickering
                if (endingFrame == m_points.Count - 1)
                {
                    for (int i = 0; i <= endingFrame; ++i)
                    {
                        if (m_locationsOccupied[m_points[i]] || s_random.Chance(60))
                            DrawPoint(screen, m_points[i], '*');
                    }
                }
                else
                {
                    // Else just draw the part of the stream
                    for (int i = 0; i <= endingFrame; ++i)
                        DrawPoint(screen, m_points[i], '*');
                }                
            }
        }
示例#24
0
 public override void DrawNewFrame(TCODConsole screen)
 {
     if (m_enabled)
     {
         foreach (Point p in m_playerFOV)
         {
             int screenPlacementX = m_mapUpCorner.X + p.X + 1;
             int screenPlacementY = m_mapUpCorner.Y + p.Y + 1;
             if (IsDrawableTile(screenPlacementX, screenPlacementY))
                 screen.setCharBackground(screenPlacementX, screenPlacementY, ColorPresets.DarkRed);
         }
         foreach (ICharacter c in m_monsterFOV.Keys)
         {
             foreach (Point p in m_monsterFOV[c])
             {
                 int screenPlacementX = m_mapUpCorner.X + p.X + 1;
                 int screenPlacementY = m_mapUpCorner.Y + p.Y + 1;
                 if (IsDrawableTile(screenPlacementX, screenPlacementY))
                 {
                     TCODColor currentColor = screen.getCharBackground(screenPlacementX, screenPlacementY);
                     screen.setCharBackground(screenPlacementX, screenPlacementY, TCODColor.Interpolate(currentColor, GetColorForMonster(c), .6f));
                 }
             }
         }
     }
 }
示例#25
0
        internal SkillTreePainter()
        {
            m_enabled = false;
            CursorPosition = Point.Invalid;
            NewlySelectedSkills = new List<ISkill>();
            m_currentTabName = m_defaultTab;
            m_dirtyFrame = true;
            m_offscreen = new TCODConsole(UIHelper.ScreenWidth, UIHelper.ScreenHeight);

            m_skillTreeTabs = new Dictionary<string, SkillTreeTab>();
            //m_skillTreeTabs.Add("Air", new SkillTreeTab("AirSkillTree.xml"));
            m_skillTreeTabs.Add("Arcane", new SkillTreeTab("ArcaneSkillTree.xml"));
            //m_skillTreeTabs.Add("Earth", new SkillTreeTab("EarthSkillTree.xml"));
            m_skillTreeTabs.Add("Fire", new SkillTreeTab("FireSkillTree.xml"));
            m_skillTreeTabs.Add("Light", new SkillTreeTab("LightSkillTree.xml"));
            m_skillTreeTabs.Add("Martial", new SkillTreeTab("MartialSkillTree.xml"));
            m_skillTreeTabs.Add("Attributes", new SkillTreeTab("AttributeSkillTree.xml"));
            //m_skillTreeTabs.Add("Water", new SkillTreeTab("WaterSkillTree.xml"));

            // Calculate the max width/height of all tabs so we can get the offsecreen surface the right size
            int maxWidth = -1;
            int maxHeight = -1;
            foreach (SkillTreeTab tab in m_skillTreeTabs.Values)
            {
                maxWidth = Math.Max(maxWidth, tab.Width);
                maxHeight = Math.Max(maxHeight, tab.Height);
            }            
        }
示例#26
0
        public void Update()
        {
            bool endturn;

            do
            {
                TCODKey key = TCODConsole.waitForKeypress(true);
                endturn = HandleKeyPress(key);
                Draw();
            } while (!endturn && !Exit);
            if (!Exit)
            {
                Map.Update();
                Draw();
                if (Map.IntensityAt(_player.PosX, _player.PosY) == 0)
                {
                    if (_turnInDark == 3)
                    {
                        Exit = true;
                    }
                    else
                    {
                        _turnInDark++;
                    }
                }
            }
        }
示例#27
0
        public void Start()
        {
            isRunning = true;
            while (isRunning)
            {
                // Check for scene change
                if (sceneChanged)
                {
                    CurrentScene = newScene;
                    newScene     = null;
                    sceneChanged = false;
                }

                // Check if the game is still running.
                if (TCODConsole.isWindowClosed() || CurrentScene == null)
                {
                    Stop();
                    break;
                }

                // Update
                CurrentScene.Update(TCODSystem.getLastFrameLength());

                // Render
                TCODConsole.root.clear();
                CurrentScene.Render(TCODSystem.getLastFrameLength());
                TCODConsole.flush();

                // Handle user input
                CheckForKeyboardEvents();
                CheckForMouseEvents();
            }
            CleanUp();
        }
示例#28
0
        private static void RenderAllConsoles(Game game, TCODConsole rootConsole, TCODConsole playConsole, TCODColor fogOfWarColour,
                                              TCODConsole playerConsole, TCODConsole competitorConsole,
                                              TCODConsole eventsConsole, Rectangle playBounds, Rectangle playerBounds,
                                              Rectangle competitorBounds, Rectangle eventBounds)
        {
            rootConsole.clear();
            rootConsole.setForegroundColor(ColorPresets.White);
            rootConsole.setBackgroundColor(ColorPresets.Black);

            RenderPlayConsole(game, playConsole, fogOfWarColour, playBounds);
            RenderPlayerConsole(game.Player, playerConsole, playerBounds);
            //RenderThreatConsole(game.Player, game.Actors, threatConsole, threatBounds);
            RenderCompetitorConsole(game, competitorConsole, competitorBounds);
            RenderEventsConsole(game, eventsConsole, eventBounds);

            TCODConsole.blit(playConsole, 0, 0, playBounds.Width, playBounds.Height, rootConsole, playBounds.X, playBounds.Y);
            TCODConsole.blit(playerConsole, 0, 0, playerBounds.Width, playerBounds.Height, rootConsole, playerBounds.X, playerBounds.Y);
            TCODConsole.blit(competitorConsole, 0, 0, competitorBounds.Width, competitorBounds.Height, rootConsole, competitorBounds.X, competitorBounds.Y);
            TCODConsole.blit(eventsConsole, 0, 0, eventBounds.Width, eventBounds.Height, rootConsole, eventBounds.X, eventBounds.Y);

            //playConsole.Blit(0, 0, playBounds.Width, playBounds.Height, rootConsole, playBounds.X, playBounds.Y);
            //playerConsole.Blit(0, 0, playerBounds.Width, playerBounds.Height, rootConsole, playerBounds.X,
            //                   playerBounds.Y);

            //competitorConsole.Blit(0, 0, competitorBounds.Width, competitorBounds.Height, rootConsole,
            //                       competitorBounds.X, competitorBounds.Y);
            //eventsConsole.Blit(0, 0, eventBounds.Width, eventBounds.Height, rootConsole, eventBounds.X, eventBounds.Y);
        }
示例#29
0
 public void SetColors(TCODConsole screen, bool selected, bool enabled)
 {
     if (enabled)
     {
         if (selected)
         {
             screen.setForegroundColor(ColorPresets.LightGray);
             screen.setBackgroundColor(ColorPresetsFromTCOD.BrightBlue);
         }
         else
         {
             screen.setForegroundColor(ColorPresets.Gray);
             screen.setBackgroundColor(ColorPresets.Black);
         }
     }
     else
     {
         if (selected)
         {
             screen.setForegroundColor(ColorPresets.Red);
             screen.setBackgroundColor(ColorPresetsFromTCOD.BrightYellow);
         }
         else
         {
             screen.setForegroundColor(ColorPresets.Red);
             screen.setBackgroundColor(ColorPresets.Black);
         }
     }
 }
示例#30
0
        static void Main(string[] args)
        {
            Console.WriteLine("Rogue Game: By Thomas Edmunds");

#if CUSTOM_FONT
            Console.WriteLine("- Creating custom libTCOD font...");
            TCODConsole.setCustomFont(FONT_SHEET, (int)TCODFontFlags.LayoutAsciiInRow | (int)TCODFontFlags.Greyscale);
#endif

            Console.WriteLine("- Initializing libTCOD console...");
            TCODConsole.initRoot(WindowWidth, WindowHeight, GAME_TITLE, false, TCODRendererType.SDL);
            TCODConsole.setKeyboardRepeat(keyInitialDelay, keyInterval);

            Console.WriteLine("- libTCOD fullscreen = " + doFullscreen.ToString());
            TCODConsole.setFullscreen(doFullscreen);

            Console.WriteLine("- Game Entry point, launching rogue engine...");

            // Init the game engine: game entrypoint
            Engine engine  = new Engine(TCODConsole.root);
            int    endCode = engine.Run();

            Console.WriteLine("- Game exit with code " + endCode);
            return;
        }
示例#31
0
        /// <summary>
        /// Renders the games HUD elemnts
        /// Should be called last so that it blits consoles on top of game content if need be
        /// </summary>
        private void RenderGameHUD(TCODConsole targetConsole, Camera camera, Vector2 screenCenter)
        {
            HUD hud = engine.playerController.hud;

            // Allow the generalized HUD to render
            hud.Draw(targetConsole, camera);

            TCODConsole hudConsole;

            for (int i = 0; i < hud.windows.Count; i++)
            {
                if (!hud.windows[i].isVisible)
                {
                    continue;
                }

                hudConsole = hud.windows[i].GetUpdatedConsole();
                if (!hud.windows[i].isVisible)
                {
                    continue;
                }
                TCODConsole.blit(hudConsole, 0, 0, hudConsole.getWidth(), hudConsole.getHeight(),           // source
                                 targetConsole, hud.windows[i].origin.X, hud.windows[i].origin.Y, 1);       // destination
            }

            // draw drag drop data if there is any
            var dragdrop = hud.dragdrop;

            if (dragdrop.active)
            {
                DrawRect(targetConsole, dragdrop.x, dragdrop.y, dragdrop.text.Length + 1, Window.elementDark);
                DrawText(targetConsole, dragdrop.x + 1, dragdrop.y, dragdrop.text, Constants.COL_FRIENDLY);
                DrawText(targetConsole, dragdrop.x, dragdrop.y, "" + (char)(25), TCODColor.white);
            }
        }
示例#32
0
文件: HUD.cs 项目: tedmunds/RogueGame
        // Draw the tile cursor, and inspection window if there are entites under the tile
        private void DrawTileCursor(TCODConsole baseConsole, PlayerController.TileCursor tileCursor, Camera camera)
        {
            if (tileCursor.IsActive)
            {
                Vector2 start      = Renderer.WorldToScreenCoord(camera, player.position);
                Vector2 end        = tileCursor.position;
                Vector2 inspectPos = Renderer.ScreenToWorldCoord(camera, tileCursor.position);

                // never draw it if cursor is not on map
                if (!world.currentMap.InBounds(inspectPos))
                {
                    return;
                }

                // change color depending on if the player has los to the endpoint
                TCODColor lineColor = tileCursor.hasLOS ? Constants.COL_FRIENDLY : Constants.COL_ANGRY;

                Renderer.DrawLine(baseConsole, start, end, lineColor);
                baseConsole.setCharBackground(end.X, end.Y, cursorColor);

                // decide if there is anything to inspect on this tile
                Entity[] entities = world.currentMap.GetAllObjectsAt(inspectPos.X, inspectPos.Y);

                // if there is stuff to inspect, and the inspect window is not open or is initialized for a different tile
                if (entities.Length > 0 &&
                    (!inspectionWindow.isVisible || inspectionWindow.currentLocation != inspectPos))
                {
                    // open the window, but make sure its on the opposite side of the where the cursor is so it never overlaps
                    if (tileCursor.position.X < engine.consoleWidth / 2)
                    {
                        inspectionWindow.origin.x = (camera.screenX + camera.width) - inspectionWindow.console.getWidth();
                    }
                    else
                    {
                        inspectionWindow.origin.x = camera.screenX;
                    }

                    var tile = world.currentMap.GetTile(inspectPos.X, inspectPos.Y);

                    // only open the inspector if the target tile is in los
                    if (tile.cachedLOS)
                    {
                        inspectionWindow.OpenForTile(tile, inspectPos);
                    }
                }
                else if (entities.Length == 0 && inspectionWindow.isVisible)
                {
                    inspectionWindow.Close();
                }
            }
            else
            {
                // always close inspect window if tile cursor gets turned off
                if (inspectionWindow.isVisible)
                {
                    inspectionWindow.Close();
                }
            }
        }
示例#33
0
 private void end()
 {
     TCODConsole.root.clear();
     TCODConsole.root.setForegroundColor(TCODColor.red);
     TCODConsole.root.print(35, 25, "You died");
     TCODConsole.flush();
     TCODConsole.waitForKeypress(true);
 }
 // Name: DungeonLayer (constructor)
 // Description: Creates an instance of the DungeonLayer class
 public DungeonLayer( TCODConsole console )
 {
     this.console = console;
     dungeon = new short[DUNGEON_HEIGHT , DUNGEON_WIDTH];
     // Create an empty dungeon
     this.fillDefaultFloor();
     this.injectPerimiter();
 }
示例#35
0
 // Used when we're responding to a callback from the game engine that something happened on someone else's turn.
 public void DrawAnimationSynchronous(PaintingCoordinator coord, TCODConsole screen)
 {
     while (!m_done)
     {
         coord.DrawNewFrame(screen);
         TCODConsole.flush();
     }
 }
示例#36
0
 public MainMenuScene(Game game) : base(game)
 {
     background           = RexPaintImageLoader.LoadImage("Assets/MainMenu/Background.xp");
     backgroundColor      = new TCODColor(0, 32, 64);
     creditsDoneRendering = false;
     GenerateStarfield();
     GenerateClouds();
 }
示例#37
0
 //Initialisation logic
 public void Init()
 {
     TCODConsole.setCustomFont("oryx_tiles.png", ((int)TCODFontFlags.Greyscale | (int)TCODFontFlags.LayoutTCOD), 32, 12);
     TCODConsole.initRoot(80, 50, "DarkRL", false, TCODRendererType.GLSL);
     console = TCODConsole.root;
     TCODConsole.checkForKeypress();
     console.setBackgroundColor(TCODColor.black);
 }
示例#38
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);
        }
示例#39
0
        public static TCODConsole LoadImage(string fileName)
        {
            var         transparentColor = new TCODColor(255, 0, 255);
            TCODConsole image            = null;

            try {
                using (var file = File.Open(fileName, FileMode.Open)) {
                    var decrompressedStream = new GZipStream(file, CompressionMode.Decompress);
                    var reader      = new BinaryReader(decrompressedStream);
                    var fileVersion = reader.ReadInt32();
                    var layerCount  = reader.ReadInt32();

                    // Reserving space for these in advance, so I'm not doing memory
                    // allocations repeatedly in the loop.
                    int       layerWidth = 0;
                    int       layerHeight = 0;
                    int       x, y;
                    int       characterCode = 0;
                    TCODColor foreground    = new TCODColor();
                    TCODColor background    = new TCODColor();

                    for (int layerIndex = 0; layerIndex < layerCount; ++layerIndex)
                    {
                        layerWidth  = reader.ReadInt32();
                        layerHeight = reader.ReadInt32();
                        if (image == null)
                        {
                            image = new TCODConsole(layerWidth, layerHeight);
                            image.setBackgroundColor(transparentColor);
                            image.clear();
                            image.setKeyColor(transparentColor);
                        }

                        for (var charIndex = 0; charIndex < layerWidth * layerHeight; ++charIndex)
                        {
                            x                = charIndex / layerHeight;
                            y                = charIndex % layerHeight;
                            characterCode    = reader.ReadInt32();
                            foreground.Red   = reader.ReadByte();
                            foreground.Green = reader.ReadByte();
                            foreground.Blue  = reader.ReadByte();
                            background.Red   = reader.ReadByte();
                            background.Green = reader.ReadByte();
                            background.Blue  = reader.ReadByte();

                            // Check if the current cell is transparent.
                            if (background.NotEqual(transparentColor))
                            {
                                image.putCharEx(x, y, characterCode, foreground, background);
                            }
                        }
                    }
                }
            } catch (Exception e) {
                Logger.Error($"Error loading file '{fileName}': {e.Message}");
            }
            return(image);
        }
示例#40
0
 public MainMenuScene(Game game)
     : base(game)
 {
     background = RexPaintImageLoader.LoadImage("Assets/MainMenu/Background.xp");
     backgroundColor = new TCODColor(0, 32, 64);
     creditsDoneRendering = false;
     GenerateStarfield();
     GenerateClouds();
 }
示例#41
0
 public void ResetColors(TCODConsole screen)
 {
     if (m_stuffSaved)
     {
         screen.setForegroundColor(m_savedForeground);
         screen.setBackgroundColor(m_savedBackground);
         m_stuffSaved = false;
     }
 }
示例#42
0
 static void Main(string[] args)
 {
     TCODConsole.initRoot(80, 50, "Z-Day", false);
     TCODSystem.setFps(30);
     TCODMouse.showCursor(false);
     Game.Current = new Game();
     Game.Current.Initialize();
     Game.Current.Play();
 }
示例#43
0
 public void RunGame()
 {
     _model.CommitChanges();
     do
     {
         TCODConsole.checkForKeypress((int)TCODKeyStatus.KeyPressed);
         _logic.RunCurrentState();
     } while (!_exitGame && !TCODConsole.isWindowClosed());
 }
示例#44
0
 public void debugRender(int iterations)
 {
     for (int i = 0; i < iterations; i++)
     {
         TCODConsole.flush();
     }
     level.render();
     level.update();
 }
示例#45
0
 private void Draw(uint elapsedTime)
 {
     TCODConsole.root.clear();
     foreach (var window in _windowsStack)
     {
         window.OnDraw();
     }
     TCODConsole.flush();
 }
 // Name: DungeonLevel (constructor)
 // Description: Instantiates an instance of the DungeonLevel class
 public DungeonLevel( TCODConsole console )
 {
     dungeonLayer = new DungeonLayer( console );
     monsterLayer = new MonsterLayer( console );
     // Temp Code
     monsterLayer.DungeonLevel = this;
     // End temp code
     this.console = console;
 }
示例#47
0
文件: Game.cs 项目: rezich/zday
 public void Play()
 {
     Console.WriteLine("Welcome to Z-Day!");
     while (!Over && !TCODConsole.isWindowClosed())
     {
         Draw();
         Update();
     }
 }
示例#48
0
        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);
            }
        }
示例#49
0
 public GUI(Window win, TCODConsole main, Camera camera)
 {
     statusWindow = new TCODConsole(Window.StatusPanelWidth, win.Height);
     eventLog = new TCODConsole(win.Width - Window.StatusPanelWidth, Window.MessagePanelHeight);
     statusWindow.setAlignment(TCODAlignment.CenterAlignment);
     statusWindow.setBackgroundColor(TCODColor.darkestRed.Multiply(0.1f));
     this.main = main;
     this.window = win;
     this.camera = camera;
 }
示例#50
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);
     }
 }
示例#51
0
        public LibtcodScreen(int width, int height, TCODConsole tcodConsole)
        {
            Width = width;
            Height = height;

            TCODConsoleInst = tcodConsole;

            TCODConsoleInst.setBackgroundFlag(TCODBackgroundFlag.Overlay);
            BackgroundColor = ConsoleRGB.Black;
            ForegroundColor = ConsoleRGB.White;
            TCODConsoleInst.setKeyColor(TCODColor.red);
        }
示例#52
0
        internal GameInstance()
        {
            m_console = TCODConsole.root;

            Compose();

            TextBox = new TextBox();
            m_painters = new PaintingCoordinator();

            // Most of the time while debugging, we don't want to save on window close
            ShouldSaveOnClose = !Preferences.Instance.DebuggingMode;
        }
示例#53
0
        private void ColorSquare(TCODConsole screen, Point p, double strength, TCODColor color)
        {
            int screenPlacementX = m_mapUpCorner.X + p.X + 1;
            int screenPlacementY = m_mapUpCorner.Y + p.Y + 1;

            if (IsDrawableTile(screenPlacementX, screenPlacementY))
            {
                TCODColor attackColor = TCODColor.Interpolate(ColorPresets.Black, color, (float)strength);
                TCODColor currentColor = screen.getCharBackground(screenPlacementX, screenPlacementY);
                TCODColor newColor = TCODColor.Interpolate(currentColor, attackColor, .5f);
                screen.setCharBackground(screenPlacementX, screenPlacementY, newColor);
            }
        }
示例#54
0
文件: Dialog.cs 项目: bilwis/SH2RL
        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++;
            }
        }
示例#55
0
        private static void Initialize()
        {
            NoiseManager.GeneratePerlinImage(imageSize).Save("heightmap.png",System.Drawing.Imaging.ImageFormat.Png);
            img = new TCODImage("heightmap.png");

            TCODConsole.initRoot(80, 80, "MapGen", false, TCODRendererType.OpenGL);
            root = TCODConsole.root;
            TCODConsole.setCustomFont("Data/terminal12x12_gs_ro.png", (int)TCODFontFlags.LayoutAsciiInRow,16,16);
            TCODSystem.setFps(60);

            random = new Random();

            stopwatch = new Stopwatch();
            stopwatch.Start();
        }
示例#56
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);
            }
        }
示例#57
0
        public void Draw(TCODConsole console, IGameEngine engine, List<ISkill> selectedSkillList, List<ISkill> newlySelectedSkillList, Point cursorPosition)
        {
            SkillSquare cursorSkillSquare = null;
            ISkill cursorOverSkill = null;
            if (m_squareLookup.ContainsKey(cursorPosition))
            {
                cursorSkillSquare = m_squareLookup[cursorPosition];
                cursorOverSkill = cursorSkillSquare.GetSkill(engine);
            }
            int selectedSkillCost = newlySelectedSkillList.Sum(x => x.Cost);

            int upperLeftX = cursorPosition.X - ((SkillTreePainter.SkillTreeWidth - 1) / 2);
            int upperLeftY = cursorPosition.Y - ((SkillTreePainter.SkillTreeHeight - 1) / 2);

            int lowerRightX = cursorPosition.X - ((SkillTreePainter.SkillTreeWidth - 1) / 2);
            int lowerRightY = cursorPosition.Y - ((SkillTreePainter.SkillTreeHeight - 1) / 2);

            int arrayWidth = CharArray.GetLength(0);
            int arrayHeight = CharArray.GetLength(1);

            for (int i = SkillTreePainter.UpperLeft + 1; i < SkillTreePainter.SkillTreeWidth + SkillTreePainter.UpperLeft - 1; ++i)
            {
                for (int j = SkillTreePainter.UpperLeft + 1; j < SkillTreePainter.SkillTreeHeight + SkillTreePainter.UpperLeft -1; ++j)
                {
                    int gridX;
                    int gridY;
                    ConvertDrawToGridCoord(i, j, cursorPosition, out gridX, out gridY);
                    if (gridX >= 0 && gridY >= 0 && gridX < arrayWidth && gridY < arrayHeight)
                    {
                        //CalculateBackgroundColorForSkill
                        // We're painting something that shows up on our "grid"
                        TCODColor background = CalculateBackgroundColorForSkill(new Point(gridX, gridY), cursorPosition, selectedSkillList, newlySelectedSkillList, engine.Player.SkillPoints, selectedSkillCost, cursorOverSkill);
                        console.putCharEx(i, j, CharArray[gridX, gridY], UIHelper.ForegroundColor, background);
                    }
                    else
                    {
                        // We're not painting something on our grid, black it out
                        console.setCharBackground(i, j, m_black);
                    }
                }
            }

            if (cursorSkillSquare != null)
                DrawSkillPopup(console, selectedSkillList, engine.Player.SkillPoints - selectedSkillCost, cursorSkillSquare, cursorOverSkill, cursorPosition);
        }
示例#58
0
        public WelcomeWindow()
        {
            m_dialogHelper = new DialogColorHelper();
            m_console = TCODConsole.root;
            m_random = new Random();
            m_windowResult = new Result();

            m_currentElementPointedTo = (MagicTypes)m_random.getInt(0, 6);    // Pick a random element to start on.

            m_flavorText = new Dictionary<MagicTypes, string>();
            m_flavorText[MagicTypes.Fire] = "Passionate fire-based magic. Aggressive front loaded damage. Weaker in magic requiring more finesse.";
            m_flavorText[MagicTypes.Water] = "As seen in the seas, water can both protect and destory life with ease. Icey effects also slow and disable.";
            m_flavorText[MagicTypes.Air] = "Born from the wind, air-based magic can enchant, entice, and when necessary strike with thunder and hail.";
            m_flavorText[MagicTypes.Earth] = "Sturdy and dependable, the earth excels in defense and striking nearby foes with the force of a landslide.";
            m_flavorText[MagicTypes.Light] = "Gifted from the Creator. Light magic is best at mending wounds, summoning aid and protection. Strong at smiting unholy abominations.";
            m_flavorText[MagicTypes.Darkness] = "Darkness magic is drawn from a pure lust for power. A mockery of the light, capable of producing much pain, summoning forbidden aid, and raising the dead to serve.";
            m_flavorText[MagicTypes.Arcane] = "Arcane magic is born from altering the fabric of reality. Infinitely flexible and neutral to all other school of magic.";

            m_mainText = new Dictionary<MagicTypes, string>();
            m_mainText[MagicTypes.Fire] = "It is our passions that seperate us from the other schools, our passion for life, our passion for knowledges, our passion for power.\n\nIt is your fiery passion that brought you to this school. Your instructors will shape your unrefined passion into power. Power to shape even the very flames beneath this mountain. \n\nTo be a pyromancer is to be channel forces so great as to be nearly out of control and yet hold onto it with your very will.\n\nRemember this as you enter these halls, as many have before you.\n\n\n\n\n\n\nSenior Pyromancer Nathan\nWelcoming Ceremony\n372 CT";
            m_mainText[MagicTypes.Water] = "And this exhibit is the famous painting of the battle of Hillsbrad Harbor. During the 2nd revolution in CT 291, this town was stormed by a small navy backed up by a large elemental force, as you can see here.\n\nWater wisps, ice demons, and even elder water elementals were summoned by the Archmage Danel II. Look at the exquisite detail of the background storm. The full force a hurricane force winds were leveled against the defenders, and is captured here.\n\nIt was painted at the height of the artist's career. Now on the left is...\n\n\n\n\n\nExcerpt from a tour\nRoyal Museum of Art, Dalundor\nCT 382";
            m_mainText[MagicTypes.Air] = "While traveling via the sea, many remember to visit the Brotherhood of Water for charms and scrolls to speed their journey. You would be wise not to forget the power of the wind. Even with a calm sea, the wind is what truly carries you.\nSome the the product we offer the public inclued:\n\n\nScroll of Strengthen Wind......50G\n\nScroll of Witch Wind..........100G\n\nWand of Calm Storm............275G\n\nWand of Lightning Bolt........500G\n\nServices of Air Mage......500G/day\n\n\nCome see us today!\n\nAirbone Services\nLocated in Arcane district next to the west gate.";
            m_mainText[MagicTypes.Earth] = "Tips when traveling to planes of Earth\n\n* 37 planes of earth have been mapped sufficiently well enough that bringing a map will do more help than harm.\n\n* Seven of these planes are partially molten, so bring a fire mage or resist elements scrolls.\n\n* While many will travel in search of precious metals and gems, removal of large quantites of materal can rouse angry elementals.\n\n* Bring scrolls of fresh air and potions of burrowing in case of cave-ins.\n\n* Remember a light source that doesn't require air, such as glowstones or coldfire torches.\n\n\nGuild of Earth Mages";
            m_mainText[MagicTypes.Light] = "In the beginning the Creator created many worlds. Some demi-planes of raw elements, others fully formed and seeded with life. While mages from all schools have explored a few of these planes, many questions remain.\n\nWhy are some more formed than others? Why did the Creator leave His fingerprints on creation so obviously, and then never act again?\n\nThe tenants of the school of light magic are based upon what we can glean about the Creator and planes of positive energy.\n\nHowever, unless the Creator returns to impart knowledge about itself, there is precious little we can know for certain.\n\n\n\nThoughts on Creation\nAugus\nCT 169";
            m_mainText[MagicTypes.Darkness] = "Jonathan,\n\n     You were right, those hidden manuscripts we found were truthful. While I have not found the tomb yet, this swamp is full of power. The dead walk, wondering (patrolling?) near this bog, the very air is filled with a dread power stronger than anything at the academy.\n\nOnce I find the tomb, the spellbooks of the Lich Algmon shall be ours. With them, the power to shape the world. Those fools who speak of restraint or treaties lack the will to act. That is one thing we do not lack.\n\nAs soon as you can slip away, locate me using the charm attached. We can continue the search.\n\n\n\nMarie\nCT 381";
            m_mainText[MagicTypes.Arcane] = "Magic in its purest form is a sentient being pressing their will against nature. More accurately, their will distorts the weave of creation. By understanding this weave, a student of the arcane can wield force alone as their weapon, as opposed to crude elemental magics.\n\nWith study, the amount of distortion one can force into the weave before it \"snaps\" back and ruins a spell increases.\n\nThis textbook will provide an introduction to Arcane magic. The study of the arcane provides both an excellent foundation for future studies in other areas and a path to high magic in itself.\n\n\nModern Exploration of the Weave: An Introduction to Modern Arcane theory\nPage 3\nDavid C. Fellow";

            m_spellLists = new Dictionary<MagicTypes, List<string>>();
            m_spellLists[MagicTypes.Fire] = new List<string>() { "Firebolt", "Warmth", "Fireblast", "Fireball", "Wall Of Fire", "Firestorm" };
            m_spellLists[MagicTypes.Water] = new List<string>() { "Cold Snap", "Icy Armor", "Frigid Aura", "Ice Bolt", "Shatter", "Cone Of Cold" };
            m_spellLists[MagicTypes.Air] = new List<string>() { "Shock", "Swiftness", "Confuse", "Lightning Bolt", "Storm Armor", "Hurricane" };
            m_spellLists[MagicTypes.Earth] = new List<string>() { "Stone Armor", "Aftershock", "Strength Of The Earth", "Stoneskin", "Summon Earth Elemental", "Earthquake" };
            m_spellLists[MagicTypes.Light] = new List<string>() { "Mend", "Smite", "Armor of Light", "Heal", "Summon Archon", "Wrath" };
            m_spellLists[MagicTypes.Darkness] = new List<string>() { "Pain", "Drain Life", "Raise Dead", "Darkness", "Summon Wraith", "Lich Form" };
            m_spellLists[MagicTypes.Arcane] = new List<string>() { "Force Bolt", "Arcane Armor", "Blink", "Slow", "Destructive Teleport", "Wave of Force" };

            GetListOfSaveFiles();
            m_lowerRange = 0;
            m_cursorPosition = -1;
            m_isScrollingNeeded = m_fileNameList.Count > NumberOfSaveFilesToList;
        }
示例#59
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);
                        }
                    }
                }
            }
        }
示例#60
0
        public override void DrawNewFrame(TCODConsole screen)
        {
            if (m_enabled)
            {
                for (int i = 0; i < m_width; ++i)
                {
                    for (int j = 0; j < m_height; ++j)
                    {
                        int screenPlacementX = m_mapUpCorner.X + i + 1;
                        int screenPlacementY = m_mapUpCorner.Y + j + 1;

                        if (IsDrawableTile(screenPlacementX, screenPlacementY))
                        {
                            if (m_moveableGrid[i, j])
                                screen.setCharBackground(screenPlacementX, screenPlacementY, ColorPresets.DarkGreen);
                            else
                                screen.setCharBackground(screenPlacementX, screenPlacementY, ColorPresets.DarkRed);
                        }
                    }
                }
            }
        }