Esempio n. 1
0
        /** Creates the listings for the store */
        protected void createStoreListings()
        {
            itemListingScrollArea.Clear();
            int yPos     = 0;
            int position = 0;

            foreach (MDRItem item in CoM.Items)
            {
                if (Store.GetQuantity(item) <= 0)
                {
                    continue;
                }
                if (item.CurseType != ItemCurseType.None)
                {
                    continue;
                }
                if (ShowOnlyUsableItems && (item.GetCanNotEquipItemReason(CoM.Party.Selected) != ""))
                {
                    continue;
                }
                GuiStoreListing listing = new GuiStoreListing(this, 0, 1 + yPos, item.ID, Store.SellPrice(item), Store.GetQuantity(item));
                listing.PositionIndex = position++;
                listing.Width         = (int)itemListingScrollArea.ContentsBounds.width;
                itemListingScrollArea.Add(listing);
                listing.Update();
                yPos += listing.Height;
                if (StoreSelectedItemID == -1)
                {
                    StoreSelectedItemID = listing.ItemID;
                }
            }
            itemListingScrollArea.ContentsScrollRect.height = yPos;
        }
Esempio n. 2
0
        /** Creates buttons for each party, allowing the user to select one of them. */
        private void updatePartyList()
        {
            CoM.CleanParties();
            partyList.Clear();
            int yPos = 0;

            foreach (MDRParty party in CoM.PartyList)
            {
                var partyButton = new GuiPartySpan(party)
                {
                    X = 0, Y = yPos
                };
                partyButton.OnMouseClicked += delegate {
                    selectParty(partyButton.Party);
                };
                partyList.Add(partyButton);
                yPos += partyButton.Height;
            }

            if (AllowCreateParty)
            {
                //var createButton = new GuiButton("Create New Party", GuiPartySpan.WIDTH, GuiPartySpan.HEIGHT) { X = 0, Y = yPos };
                var createButton = new GuiPartySpan(null)
                {
                    X = 0, Y = yPos
                };
                createButton.Editable        = false;
                createButton.Caption         = "Create New Party";
                createButton.Color           = Color.gray;
                createButton.OnMouseClicked += delegate {
                    var party = MDRParty.Create();
                    CoM.PartyList.Add(party);
                    var state = new EditPartyState(party, true);
                    Engine.PushState(state);
                };
                partyList.Add(createButton);
                yPos += createButton.Height;
            }

            partyList.FitToChildren();
        }