Пример #1
0
 public new void IgnoreDialog(Type t)
 {
     base.IgnoreDialog(t);
     up.IgnoreDialog(t);
     down.IgnoreDialog(t);
     scroll.IgnoreDialog(t);
 }
Пример #2
0
        public EOInventory(XNAPanel parent, PacketAPI api)
            : base(null, null, parent)
        {
            m_api = api;

            //load info from registry
            Dictionary <int, int> localItemSlotMap = new Dictionary <int, int>();

            m_inventoryKey = _tryGetCharacterRegKey();
            if (m_inventoryKey != null)
            {
                const string itemFmt = "item{0}";
                for (int i = 0; i < INVENTORY_ROW_LENGTH * 4; ++i)
                {
                    int id;
                    try
                    {
                        id = Convert.ToInt32(m_inventoryKey.GetValue(string.Format(itemFmt, i)));
                    }
                    catch { continue; }
                    localItemSlotMap.Add(i, id);
                }
            }

            //add the inventory items that were retrieved from the server
            List <InventoryItem> localInv = World.Instance.MainPlayer.ActiveCharacter.Inventory;

            if (localInv.Find(_item => _item.id == 1).id != 1)
            {
                localInv.Insert(0, new InventoryItem {
                    amount = 0, id = 1
                });                                                                         //add 0 gold if there isn't any gold
            }
            bool dialogShown = false;

            foreach (InventoryItem item in localInv)
            {
                ItemRecord rec  = World.Instance.EIF.GetItemRecordByID(item.id);
                int        slot = localItemSlotMap.ContainsValue(item.id)
                                        ? localItemSlotMap.First(_pair => _pair.Value == item.id).Key
                                        : GetNextOpenSlot(rec.Size);
                if (!dialogShown && !AddItemToSlot(slot, rec, item.amount))
                {
                    dialogShown = true;
                    EODialog.Show("Something doesn't fit in the inventory. Rearrange items or get rid of them.", "Warning", XNADialogButtons.Ok, EODialogStyle.SmallDialogSmallHeader);
                }
            }

            //coordinates for parent of EOInventory: 102, 330 (pnlInventory in InGameHud)
            //extra in photoshop right now: 8, 31

            //current weight label (member variable, needs to have text updated when item amounts change)
            m_lblWeight = new XNALabel(new Rectangle(385, 37, 88, 18), "Microsoft Sans MS", 8f)
            {
                ForeColor = System.Drawing.Color.FromArgb(255, 0xc8, 0xc8, 0xc8),
                TextAlign = ContentAlignment.MiddleCenter,
                Visible   = true,
                AutoSize  = false
            };
            m_lblWeight.SetParent(this);
            UpdateWeightLabel();

            Texture2D thatWeirdSheet = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 27);             //oh my gawd the offsets on this bish

            //(local variables, added to child controls)
            //'paperdoll' button
            m_btnPaperdoll = new XNAButton(thatWeirdSheet, new Vector2(385, 9), /*new Rectangle(39, 385, 88, 19)*/ null, new Rectangle(126, 385, 88, 19));
            m_btnPaperdoll.SetParent(this);
            m_btnPaperdoll.OnClick += (s, e) => m_api.RequestPaperdoll((short)World.Instance.MainPlayer.ActiveCharacter.ID);
            //'drop' button
            //491, 398 -> 389, 68
            //0,15,38,37
            //0,52,38,37
            m_btnDrop = new XNAButton(thatWeirdSheet, new Vector2(389, 68), new Rectangle(0, 15, 38, 37), new Rectangle(0, 52, 38, 37));
            m_btnDrop.SetParent(this);
            m_btnDrop.IgnoreDialog(typeof(EOPaperdollDialog));
            m_btnDrop.IgnoreDialog(typeof(EOChestDialog));
            //'junk' button - 4 + 38 on the x away from drop
            m_btnJunk = new XNAButton(thatWeirdSheet, new Vector2(431, 68), new Rectangle(0, 89, 38, 37), new Rectangle(0, 126, 38, 37));
            m_btnJunk.SetParent(this);
            m_btnJunk.IgnoreDialog(typeof(EOPaperdollDialog));
            m_btnJunk.IgnoreDialog(typeof(EOChestDialog));
        }