示例#1
0
    public void Prime(BaseIngredient ingredient)
    {
        this.ingredient = ingredient;
        if (ingredient == null)
        {
            if (textName != null)
            {
                textName.text = "";
            }
            if (sprite != null)
            {
                sprite.sprite = null;
            }
            return;
        }

        if (textName != null)
        {
            textName.text = ingredient.displayName;
        }
        if (sprite != null)
        {
            sprite.sprite = ingredient.sprite;
        }
    }
示例#2
0
 public void Add(BaseIngredient ingredient)
 {
     if (ingredient == null)
     {
         return;
     }
     ingredients.Add(ingredient);
     if (onChanged != null)
     {
         onChanged.Invoke(this);
     }
 }
示例#3
0
文件: Combo.cs 项目: topheryun/Choco
 public bool IsShown(BaseIngredient ingredient)
 {
     if (leftSlot == ingredient)
     {
         return(true);
     }
     if (rightSlot == ingredient)
     {
         return(true);
     }
     return(false);
 }
示例#4
0
 void HandleonClick(BaseIngredient ingredient)
 {
     if (combo.IsShown(ingredient))
     {
         combo.UnShow(ingredient);
         GlobalParty.ingredientInventory.Add(ingredient);
         GlobalParty.chocolateInventory.Add(ingredient);
         return;
     }
     if (combo.ShowImage(ingredient))
     {
         GlobalParty.ingredientInventory.Remove(ingredient);
         GlobalParty.chocolateInventory.Remove(ingredient);
     }
 }
示例#5
0
 public void Remove(BaseIngredient ingredient)
 {
     if (ingredient == null)
     {
         return;
     }
     if (!ingredients.Contains(ingredient))
     {
         return;
     }
     ingredients.Remove(ingredient);
     if (onChanged != null)
     {
         onChanged.Invoke(this);
     }
 }
示例#6
0
    private void InitIngredients()
    {
        BaseIngredient Water = new BaseIngredient(Strings.WATER, "Water.jpeg");
        ListOfIngredients.Add(Strings.WATER, Water);

        BaseIngredient Herb = new BaseIngredient(Strings.HERB, "Herb.jpeg");
        ListOfIngredients.Add(Strings.HERB, Herb);

        BaseIngredient Oil = new BaseIngredient(Strings.OIL, "Oil.jpeg");
        ListOfIngredients.Add(Strings.OIL, Oil);

        BaseIngredient PhoenixAsh = new BaseIngredient(Strings.PHOENIXASH, "PhoenixAsh.jpeg");
        ListOfIngredients.Add(Strings.PHOENIXASH, PhoenixAsh);

        BaseIngredient CristalFlower = new BaseIngredient(Strings.CRISTALFLOWER, "CristalFlower.jpeg");
        ListOfIngredients.Add(Strings.CRISTALFLOWER, CristalFlower);
    }
示例#7
0
文件: Combo.cs 项目: topheryun/Choco
    public void UnShow(BaseIngredient ingredient)
    {
        if (leftSlot == ingredient)
        {
            leftSlot = null;
        }
        if (rightSlot == ingredient)
        {
            rightSlot = null;
        }

        if (onImageChanged != null)
        {
            Debug.Log(name + " image unshown, listen up.");
            onImageChanged.Invoke(this);
        }
        else
        {
            Debug.Log(name + " image unshown, nobody cared.");
        }
    }
示例#8
0
文件: Combo.cs 项目: topheryun/Choco
    public bool ShowImage(BaseIngredient ingredient)
    {
        if (ingredient == null)
        {
            return(false);
        }
        switch (ingredient.slot)
        {
        default:
            Debug.Log("Doesn't know how to use slot " + ingredient.slot);
            return(false);

        case ImageSlot.LeftSlot:
            GlobalParty.chocolateInventory.Add(leftSlot);                               // UI Lists #9 at 7:00
            leftSlot = ingredient;
            break;

        case ImageSlot.RightSlot:
            GlobalParty.ingredientInventory.Add(rightSlot);
            rightSlot = ingredient;
            break;
//		case ImageSlot.ComboSlot:
//			comboSlot = ingredient;
//			break;
        }

        if (onImageChanged != null)
        {
            Debug.Log(name + " image change, listen up.");
            onImageChanged.Invoke(this);
        }
        else
        {
            Debug.Log(name + " image change, nobody cared.");
        }

        return(true);
    }
        private IBaseRecipe Recipe2()
        {
            IBaseRecipe recipe1 = new SweetsRecipe
            {
                RecipeName         = "Calitate cu dulceata",
                RecipeDescriptions = "Cand ai chef de clatite..."
            };

            BaseIngredient ingredient1 = new BaseIngredient
            {
                Name     = "Dulceata de visine",
                Quantity = "un borcan"
            };

            BaseIngredient ingredient2 = new BaseIngredient
            {
                Name     = "Faina",
                Quantity = "un pahar"
            };

            BaseIngredient ingredient3 = new BaseIngredient
            {
                Name     = "Apa minerala",
                Quantity = "un sfert de pahar"
            };

            List <BaseIngredient> baseIngredients1 =
                new List <BaseIngredient>()
            {
                ingredient1, ingredient2, ingredient3
            };

            recipe1.AddMoreIngredients(baseIngredients1);

            return(recipe1);
        }
        private IBaseRecipe Recipe1()
        {
            IBaseRecipe recipe1 = new SweetsRecipe
            {
                RecipeName         = "Placinta cu mere",
                RecipeDescriptions = "O placinta buna"
            };

            BaseIngredient ingredient1 = new BaseIngredient
            {
                Name     = "Mere",
                Quantity = "20"
            };

            BaseIngredient ingredient2 = new BaseIngredient
            {
                Name     = "Faina",
                Quantity = "4 pahare"
            };

            BaseIngredient ingredient3 = new BaseIngredient
            {
                Name     = "Drojdie",
                Quantity = "o bucata"
            };

            List <BaseIngredient> baseIngredients1 =
                new List <BaseIngredient>()
            {
                ingredient1, ingredient2, ingredient3
            };

            recipe1.AddMoreIngredients(baseIngredients1);

            return(recipe1);
        }
 public void AddIngredient(BaseIngredient baseIngredient)
 {
     _baseIngredients.Add(baseIngredient);
 }
示例#12
0
        public bool isCountOfIngredience(BaseIngredient searchIngredience, int needCount)
        {
            int count = 0;
            foreach (BaseIngredient itemInList in ingredieceInventory)
            {
                if (itemInList == searchIngredience)
                {
                    count++;
                }
            }

            if(count >= needCount)
            {
                return true;
            }

            return false;
        }
示例#13
0
 public int getCountOfIngredience(BaseIngredient searchIngredience)
 {
     int count = 0;
     foreach (BaseIngredient itemInList in ingredieceInventory)
     {
         if (itemInList == searchIngredience)
         {
             count++;
         }
     }
     return count;
 }
示例#14
0
 ///INGREDIENCE
 public void addIngredience(BaseIngredient newIngredience)
 {
     ingredieceInventory.Add(newIngredience);
 }
示例#15
0
 void HandleonClick(BaseIngredient ingredient)
 {
     Debug.Log("BEHOLD I HAVE HEARD OF A LEGENDARY " + ingredient.displayName);
 }
示例#16
0
        public bool removeCountOfIngredience(BaseIngredient searchIngredience, int needCount)
        {
            List<BaseIngredient> items = new List<BaseIngredient>();

            foreach (BaseIngredient itemInList in ingredieceInventory)
            {
                if (itemInList == searchIngredience)
                {
                    items.Add(itemInList);
                }
            }

            if(items.Count>= needCount)
            {
                for (int i = 0; i < needCount; i++ )
                {
                    ingredieceInventory.Remove(searchIngredience);
                }
                    return true;
            }
            return false;
        }
示例#17
0
 public BaseIngredient[] GetAllIngredients()
 {
     BaseIngredient[] Values = new BaseIngredient[ListOfIngredients.Count];
     ListOfIngredients.Values.CopyTo(Values, 0);
     return Values;
 }