Beispiel #1
0
 public ShiftoriumUpgrade GetUpgradeFromName(string upg)
 {
     foreach (var upgrade in Shiftorium.GetDefaults())
     {
         if (upgrade.Name == upg)
         {
             return(upgrade);
         }
     }
     return(null);
 }
Beispiel #2
0
        public ShiftoriumUpgrade[] GetAllInCategory()
        {
            var upgrades = Shiftorium.GetDefaults().Where(x => (x.Dependencies == null) ? false : x.Dependencies.Contains("appscape_"));

            if (upgrades.Count() == 0)
            {
                return(new ShiftoriumUpgrade[0]);
            }

            if (Category == "All")
            {
                return(upgrades.ToArray());
            }
            else
            {
                return(upgrades.Where(x => Localization.Parse(x.Category) == Localization.Parse(Category)).ToArray());
            }
        }
Beispiel #3
0
        protected override void Run()
        {
            if (Shiftorium.UpgradeInstalled(Contents.Upgrade))
            {
                Infobox.Show("Installation failed.", "This package has already been installed.");
                return;
            }

            if (!string.IsNullOrWhiteSpace(Contents.Dependencies))
            {
                SetStatus("Checking Shiftorium for dependencies...");
                string[] dependencies = Contents.Dependencies.Split(';');
                for (int i = 0; i < dependencies.Length; i++)
                {
                    if (Shiftorium.UpgradeInstalled(dependencies[i]))
                    {
                        double percent = (i / dependencies.Length) * 100;
                        SetProgress((int)percent);
                    }
                    else
                    {
                        var upg = Shiftorium.GetDefaults().FirstOrDefault(x => x.Id == dependencies[i]);
                        Infobox.Show("Missing dependency!", $"You are missing the following Shiftorium Upgrade: {upg.Name}\r\n\r\nThe installation cannot continue.");
                        return;
                    }
                    Thread.Sleep(250);
                }
            }
            SetStatus("Installing...");
            SetProgress(0);
            for (int i = 0; i < 100; i++)
            {
                SetProgress(i);
                Thread.Sleep(50);
            }
            Desktop.InvokeOnWorkerThread(() =>
            {
                Shiftorium.Buy(Contents.Upgrade, 0);
                Infobox.Show("Install complete.", "The installation has completed successfully.");
                SaveSystem.SaveGame();
            });
        }
Beispiel #4
0
        public string[] GetCategories()
        {
            var           upgrades = Shiftorium.GetDefaults().Where(x => (x.Dependencies == null) ? false : x.Dependencies.Contains("appscape_"));
            List <string> cats     = new List <string>();

            cats.Add("All");
            try
            {
                if (upgrades.Count() > 0)
                {
                    foreach (var upg in upgrades)
                    {
                        if (!cats.Contains(Localization.Parse(upg.Category)))
                        {
                            cats.Add(Localization.Parse(upg.Category));
                        }
                    }
                }
            }
            catch { }
            return(cats.ToArray());
        }
Beispiel #5
0
        public void SetupSystemStatus()
        {
            int    scripts    = 0;
            string legionname = "";

            foreach (var lgn in SaveSystem.CurrentSave.CurrentLegions)
            {
                legionname += Environment.NewLine + " - " + lgn;
            }

            you_systemstatus.BringToFront();

            lblsysstatus.Text = $@"Username: {SaveSystem.CurrentSave.Username}
System name: {SaveSystem.CurrentSave.SystemName}

Codepoints: {SaveSystem.CurrentSave.Codepoints}
Upgrades: {SaveSystem.CurrentSave.CountUpgrades()}/{Shiftorium.GetDefaults().Count}

System version: {SaveSystem.CurrentSave.MajorVersion}.{SaveSystem.CurrentSave.MinorVersion}.{SaveSystem.CurrentSave.Revision}

Shared scripts: {scripts}

Current legions: {legionname}";
        }
Beispiel #6
0
        public void StartOOBESlideshow()
        {
            var t = new System.Timers.Timer(10000);

            int currentslide = 0;

            t.Elapsed += (o, a) =>
            {
                Dispatcher.Invoke(() =>
                {
                    switch (currentslide)
                    {
                    case 0:
                        oobehead.Text = "Introduction";
                        oobedesc.Text = @"Welcome to ShiftOS.

You have successfully registered to take part in the testing and development of ShiftOS. We are currently installing the system's core components.

This may take a while. There is a progress indicator at the bottom of this window. You can also see a log of everything that's happening in the terminal on the right.

While you wait, we'll take the time to tell you about what you'll be doing.";
                        break;

                    case 1:
                        oobehead.Text = "About the project";
                        oobedesc.Text = @"You may wanna know what exactly we're working on here. Basically, we want to make ShiftOS one of the most powerful, customizable, user-friendly operating systems in the world. Not just ONE of the most, we want to make it THE most.

We'll do whatever we can to do this - and having you onboard is just the beginning. At ShiftOS, we strive to make things user-friendly, and versatile. We want to put a barebones operating system on your computer and see what you do with it, what you make, so we can use that data to make ShiftOS awesome.";
                        break;

                    case 2:
                        oobehead.Text = "The Humble Beginnings";
                        oobedesc.Text = @"It may look complicated but we're really just wasting your time installing a blank desktop with a terminal. Seriously, that's all ShiftOS is right now. It's not about that, though.
                            
It's about what you do in this blank desktop with just a terminal. We want to see what you make of it. It's a build-your-own-system type deal - one of the best in the world, in fact.";
                        break;

                    case 3:
                        oobehead.Text = "Stay connected.";
                        oobedesc.Text = @"With ShiftOS, you're always connected to something. Like literally. Even if you turn off your home router, unplug the computer or smash it you're still connected to ShiftOS's multi-user domain. There's just no escape.
                            
Uhhhhhhh whoops.... I meant to make that not sound fishy.";

                        break;

                    case 4:
                        oobehead.Text = "Now it's too late to go back.";
                        oobedesc.Text = @"I guess you weren't paying attention to that terminal seeings as you're reading this. Now, it's too late for you to go back to your old system. You're enrolled as a tester for the ShiftOS project and all your files have been deleted.

There's no turning back. And now that you can't leave.... I don't have to keep inticing you.";
                        break;

                    case 5:
                        oobehead.Text = "Thanks for not choosing ShiftOS!";
                        oobedesc.Text = @"By now it's definitely too late. We really value our users to the point where they can never uninstall ShiftOS. ShiftOS will haunt you in your sleep and take over your entire network. It will spread to all your friends, your family, your coworkers and even other worlds.
                            
We hope you enjoy your.... eternal stay.";
                        break;
                    }
                });

                if (currentslide == 5)
                {
                    currentslide = 0;
                }
                else
                {
                    currentslide++;
                }
            };

            t.Start();

            var th = new System.Threading.Thread(new ThreadStart(() =>
            {
                Console.WriteLine("Loading useless out-of-box-experience stuff...");
                Thread.Sleep(10000);
                Console.WriteLine("Introducing ShiftOS to the user...");
                Thread.Sleep(1000);
                Console.Write("Formatting drive 0:/ with ShiftFS 2.0...");
                Thread.Sleep(100);
                Console.WriteLine(" done");
                Thread.Sleep(500);
                Console.WriteLine("Pirating programming music...");
                Thread.Sleep(250);
                Console.Write("Deafening the user... ");
                for (int i = 0; i < 100; i++)
                {
                    var th2 = new Thread(new ThreadStart(() =>
                    {
                        Console.Beep(1024, 1000);
                    }));
                    th2.Start();
                }
                Console.WriteLine("failed, whatever");

                Thread.Sleep(750);
                Console.WriteLine("Writing directories to the system...");
                foreach (var path in Paths.GetAllWithoutKey())
                {
                    Thread.Sleep(50);
                    if (path.StartsWith("0") && Utils.DirectoryExists(path))
                    {
                        Console.WriteLine(path);
                    }
                }
                Thread.Sleep(500);
                Console.WriteLine("Procrastinating...");
                Thread.Sleep(2000);
                Console.WriteLine("Making it look like we're doing things...");

                var rand = new Random();

                for (int i = 0; i < 100; i++)
                {
                    try
                    {
                        Thread.Sleep(1000 / i);
                        Console.WriteLine(rand.Next(int.MaxValue - 1000000000, Int32.MaxValue));
                    }
                    catch (DivideByZeroException e)
                    {
                        Console.WriteLine($"Attempting to divide by zero.... but getting {e.GetType().Name}s...");
                        Thread.Sleep(1000);
                    }
                }
                Console.WriteLine("Still procrastinating...");

                Thread.Sleep(5000);
                Console.Write("Enabling all the upgrades for free...");
                foreach (var upg in Shiftorium.GetDefaults())
                {
                    Shiftorium.Silent = true;
                    Thread.Sleep(100);
                    Dispatcher.Invoke(() =>
                    {
                        Shiftorium.Buy(upg.ID, 0);
                    });
                }
                Shiftorium.Silent = false;
                foreach (var upg in Shiftorium.GetDefaults())
                {
                    SaveSystem.CurrentSave.Upgrades[upg.ID] = false;
                }
                Console.WriteLine(" ...and disabling them because we can.");
                Dispatcher.Invoke(() => Shiftorium.InvokeUpgradeInstalled());

                Console.WriteLine("Showing more useless stuff...");

                while (currentslide != 0)
                {
                }
                Console.WriteLine("Done installing.");

                SaveSystem.CurrentSave = this.MySave;
                SaveSystem.CurrentSave.StoryPosition = 5;
                SaveSystem.SaveGame();
            }));

            th.IsBackground = true;
            th.Start();
        }
Beispiel #7
0
 public void OnUpgrade()
 {
     pgupgrades.Maximum = Shiftorium.GetDefaults().Count;
     pgupgrades.Value   = SaveSystem.CurrentSave.CountUpgrades();
     lbstatus.Text      = $"You have unlocked {pgupgrades.Value} upgrades out of the {pgupgrades.Maximum} available.";
 }
Beispiel #8
0
 public dynamic[] getAll()
 {
     return(Shiftorium.GetDefaults().ToArray());
 }
Beispiel #9
0
        public void ViewMoreInfo(ShiftoriumUpgrade upg)
        {
            lbtitle.Text = upg.Name;
            pnlappslist.Controls.Clear();

            var cp_display = new Panel();

            cp_display.Height = 30;
            cp_display.Dock   = DockStyle.Bottom;
            pnlappslist.Controls.Add(cp_display);
            cp_display.Show();

            var cp_value = new Label();

            if (Shiftorium.UpgradeInstalled(upg.ID))
            {
                cp_value.Text = "Already Purchased.";
            }
            else
            {
                cp_value.Text = $"{upg.Cost} CP";
            }
            cp_value.AutoSize = true;
            cp_value.Top      = (cp_display.Height - cp_value.Height) / 2;
            cp_value.Left     = 5;
            cp_display.Controls.Add(cp_value);
            cp_value.Show();


            if (cp_value.Text != "Already Purchased.")
            {
                var more_info = new Button();
                more_info.Text   = "Buy";
                more_info.Click += (o, a) =>
                {
                    //Detect if dependencies are installed.
                    if (DependenciesInstalled(upg))
                    {
                        //Detect sufficient codepoints
                        if (SaveSystem.CurrentSave.Codepoints >= upg.Cost)
                        {
                            Infobox.PromptYesNo("Confirm Purchase", "Do you want to purchase " + upg.Name + " from Appscape for " + upg.Cost.ToString() + " Codepoints?", (result) =>
                            {
                                if (result == true)
                                {
                                    SaveSystem.CurrentSave.Codepoints -= upg.Cost;
                                    foreach (var type in ReflectMan.Types)
                                    {
                                        var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is AppscapeEntryAttribute) as AppscapeEntryAttribute;
                                        if (attrib != null)
                                        {
                                            if (attrib.Name == upg.Name)
                                            {
                                                var installer    = new Applications.Installer();
                                                var installation = new AppscapeInstallation(upg.Name, attrib.DownloadSize, upg.ID);
                                                AppearanceManager.SetupWindow(installer);
                                                installer.InitiateInstall(installation);
                                                return;
                                            }
                                        }
                                    }
                                }
                            });
                        }
                        else
                        {
                            Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to buy this package.");
                        }
                    }
                    else
                    {
                        Infobox.Show("Missing dependencies", "You are missing some Shiftorium upgrades that this package requires. Please upgrade your system and try again!");
                    }
                };
                more_info.AutoSize     = false;
                more_info.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                more_info.Top          = (cp_display.Height - more_info.Height) / 2;
                more_info.Left         = cp_display.Width - more_info.Width - 5;
                cp_display.Controls.Add(more_info);
                more_info.Show();
                ControlManager.SetupControls(pnlappslist);
            }

            var desc = new Label();

            desc.Text     = upg.Description;
            desc.AutoSize = false;
            desc.Dock     = DockStyle.Fill;
            pnlappslist.Controls.Add(desc);
            desc.Show();
            desc.BringToFront();

            desc.Text += Environment.NewLine + Environment.NewLine + "Dependencies:" + Environment.NewLine;
            string[] deplist = upg.Dependencies.Split(';');
            if (deplist.Length > 1)
            {
                for (int i = 1; i < deplist.Length; i++)
                {
                    ShiftoriumUpgrade dep = Shiftorium.GetDefaults().FirstOrDefault(x => x.ID == deplist[i]);
                    if (dep != null)
                    {
                        desc.Text += $" - {dep.Name}{Environment.NewLine}";
                    }
                }
            }
            else
            {
                desc.Text += " - No dependencies.";
            }
        }
Beispiel #10
0
        private void StartGame()
        {
            guessedCharacters  = "";
            lives              = 7;
            comboBox1.Visible  = false;
            tbguess.Visible    = true;
            lbllives.Visible   = true;
            lblword.Visible    = true;
            btnrestart.Visible = false;

            bool isShiftOS      = comboBox1.SelectedItem.ToString().ToLower() == "shiftos";
            bool isContributors = comboBox1.SelectedItem.ToString().ToLower() == "contributors";
            bool isOSes         = comboBox1.SelectedItem.ToString().ToLower() == "operating systems";


            var wordlist = new List <string>();

            if (isOSes)
            {
                foreach (var w in osWordlist)
                {
                    if (!wordlist.Contains(w.ToLower()))
                    {
                        wordlist.Add(w.ToLower());
                    }
                }
            }
            if (isShiftOS)
            {
                foreach (var w in shiftWordlist)
                {
                    if (!wordlist.Contains(w.ToLower()))
                    {
                        wordlist.Add(w.ToLower());
                    }
                }
            }
            else if (isContributors)
            {
                foreach (var w in contributorsWordlist)
                {
                    if (!wordlist.Contains(w.ToLower()))
                    {
                        wordlist.Add(w.ToLower());
                    }
                }
            }
            if (isShiftOS)
            {
                //This can diversify the amount of ShiftOS-related words in the game.
                foreach (var upg in Shiftorium.GetDefaults())
                {
                    foreach (var w in upg.Name.Split(' '))
                    {
                        if (!wordlist.Contains(w.ToLower()))
                        {
                            wordlist.Add(w.ToLower());
                        }
                    }
                }
            }
            word = wordlist[rng.Next(wordlist.Count)];
            while (word == lastword)
            {
                word = wordlist[rng.Next(wordlist.Count)];
            }
            lastword      = word; //to make the game not choose the same word twice or more in a row
            lbllives.Text = "You have 7 lives left!";
            lblword.Text  = "";
            for (int i = 0; i < word.Length; i++)
            {
                lblword.Text = lblword.Text + "_ ";
            }
        }