// Use this for initialization void Start () { weaponhandler = GameObject.FindGameObjectWithTag ("WeaponHandler").GetComponent<WeaponHandler> (); itemAmount = gameObject.transform.GetChild (1).GetComponent<Text> (); inventory = GameObject.FindGameObjectWithTag ("Inventory").GetComponent<Inventory>(); itemImage = gameObject.transform.GetChild (0).GetComponent<Image> (); showinv = GameObject.FindGameObjectWithTag ("Player").GetComponent<ShowInventory> (); }
internal InventoryInquiryRequest(string gameID, ShowInventory showInventory, int pageIndex, int rowPerPage) { this.GameID = gameID; this.ShowInventory = showInventory; this.PageIndex = pageIndex; this.RowPerPage = rowPerPage; }
// Use this for initialization void Awake() { exit.onClick.AddListener(Exit); anim = GameObject.FindGameObjectWithTag("Player").GetComponent <Animator> (); itemOptions = Resources.Load <GameObject> ("InventoryPrefab/ItemOptions"); inventoryManager = FindObjectOfType(typeof(InventoryManager)) as InventoryManager; showInventory = FindObjectOfType(typeof(ShowInventory)) as ShowInventory; }
void Update() { move.x = Input.GetAxis("Horizontal"); move.y = Input.GetAxis("Vertical"); mouse.x = Input.mousePosition.x; mouse.y = Input.mousePosition.y; interactFocus = CheckForInteractable(); if (interactFocus != null && Input.GetKeyDown(KeyCode.E)) { // Send the interactFocus so it can be acted upon after the event Interacted.Invoke(this, interactFocus.interact()); } if (Input.GetKeyDown(KeyCode.I) || Input.GetKeyDown(KeyCode.Tab)) { ShowInventory.Invoke(this); } }
void throwItem(InventoryItem item, Button iob, Button b) { Debug.Log(item.name); inventoryManager.removeItem(item.code); Button[] toolButtons = ToolCanvas.GetComponentInChildren <ScrollRect> ().content.GetComponentsInChildren <Button> (); showInventory = FindObjectOfType(typeof(ShowInventory)) as ShowInventory; foreach (Button toolButton in toolButtons) { Debug.Log(item.code == b.GetComponentInChildren <InventoryButtonNumer> ().itemCode); if (toolButton.tag != "Untagged") { if (item.code == b.GetComponentInChildren <InventoryButtonNumer> ().itemCode&& item.code == int.Parse(toolButton.tag)) { Destroy(toolButton.gameObject); } } } for (int i = 0; i < allButtons.Length; i++) { if (allButtons [i] != null) { if (item.code == allButtons [i].GetComponentInChildren <InventoryButtonNumer> ().itemCode) { showInventory.addedToViewObjects.Remove(allButtons [i].transform.parent.gameObject); Destroy(allButtons [i].transform.parent.gameObject); allButtons [i] = null; break; } } } Destroy(iob.transform.parent.gameObject); exit.enabled = true; enableButtons(); startFunction(); }
void eat(InventoryItem item, Button iob, Button b) { if (item.inventoryType.Equals(InventoryItem.inventoryTypes.EDIBLE)) { GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStamina> ().currentStamina += item.staminaRecovery; GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStamina> ().staminaSlider.value += item.staminaRecovery; item.quantity -= 1; b.GetComponentInChildren <Text> ().text = b.GetComponentInChildren <Text> ().text.Substring(0, b.GetComponentInChildren <Text> ().text.Length - 2) + " " + item.quantity; if (item.quantity <= 0) { inventoryManager.removeItem(item.code); Destroy(iob.transform.parent.gameObject); showInventory = FindObjectOfType(typeof(ShowInventory)) as ShowInventory; for (int i = 0; i < allButtons.Length; i++) { if (allButtons [i] != null) { if (item.code == (allButtons [i].GetComponentInChildren <InventoryButtonNumer> ().itemCode)) { showInventory.addedToViewObjects.Remove(allButtons [i].transform.parent.gameObject); Destroy(allButtons [i].transform.parent.gameObject); allButtons [i] = null; break; } } } } } else { Debug.Log("Not Edible"); } exit.enabled = true; enableButtons(); startFunction(); }
public ShowInventoryTest() { action = new ShowInventory(); controllerMock = new Mock <IGameController>(); }
public IAsyncResult BeginInventoryInquiry(string gameID, ShowInventory showInventory, int pageIndex, int rowPerPage, AsyncCallback callback, object state) { InventoryInquiryRequest inventoryInquiryRequest = new InventoryInquiryRequest(gameID, showInventory, pageIndex, rowPerPage); return(this.Transmit(inventoryInquiryRequest.Serialize(), callback, state)); }