protected override void Draw(SpriteBatch sb, Game game, float elapsedSeconds)
        {
            Primitives.FillRectangle(Root.Screen, victory ? Color.White : Color.Black);
            if (!victory)
            {
                Primitives.DrawImage(Assets.Black, Root.Screen);
            }
            Rectangle rText    = new Rectangle(Root.ScreenWidth / 2 - 300, Root.ScreenHeight / 2 - 300, 600, 600);
            Rectangle rCaption = new Rectangle(rText.X, rText.Y - 100, rText.Width, 100);
            int       x        = yearOver - 2018;
            int       y        = x * 7;
            string    winText  = @"Congratulations! It is now the year 2040 and the humanity still lives and flourishes, the world's people enjoying a better quality of life than ever before. You are a hero and the agency you lead has been the best defender humankind has ever had. You have faced numerous challenges but you dealt with each of them with professionalism, heroism, kindness and strength of will. The world is forever in your debt.

Thank you for playing the Existential Risk Prevention Authority game. We hope you enjoyed playing it as much as we enjoyed making it. We will be grateful for any feedback - either on the game's GameJolt page, or you may send it to my email at [email protected]";
            string    loseText = @"R.I.P.
H**o sapiens sapiens
-200 000 -- " + yearOver + @"

The apocalypse has come.

" + text + @"

Humans have been ended. Perhaps they realized their fragility only too late, perhaps it was an unfortunate accident of low probability, or perhaps they deserved to be destroyed by their own arrogance. You have fought valiantly but it matters little for the world. Either it lives or it dies. It died.

Thanks to you, the world survived for " + x + @" years since 2018. 
Your efforts have caused an additional " + y + @",000,000,000 human years to be lived by humans around the world.
You can still do better.";

            Primitives.DrawMultiLineText(victory ? winText : loseText, rText, victory? Color.Black : Color.White, FontFamily.Small);
            Primitives.DrawMultiLineText(victory ? "{b}APOCALYPSE AVERTED!{/b}" : "{b}APOCALYPSE!{/b}", rCaption, victory ? Color.Black : Color.White, FontFamily.Big, Primitives.TextAlignment.Left);
            base.Draw(sb, game, elapsedSeconds);
        }
        public void Draw()
        {
            mouseOverItem = null;
            Primitives.DrawAndFillRectangle(rectangle, Color.Brown, Color.Black, 1);
            int y      = rectangle.Y;
            int x      = rectangle.X;
            int width  = rectangle.Width;
            int height = ITEMHEIGHT;

            for (int index = 0; index < Items.Count; index++)
            {
                Rectangle       rectThisItem = new Rectangle(x, y, width, height);
                Color           colorInner   = Color.SandyBrown;
                ContextMenuItem item         = Items[index];
                if (Root.IsMouseOver(rectThisItem))
                {
                    colorInner    = Color.White;
                    mouseOverItem = item;
                    // Tooltip
                    if (item.Tooltip != null)
                    {
                        Tooltip.DrawTooltip(item.OptimumTooltipRectangle, item.Tooltip);
                    }
                }
                Primitives.DrawAndFillRectangle(rectThisItem, colorInner, Color.Black, 1);
                Primitives.DrawImage(item.Icon, new Rectangle(rectThisItem.X + 2, rectThisItem.Y + 2, rectThisItem.Height - 4, rectThisItem.Height - 4));
                Writer.DrawString(item.Name, new Rectangle(rectThisItem.X + rectThisItem.Height + 4, rectThisItem.Y, rectThisItem.Width - rectThisItem.Height - 6, rectThisItem.Height), Color.Black, font, Writer.TextAlignment.Left);
                y += height;
            }
            if (!Root.IsMouseOver(rectangle.Extend(40, 40)))
            {
                this.ScheduledForElimination = true;
            }
        }
        protected override void Draw(SpriteBatch sb, Game game, float elapsedSeconds)
        {
            Primitives.FillRectangle(Root.Screen, Colors.TotalBackground);
            Primitives.DrawImage(Assets.Blue, Root.Screen);
            Primitives.DrawAndFillRectangle(rectLeftBar, Colors.HighlightBack, Colors.Front);
            Primitives.DrawAndFillRectangle(rectRightBar, Colors.HighlightBack, Colors.Front);
            Primitives.DrawAndFillRectangle(rectBottomBar, Colors.HighlightBack, Colors.Front);
            Primitives.DrawMultiLineText("Year " + Session.Year, new Rectangle(rectBottomBar.Right - 500, rectBottomBar.Y, 120, rectBottomBar.Height), Colors.Front, FontFamily.Small, Primitives.TextAlignment.Middle);
            // Right bar
            foreach (var rb in RightBarButtons)
            {
                rb.Draw();
            }
            // Attitude changes
            int y = 180;

            foreach (var att in Session.AttitudeChanges)
            {
                var r = new Rectangle(0, y, 200, 80);
                Primitives.DrawAndFillRectangle(r, att.Up ? Color.LightGreen : Color.Pink, Color.Black);
                Primitives.DrawMultiLineText(att.Up ? "Attitude improves" : "Attitude worsens", r.Extend(-2, -2), Color.Black);
                Primitives.DrawMultiLineText("{b}" + att.Actor + "{/b}", new Rectangle(r.X + 2, r.Y + 30, r.Width, r.Height), Color.Black);
                Primitives.DrawMultiLineText("Now {i}" + att.NewAttitude + "{/i}", new Rectangle(r.X + 2, r.Y + 50, r.Width, r.Height), Color.Black);
                y += 80;
            }
            ActiveWindow?.Draw(sb, rectMiddleWindow, elapsedSeconds);

            base.Draw(sb, game, elapsedSeconds);
        }
Exemple #4
0
        protected override void Draw(SpriteBatch sb, Game game, float elapsedSeconds)
        {
            Primitives.FillRectangle(Root.Screen, Color.LightBlue);
            Primitives.DrawImage(Assets.TextureFromCard(Illustration.MainTitle), new Rectangle(0, 0, Root.ScreenWidth, 400),
                                 null, true, false);
            Writer.DrawString("Welcome to the monastery, commander. Are you ready to serve?",
                              new Rectangle(50, 405, 1000, 140), Color.Black);

            DrawRespondToEmergencyButtons();
            int y = 410;

            /*
             * UX.DrawButton("Enter your monastery",
             *  new Rectangle(Root.ScreenWidth - 450, y, 400, 40),
             *  () => { Root.PushPhase(new MonasteryPhase()); },
             *  "The monastery is your base of operations. In the monastery, you can {b}review{/b} your rescue team and choose {b}new powers{/b} for your paladins.");
             * y += 40;
             * UX.DrawButton("Reset all progress",
             *  new Rectangle(Root.ScreenWidth - 450, y, 400, 40),
             *  () => {    Root.PushPhase(new MessageBoxPhase("You will reset back to level 1 with two starting paladins, as if you just started the game for the first time. Is that okay?",
             *      "Reset all progress?", GuiIcon.Question, MessageBoxButtons.YesNo, (str) =>
             *      {
             *          Treasure.Clear();
             *          Treasure.Instance.Save();
             *      }));
             *  },
             *  "You will reset back to level 1 with two starting paladins, as if you just started the game for the first time.");*/
            y += 40;
            UX.DrawButton("Help",
                          new Rectangle(Root.ScreenWidth - 450, y, 400, 40),
                          () => { Root.PushPhase(new HelpPhase()); },
                          Treasure.Instance.IsFirstLaunch ? "Maybe you should read these instructions before you respond to an emergency..."
                    : "Read about how to become a better commander of your rescue service.");
            y += 40;
            UX.DrawButton("Quit game",
                          new Rectangle(Root.ScreenWidth - 450, y, 400, 40),
                          () =>
            {
                Root.PushPhase(new MessageBoxPhase("Do you really want to quit?",
                                                   "Quit Game", GuiIcon.Question, MessageBoxButtons.YesNo, (str) => { Root.Quit(); }));
            },
                          "Please don't...");
        }
        public void Draw(Rectangle real)
        {
            foreach (var illustration in Illustrations)
            {
                Primitives.DrawImage(Assets.TextureFromCard(illustration), real);
                if (Treasure.Instance.ShowFireMode)
                {
                    Writer.DrawNumberInRectangle(Heat.DescribeSelf(), real.Extend(-4, -4));
                }
                else
                {
                    if (Heat.Burning)
                    {
                        Illustration fireIllus = Illustration.Fire16;
                        float        diff      = Heat.MaximumIntensity - Heat.FireStartAt;
                        if (Heat.HeatCount >= Heat.FireStartAt + diff / 4)
                        {
                            fireIllus = Illustration.Fire20;
                        }

                        if (Heat.HeatCount >= Heat.FireStartAt + diff * 2 / 4)
                        {
                            fireIllus = Illustration.Fire24;
                        }

                        if (Heat.HeatCount >= Heat.FireStartAt + diff * 3 / 4)
                        {
                            fireIllus = Illustration.Fire32;
                        }

                        Primitives.DrawImage(Assets.TextureFromCard(fireIllus), real);
                    }
                    else if (Heat.HeatCount >= 0.5f)
                    {
                        Primitives.DrawImage(Assets.TextureFromCard(Illustration.Fire16), real);
                    }
                }
            }
        }
Exemple #6
0
        protected override void Draw(SpriteBatch sb, Game game, float elapsedSeconds)
        {
            if (Treasure.Instance.TimeDilationFast)
            {
                elapsedSeconds *= 4;
            }

            elapsedSeconds    *= TimeDilation;
            mouseOverTile      = null;
            mouseOverCharacter = null;
            base.Draw(sb, game, elapsedSeconds);
            Primitives.FillRectangle(Root.Screen, Color.Black);
            Rectangle start = ToReal(new Rectangle(0, 0, 1, 1));

            Primitives.DrawRectangle(new Rectangle(start.X - 3, start.Y - 3, Session.MapWidth * TILESIZE + 6, Session.MapHeight * TILESIZE + 6), Color.White, 3);
            for (int x = 0; x < Session.MapWidth; x++)
            {
                for (int y = 0; y < Session.MapHeight; y++)
                {
                    var rectThisTile = new Rectangle(start.X + x * TILESIZE, start.Y + y * TILESIZE, TILESIZE, TILESIZE);
                    if (rectThisTile.Right < 0 || rectThisTile.Bottom < 0 || rectThisTile.X >= Root.ScreenWidth ||
                        rectThisTile.Y >= Root.ScreenHeight)
                    {
                        continue;
                    }
                    Session.Map[x, y].Draw(rectThisTile);
                    if (Root.IsMouseOver(rectThisTile))
                    {
                        mouseOverTile = Session.Map[x, y];
                    }
                }
            }

            foreach (var character in Session.Characters)
            {
                Point     p    = ToReal(character.Position);
                Rectangle rect = new Rectangle(p.X, p.Y, TILESIZE, TILESIZE);

                if (Root.IsMouseOver(rect))
                {
                    if (mouseOverCharacter == null || mouseOverCharacter.IsNPC || mouseOverCharacter.Dead)
                    {
                        mouseOverCharacter = character;
                    }
                }

                if (character.Dead)
                {
                    rect = new Rectangle(rect.X + 8, rect.Y + 8, rect.Width - 16, rect.Height - 16);
                }

                Primitives.DrawImage(Assets.TextureFromCard(character.Illustration), rect, character.Dead ? Color.Red : Color.White);
                if (character.ImmediateActivity != null)
                {
                    Writer.DrawProgressBar(new Rectangle(rect.X, rect.Y - 6, rect.Width, 4), Color.Yellow, character.ImmediateActivity.SecondsProgressed,
                                           character.ImmediateActivity.SecondsToComplete, null);
                }

                if (character == SelectedCharacter)
                {
                    Primitives.DrawRectangle(rect, Color.White);
                }
            }

            if (!Treasure.Instance.CheatMode)
            {
                for (int x = 0; x < Session.MapWidth; x++)
                {
                    for (int y = 0; y < Session.MapHeight; y++)
                    {
                        var rectThisTile = new Rectangle(start.X + x * TILESIZE, start.Y + y * TILESIZE, TILESIZE,
                                                         TILESIZE);
                        if (rectThisTile.Right < 0 || rectThisTile.Bottom < 0 || rectThisTile.X >= Root.ScreenWidth ||
                            rectThisTile.Y >= Root.ScreenHeight)
                        {
                            continue;
                        }

                        Tile tile = Session.Map[x, y];
                        if (tile.Blackened)
                        {
                            Primitives.FillRectangle(rectThisTile, Color.DarkBlue);
                        }
                    }
                }
            }

            for (int x = 0; x < Session.MapWidth; x++)
            {
                for (int y = 0; y < Session.MapHeight; y++)
                {
                    var rectThisTile =
                        new Rectangle(start.X + x * TILESIZE, start.Y + y * TILESIZE, TILESIZE, TILESIZE);
                    if (rectThisTile.Right < 0 || rectThisTile.Bottom < 0 || rectThisTile.X >= Root.ScreenWidth ||
                        rectThisTile.Y >= Root.ScreenHeight)
                    {
                        continue;
                    }
                    Tile tile = Session.Map[x, y];

                    foreach (Overhead overhead in tile.Overheads)
                    {
                        overhead.Draw(rectThisTile);
                    }

                    tile.Overheads.RemoveAll(oh => oh.UpdateAndPossiblyDelete(elapsedSeconds));
                }
            }

            for (int wi = 0; wi < Session.Particles.Count; wi++)
            {
                WaterParticle pp     = Session.Particles[wi];
                Point         asReal = ToReal(pp.Position);
                Primitives.DrawPoint(new Vector2(asReal.X, asReal.Y), Color.Blue, 6);
                pp.Position += pp.Speed * elapsedSeconds;
                pp.TimeLeft -= elapsedSeconds;
                if (pp.TimeLeft <= 0)
                {
                    Session.Particles.RemoveAt(wi);
                    wi--;
                }
            }

            DrawTopBar();
            DrawBottomBar();
            contextMenu?.Draw();
        }
Exemple #7
0
        protected override void Draw(GameTime gameTime)
        {
            Color clrFluttershy = Color.FromNonPremultiplied(248, 247, 152, 255);

            GraphicsDevice.Clear(Color.White);//248,247,152
            Color clrPink         = Color.FromNonPremultiplied(248, 185, 206, 255);
            Color clrButterscotch = Color.FromNonPremultiplied(226, 187, 50, 255);

            spriteBatch.Begin();

            // Console output
            Primitives.DrawAndFillRectangle(rectConsoleTop, clrFluttershy, Color.Black, 2);
            for (int i = 0; i < ConsoleMaxLines; i++)
            {
                int lineID = i + ConsoleOutputCurrentLine;
                if (lineID >= Session.ConsoleTotalLines)
                {
                    break;
                }
                Primitives.DrawSingleLineText(Session.ConsoleOutput[lineID], new Vector2(rectConsoleTopInner.X, rectConsoleTopInner.Y + Library.FontConsoleNormal.LineSpacing * i),
                                              lineID < GreyOutputUntil ? Color.Black.Alpha(50) : Color.Black, null, 1);
            }

            // Inputbox
            Primitives.DrawAndFillRectangle(rectInputLine, clrFluttershy, Color.Black, 2);
            InputTextBox.Draw();

            // Suggestions
            Primitives.DrawAndFillRectangle(rectSuggestions, clrFluttershy, Color.Black, 2);
            List <Command> suggestions = CurrentSuggestions;
            int            lnSpacing   = Library.FontConsoleNormal.LineSpacing + 2;

            maxsuggestioncount = rectSuggestions.Height / lnSpacing;
            if (ChosenSuggestion < 0)
            {
                ChosenSuggestion = maxsuggestioncount - 1;
            }
            if (ChosenSuggestion > maxsuggestioncount - 1)
            {
                ChosenSuggestion = 0;
            }
            for (int i = 0; i < maxsuggestioncount; i++)
            {
                if (suggestions.Count <= i)
                {
                    break;
                }
                Command   c = suggestions[i];
                Rectangle rectSuggestion = new Rectangle(rectSuggestions.X + 3, rectSuggestions.Y + 2 + i * lnSpacing, rectSuggestions.Width - 6, lnSpacing);
                Primitives.DrawSingleLineText(c.TotalString, new Vector2(rectSuggestion.X + 5, rectSuggestion.Y + 1), Color.Black);
                if (ChosenSuggestion == i)
                {
                    Primitives.FillRectangle(rectSuggestion, clrPink);
                    Primitives.DrawSingleLineText(c.TotalString, new Vector2(rectSuggestion.X + 5, rectSuggestion.Y + 1), Color.Black);
                }
            }
            if (maxsuggestioncount < suggestions.Count)
            {
                Primitives.DrawSingleLineText((suggestions.Count - maxsuggestioncount) + " more suggestions are hidden",
                                              new Vector2(rectSuggestions.X + rectSuggestions.Width - 8 - Library.FontConsoleNormal.MeasureString((suggestions.Count - maxsuggestioncount) + " more suggestions are hidden").X,
                                                          rectSuggestions.Y + rectSuggestions.Height - lnSpacing), Color.Black);
            }

            // Fluttershy
            Primitives.DrawAndFillRectangle(rectRecommendedCommands, clrFluttershy, Color.Black, 2);
            Primitives.DrawImage(ImageFluttershy, new Rectangle(rectRecommendedCommands.X + 5, rectRecommendedCommands.Y + 5, rectRecommendedCommands.Width - 10, rectRecommendedCommands.Height - 10),
                                 Color.White, true, true, Color.Transparent);

            Root.Draw(gameTime);
            spriteBatch.End();
            base.Draw(gameTime);
        }