public void FillInventoryButton(ItemTypeSO itemType, bool isInteractable = true) { _buttonAction.interactable = isInteractable; _buttonActionText.StringReference = itemType.ActionName; //bool isKeyboard = !(Input.GetJoystickNames() != null && Input.GetJoystickNames().Length > 0); bool isKeyboard = true; buttonPromptSetter.SetButtonPrompt(isKeyboard); if (isInteractable) { if (_inputReader != null) { hasEvent = true; _inputReader.inventoryActionButtonEvent += ClickActionButton; } } else { if (_inputReader != null) { if (hasEvent) { _inputReader.inventoryActionButtonEvent -= ClickActionButton; } } } }
public void FillInventoryButton(ItemTypeSO itemType, bool isInteractable = true) { _buttonAction.interactable = isInteractable; _buttonActionText.StringReference = itemType.ActionName; bool isKeyboard = true; _buttonPromptSetter.SetButtonPrompt(isKeyboard); if (isInteractable) { if (_inputReader != null) { _hasEvent = true; _inputReader.InventoryActionButtonEvent += ClickActionButton; } } else { if (_inputReader != null) { if (_hasEvent) { _inputReader.InventoryActionButtonEvent -= ClickActionButton; } } } }
public bool Unregister(ItemTypeSO itemType, UnityObject handler) { if (_itemHandlerMap.TryGetValue(itemType, out UnityObjectSet set)) { return(set.Remove(handler)); } return(false); }
public bool Register(ItemTypeSO itemType, UnityObject handler) { if (_itemHandlerMap.TryGetValue(itemType, out UnityObjectSet set)) { return(set.Add(handler)); } else { set = new UnityObjectSet(); set.Add(handler); _itemHandlerMap.Add(itemType, set); return(true); } }
public void FillInventoryButtons(ItemTypeSO itemType, bool isInteractable = true) { buttonAction.interactable = isInteractable; buttonActionText.StringReference = itemType.ActionName; }