private void Start()
 {
     if (herbsImg != null && chemsImg != null && plasticImg != null)
     {
         herbsImg.sprite   = Resources.Load <Sprite>("Icons/herbs");
         chemsImg.sprite   = Resources.Load <Sprite>("Icons/chemistry");
         plasticImg.sprite = Resources.Load <Sprite>("Icons/plastic");
     }
     if (rpImg != null)
     {
         rpImg.sprite = Resources.Load <Sprite>("Icons/researchPoint");
     }
     if (moneyImg != null)
     {
         moneyImg.sprite        = Resources.Load <Sprite>("Icons/money");
         interpol.originalColor = money.color;
     }
     if (autoGenerate)
     {
         craftHolder  = GetComponentInChildren <CraftHolder>();
         recipeHolder = GetComponentInChildren <RecipeHolder>();
         if (craftHolder != null)
         {
             SetPanel(craftHolder.Talent.characteristics);
         }
         else if (recipeHolder != null)
         {
             SetPanel(recipeHolder.recipe.characteristics);
         }
     }
     else
     {
         SetPanel();
     }
 }
Exemple #2
0
 void FillList()
 {
     for (int i = 0; i < recipes.Count; i++)
     {
         GameObject   holder       = Instantiate(recipeHolderPrefab, grid);
         RecipeHolder holderScript = holder.GetComponent <RecipeHolder>();
         holderScript.recipe = recipes[i];
     }
 }
 public void SetPanel(Recipe recipe, RecipeHolder holder)
 {
     if (recipe == null)
     {
         return;
     }
     ChangeView(true);
     SetMainInformation(recipe);
 }
Exemple #4
0
 public static void UnSelectRecipe()
 {
     if (recipeHolderSelected != null && recipeHolderSelected.recipe != null)
     {
         recipeHolderSelected.recipe         = null;
         recipeHolderSelected.picture.sprite = recipeHolderSelected.defaultSprite;
         recipeHolderSelected.ClearDescription();
         recipeHolderSelected = null;
         EventManager.TriggerEvent("OnRecipeRemove");
     }
 }
    public void SetPanel(Recipe recipe, RecipeHolder holder)
    {
        if (recipe.Talents.Count == 0 || holder == null || recipe == null)
        {
            return;
        }
        ChangeView(true);
        if (scroll != null)
        {
            StartCoroutine(SlideValueOverTime(slideTo));
        }
        SetMainInformation(recipe);

        TalentHolder[] primaryHolders   = { talents[0], talents[1], talents[2] };
        TalentHolder[] secondaryHolders = { talents[3], talents[4], talents[5], talents[6] };
        foreach (TalentHolder t in talents)
        {
            t.gameObject.SetActive(true);
        }
        for (int i = 0; i < primaryHolders.Length; i++)
        {
            primaryHolders[i].Talent = null;

            if (i >= recipe.PTalents.Count)
            {
                continue;
            }
            primaryHolders[i].Talent = recipe.PTalents[i];
        }
        for (int i = 0; i < secondaryHolders.Length; i++)
        {
            secondaryHolders[i].Talent = null;

            if (i >= recipe.STalents.Count)
            {
                continue;
            }
            secondaryHolders[i].Talent = recipe.STalents[i];
        }
        foreach (TalentHolder t in talents)
        {
            t.SetPanel();
        }
    }
Exemple #6
0
 public DescriptionPanel GetDescriptionPanel(RecipeHolder holder)
 {
     if (dPanels[0].gameObject.activeInHierarchy)
     {
         return(dPanels[0]);
     }
     else if (dPanels[1].gameObject.activeInHierarchy)
     {
         return(dPanels[1]);
     }
     else if (dPanels[3].gameObject.activeInHierarchy)
     {
         return(dPanels[3]);
     }
     else
     {
         return(null);
     }
 }
Exemple #7
0
 private void Start()
 {
     if (autoGenerate)
     {
         craftHolder  = GetComponentInChildren <CraftHolder>();
         recipeHolder = GetComponentInChildren <RecipeHolder>();
         if (craftHolder != null)
         {
             SetPanel(craftHolder.Talent.characteristics);
         }
         else if (recipeHolder != null)
         {
             SetPanel(recipeHolder.recipe.characteristics);
         }
     }
     else
     {
         SetPanel();
     }
 }
Exemple #8
0
 private void Awake()
 {
     _recipeHolder = RecipeHolder.Instance;
 }
Exemple #9
0
 public void OnAddRecipe(RecipeHolder recipeHolder)
 {
     crafter.view.holderSelected.glowImg.gameObject.SetActive(false);
     crafter.view.craftDescriptionPanel.SetPanel(recipeHolder.recipe, recipeHolder);
     crafter.AssignRecipe(recipeHolder.recipe);
 }
Exemple #10
0
 public void OnSelectHolder(RecipeHolder holder) // on click at main talent holders
 {
     crafter.view.recipeHolderSelected = holder;
 }