// -----------------------------------------------------------------------------------------------------------// /// <summary> /// Return the items type in selectedSlot /// </summary> /// <param name="removeItem"> If we want to remove the selected item from the inventory </param> /// <returns> Int that represents the item type </returns> public TileType GetItemInSelectedInventorySlot(bool removeItem) { if (slots[selectedSlot].ItemGO != null && slots[selectedSlot].Item.item.placable) { TileType _id = slots[selectedSlot].Item.item.type; if (removeItem) { UpdateItemCount(selectedSlot, -1, slots); EventManagerTypeSafe.TriggerEvent(new UIEvents.OnItemAddedOrRemoved()); } return(_id); } else { return(0); } }
// Update is called once per frame private void Update() { if (Input.GetKeyDown(mouseButton1)) { EventManagerTypeSafe.TriggerEvent(new InputEvents.OnMouseButton1DownEvent()); } if (Input.GetKeyDown(mouseButton2)) { EventManagerTypeSafe.TriggerEvent(new InputEvents.OnMouseButton2DownEvent()); } // Mouse Scroll float scrollAmount = Input.GetAxis(mouseScrollWheel); if (scrollAmount != 0) { EventManagerTypeSafe.TriggerEvent(new InputEvents.OnMouseScrollEvent(scrollAmount)); if (Input.GetKey(controlKey)) { EventManagerTypeSafe.TriggerEvent(new InputEvents.OnControllPressedEvent(scrollAmount)); } } }
// -----------------------------------------------------------------------------------------------------------// public void RemoveItem(TileType type, int amount) { base.RemoveItem(type, amount, slots); EventManagerTypeSafe.TriggerEvent(new UIEvents.OnItemAddedOrRemoved()); }
private void OnDisable() { EventManagerTypeSafe.RemoveListener <InputEvents.OnMouseScrollEvent>(OnMouseScrollEvent); }
//-----------------------------------------------------------------------------------------------------------// #region EventFunctions private void OnEnable() { EventManagerTypeSafe.AddListener <InputEvents.OnMouseScrollEvent>(OnMouseScrollEvent); }
private void OnDisable() { EventManagerTypeSafe.RemoveListener <UIEvents.OnItemAddedOrRemoved>(CheckCraftableItems); }
private void OnDisable() { EventManagerTypeSafe.RemoveListener <InputEvents.OnControllPressedEvent>(Zoom); }
private void OnEnable() { EventManagerTypeSafe.AddListener <InputEvents.OnControllPressedEvent>(Zoom); }