Пример #1
0
        public void UpdateSelectedItem(GameTime gameTime, Furni item)
        {
            if (item.CanTrade())
            {
                canTrade.Update(gameTime);
            }
            else
            {
                cantTrade.Update(gameTime);
            }

            if (item.CanRecycle())
            {
                canRecycle.Update(gameTime);
            }
            else
            {
                cantRecycle.Update(gameTime);
            }

            selectedItem.SetText(item.GetFurniName());
            placeItemButton.Update(gameTime);

            amountTrade.SetText(GameScreenManager.Instance.GetInventoryManager().GetItemAmount(item.GetFurniClass()).ToString());
            amountTrade.Update(gameTime);

            amountRecycle.SetText(GameScreenManager.Instance.GetInventoryManager().GetItemAmount(item.GetFurniClass()).ToString());
            amountRecycle.Update(gameTime);
        }
Пример #2
0
        public void DrawSelectedItem(SpriteBatch spriteBatch, Furni item, float depth = 0.92f)
        {
            if (item.CanTrade())
            {
                canTrade.Draw(spriteBatch, itemDisplay.GetPosition() + new Vector2i(12 + itemDisplay.GetSize().X, 0), depth);
            }
            else
            {
                cantTrade.Draw(spriteBatch, itemDisplay.GetPosition() + new Vector2i(12 + itemDisplay.GetSize().X, 0), depth);
            }

            if (item.CanRecycle())
            {
                canRecycle.Draw(spriteBatch, itemDisplay.GetPosition() + new Vector2i(12 + itemDisplay.GetSize().X, 3 + canTrade.GetTexture().Height), depth);
            }
            else
            {
                cantRecycle.Draw(spriteBatch, itemDisplay.GetPosition() + new Vector2i(12 + itemDisplay.GetSize().X, 3 + canTrade.GetTexture().Height), depth);
            }

            if (item.CanTrade())
            {
                amountTrade.Draw(spriteBatch, itemDisplay.GetPosition() + new Vector2i(12 + itemDisplay.GetSize().X + canTrade.GetTexture().Width + 3, 0), depth);
            }
            if (item.CanRecycle())
            {
                amountRecycle.Draw(spriteBatch, itemDisplay.GetPosition() + new Vector2i(12 + itemDisplay.GetSize().X + canRecycle.GetTexture().Width + 3, 3 + canTrade.GetTexture().Height), depth);
            }

            selectedItem.Draw(spriteBatch, itemDisplay.GetPosition() + new Vector2i(12 + itemDisplay.GetSize().X, itemDisplay.GetSize().Y - placeItemButton.GetSize().Y - selectedItem.measureString().Y - 10), depth);
            placeItemButton.Draw(spriteBatch, itemDisplay.GetPosition() + new Vector2i(12 + itemDisplay.GetSize().X, itemDisplay.GetSize().Y - placeItemButton.GetSize().Y), depth);
        }
Пример #3
0
        public void AddFurni(Furni item)
        {
            bool found = false;

            furnis.Add(item.GetItemId(), item);

            if (item.CanStack())
            {
                foreach (KeyValuePair <IInventoryItem, int> itm in items)
                {
                    if (itm.Key.GetFurniClass().Equals(item.GetFurniClass()))
                    {
                        items.Remove(itm.Key);
                        items.Add(itm.Key, itm.Value + 1);

                        found = true;
                        return;
                    }
                }
            }

            if (!found)
            {
                items.Add(item, 1);
            }

            if (!UpdateDelay.Enabled)
            {
                UpdateDelay.Start();
            }
        }
Пример #4
0
        public void Reset()
        {
            Logger.DebugWarn("Resetting inventory");

            furnis.Clear();
            items.Clear();
            selectedItem = null;
            firstSelect  = true;
        }
Пример #5
0
 public bool SelectItem(string className)
 {
     foreach (Furni furni in furnis.Values)
     {
         if (furni.GetFurniClass().Equals(className))
         {
             selectedItem = furni;
             return(true);
         }
     }
     return(false);
 }