/// <summary>
        /// Sets up the user interface.
        /// </summary>
        private void SetupUI()
        {
            RecursiveControlSetup(pnlmain);
            switch (page)
            {
            case 0:
                lbtitle.Text        = "Welcome!";
                lbldescription.Text = "This wizard will guide you through the creation of an Appscape Package which will be uploaded to Appscape for all to see. First, let's start with some basics.";
                Page0.BringToFront();
                btndone.Hide();
                btnback.Hide();
                break;

            case 1:
                lbtitle.Text        = "Packaged Files";
                lbldescription.Text = "Now that we have a name and description, it's time to get some files into your package. Namely, an icon and the app itself.";
                btnback.Show();
                Page1.BringToFront();
                break;

            case 2:
                lbtitle.Text        = "Ready!";
                lbldescription.Text = "That's all we need from you. Assuming everything is correct, as soon as you click 'Done!', the package will be generated and uploaded to Appscape quicker than you can say \"Appscape Package Manager is so freakin' awesome.\".";
                btnnext.Hide();
                btndone.Show();
                Page2.BringToFront();
                txtconfirm.Font = new Font(OSInfo.GetMonospaceFont(), 9);
                ConfirmPKG();
                break;
            }
        }
 private void RecursiveControlSetup(Control ctrl)
 {
     ctrl.Font = new Font(OSInfo.GetMonospaceFont(), ctrl.Font.Size);
     try
     {
         var pnl = (Panel)ctrl;
         foreach (Control c in pnl.Controls)
         {
             RecursiveControlSetup(c);
         }
     }
     catch (Exception ex)
     {
     }
 }
示例#3
0
        /// <summary>
        /// Hire a character to attempt to hack a Shiftorium Upgrade.
        /// </summary>
        /// <param name="cid">The character.</param>
        /// <param name="upgrade">The upgrade ID.</param>
        public static void StartHackWithCharacter(int cid, string upgrade)
        {
            if (upgrade == "random")
            {
                StartHackWithCharacter(cid, GetRandomHack());
            }
            else
            {
                var h = Characters[cid];
                var f = new Form();
                f.BackColor = Color.Black;
                f.ForeColor = Color.White;
                f.Font      = new Font(OSInfo.GetMonospaceFont(), 9);
                var l     = new Label();
                int p     = 0;
                int speed = 100000 / h.Speed; //If a hacker has a speed of one, it will take 100,000 milliseconds to move 1% in the hack progress. Divide it by a thousand, you get 10,000 seconds.
                var t     = new Timer();
                t.Interval        = speed;
                f.FormBorderStyle = FormBorderStyle.None;
                f.Show();
                switch (API.CurrentSkin.desktoppanelposition)
                {
                case "Top":
                    f.Location = new Point(5, API.CurrentSkin.desktoppanelheight + 5);
                    break;

                case "Bottom":
                    f.Location = new Point(5, 5);
                    break;
                }

                f.Controls.Add(l);
                l.Show();
                l.TextAlign = ContentAlignment.MiddleCenter;
                f.Height    = 25;
                f.TopMost   = true;
                l.Text      = $"Progress: {p}%";
                l.Dock      = DockStyle.Fill;
                t.Tick     += (object s, EventArgs a) =>
                {
                    if (l.Text != "Hack failed.")
                    {
                        if (p <= 100)
                        {
                            l.Text = $"Progress: {p}%";
                            int fail = new Random().Next(0, h.Skill + h.Speed);
                            if (fail == h.Skill / 2)
                            {
                                l.Text = "Hack failed.";
                            }
                        }
                        else
                        {
                            GiveUpgrade(upgrade);
                            f.Close();
                            t.Stop();
                            IncreaseSkill(cid);
                        }
                    }
                    else
                    {
                        f.Close();
                        t.Stop();
                    }

                    p += 1;
                };
                t.Start();
            }
        }