public EquipmentsMarket init(PlanetSurface planetSurface, Inventory playerInventory, ItemDescriptor itemDescriptor) { this.planetSurface = planetSurface; this.playerInventory = playerInventory; this.itemDescriptor = itemDescriptor; buyMarket = transform.Find("Buy Market").GetComponent <Inventory>().init(Inventory.InventoryType.MARKET); sellMarket = transform.Find("Sell Market").GetComponent <Inventory>().init(Inventory.InventoryType.MARKET); bgRender = transform.Find("Background").GetComponent <SpriteRenderer>(); buyBtn = transform.Find("Buy Button").GetComponent <Button> ().init(); sellBtn = transform.Find("Sell Button").GetComponent <Button> ().init(); closeBtn = transform.Find("Close Button").GetComponent <Button>().init(); actionMsg = transform.Find("Action Description").GetComponent <TextMesh>(); MeshRenderer mesh = actionMsg.GetComponent <MeshRenderer>(); mesh.sortingOrder = 1; for (int i = 0; i < transform.childCount; i++) { transform.GetChild(i).gameObject.SetActive(true); } popup = transform.Find("Popup").GetComponent <QuantityPopup>().init(this); popup.adjustPosition(Vector3.zero); gameObject.SetActive(false); return(this); }
public LootDisplay init(Inventory inventory, ItemDescriptor itemDescriptor) { this.inventory = inventory; this.itemDescriptor = itemDescriptor; cameraTrans = Camera.main.transform; takeAllBtn = transform.Find("Take All Button").GetComponent <Button>().init(); closeBtn = transform.Find("Close Button").GetComponent <Button>().init(); popup = transform.Find("Popup").GetComponent <QuantityPopup>().init(this); Transform holder = transform.Find("Holder"); slots = new LootSlot[holder.childCount]; int index; Transform slot; char[] splitChar = new char[] { ' ' }; for (int i = 0; i < holder.childCount; i++) { slot = holder.GetChild(i); index = int.Parse(slot.name.Split(splitChar, 2)[0]); slots[index] = slot.GetComponent <LootSlot>(); } takeAllBtn.gameObject.SetActive(true); closeBtn.gameObject.SetActive(true); holder.gameObject.SetActive(true); transform.Find("Background").gameObject.SetActive(true); gameObject.SetActive(false); pos = transform.position; return(this); }
private void SetTransactionQuantityForStackable() { if (TransactionItem.Quantity > 1) { var quantitySetterWindow = new QuantityPopup(this); quantitySetterWindow.ShowDialog(); } else { TransactionQuantity = 1; } }
static void ctl_QuantitySelected(object sender, QuantitySelectedEventArgs e) { QuantityPopup ctl = sender as QuantityPopup; if (ctl != null) { string key = ctl.Tag as string; if (!String.IsNullOrEmpty(key) && _handlers.ContainsKey(key)) { _handlers[key](ctl, e); _handlers.Remove(key); _host.Children.Remove(ctl); } } }
public static void ShowQuantity(string key, bool isSell, int itemId, int maxQuantity, QuantitySelectedEventHandler selectedHandler) { if (_host != null) { if (_handlers.ContainsKey(key)) { _handlers.Remove(key); } _handlers.Add(key, selectedHandler); QuantityPopup ctl = new QuantityPopup(); ctl.Tag = key; ctl.IsSell = isSell; ctl.SetValue(Canvas.ZIndexProperty, 1000); ctl.QuantitySelected += new QuantitySelectedEventHandler(ctl_QuantitySelected); _host.Children.Add(ctl); ctl.Show(itemId, maxQuantity); } }