public void MakeButtons() { foreach (GameObject item in m_items) { Destroy(item); } m_items.Clear(); var cupboard = CookingMain.CupboardList; for (int i = 0; i < cupboard.Count; i++) { IngredientType ingredient = cupboard[i]; GameObject newItem = Instantiate(ItemTemplate, ItemTemplate.transform.parent); newItem.SetActive(true); m_items.Add(newItem); Text text = newItem.GetComponentInChildren <Text>(); text.text = CookingMain.GetIngredientName(ingredient, true); newItem.name = text.text; Button button = newItem.GetComponent <Button>(); button.onClick.AddListener(delegate { OnCupboardItemSelected(ingredient); }); ButtonHoverer hover = newItem.AddComponent <ButtonHoverer>(); hover.Icon = Icons[(int)ingredient]; hover.TargetImage = FoodIcon; } FoodIcon.sprite = emptySprite; }
void ReplaceWord(VD.NodeData data) { //if (data.comments[data.commentIndex].Contains("[NAME]")) // data.comments[data.commentIndex] = data.comments[data.commentIndex].Replace("[NAME]", VD.assigned.gameObject.name); if (data.comments[data.commentIndex].Contains("[WEAPON]")) { data.comments[data.commentIndex] = data.comments[data.commentIndex].Replace("[WEAPON]", "sword"); } if (data.extraVars.ContainsKey("ReplaceItem")) { string itemName = CookingMain.GetIngredientName(textReplaceIngredient, (int)data.extraVars["ReplaceItem"] == 1); data.comments[data.commentIndex] = data.comments[data.commentIndex].Replace("[ITEM]", itemName); } if (data.extraVars.ContainsKey("ReplaceItems")) { string items = CookingMain.Instance.GetNamesOfIngredientsInStew(); data.comments[data.commentIndex] = data.comments[data.commentIndex].Replace("[ITEMS]", items); } if (data.extraVars.ContainsKey("ReplaceScore")) { data.comments[data.commentIndex] = data.comments[data.commentIndex].Replace("[SCORE]", stewScore.ToString()); } }