Example #1
0
        public MPLoadScreen()
            : base(null, Rectangle.Empty)
        {
            int userCount = Game1.GetInstance().multiplayerGame.GetUserCount();
            int panelHeight = (((itemHeight * 2) + (itemPadding * 2) + userPadding) * userCount) + 40;
            progressBars = new XNAProgressBar[userCount];
            loadingWhatLabels = new XNALabel[userCount];

            this.bounds = new Rectangle((Game1.GetInstance().graphics.PreferredBackBufferWidth / 2) - 200,
            (Game1.GetInstance().graphics.PreferredBackBufferHeight / 2) - (panelHeight / 2),
            400, panelHeight);

            for (int i = 0; i < userCount; i++)
            {
                progressBars[i] = new XNAProgressBar(this,
                    new Rectangle(20, (i * itemHeight) + (i * itemPadding) + ((i + 1) * userPadding), this.bounds.Width - 40, itemHeight),
                    100);
                progressBars[i].progressDisplayLabel.font = MenuManager.BUTTON_FONT;
                progressBars[i].progressDisplayLabel.fontColor = Color.White;
                progressBars[i].currentValue = 0;
                progressBars[i].maxValue = 100;

                loadingWhatLabels[i] = new XNALabel(this,
                    new Rectangle(20, ((i + 1) * itemHeight) + ((i + 1) * itemPadding) + ((i + 1) * userPadding),
                        this.bounds.Width - 40, itemHeight), "Startup..");
                loadingWhatLabels[i].textAlign = XNALabel.TextAlign.CENTER;
                loadingWhatLabels[i].border = null;
            }

            loadingLabel = new XNALabel(this, new Rectangle(20, this.bounds.Height - 30, this.bounds.Width - 40, itemHeight), "Loading..");
            loadingLabel.textAlign = XNALabel.TextAlign.CENTER;
            loadingLabel.border = null;
        }
Example #2
0
        public SPLoadScreen(Rectangle bounds)
            : base(null, bounds)
        {
            progressBar = new XNAProgressBar(this,
                new Rectangle(20, 30, this.bounds.Width - 40, 20),
                100);
            progressBar.progressDisplayLabel.font = MenuManager.BUTTON_FONT;
            progressBar.progressDisplayLabel.fontColor = Color.White;

            loadingWhatLabel = new XNALabel(this, new Rectangle(20, 80, this.bounds.Width - 40, 30), "Startup..");
            loadingWhatLabel.textAlign = XNALabel.TextAlign.CENTER;
            loadingWhatLabel.border = null;

            loadingLabel = new XNALabel(this, new Rectangle(20, this.bounds.Height - 30, this.bounds.Width - 40, 20), "Loading..");
            loadingLabel.textAlign = XNALabel.TextAlign.CENTER;
            loadingLabel.border = null;
        }
        public override void Initialize()
        {
            Name              = "UpdateWindow";
            ClientRectangle   = new Rectangle(0, 0, 446, 270);
            BackgroundTexture = AssetLoader.LoadTexture("updaterbg.png");

            lblDescription                 = new XNALabel(WindowManager);
            lblDescription.Text            = string.Empty;
            lblDescription.ClientRectangle = new Rectangle(12, 9, 0, 0);
            lblDescription.Name            = "lblDescription";

            var lblCurrentFileProgressPercentage = new XNALabel(WindowManager);

            lblCurrentFileProgressPercentage.Text            = "Progress percentage of current file:";
            lblCurrentFileProgressPercentage.ClientRectangle = new Rectangle(12, 90, 0, 0);
            lblCurrentFileProgressPercentage.Name            = "lblCurrentFileProgressPercentage";

            lblCurrentFileProgressPercentageValue                 = new XNALabel(WindowManager);
            lblCurrentFileProgressPercentageValue.Text            = "0%";
            lblCurrentFileProgressPercentageValue.ClientRectangle = new Rectangle(409, lblCurrentFileProgressPercentage.ClientRectangle.Y, 0, 0);
            lblCurrentFileProgressPercentageValue.Name            = "lblCurrentFileProgressPercentageValue";

            prgCurrentFile                         = new XNAProgressBar(WindowManager);
            prgCurrentFile.Name                    = "prgCurrentFile";
            prgCurrentFile.Maximum                 = 100;
            prgCurrentFile.ClientRectangle         = new Rectangle(12, 110, 422, 30);
            prgCurrentFile.BorderColor             = UISettings.WindowBorderColor;
            prgCurrentFile.SmoothForwardTransition = true;
            prgCurrentFile.SmoothTransitionRate    = 10;

            lblCurrentFile                 = new XNALabel(WindowManager);
            lblCurrentFile.Name            = "lblCurrentFile";
            lblCurrentFile.ClientRectangle = new Rectangle(12, 142, 0, 0);

            var lblTotalProgressPercentage = new XNALabel(WindowManager);

            lblTotalProgressPercentage.Text            = "Total progress percentage:";
            lblTotalProgressPercentage.ClientRectangle = new Rectangle(12, 170, 0, 0);
            lblTotalProgressPercentage.Name            = "lblTotalProgressPercentage";

            lblTotalProgressPercentageValue                 = new XNALabel(WindowManager);
            lblTotalProgressPercentageValue.Text            = "0%";
            lblTotalProgressPercentageValue.ClientRectangle = new Rectangle(409, lblTotalProgressPercentage.ClientRectangle.Y, 0, 0);
            lblTotalProgressPercentageValue.Name            = "lblTotalProgressPercentageValue";

            prgTotal                 = new XNAProgressBar(WindowManager);
            prgTotal.Name            = "prgTotal";
            prgTotal.Maximum         = 100;
            prgTotal.ClientRectangle = new Rectangle(12, 190, prgCurrentFile.ClientRectangle.Width, prgCurrentFile.ClientRectangle.Height);
            prgTotal.BorderColor     = UISettings.WindowBorderColor;

            lblUpdaterStatus                 = new XNALabel(WindowManager);
            lblUpdaterStatus.Name            = "lblUpdaterStatus";
            lblUpdaterStatus.Text            = "Preparing...";
            lblUpdaterStatus.ClientRectangle = new Rectangle(12, 240, 0, 0);

            var btnCancel = new XNAClientButton(WindowManager);

            btnCancel.ClientRectangle = new Rectangle(301, 240, 133, 23);
            btnCancel.Text            = "Cancel";
            btnCancel.LeftClick      += BtnCancel_LeftClick;

            AddChild(lblDescription);
            AddChild(lblCurrentFileProgressPercentage);
            AddChild(lblCurrentFileProgressPercentageValue);
            AddChild(prgCurrentFile);
            AddChild(lblCurrentFile);
            AddChild(lblTotalProgressPercentage);
            AddChild(lblTotalProgressPercentageValue);
            AddChild(prgTotal);
            AddChild(lblUpdaterStatus);
            AddChild(btnCancel);

            base.Initialize(); // Read theme settings from INI

            CenterOnParent();

            CUpdater.OnUpdateCompleted             += Updater_OnUpdateCompleted;
            CUpdater.OnUpdateFailed                += Updater_OnUpdateFailed;
            CUpdater.UpdateProgressChanged         += Updater_UpdateProgressChanged;
            CUpdater.LocalFileCheckProgressChanged += CUpdater_LocalFileCheckProgressChanged;

            if (IsTaskbarSupported())
            {
                tbp = new TaskbarProgress();
            }
        }