public int GetSellPrice() { VendorShop vendorShopInfo = InventorySystem.reference.GetVendorShopInfo(); float sellMod = vendorShopInfo.FindInfoByIndex(info.databaseIndex).sellModifier; int totalPrice = (int)(info.costInfo.timePrice * sellMod * (1f + PlayerSaveData.reference.trainData.bonusTradePricePercent / 100f)); return(totalPrice); }
public void ShowVendorWindow(VendorShop shop) { Show = !Show; SelectItem(null, null); if (Show) { PosOnOpen = GetObject.PlayerMonoGameObject.transform.position; UpdateItemContainer(shop); } }
public void UpdateItemContainer(VendorShop shop) { selectedVendorShop = shop; curQuantity = 1; VendorShopTitle.text = shop.Name; QuantityPlusButton.interactable = (selectedRefItem as IStackable) != null && selectedVendorItem.QuantityRemaining > 1; QuantityMinusButton.interactable = false; UpdatePurchaseText(); if (!Show) { return; } ItemContainer.transform.DestroyChildren(); //GameObject firstButton = null; for (int i = 0; i < shop.VendorShopItems.Count; i++) { var vendorItem = shop.VendorShopItems[i]; var go = Instantiate(VendorItemUIPrefab, Vector3.zero, Quaternion.identity) as GameObject; go.transform.SetParent(ItemContainer.transform, false); var itemModel = go.GetComponent <VendorItemModel>(); itemModel.Init(vendorItem); //firstButton = firstButton ?? go; } //var buyback = Instantiate(BuyBackSepeatorPrefab, Vector3.zero, Quaternion.identity) as GameObject; //buyback.transform.SetParent(ItemContainer.transform, false); // //for (int i = 0; i < GetObject.PlayerSave.GamePersistence.BuyBackItems.Count; i++) //{ // var buyBackItem = GetObject.PlayerSave.GamePersistence.BuyBackItems[i]; // var go = Instantiate(VendorItemUIPrefab, Vector3.zero, Quaternion.identity) as GameObject; // go.transform.SetParent(ItemContainer.transform, false); // var itemModel = go.GetComponent<VendorItemModel>(); // itemModel.InitBuyBack(buyBackItem); // //firstButton = firstButton ?? go; // //} //EventSystem.SetSelectedGameObject(firstButton); }
public void LoadShopInfo(VendorShop info) { vendorShopInfo = info; }