Exemplo n.º 1
0
 public override void EnterState()
 {
     MsgLog        = (Utilities.MessageLog)Utilities.InterStateResources.Instance.Resources["Game_MessageLog"];
     MsgCons       = libtcodWrapper.RootConsole.GetNewConsole(90, 30);
     ScrollValue   = 0;
     Scrollability = Guardian_Roguelike.Utilities.MessageLogScrollPossibilities.None;
 }
Exemplo n.º 2
0
        public void RenderToConsole(libtcodWrapper.Console Target)
        {
            Target.Clear();
            for (int x = 0; x < WIDTH; x++)
            {
                for (int y = 0; y < HEIGHT; y++)
                {
                    if (DisplayData[x, y].HasBeenSeen || DisplayData[x, y].Type == TerrainTypes.ExitPortal) //Last condition for debug only
                    {
                        if (DisplayData[x, y].IsVisible)
                        {
                            Target.ForegroundColor = DisplayData[x, y].DrawColor;
                        }
                        else
                        {
                            Target.ForegroundColor = libtcodWrapper.ColorPresets.Gray;
                        }
                        Target.PutChar(x, y, DisplayData[x, y].CharRepresentation);
                    }
                }
            }

            for (int i = Creatures.Count - 1; i >= 0; i--)
            {
                World.Creatures.CreatureBase C = Creatures[i];
                if (DisplayData[C.Position.X, C.Position.Y].IsVisible)
                {
                    Target.ForegroundColor = C.DrawColor;
                    Target.PutChar(C.Position.X, C.Position.Y, C.CharRepresentation);
                }
            }
        }
Exemplo n.º 3
0
        public static void RenderRecentToConsole(libtcodWrapper.Console Target)
        {
            Target.Clear();

            for (int i = (Lines.Count - 4 > 0 ? Lines.Count - 4 : 0), j = 0; i < Lines.Count; i++, j++)
            {
                Target.ForegroundColor = Lines[i].TextColor;
                Target.PrintLine(Lines[i].Text + "\n", 0, j, libtcodWrapper.LineAlignment.Left);
            }
        }
        public override void EnterState()
        {
            WMCons  = libtcodWrapper.RootConsole.GetNewConsole(90, 30);
            MSGCons = libtcodWrapper.RootConsole.GetNewConsole(90, 5);

            Utilities.MessageLog MSGLog = (Utilities.MessageLog)Utilities.InterStateResources.Instance.Resources["Game_MessageLog"];
            WMap = (World.WorldMap)Utilities.InterStateResources.Instance.Resources["Game_WorldMap"];

            WMap.RenderToConsole(WMCons);
            MSGLog.RenderRecentToConsole(MSGCons);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Renders the full message log to a console.
        /// </summary>
        /// <param name="Target">Target console.</param>
        /// <param name="Scroll">How much to scroll down.</param>
        /// <returns>Which way can be scrolled.</returns>
        public static MessageLogScrollPossibilities RenderFullToConsole(libtcodWrapper.Console Target, int Scroll)
        {
            Target.Clear();

            bool canscrollup, canscrolldown;

            canscrollup = canscrolldown = false;
            if (Scroll > 0)
            {
                canscrollup = true;
            }
            for (int i = Scroll, j = 0; i < Lines.Count; i++, j++)
            {
                Target.ForegroundColor = Lines[i].TextColor;
                Target.PrintLine(Lines[i].Text, 0, j, libtcodWrapper.LineAlignment.Left);
                if (j > 30)
                {
                    canscrolldown = true;
                    break;
                }
            }
            if (canscrolldown && canscrollup)
            {
                return(MessageLogScrollPossibilities.Both);
            }
            else if (canscrolldown)
            {
                return(MessageLogScrollPossibilities.Down);
            }
            else if (canscrollup)
            {
                return(MessageLogScrollPossibilities.Up);
            }
            else
            {
                return(MessageLogScrollPossibilities.None);
            }
        }
 public override void EnterState()
 {
     Player       = new Guardian_Roguelike.World.Creatures.Dwarf();
     DispCons     = libtcodWrapper.RootConsole.GetNewConsole(90, 30);
     CreationStep = 0;
 }
Exemplo n.º 7
0
        public GameState() : base()
        {
            DEBUG_PassedMilliseconds = 0;
            SkipAI  = false;
            CurMode = Modes.Normal;
            if (Utilities.InterStateResources.Instance.Resources.ContainsKey("Game_FOVHandler"))
            {
                Utilities.InterStateResources.Instance.Resources.Remove("Game_FOVHandler");
            }
            if (Utilities.InterStateResources.Instance.Resources.ContainsKey("Game_PathFinder"))
            {
                Utilities.InterStateResources.Instance.Resources.Remove("Game_PathFinder");
            }
            if (Utilities.InterStateResources.Instance.Resources.ContainsKey("Game_CurrentLevel"))
            {
                Utilities.InterStateResources.Instance.Resources.Remove("Game_CurrentLevel");
            }
            if (Utilities.InterStateResources.Instance.Resources.ContainsKey("Game_NotableEventsLog"))
            {
                Utilities.InterStateResources.Instance.Resources.Remove("Game_NotableEventsLog");
            }
            if (Utilities.InterStateResources.Instance.Resources.ContainsKey("Game_DeathData"))
            {
                Utilities.InterStateResources.Instance.Resources.Remove("Game_DeathData");
            }

            Utilities.InterStateResources.Instance.Resources.Add("Game_FOVHandler", new libtcodWrapper.TCODFov(90, 30));
            Utilities.InterStateResources.Instance.Resources.Add("Game_PathFinder", new libtcodWrapper.TCODPathFinding((libtcodWrapper.TCODFov)Utilities.InterStateResources.Instance.Resources["Game_FOVHandler"], 1));
            Utilities.InterStateResources.Instance.Resources.Add("Game_CurrentLevel", new World.Map());

            /*
             * World.Creatures.Dwarf tPlayer = new Guardian_Roguelike.World.Creatures.Dwarf();
             * tPlayer.Position.X = tPlayer.Position.Y = 1;
             * tPlayer.FirstName = "Urist";
             * tPlayer.LastName = "Litasterar";
             * tPlayer.DrawColor = libtcodWrapper.ColorPresets.ForestGreen;*/
            if (Utilities.InterStateResources.Instance.Resources.ContainsKey("Game_PlayerCreature"))
            {
                Utilities.InterStateResources.Instance.Resources.Remove("Game_PlayerCreature");
            }
            World.Creatures.CreatureBase tPlayer = new World.Creatures.Dwarf();
            tPlayer.Generate();
            tPlayer.DrawColor = libtcodWrapper.ColorPresets.ForestGreen;

            Utilities.InterStateResources.Instance.Resources.Add("Game_PlayerCreature", tPlayer);

            StatusCons = libtcodWrapper.RootConsole.GetNewConsole(90, 5);

            MapCons = libtcodWrapper.RootConsole.GetNewConsole(90, 30);

            MsgCons = libtcodWrapper.RootConsole.GetNewConsole(90, 5);


            Player               = (World.Creatures.Dwarf)Utilities.InterStateResources.Instance.Resources["Game_PlayerCreature"];
            Player.BaseAim      += 2;
            Player.BaseEnergy   += 2;
            Player.BaseSpeed    += 2;
            Player.BaseStrength += 2;
            Player.BaseVigor    += 2;
            Player.FirstName     = "Urist";
            Player.LastName      = "Litasterar";

            CurrentLevel = (World.Map)Utilities.InterStateResources.Instance.Resources["Game_CurrentLevel"];
            CurrentLevel.Creatures.Add(Player);

            Player.Position = CurrentLevel.GetFirstWalkable();

            Utilities.MessageLog.AddMsg("Get running, " + Player.FirstName + "!");

            TurnsPassed = SkipTurns = 0;

            LevelNumber = 1;

            Utilities.InterStateResources.Instance.Resources.Add("Game_DeathData", new Utilities.DeathData(Player, null, 0, 1));
        }