// ----------------------------------------------------------------------------------- // OnClick // ----------------------------------------------------------------------------------- public void OnClick() { UCE_UI_Crafting co = panel.GetComponent <UCE_UI_Crafting>(); if (co) { co.changeCategory(category); } }
public void UCE_OnSelect_InteractableWorkbench(UCE_InteractableWorkbench _UCE_selectedWorkbench) { UCE_selectedWorkbench = _UCE_selectedWorkbench; UCE_CraftingProfessionRequirement requiredProfession = getRequiredCraftingProfession(); if (requiredProfession != null) { List <UCE_Tmpl_Recipe> recipes = new List <UCE_Tmpl_Recipe>(); // -- filter recipes that match the workbench's profession // -- filter recipes that match the players recipe list recipes.AddRange( UCE_Tmpl_Recipe.dict.Values.ToList().Where( x => x.requiredCraft == requiredProfession.template && UCE_recipes.Any(r => r == x.name) ) ); if (recipes.Count > 0) { if (!_UCE_UI_Crafting) { _UCE_UI_Crafting = FindObjectOfType <UCE_UI_Crafting>(); } _UCE_UI_Crafting.Show(UCE_selectedWorkbench.gameObject, requiredProfession.template, recipes); } else { UCE_PopupShow(UCE_selectedWorkbench.nothingMessage); } } else { UCE_PopupShow(UCE_selectedWorkbench.nothingMessage); } }