public virtual void OnUpdateClient() { Player player = Player.localPlayer; if (!player) { return; } // -- check for interaction Distance this.GetComponentInChildren <SpriteRenderer>().enabled = UCE_Tools.UCE_CheckSelectionHandling(this.gameObject); // -- check for click if (UCE_Tools.UCE_SelectionHandling(this.gameObject)) { if (checkInteractionRange(player) && ((!interactionRequirements.hasRequirements() && !interactionRequirements.hasCosts()) || automaticActivation)) { // -- when no requirements & no costs: automatically ConfirmAccess(); } else if (checkInteractionRange(player) && interactionRequirements.checkState(player)) { // -- in any other case: show confirmation UI ShowAccessRequirementsUI(); } } }
private void Update() { Player player = Player.localPlayer; if (!player) { return; } // -- check for interaction Distance if (IsWorthUpdating()) { this.GetComponentInChildren <SpriteRenderer>().enabled = UCE_Tools.UCE_CheckSelectionHandling(this.gameObject); } }
// ----------------------------------------------------------------------------------- // Update // ----------------------------------------------------------------------------------- protected override void Update() { if (!panel.activeSelf) { return; } Player player = Player.localPlayer; if (!player) { return; } if (!UCE_Tools.UCE_CheckSelectionHandling(interactable.gameObject)) { Hide(); } }
// ----------------------------------------------------------------------------------- // Update // ----------------------------------------------------------------------------------- protected override void Update() { if (!panel.activeSelf) { return; } Player player = Player.localPlayer; if (!player) { return; } if (!npc || !UCE_Tools.UCE_CheckSelectionHandling(npc.gameObject)) { npc = null; Hide(); } }
// ----------------------------------------------------------------------------------- // Refresh // ----------------------------------------------------------------------------------- public void Refresh() { Player player = Player.localPlayer; if (!player) { return; } if (panel.activeSelf && instance != null && UCE_Tools.UCE_CheckSelectionHandling(instance) ) { int rcount = getRecipeCount(); int t_index = -1; int r_index = 0; UIUtils.BalancePrefabs(slotPrefab.gameObject, rcount, content); for (int i = 0; i < recipes.Count; ++i) { if (canCraft(i)) { r_index = i; t_index++; UCE_Tmpl_Recipe recipe = recipes[r_index]; UCE_Slot_Crafting slot = content.GetChild(t_index).GetComponent <UCE_Slot_Crafting>(); slot.Show(recipe, player.UCE_Crafting_CanBoost(recipe, slot.amount)); if (player.UCE_Crafting_CraftValidation(recipe, slot.amount, slot.boost) && !player.UCE_Crafting_isBusy()) { slot.actionButton.interactable = true; } else { slot.actionButton.interactable = false; } slot.unlearnButton.interactable = true; slot.unlearnButton.onClick.SetListener(() => { unlearnPanel.Show(recipe); }); slot.actionButton.onClick.SetListener(() => { player.UCE_Crafting_startCrafting(recipe, slot.amount, slot.boost); panel.SetActive(false); }); } } } else { currentCategory = ""; panel.SetActive(false); // hide } }