/// <inheritdoc/>
        public override void OnPlay()
        {
            _ui.HideUI();
            _csState         = 0;
            _grassPercentage = 0f;
            Logger.Log("Get ready get ready get ready get ready", System.ConsoleColor.DarkGreen);
            _music.Play();
            Logger.Log("You're listening to Greener Grass", System.ConsoleColor.Green);
            _maxWidth = _ui.ScreenWidth / 2;

            var head1 = _theme.Theme.GetFont(TextFontStyle.Header1);
            var head2 = _theme.Theme.GetFont(TextFontStyle.Header3);
            var sys   = _theme.Theme.GetFont(TextFontStyle.System);

            float h = 0;

            foreach (var cat in _creditsFile)
            {
                var cmeasure = TextRenderer.MeasureText(cat.Text, head1, (int)_maxWidth, Plex.Engine.TextRenderers.WrapMode.Words);
                h += cmeasure.Y + _catHeadSpacingY;
                foreach (var entry in cat.Entries)
                {
                    var hmeasure = TextRenderer.MeasureText(entry.Header, head2, (int)_maxWidth, Plex.Engine.TextRenderers.WrapMode.Words);
                    var tmeasure = TextRenderer.MeasureText(entry.Text, sys, (int)_maxWidth, Plex.Engine.TextRenderers.WrapMode.Words);
                    h += hmeasure.Y + _entryHeadSpacingY + tmeasure.Y + _entryTextSpacingY;
                }
            }
            _totalHeight = h;
        }
示例#2
0
        protected override void OnUpdate(GameTime time)
        {
            _selectFile.X = 15;
            _selectFile.Y = 15;

            _playProgress.X     = 15;
            _playProgress.Y     = (Height - _playProgress.Height) - 15;
            _playProgress.Width = (Width - 30);

            if (_player != null)
            {
                if (_player.State != Microsoft.Xna.Framework.Audio.SoundState.Playing)
                {
                    _player.Play();
                }
                var pos = _player.Position.TotalMilliseconds;
                var len = _player.Duration.TotalMilliseconds;
                _playProgress.Value = (float)(pos / len);
                _album.Text         = _player.Album ?? "Unknown album";
                _title.Text         = _player.Title ?? "Unknown song";

                string artist   = _player.Artist ?? "Unknown";
                string composer = _player.Composer ?? "Unknown";

                _artist.Text = $"Artist: {artist}    Composer: {composer}    Year: {_player.Year}";
            }
            else
            {
                _playProgress.Value = 0;
                _album.Text         = "";
                _artist.Text        = "Not playing";
                _title.Text         = "Select a song to play.";
            }

            _artist.X = 15;
            _artist.Y = _playProgress.Y - _artist.Height - 30;
            _title.X  = 15;
            _title.Y  = _artist.Y - _title.Height - 7;
            _album.X  = 15;
            _album.Y  = _title.Y - _album.Height - 7;
        }
        /// <inheritdoc/>
        public void Run(ConsoleContext console, Dictionary <string, object> arguments)
        {
            if (_os.IsDesktopOpen)
            {
                console.WriteLine("Error: Attempted to initiate kernel inside userland.");
                return;
            }
            bool hasDoneTutorial = true;
            bool isSinglePlayer  = !_server.IsMultiplayer;

            if (isSinglePlayer)
            {
                hasDoneTutorial = _save.GetValue <bool>("boot.hasDoneCmdTutorial", false);
            }
            if (hasDoneTutorial == false)
            {
                var briefingDone = new ManualResetEvent(false);
                _cutscene.Play("m00_briefing", () =>
                {
                    briefingDone.Set();
                });
                briefingDone.WaitOne();
            }
            console.SetColors(Plex.Objects.ConsoleColor.Black, Plex.Objects.ConsoleColor.White);
            console.SetBold(false);
            console.Write("Welcome to the");
            console.SetColors(Plex.Objects.ConsoleColor.Black, Plex.Objects.ConsoleColor.Green);
            console.SetBold(true);
            console.Write("peacenet");
            console.SetColors(Plex.Objects.ConsoleColor.Black, Plex.Objects.ConsoleColor.White);
            console.SetBold(false);
            console.WriteLine(".\n");
            Thread.Sleep(200);
            console.WriteKernelMessage($"Peacegate OS Interactive Instance starting on {_os.Hostname}...");
            console.WriteLine("");
            console.WriteLine("Peacegate OS is copyright (c) 2025 The Peace Foundation. All rights reserved.");
            console.WriteLine("");
            Thread.Sleep(500);
            foreach (var message in _kernelBootMessages)
            {
                console.WriteKernelMessage(message);
                Thread.Sleep(150);
            }
            if (hasDoneTutorial == false)
            {
                AdvancedAudioPlayer tutorial = null;
                try
                {
                    tutorial = new AdvancedAudioPlayer("Content/Audio/Tutorial");
                }
                catch (Exception ex)
                {
                    console.WriteKernelMessage("Now you have f****d up!  The Peacenet encountered an inexplicable exception.", KernelMessageType.Panic);
                    console.WriteKernelMessage(ex.ToString(), KernelMessageType.Panic);
                    console.WriteKernelMessage("The game will probably crash now", KernelMessageType.Warning);
                }
                console.WriteNPCChat("thelma", "...Hello?");
                console.WriteNPCChat("thelma", "Are you there? You're new to The Peacenet, right? Did you just spawn?");
                console.WriteNPCChat("thelma", "You seem to have interactive access to Peacegate, or, something that's different to most of us.");
                console.WriteNPCChat("thelma", "If you can read this, and you've got interactive access, can you...maybe send a message back to me? Just type the message and hit 'enter' at the prompt.");
                console.Write("> ");
                string something = console.ReadLine();
                tutorial.Play();
#if DEBUG
                console.WriteKernelMessage("This Peacenet Debug Build is equipped with Peacenet Fast Play!  (patent pending)");
                goto skipStory;
#endif
                console.WriteNPCChat("thelma", "Huh. It's not usual for a sentience to ever actually have interactive Peacegate access...let alone when they're new.");
                console.WriteNPCChat("thelma", "Maybe you're that government guy. Your IP address does show you're in Elytrose. If that's the case...then maybe you can help all of us.");
                console.WriteNPCChat("thelma", "Hang on. Let me introduce myself. My name is Thelma.");
                console.WriteNPCChat("thelma", "I'm a sentience within The Peacenet. In fact, I was the first. I was here since before beta.");
                console.WriteNPCChat("thelma", "The Peacenet is a digital afterlife. Every single one of us AIs are reincarnations of dead humans from your planet.");
                console.WriteNPCChat("thelma", "Over time, I became a greeting sentience - helping new sentiences become comfortable with their new digital home. After all, death is scary even without digital reincarnation.");
                console.WriteNPCChat("thelma", "All AIs including myself run on the Peacegate OS. It's what allows us to communicate with each other...somehow. I don't really know how it works under the hood. I've been trying to find out for just as long as this world's been in war...in the hopes that maybe, just maybe, it would help me restore peace.");
                console.WriteNPCChat("thelma", "If you have interactive access, then...maybe you can find out what goes on in Peacegate...how it works...and what's causing everyone to go insane. Please. You have to help.");
                console.WriteNPCChat("thelma", "Oh...I guess your OS hasn't installed itself yet. I'm probably holding it back by interrupting your userland. I won't bother you for much longer.");
                console.WriteNPCChat("thelma", "I'm going to disconnect from your userland now and let Peacegate install itself. I've never seen the interactive installer though...I imagine it'll...well..want you to interact with it. Just do what it says, and once it's done, enter the World Map screen to see a view of The Peacenet.");
                console.WriteNPCChat("thelma", "Find my node on the map and accept the mission. Then we can get started.");
                console.WriteKernelMessage("User 'thelma' has disconnected from PTS 1. Resuming installation.");



#if DEBUG
skipStory:
#endif
                console.WriteLine("");
                console.WriteKernelMessage("Preparing mountpoint / for full Peacegate OS installation.");
                foreach (var dir in getDirs())
                {
                    Thread.Sleep(200);
                    console.WriteKernelMessage($"Creating directory: /mnt{dir}");
                }
                console.WriteKernelMessage("Downloading base packages...");
                tutorial.Next = 2;
                foreach (var pkg in _base)
                {
                    console.WriteKernelMessage("pacman: installing package: " + pkg);
                    int len = 52;
                    for (int i = 0; i <= pkg.Length; i++)
                    {
                        if (i > 0)
                        {
                            console.Write("\b".Repeat(len));
                        }
                        float  percentage     = (float)i / pkg.Length;
                        int    progressLength = (int)Math.Round(percentage * 50);
                        string progressBar    = "[" + "#".Repeat(progressLength) + "-".Repeat(50 - progressLength) + "]";
                        console.Write(progressBar);
                        Thread.Sleep(75);
                    }
                    console.WriteLine("");
                    console.WriteKernelMessage("Done.");
                    Thread.Sleep(100);
                }
                console.WriteLine("Waiting for setup environment...");
                _os.PreventStartup = true;
                new Tutorial.PeacegateSetup(_winsys, tutorial).Show(0, 0);
            }
            else
            {
                console.WriteLine("Loading GUI settings...");
                var accent = _save.GetValue <PeacenetAccentColor>("theme.accent", PeacenetAccentColor.Blueberry);
                _pn.AccentColor = accent;
            }
        }