Ejemplo n.º 1
0
    public void InitShopList(ShopContainer shopConatiner)
    {
        gameObject.SetActive(true);
        this.shopConatiner = shopConatiner;

        PopulateList();
    }
Ejemplo n.º 2
0
        private static void BuyItem(Client arg1, int sourceSlot)
        {
            Console.WriteLine("Buy item slot: " + sourceSlot);

            ShopContainer shop = ServerManager.Instance.ShopManager.GetShop(((Player)arg1.SelectedCharacter).SelectedVendorId);

            if (shop != null)
            {
                if (shop.items.GetItem(sourceSlot, out ItemData data))
                {
                    if (ServerManager.Instance.ItemsManager.GetItemPrototype(data.baseId, out ItemPrototype prototype))
                    {
                        if ((int)arg1.SelectedCharacter.GetStat(StatType.GOLD) >= prototype.price)
                        {
                            int freeInventorySlot = arg1.SelectedCharacter.GetItemsContainer(ItemsContainerId.INVENTORY).GetFreeSlot();
                            if (freeInventorySlot != -1)
                            {
                                ItemData boughtItem = ServerManager.Instance.ItemsManager.CreateItemData(new ItemData()
                                {
                                    baseId = data.baseId,
                                });

                                arg1.SelectedCharacter.AddStatInt(StatType.GOLD, -prototype.price);
                                arg1.SelectedCharacter.GetItemsContainer(ItemsContainerId.INVENTORY).AddItem(freeInventorySlot, boughtItem);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public void ResetContainers()
 {
     m_freeWorldContainer   = null;
     m_persistentContainer  = null;
     m_shopContainer        = null;
     m_updateContainersFlag = true;
     m_server.SendShopInfo(this, -1f, -1f);
 }
Ejemplo n.º 4
0
 public void LoadInItems()
 {
     if (_shopFile != null)
     {
         TextAsset textAsset = (TextAsset)Resources.Load(_shopFile.name);
         _items = ShopContainer.LoadFromText(textAsset.text)._shopItems;
     }
 }
Ejemplo n.º 5
0
 public HomeController(ShopContainer sh, ILogger <HomeController> logger)
 {
     _sh     = sh;
     _logger = logger;
 }