public override void PreDisplay(int _slot, int languageNumber, bool isActive) { if (buttonClickType == AC_ButtonClickType.OffsetElementSlot && onlyShowWhenEffective && inventoryBoxTitle != "" && Application.isPlaying) { if (elementToShift == null) { foreach (AC.Menu _menu in PlayerMenus.GetMenus()) { if (_menu != null && _menu.elements.Contains(this)) { elementToShift = PlayerMenus.GetElementWithName(_menu.title, inventoryBoxTitle); break; } } } if (elementToShift != null) { isVisible = elementToShift.CanBeShifted(shiftInventory); } } fullText = TranslateLabel(label, languageNumber); if (uiButton != null) { UpdateUIElement(uiButton); if (uiText != null) { uiText.text = fullText; } } }
public override void SetUIInteractableState(bool state) { if (uiButton) { disabledUI = !state; // Don't make interactable if dependent on others if (state && buttonClickType == AC_ButtonClickType.OffsetElementSlot || buttonClickType == AC_ButtonClickType.OffsetJournal) { if (onlyShowWhenEffective && uiSelectableHideStyle == UISelectableHideStyle.DisableInteractability && Application.isPlaying && elementToShift != null) { if (buttonClickType == AC_ButtonClickType.OffsetElementSlot || !loopJournal) { if (!elementToShift.CanBeShifted(shiftInventory)) { return; } } } } uiButton.interactable = state; } }
/** * <summary>Recalculates the element's size. * This should be called whenever a Menu's shape is changed.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public override void RecalculateSize(MenuSource source) { if (buttonClickType == AC_ButtonClickType.OffsetElementSlot || buttonClickType == AC_ButtonClickType.OffsetJournal) { if (onlyShowWhenEffective && Application.isPlaying && elementToShift != null) { if (buttonClickType == AC_ButtonClickType.OffsetElementSlot || !loopJournal) { isVisible = elementToShift.CanBeShifted(shiftInventory); } } } clickAlpha = 0f; base.RecalculateSize(source); }
private void SetEffectiveVisibility(bool fromPreDisplay) { if (buttonClickType == AC_ButtonClickType.OffsetElementSlot || buttonClickType == AC_ButtonClickType.OffsetJournal) { if (onlyShowWhenEffective && Application.isPlaying && elementToShift != null) { if (buttonClickType == AC_ButtonClickType.OffsetElementSlot || !loopJournal) { bool newVisibleValue = elementToShift.CanBeShifted(shiftInventory); if (fromPreDisplay && newVisibleValue != isVisible && parentMenu != null) { parentMenu.Recalculate(); } isVisible = newVisibleValue; } } } }