Пример #1
0
        public NPCTalkUI(Vector2 size, string name, string text, Vector2? location = null)
        {
            this.Size = size;
            if (location != null)
                this.Location = (Vector2)location;
            else
                Alignment = ControlAlignment.Center;

            // Double border for niceness...
            Container doubleBorderContainer = new Container();
            doubleBorderContainer.Size = new Vector2(this.Size.X * .95f, this.Size.Y * .95f);
            doubleBorderContainer.Alignment = ControlAlignment.Center;
            Add(doubleBorderContainer);

            // Header container
            Container headerContainer = new Container();
            headerContainer.Size = new Vector2(doubleBorderContainer.Size.X, doubleBorderContainer.Size.Y * .1f);
            headerContainer.Alignment = ControlAlignment.Left;
            headerContainer.Border = null;
            doubleBorderContainer.Add(headerContainer);

            // Name of thing talking to you label
            nameOfNPCLabel = new Label();
            nameOfNPCLabel.Text = name;
            nameOfNPCLabel.Scale = .9f;
            nameOfNPCLabel.Alignment = ControlAlignment.Center;
            headerContainer.Add(nameOfNPCLabel);

            // Text container
            textContainer = new Container();
            textContainer.Size = new Vector2(doubleBorderContainer.Size.X, doubleBorderContainer.Size.Y * .8f);
            textContainer.Location = new Vector2(0, doubleBorderContainer.Size.Y * .1f);
            textContainer.Alignment = ControlAlignment.Left;
            doubleBorderContainer.Add(textContainer);

            // Text to speak!
            textToSpeakLabel = new Label();
            textToSpeakLabel.WordWrap = true;
            textToSpeakLabel.Text = text;
            textToSpeakLabel.Alignment = ControlAlignment.Center;
            textContainer.Add(textToSpeakLabel);

            // How to proceed container
            Container stuffToDoNextContainer = new Container();
            stuffToDoNextContainer.Size = new Vector2(doubleBorderContainer.Size.X, doubleBorderContainer.Size.Y * .1f);
            stuffToDoNextContainer.Location = new Vector2(0, doubleBorderContainer.Size.Y * .9f);
            stuffToDoNextContainer.Border = null;
            stuffToDoNextContainer.Alignment = ControlAlignment.Left;
            doubleBorderContainer.Add(stuffToDoNextContainer);

            // How to proceed label.
            proceedingLabel = new Label();
            proceedingLabel.Alignment = ControlAlignment.Center;
            proceedingLabel.Scale = .75f;
            proceedingLabel.Text = "Space to continue...";
            stuffToDoNextContainer.Add(proceedingLabel);

            KeyClicked += NPCTalkUI_KeyClicked;
        }
Пример #2
0
        public QuestInfoBarUI(Vector2 size)
        {
            // Root control information
            this.Size = size;

            // Name container
            Container nameContainer = new Container();
            nameContainer.Size = new Vector2(this.Size.X - 40, this.Size.Y / 3);
            nameContainer.Location = new Vector2(0, -this.Size.Y / 5);
            nameContainer.Alignment = ControlAlignment.Center;
            //nameContainer.parent = this;
            Add(nameContainer);

            // Name label
            questNameLabel = new Label();
            questNameLabel.Alignment = ControlAlignment.Center;
            questNameLabel.Text = "Quest Name";
            //questNameLabel.parent = nameContainer;
            nameContainer.Add(questNameLabel);

            // Quest Info container
            Container questInfoContainer = new Container();
            questInfoContainer.Size = new Vector2(this.Size.X - 40, this.Size.Y / 3);
            questInfoContainer.Location = new Vector2(0, this.Size.Y / 5);
            questInfoContainer.Alignment = ControlAlignment.Center;
            //questInfoContainer.parent = this;
            Add(questInfoContainer);

            // money label
            questRewardMoneyLabel = new Label();
            questRewardMoneyLabel.Location = new Vector2(5, 0);
            questRewardMoneyLabel.Alignment = ControlAlignment.Left;
            //questRewardMoneyLabel.Location = new Vector2(0, questInfoContainer.Size.Y / 2);
            questRewardMoneyLabel.Text = "$0000";
            //questRewardMoneyLabel.parent = questInfoContainer;
            questInfoContainer.Add(questRewardMoneyLabel);

            // quest point label
            questRewardPointLabel = new Label();
            questRewardPointLabel.Location = new Vector2(5, 0);
            questRewardPointLabel.Alignment = ControlAlignment.Right;
            //questRewardPointLabel.Location = new Vector2(0, questInfoContainer.Size.Y / 2);
            questRewardPointLabel.Text = "@0000";
            //questRewardPointLabel.parent = questInfoContainer;
            questInfoContainer.Add(questRewardPointLabel);

            // condition label
            questStatusLabel = new Label();
            questStatusLabel.Alignment = ControlAlignment.Center;
            questStatusLabel.Text = "Unavailable";
            //questStatusLabel.parent = questInfoContainer;
            questInfoContainer.Add(questStatusLabel);
        }
Пример #3
0
        // Enemy to kill
        public ObjectivesUI(Vector2 size)
        {
            // same size as parent or predefined size (?)
            this.Size = size;

            // top half container
            Container topHalfContainer = new Container();
            topHalfContainer.Size = new Vector2(this.Size.X, this.Size.Y / 2);
            topHalfContainer.Alignment = ControlAlignment.Left;
            //topHalfContainer.parent = this;
            Add(topHalfContainer);

            // win condition label
            winConditionLabel = new Label();
            winConditionLabel.Location = new Vector2(0, -45);
            winConditionLabel.Text = "Win condition";
            winConditionLabel.Alignment = ControlAlignment.Center;
            //winConditionLabel.parent = topHalfContainer;
            topHalfContainer.Add(winConditionLabel);

            // Image container
            Container actualImageContainer = new Container();
            actualImageContainer.Size = new Vector2(64, 64);
            actualImageContainer.Alignment = ControlAlignment.Center;
            //actualImageContainer.parent = topHalfContainer;
            topHalfContainer.Add(actualImageContainer);

            // The actual image
            objectiveImageContainer = new Container();
            objectiveImageContainer.Size = new Vector2(1, 1);
            objectiveImageContainer.Border = null;
            objectiveImageContainer.Alignment = ControlAlignment.Center;
            //objectiveImageContainer.parent = actualImageContainer;
            actualImageContainer.Add(objectiveImageContainer);

            // info container
            Container nameConditionContainer = new Container();
            nameConditionContainer.Size = new Vector2(this.Size.X, this.Size.Y / 2);
            nameConditionContainer.Location = new Vector2(0, this.Size.Y / 2);
            nameConditionContainer.Alignment = ControlAlignment.Left;
            //nameConditionContainer.parent = this;
            Add(nameConditionContainer);

            // objective name label
            objectiveNameLabel = new Label();
            objectiveNameLabel.Text = "NAME";
            objectiveNameLabel.Alignment = ControlAlignment.Center;
            objectiveNameLabel.WordWrap = true;
            //objectiveNameLabel.parent = nameConditionContainer;
            nameConditionContainer.Add(objectiveNameLabel);
        }
Пример #4
0
        public ItemStatsUI(Vector2 size)
        {
            this.Size = size;

            // Header label
            headerLabel = new Label();
            headerLabel.Alignment = ControlAlignment.CenterX;
            headerLabel.Location = new Vector2(0, size.Y * .025f);
            Add(headerLabel);

            // Information container
            informationContainer = new Container();
            informationContainer.Alignment = ControlAlignment.Center;
            informationContainer.Size = new Vector2(size.X * .90f, size.Y * .80f);
            informationContainer.Location = new Vector2(0, size.Y * .05f);
            Add(informationContainer);
        }
Пример #5
0
        public WeaponWheelUI()
        {
            this.Size = new Vector2(500, 200);
            this.Alignment = ControlAlignment.Center;

            currentActive = null;

            // Close button
            Button closeButton = new Button();
            closeButton.Size = new Vector2(15, 15);
            closeButton.Location = new Vector2(5, 5);
            closeButton.Alignment = ControlAlignment.Right;
            closeButton.Text = "X";
            closeButton.Click += closeButton_Click;
            //closeButton.parent = this;
            Add(closeButton);

            // Weapon Buttons container.
            weaponButtonsContainer = new Container();
            weaponButtonsContainer.Size = new Vector2(450, 150);
            weaponButtonsContainer.Alignment = ControlAlignment.Center;
            //weaponButtonsContainer.parent = this;
            Add(weaponButtonsContainer);
        }
Пример #6
0
        public WeaponInfoUI()
        {
            // Properties for this class
            this.Alignment = ControlAlignment.Left;
            this.Size = new Vector2(180, 100);

            // Init other things.
            // Holds weapon and ammo info
            Container weaponAmmoContainer = new Container();
            weaponAmmoContainer.Size = new Vector2(this.Size.X - 10, this.Size.Y - 10);
            weaponAmmoContainer.Alignment = ControlAlignment.Center;
            //weaponAmmoContainer.parent = this;
            Add(weaponAmmoContainer);

            // Holds weapon img and name
            Container weaponImgInfoContainer = new Container();
            weaponImgInfoContainer.Size = new Vector2(100, 90);
            //weaponImgInfoContainer.Border = new BorderInfo(Sprites.guiSpritesDictionary["circle_border"]);

            //weaponImgInfoContainer.parent = weaponAmmoContainer;
            weaponAmmoContainer.Add(weaponImgInfoContainer);

            // Weapon image
            weaponImageContainer = new Container();
            weaponImageContainer.Fill = null;
            //weaponImageContainer.Border = new BorderInfo(Sprites.guiSpritesDictionary["circle_border"]);
            weaponImageContainer.Size = new Vector2(64, 64);
            weaponImageContainer.Location = new Vector2(0, -5);
            weaponImageContainer.Alignment = ControlAlignment.Center;
            //weaponImageContainer.parent = weaponImgInfoContainer;
            weaponImgInfoContainer.Add(weaponImageContainer);

            // Weapon name
            weaponNameLbl = new Label();
            weaponNameLbl.Location = new Vector2(0, 35);
            //weaponNameLbl.Text = "";
            weaponNameLbl.Alignment = ControlAlignment.Center;
            //weaponNameLbl.parent = weaponImgInfoContainer;
            weaponImgInfoContainer.Add(weaponNameLbl);

            // Ammo container
            Container ammoInfoContainer = new Container();
            ammoInfoContainer.Size = new Vector2(75, 90);
            ammoInfoContainer.Alignment = ControlAlignment.Right;
            //ammoInfoContainer.parent = weaponAmmoContainer;
            weaponAmmoContainer.Add(ammoInfoContainer);

            // Ammo top
            ammoCurrentInClipLbl = new Label();
            ammoCurrentInClipLbl.Location = new Vector2(0, -20);
            ammoCurrentInClipLbl.Text = "";
            ammoCurrentInClipLbl.Alignment = ControlAlignment.Center;
            //ammoCurrentInClipLbl.parent = ammoInfoContainer;
            ammoInfoContainer.Add(ammoCurrentInClipLbl);

            // Ammo divider
            reloadBar = new ProgressBar(new Vector2(75, 10));
            reloadBar.ProgressColor = Color.Black;
            reloadBar.MaxValue = 100;
            reloadBar.CurrentValue = 0;
            reloadBar.IncludeText = String.Empty;
            reloadBar.Alignment = ControlAlignment.Center;
            //reloadBar.parent = ammoInfoContainer;
            ammoInfoContainer.Add(reloadBar);

            isReloadingLbl = new Label();
            isReloadingLbl.Scale = .5f;
            isReloadingLbl.Alignment = ControlAlignment.Center;
            isReloadingLbl.Text = "";
            //isReloadingLbl.parent = reloadBar;
            reloadBar.Add(isReloadingLbl);
            /*
            Container ammoDivisorContainer = new Container();
            ammoDivisorContainer.Size = new Vector2(75, 10);
            ammoDivisorContainer.Location = new Vector2(0, 0);
            ammoDivisorContainer.Alignment = ControlAlignment.Center;
            ammoDivisorContainer.parent = ammoInfoContainer;
            ammoInfoContainer.Add(ammoDivisorContainer);
            */
            // Ammo bottom
            ammoTotalLbl = new Label();
            ammoTotalLbl.Location = new Vector2(0, 20);
            ammoTotalLbl.Text = "";
            ammoTotalLbl.Alignment = ControlAlignment.Center;
            //ammoTotalLbl.parent = ammoInfoContainer;
            ammoInfoContainer.Add(ammoTotalLbl);
        }
Пример #7
0
        public DialogBox(Vector2 size, DialogBoxType type, string header, string description, Vector2? location = null)
        {
            this.Size = size;
            this.type = type;

            //eventsCompleted = false;

            if (location != null)
                this.Location = (Vector2)location;
            else
                this.Alignment = ControlAlignment.Center;

            // Header container
            Container headerContainer = new Container();
            headerContainer.Size = new Vector2(this.Size.X, this.Size.Y * .13f);
            Add(headerContainer);

            // Header lbl
            Label headerLabel = new Label();
            headerLabel.Alignment = ControlAlignment.Center;
            headerLabel.Text = header;
            headerContainer.Add(headerLabel);

            // Close dialog button.
            Button closeButton = new Button();
            closeButton.Alignment = ControlAlignment.Right;
            closeButton.Size = new Vector2(this.Size.Y * .10f, this.Size.Y * .10f);
            closeButton.Click += closeButton_Click;
            closeButton.Text = "X";
            headerContainer.Add(closeButton);

            // Fill (description)
            Container fillContainer = new Container();
            fillContainer.Fill = new FillInfo(Color.DarkGray);
            fillContainer.Border = null;
            fillContainer.Alignment = ControlAlignment.Center;
            fillContainer.Size = new Vector2(this.Size.X * .90f, this.Size.Y * .72f);
            //fillContainer.Location = new Vector2(0, headerContainer.Size.Y);
            Add(fillContainer);

            // Fill description
            Label dialogDescriptionLabel = new Label();
            dialogDescriptionLabel.WordWrap = true;
            dialogDescriptionLabel.Text = description;
            dialogDescriptionLabel.Alignment = ControlAlignment.Center;
            fillContainer.Add(dialogDescriptionLabel);

            // Button container
            Container buttonsContainer = new Container();
            buttonsContainer.Size = new Vector2(this.Size.X, this.Size.Y * .15f);
            buttonsContainer.Location = new Vector2(0, headerContainer.Size.Y + fillContainer.Size.Y);
            Add(buttonsContainer);

            // Buttons
            Button firstActionButton;
            Button secondActionButton;
            switch(type)
            {
                case DialogBoxType.Ok:
                    firstActionButton = new Button();
                    firstActionButton.Text = "OK";
                    firstActionButton.Alignment = ControlAlignment.Center;
                    firstActionButton.Size = new Vector2(buttonsContainer.Size.X * .50f, buttonsContainer.Size.Y * .80f);
                    firstActionButton.Click += firstActionButton_Click;
                    buttonsContainer.Add(firstActionButton);
                    break;

                case DialogBoxType.OkCancel:
                    firstActionButton = new Button();
                    firstActionButton.Text = "OK";
                    firstActionButton.Alignment = ControlAlignment.Center;
                    firstActionButton.Location = new Vector2(-buttonsContainer.Size.X * .25f, 0);
                    firstActionButton.Size = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                    firstActionButton.Click += firstActionButton_Click;
                    buttonsContainer.Add(firstActionButton);

                    secondActionButton = new Button();
                    secondActionButton.Text = "Cancel";
                    secondActionButton.Alignment = ControlAlignment.Center;
                    secondActionButton.Location = new Vector2(buttonsContainer.Size.X * .25f, 0);
                    secondActionButton.Size = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                    secondActionButton.Click += secondActionButton_Click;
                    buttonsContainer.Add(secondActionButton);
                    break;

                case DialogBoxType.YesNo:
                    firstActionButton = new Button();
                    firstActionButton.Text = "Yes";
                    firstActionButton.Alignment = ControlAlignment.Center;
                    firstActionButton.Location = new Vector2(-buttonsContainer.Size.X * .25f, 0);
                    firstActionButton.Size = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                    firstActionButton.Click += firstActionButton_Click;
                    buttonsContainer.Add(firstActionButton);

                    secondActionButton = new Button();
                    secondActionButton.Text = "No";
                    secondActionButton.Alignment = ControlAlignment.Center;
                    secondActionButton.Location = new Vector2(buttonsContainer.Size.X * .25f, 0);
                    secondActionButton.Size = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                    secondActionButton.Click += secondActionButton_Click;
                    buttonsContainer.Add(secondActionButton);
                    break;
            }
        }
        public LivingEntityInfoUI()
        {
            // Properties for this class
            this.Alignment = ControlAlignment.Right;
            this.Size = new Vector2(180, 80);
            this.Location = new Vector2(0, RenderManager.ViewportHeight - 80);

            // Holds health label and current health label
            Container healthInfoContainer = new Container();
            healthInfoContainer.Size = new Vector2(this.Size.X - 20, 30);
            healthInfoContainer.Location = new Vector2(0, -15);
            healthInfoContainer.Alignment = ControlAlignment.Center;
            //healthInfoContainer.parent = this;
            Add(healthInfoContainer);

            Container healthTxtLblContainer = new Container();
            healthTxtLblContainer.Size = new Vector2(50, 30);
            healthTxtLblContainer.Alignment = ControlAlignment.Left;
            //healthTxtLblContainer.parent = healthInfoContainer;
            healthInfoContainer.Add(healthTxtLblContainer);

            Label healthTxtLbl = new Label();
            healthTxtLbl.AutoResize = true;
            healthTxtLbl.Text = "Health:";
            healthTxtLbl.Alignment = ControlAlignment.Center;
            //healthTxtLbl.parent = healthTxtLblContainer;
            healthTxtLblContainer.Add(healthTxtLbl);

            Container healthLblContainer = new Container();
            healthLblContainer.Size = new Vector2(80, 30);
            healthLblContainer.Alignment = ControlAlignment.Right;
            //healthLblContainer.parent = healthInfoContainer;
            healthInfoContainer.Add(healthLblContainer);
            /*
            healthLbl = new Label();
            healthLbl.AutoResize = true;
            healthLbl.Text = "";
            healthLbl.Alignment = ControlAlignment.Center;
            healthLbl.parent = healthLblContainer;
            healthLblContainer.Add(healthLbl);
            */
            healthBar = new ProgressBar(healthLblContainer.Size);
            healthBar.Size = healthLblContainer.Size;
            healthBar.Alignment = ControlAlignment.Center;
            healthBar.ProgressColor = Color.Green;

            healthBar.MaxValue = 4;
            //healthBar.parent = healthLblContainer;
            healthLblContainer.Add(healthBar);

            // Holds money label and current money label
            Container moneyInfoContainer = new Container();
            moneyInfoContainer.Location = new Vector2(0, 15);
            moneyInfoContainer.Size = new Vector2(this.Size.X - 20, 30);
            moneyInfoContainer.Alignment = ControlAlignment.Center;

            Container moneyTxtLblContainer = new Container();
            moneyTxtLblContainer.Size = new Vector2(50, 30);
            moneyTxtLblContainer.Alignment = ControlAlignment.Left;
            //moneyTxtLblContainer.parent = moneyInfoContainer;
            moneyInfoContainer.Add(moneyTxtLblContainer);

            Label moneyTxtLbl = new Label();
            moneyTxtLbl.AutoResize = true;
            moneyTxtLbl.Text = "Money:";
            moneyTxtLbl.Alignment = ControlAlignment.Center;
            //moneyTxtLbl.parent = moneyTxtLblContainer;
            moneyTxtLblContainer.Add(moneyTxtLbl);

            Container moneyLblContainer = new Container();
            moneyLblContainer.Size = new Vector2(80, 30);
            moneyLblContainer.Alignment = ControlAlignment.Right;
            //moneyLblContainer.parent = moneyInfoContainer;
            moneyInfoContainer.Add(moneyLblContainer);

            moneyLbl = new Label();
            moneyLbl.AutoResize = true;
            moneyLbl.Text = "$00000000";
            moneyLbl.Alignment = ControlAlignment.Center;
            //moneyLbl.parent = moneyLblContainer;
            moneyLblContainer.Add(moneyLbl);

            //moneyInfoContainer.parent = this;
            Add(moneyInfoContainer);
        }
Пример #9
0
        public event EventHandler noEvent;  // also cancel

        public DialogBox(Vector2 size, DialogBoxType type, string header, string description, Vector2?location = null)
        {
            this.Size = size;
            this.type = type;

            //eventsCompleted = false;

            if (location != null)
            {
                this.Location = (Vector2)location;
            }
            else
            {
                this.Alignment = ControlAlignment.Center;
            }

            // Header container
            Container headerContainer = new Container();

            headerContainer.Size = new Vector2(this.Size.X, this.Size.Y * .13f);
            Add(headerContainer);

            // Header lbl
            Label headerLabel = new Label();

            headerLabel.Alignment = ControlAlignment.Center;
            headerLabel.Text      = header;
            headerContainer.Add(headerLabel);

            // Close dialog button.
            Button closeButton = new Button();

            closeButton.Alignment = ControlAlignment.Right;
            closeButton.Size      = new Vector2(this.Size.Y * .10f, this.Size.Y * .10f);
            closeButton.Click    += closeButton_Click;
            closeButton.Text      = "X";
            headerContainer.Add(closeButton);

            // Fill (description)
            Container fillContainer = new Container();

            fillContainer.Fill      = new FillInfo(Color.DarkGray);
            fillContainer.Border    = null;
            fillContainer.Alignment = ControlAlignment.Center;
            fillContainer.Size      = new Vector2(this.Size.X * .90f, this.Size.Y * .72f);
            //fillContainer.Location = new Vector2(0, headerContainer.Size.Y);
            Add(fillContainer);

            // Fill description
            Label dialogDescriptionLabel = new Label();

            dialogDescriptionLabel.WordWrap  = true;
            dialogDescriptionLabel.Text      = description;
            dialogDescriptionLabel.Alignment = ControlAlignment.Center;
            fillContainer.Add(dialogDescriptionLabel);

            // Button container
            Container buttonsContainer = new Container();

            buttonsContainer.Size     = new Vector2(this.Size.X, this.Size.Y * .15f);
            buttonsContainer.Location = new Vector2(0, headerContainer.Size.Y + fillContainer.Size.Y);
            Add(buttonsContainer);

            // Buttons
            Button firstActionButton;
            Button secondActionButton;

            switch (type)
            {
            case DialogBoxType.Ok:
                firstActionButton           = new Button();
                firstActionButton.Text      = "OK";
                firstActionButton.Alignment = ControlAlignment.Center;
                firstActionButton.Size      = new Vector2(buttonsContainer.Size.X * .50f, buttonsContainer.Size.Y * .80f);
                firstActionButton.Click    += firstActionButton_Click;
                buttonsContainer.Add(firstActionButton);
                break;

            case DialogBoxType.OkCancel:
                firstActionButton           = new Button();
                firstActionButton.Text      = "OK";
                firstActionButton.Alignment = ControlAlignment.Center;
                firstActionButton.Location  = new Vector2(-buttonsContainer.Size.X * .25f, 0);
                firstActionButton.Size      = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                firstActionButton.Click    += firstActionButton_Click;
                buttonsContainer.Add(firstActionButton);

                secondActionButton           = new Button();
                secondActionButton.Text      = "Cancel";
                secondActionButton.Alignment = ControlAlignment.Center;
                secondActionButton.Location  = new Vector2(buttonsContainer.Size.X * .25f, 0);
                secondActionButton.Size      = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                secondActionButton.Click    += secondActionButton_Click;
                buttonsContainer.Add(secondActionButton);
                break;

            case DialogBoxType.YesNo:
                firstActionButton           = new Button();
                firstActionButton.Text      = "Yes";
                firstActionButton.Alignment = ControlAlignment.Center;
                firstActionButton.Location  = new Vector2(-buttonsContainer.Size.X * .25f, 0);
                firstActionButton.Size      = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                firstActionButton.Click    += firstActionButton_Click;
                buttonsContainer.Add(firstActionButton);

                secondActionButton           = new Button();
                secondActionButton.Text      = "No";
                secondActionButton.Alignment = ControlAlignment.Center;
                secondActionButton.Location  = new Vector2(buttonsContainer.Size.X * .25f, 0);
                secondActionButton.Size      = new Vector2(buttonsContainer.Size.X * .25f, buttonsContainer.Size.Y * .80f);
                secondActionButton.Click    += secondActionButton_Click;
                buttonsContainer.Add(secondActionButton);
                break;
            }
        }
Пример #10
0
        /// <summary>
        /// Constructor:
        /// - Init size
        /// - Init location
        /// - InitializeForms function.
        /// </summary>
        public InventoryMenu()
        {
            isInventoryLoaded = false;

            this.Size = new Vector2(650, 450);
            this.Alignment = ControlAlignment.Center;

            // Header container
            Container headerContainer = new Container()
            {
                Alignment = ControlAlignment.Left,
                Size = new Vector2(this.Size.X, this.Size.Y / 16),
                parent = this
            };
            Add(headerContainer);

            // Header label
            Label headerLabel = new Label()
            {
                Alignment = ControlAlignment.Center,
                Text = "INVENTORY",
                parent = headerContainer
            };
            headerContainer.Add(headerLabel);

            // Exit inventory button
            Button xButton = new Button()
            {
                Size = new Vector2(15, 15),
                Location = new Vector2(5, (headerContainer.Size.Y / 2) - 7.5f),
                Alignment = ControlAlignment.Right,
                Text = "X",
                parent = headerContainer
            };
            xButton.Click += closeButton_Click;
            headerContainer.Add(xButton);

            // main container
            Container multiMatContainer = new Container();
            multiMatContainer.Size = new Vector2(this.Size.X * .90f, this.Size.Y * .80f);
            multiMatContainer.Alignment = ControlAlignment.Center;
            //multiMatContainer.parent = this;

            // Action button container.
            Container actionButtonsContainer = new Container()
            {
                Size = new Vector2(multiMatContainer.Size.X, this.Size.Y * .10f),
                Location = new Vector2(0, multiMatContainer.Size.Y / 2 + this.Size.Y * .05f),
                Alignment = ControlAlignment.Center,
                parent = this
            };
            Add(actionButtonsContainer);

            // Close inventory button.
            Button closeButton = new Button();
            closeButton.Size = new Vector2(110, 20);
            closeButton.Location = new Vector2(10, actionButtonsContainer.Size.Y / 2 - 10);
            closeButton.Alignment = ControlAlignment.Right;
            closeButton.Text = "Close Inventory";
            closeButton.Click += closeButton_Click;
            //closeButton.parent = actionButtonsContainer;
            actionButtonsContainer.Add(closeButton);

            // Inventory matrix.
            inventoryMatrix = new DragableMatrixV2(new Vector2(multiMatContainer.Size.X * .80f, multiMatContainer.Size.Y * .75f), 12);
            inventoryMatrix.Location = new Vector2(10, multiMatContainer.Size.Y / 2 - inventoryMatrix.Size.Y / 2);
            inventoryMatrix.Alignment = ControlAlignment.Right;
            //inventoryMatrix.parent = multiMatContainer;
            multiMatContainer.Add(inventoryMatrix);

            // Current wep matrix.
            currentWeaponMatrix = new DragableMatrixV2(new Vector2(inventoryMatrix.ContainerSideLength, inventoryMatrix.ContainerSideLength), 1);
            currentWeaponMatrix.Location = new Vector2(10, multiMatContainer.Size.Y / 2 - inventoryMatrix.Size.Y / 2);
            currentWeaponMatrix.Alignment = ControlAlignment.Left;
            //currentWeaponMatrix.parent = multiMatContainer;
            multiMatContainer.Add(currentWeaponMatrix);

            // Add down here for overlap.
            Add(multiMatContainer);
        }
Пример #11
0
        public QuestUI(Vector2 size)
        {
            // base
            this.Size = size;
            this.Alignment = ControlAlignment.Center;

            // Name and Reward container
            Container nameRewardContainer = new Container();
            nameRewardContainer.Size = new Vector2(this.Size.X, this.Size.Y / 10);
            //nameRewardContainer.parent = this;
            Add(nameRewardContainer);

            // Reward Info Container
            Container rewardInfoContainer = new Container();
            rewardInfoContainer.Size = new Vector2(nameRewardContainer.Size.X / 2, nameRewardContainer.Size.Y);
            rewardInfoContainer.Alignment = ControlAlignment.Right;
            //rewardInfoContainer.parent = nameRewardContainer;
            nameRewardContainer.Add(rewardInfoContainer);

            // Cash reward container
            Container cashRewardContainer = new Container();
            cashRewardContainer.Size = new Vector2(rewardInfoContainer.Size.X / 2, nameRewardContainer.Size.Y);
            cashRewardContainer.Alignment = ControlAlignment.Right;
            //cashRewardContainer.parent = rewardInfoContainer;
            rewardInfoContainer.Add(cashRewardContainer);

            // Cash label
            cashReward = new Label();
            cashReward.Alignment = ControlAlignment.Center;
            cashReward.Text = "";
            //cashReward.parent = cashRewardContainer;
            cashRewardContainer.Add(cashReward);

            // Quest point reward container
            Container questPointContainer = new Container();
            questPointContainer.Size = new Vector2(rewardInfoContainer.Size.X / 2, nameRewardContainer.Size.Y);
            questPointContainer.Alignment = ControlAlignment.Left;
            //questPointContainer.parent = rewardInfoContainer;
            rewardInfoContainer.Add(questPointContainer);

            // Quest point label
            pointReward = new Label();
            pointReward.Alignment = ControlAlignment.Center;
            pointReward.Text = "";
            //pointReward.parent = questPointContainer;

            questPointContainer.Add(pointReward);

            // Name label container
            Container nameLabelContainer = new Container();
            nameLabelContainer.Size = new Vector2(nameRewardContainer.Size.X / 2, nameRewardContainer.Size.Y);
            nameLabelContainer.Alignment = ControlAlignment.Left;
            //nameLabelContainer.parent = nameRewardContainer;
            nameRewardContainer.Add(nameLabelContainer);

            // Name Label
            name = new Label();
            name.Alignment = ControlAlignment.Center;
            name.Text = "";
            //name.parent = nameLabelContainer;
            nameLabelContainer.Add(name);

            // DescriptionObjective container
            Container descObjectiveContainer = new Container();
            descObjectiveContainer.Size = new Vector2(this.Size.X, this.Size.Y - nameRewardContainer.Size.Y);
            descObjectiveContainer.Location = new Vector2(0, nameRewardContainer.Size.Y);
            descObjectiveContainer.Alignment = ControlAlignment.Left;
            //descObjectiveContainer.parent = this;
            Add(descObjectiveContainer);

            // Description container
            Container descriptionContainer = new Container();
            descriptionContainer.Size = new Vector2((this.Size.X / 8) * 5, this.Size.Y - nameRewardContainer.Size.Y);
            descriptionContainer.Alignment = ControlAlignment.Left;
            //descriptionContainer.parent = descObjectiveContainer;
            descObjectiveContainer.Add(descriptionContainer);

            // Description label
            description = new Label();
            description.Alignment = ControlAlignment.Left;
            description.Text = "Click on a quest on the left to see information about it here!";
            //description.Text = "Description\nDescription Description Description Description Description Description Description Description Description Description Description Description\nDescription Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description Description ";
            description.WordWrap = true;
            //description.parent = descriptionContainer;
            descriptionContainer.Add(description);

            // --- THERE COULD BE MULTIPLE OF THESE (stack them or side by side?) ---

            // Objective container
            objectivesContainer = new Container();
            objectivesContainer.Size = new Vector2((this.Size.X / 8) * 3, this.Size.Y - nameRewardContainer.Size.Y);
            objectivesContainer.Alignment = ControlAlignment.Right;
            //objectivesContainer.parent = descObjectiveContainer;
            descObjectiveContainer.Add(objectivesContainer);
            // --- THERE COULD BE MULTIPLE OF THESE ---
        }
Пример #12
0
        public QuestLogUI()
        {
            // Quest pages
            questInfoBars = new List<QuestInfoBarUI>();
            //currentIndex = 0;

            // this info...
            this.Size = new Vector2(600, 400);
            this.Alignment = ControlAlignment.Center;

            // Header container
            Container headerContainer = new Container();
            headerContainer.Size = new Vector2(this.Size.X, 20);
            headerContainer.Alignment = ControlAlignment.Left;
            //headerContainer.parent = this;
            Add(headerContainer);

            // Exit quest log
            Button closeButton = new Button();
            closeButton.Size = new Vector2(15, 15);
            closeButton.Location = new Vector2(5, (headerContainer.Size.Y / 2) - 7.5f);
            closeButton.Alignment = ControlAlignment.Right;
            closeButton.Text = "X";
            closeButton.Click += closeButton_Click;
            //closeButton.parent = headerContainer;
            headerContainer.Add(closeButton);

            // Header
            questLogHeaderLabel = new Label();
            questLogHeaderLabel.Alignment = ControlAlignment.Center;
            questLogHeaderLabel.Text = "QUEST LOG";
            questLogHeaderLabel.Color = Color.Black;
            //questLogHeaderLabel.parent = headerContainer;
            headerContainer.Add(questLogHeaderLabel);

            // Quest bar container
            questBarsContainer = new Container();
            questBarsContainer.Alignment = ControlAlignment.Left;
            questBarsContainer.Size = new Vector2(this.Size.X / 2, (this.Size.Y - headerContainer.Size.Y) * .85f);
            questBarsContainer.Location = new Vector2(0, headerContainer.Size.Y);
            //questBarsContainer.parent = this;
            Add(questBarsContainer);

            // Forward backward button container

            // Quest UI to display more info on the quest.
            questUI = new QuestUI(new Vector2(this.Size.X / 2, (this.Size.Y - headerContainer.Size.Y) * .85f));
            //questUI.Size = new Vector2(this.Size.X / 2, (this.Size.Y - headerContainer.Size.Y) * .80f);
            questUI.Alignment = ControlAlignment.Right;
            questUI.Location = new Vector2(0, headerContainer.Size.Y);
            //questUI.parent = this;
            Add(questUI);

            // quest buttons container.
            questActionsContainer = new Container();
            questActionsContainer.Alignment = ControlAlignment.Right;
            questActionsContainer.Size = new Vector2(this.Size.X / 2, (this.Size.Y - headerContainer.Size.Y) * .15f);
            questActionsContainer.Location = new Vector2(0, questUI.Size.Y + headerContainer.Size.Y);
            //questActionsContainer.parent = this;
            Add(questActionsContainer);

            // the buttons...
            startQuestButton = new Button();
            startQuestButton.Alignment = ControlAlignment.Center;
            startQuestButton.Size = new Vector2(100, 50);
            startQuestButton.Location = new Vector2(-60, 0);
            startQuestButton.IsActive = false;
            startQuestButton.Text = "Start Quest";
            startQuestButton.Click += startQuestButton_Click;
            startQuestButton.Click += closeButton_Click;
            //startQuestButton.parent = questActionsContainer;
            questActionsContainer.Add(startQuestButton);

            stopQuestButton = new Button();
            stopQuestButton.Alignment = ControlAlignment.Center;
            stopQuestButton.Size = new Vector2(100, 50);
            stopQuestButton.Location = new Vector2(60, 0);
            stopQuestButton.IsActive = false;
            stopQuestButton.Text = "Stop Quest";
            stopQuestButton.Click += stopQuestButton_Click;
            //stopQuestButton.parent = questActionsContainer;
            questActionsContainer.Add(stopQuestButton);

            // page button container
            Container pageButtonContainer = new Container();
            pageButtonContainer.Alignment = ControlAlignment.Left;
            pageButtonContainer.Size = new Vector2(this.Size.X / 2, (this.Size.Y - headerContainer.Size.Y) * .15f);
            pageButtonContainer.Location = new Vector2(0, questUI.Size.Y + headerContainer.Size.Y);
            //pageButtonContainer.parent = this;
            Add(pageButtonContainer);

            // forward button
            pageForwardButton = new Button();
            pageForwardButton.Alignment = ControlAlignment.Center;
            pageForwardButton.Size = new Vector2(100, 50);
            pageForwardButton.Location = new Vector2(70, 0);
            pageForwardButton.IsActive = false;
            pageForwardButton.Text = "Forward >";
            pageForwardButton.Click += pageForwardButton_Click;
            //pageForwardButton.parent = pageButtonContainer;
            pageButtonContainer.Add(pageForwardButton);

            // back button
            pageBackwardButton = new Button();
            pageBackwardButton.Alignment = ControlAlignment.Center;
            pageBackwardButton.Size = new Vector2(100, 50);
            pageBackwardButton.Location = new Vector2(-70, 0);
            pageBackwardButton.IsActive = false;
            pageBackwardButton.Text = "< Backward";
            pageBackwardButton.Click += pageBackwardButton_Click;
            //pageBackwardButton.parent = pageButtonContainer;
            pageButtonContainer.Add(pageBackwardButton);

            currentPageLabel = new Label();
            currentPageLabel.Alignment = ControlAlignment.Center;
            currentPageLabel.Text = "{0} / {1}";
            pageButtonContainer.Add(currentPageLabel);
        }