Beispiel #1
0
        public GuiStoreListing(GuiStore parentStore, int x, int y, int itemID, int price, int quantity = 1)
            : base(300, 50)
        {
            X = x;
            Y = y;

            this.ItemID = itemID;
            this.Style  = Engine.GetStyleCopy("PanelSquare");
            this.price  = price;
            this.Style.padding.right     = 10;
            this.parentStore             = parentStore;
            this.DisableChildInteraction = true;

            link          = new MDRItemSlot();
            link.Quantity = quantity;

            itemContainer                    = new GuiItemSlot(2, 2, link);
            itemContainer.Locked             = true;
            itemContainer.ShowToolTipOnHover = false;
            Add(itemContainer);

            nameLabel = new GuiLabel(52, 14, "", 220);
            Add(nameLabel);

            coinsAmount = new GuiCoinAmount();
            Add(coinsAmount, -10, -10, true);

            CacheMode = CacheMode.Solid;

            Refresh();
        }
Beispiel #2
0
        private void createButons()
        {
            buttonsGroup = new GuiContainer(Width, 200);
            Add(buttonsGroup, 0, 250);

            // Sell
            var sellFrame = new GuiContainer(300, 50);

            sellFrame.Style = Engine.GetStyleCopy("Frame");
            buttonsGroup.Add(sellFrame, 0, 1);

            sellButton = new GuiButton("Sell", 80);
            sellFrame.Add(sellButton, 10, 0);

            sellPrice = new GuiCoinAmount();
            sellFrame.Add(sellPrice, 150, 0);

            // ID
            var IDFrame = new GuiContainer(300, 50);

            IDFrame.Style = Engine.GetStyleCopy("Frame");
            buttonsGroup.Add(IDFrame, 0, 1 + 48);

            idButton = new GuiButton("ID", 80);
            IDFrame.Add(idButton, 10, 0);

            idPrice = new GuiCoinAmount();
            IDFrame.Add(idPrice, 150, 0);

            sellButton.OnMouseClicked += delegate {
                SellItem();
            };

            idButton.OnMouseClicked += delegate {
                IdItem();
            };

            buttonsGroup.FitToChildren();
        }
Beispiel #3
0
        public TempleState()
            : base("Temple")
        {
            MainWindow.Width  = 650;
            MainWindow.Height = 400;

            // Background:
            MainWindow.InnerShadow       = true;
            MainWindow.Background.Align  = GuiAlignment.None;
            MainWindow.Background.Sprite = ResourceManager.GetSprite("Backgrounds/TownTemple");
            MainWindow.Background.Color  = Color.white;
            MainWindow.Background.BestFit(MainWindow.ContentsFrame, true);
            MainWindow.PositionComponent(MainWindow.Background, 0, 0);

            // Bodies list:
            deadCharactersList = new GuiListBox <MDRCharacter>(0, 0, 250, 200);
            var deadCharactersListFrame = GuiWindow.CreateFrame(deadCharactersList, "Characters");

            deadCharactersListFrame.Style            = Engine.GetStyleCopy("Box50");
            deadCharactersListFrame.Background.Color = Colors.BackgroundYellow.Faded(0.75f);
            MainWindow.Add(deadCharactersListFrame, 10, 0);

            noDeadCharacters            = new GuiLabel("There are no dead\ncharacters here.", 250);
            noDeadCharacters.TextAlign  = TextAnchor.MiddleCenter;
            noDeadCharacters.DropShadow = true;
            MainWindow.Add(noDeadCharacters, 10, 150);

            // Info:
            raiseInfo               = new GuiLabel(0, 0, "", 300, 200);
            raiseInfo.WordWrap      = true;
            raiseInfo.Color         = new Color(0.9f, 0.9f, 0.9f, 0.9f);
            raiseInfo.Style.padding = new RectOffset(10, 10, 10, 4);
            var raiseInfoFrame = GuiWindow.CreateFrame(raiseInfo, "Details");

            raiseInfoFrame.Style            = Engine.GetStyleCopy("Box50");
            raiseInfoFrame.Background.Color = Color.white.Faded(0.75f);
            MainWindow.Add(raiseInfoFrame, (int)deadCharactersList.Bounds.xMax + 40, (int)deadCharactersList.Bounds.yMin);

            // Buttons:
            raiseCharacterButton = new GuiButton("Raise", 120);
            MainWindow.Add(raiseCharacterButton, raiseInfoFrame.X + 70, (int)raiseInfoFrame.Bounds.yMax + 5);

            costLabel = new GuiCoinAmount();

            MainWindow.Add(costLabel, (int)raiseCharacterButton.Bounds.xMax + 20, raiseCharacterButton.Y + 3);

            // Triggers
            deadCharactersList.OnSelectedChanged += delegate {
                doUpdateRaiseInfo();
            };
            PopulateDeadCharacterList();

            raiseCharacterButton.OnMouseClicked += delegate {
                if (deadCharactersList.Selected != null)
                {
                    doRaiseCharacter(deadCharactersList.Selected);
                }
            };

            RepositionControls();
        }
Beispiel #4
0
        public AllPartyMembersDeadState(MDRParty party) : base("Party has Died")
        {
            Party = party;

            Window.Width  = 500;
            Window.Height = 300;

            costToHire = GameRules.CostToHireRescue(party.Depth);

            var label = new GuiLabel("", 450, 200);

            label.Color     = Colors.FourNines;
            label.TextAlign = TextAnchor.UpperCenter;
            label.WordWrap  = true;
            Window.Add(label, 0, 0, true);

            var okButton = new GuiButton("Ok");

            okButton.Visible = false;
            Window.Add(okButton, 0, -20, true);

            var returnButton = new GuiButton("Return to Menu", 160, 24);

            returnButton.Visible = false;
            Window.Add(returnButton, 0, 20, true);

            var hireButton = new GuiButton("Hire", 140, 30);

            hireButton.Visible     = false;
            hireButton.SelfEnabled = Party.Gold >= costToHire;
            Window.Add(hireButton, 0, -25, true);

            var hireCost = new GuiCoinAmount();

            Window.Add(hireCost, (int)hireButton.Bounds.xMax + 20, -31, true);
            hireCost.Value   = costToHire;
            hireCost.Visible = false;

            var retrieveButton = new GuiButton("Retrieve");

            retrieveButton.Visible = false;
            Window.Add(retrieveButton, 0, 0);

            string message = "All party members have died.\n";

            if (party.Depth == 1)
            {
                message         += "\nThankfuly some friendly adventures have found you and brought you back to the town temple.";
                okButton.Visible = true;
            }
            else if (party.Depth < 10)
            {
                message += "\nIt might take a while for anyone to find you down here.";

                if (Party.Gold >= costToHire)
                {
                    message += "\n\nYou'll need to either hire some adventurers or organise your own rescue party.";
                }
                else
                {
                    message += "\n\nLooks like you don't have enough to hire a rescue party.";
                    message += "\nTogether you have only {0}.";
                    message += "\n\nYou'll need to either form your own rescue party or have another character pay to send rescuers out.";

                    Window.Height += 60;
                }

                returnButton.Visible = true;
                hireCost.Visible     = true;
                hireButton.Visible   = true;
            }
            else
            {
                message += "\nVery few venture this deep.  You won't be able to hire any adventures this time.";
                message += "\nYou need to either organise your own rescue party or pay at the temple for them to retrieve your soul.";
                returnButton.Visible   = true;
                retrieveButton.Visible = true;
            }

            label.Caption = string.Format(message, CoM.CoinsAmount(Party.Gold));

            okButton.OnMouseClicked += delegate {
                CoM.AutoGotoTemple = true;
                CoM.Party.ReturnToTown();
                Engine.PopState();
            };

            hireButton.OnMouseClicked += delegate {
                CoM.AutoGotoTemple = true;
                CoM.Party.DebitGold(costToHire);
                CoM.Party.ReturnToTown();
                Engine.PopState();
            };

            returnButton.OnMouseClicked += CoM.ReturnToMainMenu;
        }