Beispiel #1
0
        protected override void OnLoad()
        {
            _ui.Theme = New <UIDemoTheme>();
            _ui.Controls.Add(_selectFile);
            _ui.Controls.Add(_album);
            _ui.Controls.Add(_artist);
            _ui.Controls.Add(_title);

            _album.AutoSize  = true;
            _artist.AutoSize = true;
            _title.AutoSize  = true;

            _album.TextStyle = Plex.Engine.GameComponents.UI.Themes.TextStyle.Heading3;
            _title.TextStyle = Plex.Engine.GameComponents.UI.Themes.TextStyle.Heading1;

            _selectFile.Text = "Open file";

            _selectFile.Click += (o, a) =>
            {
                var opener = new System.Windows.Forms.OpenFileDialog();
                opener.Filter = "Ogg Vorbis files|*.ogg";
                opener.Title  = "Open Audio File";
                if (opener.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    _player = new AdvancedAudioPlayer(opener.FileName, false);
                    System.Threading.Thread.Sleep(100);
                }
            };

            _ui.Controls.Add(_playProgress);
        }
        /// <inheritdoc/>
        public override void Load(ContentManager Content)
        {
            Logger.Log("Credits Loading NOW");
            _music = new AdvancedAudioPlayer(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content", "Audio", "Cutscene", "Credits" + (_doAlternateCreditsMusic ? "Alt" : "") + ".ogg"), false);
            string creditsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content", "credits.json");
            string json        = File.ReadAllText(creditsPath);

            _creditsFile = JsonConvert.DeserializeObject <CreditCategory[]>(json);
            _peacenet    = Content.Load <Texture2D>("Splash/Peacenet");
        }
        /// <summary>
        /// Creates a new instance of the <see cref="TutorialInstructionEntity"/>.
        /// </summary>
        /// <param name="music">The <see cref="TutorialBgmEntity"/> currently playing music.</param>
        public TutorialInstructionEntity(AdvancedAudioPlayer music)
        {
            if (music == null)
            {
                throw new ArgumentNullException(nameof(music));
            }
            _music = music;

            _tutorialLabel.AutoSize       = true;
            _tutorialDescription.AutoSize = true;
            _tutorialLabel.FontStyle      = TextFontStyle.Header1;

            _tutorialButton.Click += (o, a) =>
            {
                _tutorialStage++;
            };
        }
        /// <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;
            }
        }
Beispiel #5
0
        /// <inheritdoc/>
        public PeacegateSetup(WindowSystem _winsys, AdvancedAudioPlayer tutorial) : base(_winsys)
        {
            _tutorial = tutorial;
            SetWindowStyle(WindowStyle.NoBorder);
            Width  = _winsys.Width;
            Height = _winsys.Height;
            AddChild(_setupTitle);
            AddChild(_setupMode);
            AddChild(_back);
            AddChild(_next);

            _back.Text          = "Back";
            _next.Text          = "Next";
            _setupMode.AutoSize = true;
            _setupMode.Text     = "Introduction";

            _introPanel.AddChild(_introHeader);
            _introPanel.AddChild(_introText);
            _introPanel.AutoSize = true;

            _introHeader.AutoSize  = true;
            _introText.AutoSize    = true;
            _introHeader.FontStyle = Plex.Engine.Themes.TextFontStyle.Header3;

            _introHeader.Text = "Welcome to Peacegate OS.";
            _introText.Text   = @"Peacegate OS is the gateway to the Peacenet. You will use it to run programs, interact with other members of the network, and perform other tasks. It is your primary user interface.

We will guide you through how to use Peacegate OS and the Peacegate Desktop, but first we must set some things up for first use. This installer program will guide you through the setup process and prepare your new environment for you.

Click 'Next' to get started.";

            _back.Click += (o, a) =>
            {
                if (_animState == 6)
                {
                    return;
                }
                _uiState--;
                _animState = 6;
            };
            _next.Click += (o, a) =>
            {
                if (_animState == 6)
                {
                    return;
                }
                _uiState++;
                _animState = 6;
            };

            var wall1 = new PictureBox();
            var wall2 = new PictureBox();

            wall1.Texture = _plexgate.Content.Load <Texture2D>("Desktop/DesktopBackgroundImage");
            wall2.Texture = _plexgate.Content.Load <Texture2D>("Desktop/DesktopBackgroundImage2");
            _wallpapers.AddChild(wall1);
            _wallpapers.AddChild(wall2);

            _desktopWallpaperPanel.AddChild(_desktopHeader);
            _desktopWallpaperPanel.AddChild(_desktopText);
            _desktopWallpaperPanel.AddChild(_wallpapers);

            _desktopHeader.AutoSize         = true;
            _desktopText.AutoSize           = true;
            _desktopWallpaperPanel.AutoSize = true;

            _desktopHeader.FontStyle = Plex.Engine.Themes.TextFontStyle.Header3;
            _desktopHeader.Text      = "Choose a wallpaper";
            _desktopText.Text        = "A wallpaper is displayed in the background of your desktop. You will see it when there are no windows open or anywhere where a window is not being displayed. Right now you only have a small selection of wallpapers, but you will unlock more as you explore the Peacenet.";

            _save.SetValue("desktop.wallpaper", "DesktopBackgroundImage2");

            _wallpapers.SelectedTextureChanged += (texture) =>
            {
                _loadedWallpaper = texture;
                string name = texture.Name.Remove(0, 8);
                _save.SetValue("desktop.wallpaper", name);
                Invalidate(true);
            };

            _accentHeader.FontStyle = Plex.Engine.Themes.TextFontStyle.Header3;
            _accentHeader.AutoSize  = true;
            _accentHeader.Text      = "Choose an accent color";
            _accentText.Text        = "An accent color defines the general color of your Peacegate user interface. The accent color defines the color of buttons, window borders, the Desktop Panels, and other UI elements. You can change this later in your Terminal.";
            _accentText.AutoSize    = true;
            _accentPanel.AutoSize   = true;
            _accentColors.Layout    = ListViewLayout.List;

            var currentAccent = _save.GetValue("theme.accent", PeacenetAccentColor.Blueberry);

            foreach (var accent in Enum.GetNames(typeof(PeacenetAccentColor)))
            {
                var lvitem = new ListViewItem();
                lvitem.Value = accent.ToString();
                lvitem.Tag   = (PeacenetAccentColor)Enum.Parse(typeof(PeacenetAccentColor), accent);
                _accentColors.AddItem(lvitem);
            }
            _accentColors.SelectedIndex         = Array.IndexOf(_accentColors.Items, _accentColors.Items.FirstOrDefault(x => (PeacenetAccentColor)x.Tag == currentAccent));
            _accentColors.SelectedIndexChanged += (o, a) =>
            {
                if (_accentColors.SelectedItem == null)
                {
                    return;
                }
                _save.SetValue <PeacenetAccentColor>("theme.accent", (PeacenetAccentColor)_accentColors.SelectedItem.Tag);
                _pn.AccentColor = (PeacenetAccentColor)_accentColors.SelectedItem.Tag;
            };
            _accentPanel.AddChild(_accentColors);
            _accentPanel.AddChild(_accentHeader);
            _accentPanel.AddChild(_accentText);

            _completeHead.Text      = "You have successfully completed the Peacegate OS Setup.";
            _completeText.Text      = @"That's all the information we need from you for now. Feel free to go back and change what you have set.

You will also be able to change your desktop wallpaper, accent color and other settings at any time in the Peacegate Settings program.

Press 'Finish' to exit Setup and continue system boot. When the system starts up again, you will have to complete the Peacegate GUI Crash Course. Good luck!";
            _completeHead.AutoSize  = true;
            _completeHead.FontStyle = Plex.Engine.Themes.TextFontStyle.Header3;
            _completeText.AutoSize  = true;
            _setupComplete.AddChild(_completeHead);
            _setupComplete.AddChild(_completeText);

            _setupTitle.Text = "Peacegate OS Setup";

            AddChild(_mainView);
        }