Example #1
0
    public void Load()
    {
        LoadIngredients();
        ClearUI();
        Util.ClearConsole();

        if (self == null)
        {
            self = this;
        }

        switch (databaseSource)
        {
        case RecipeSource.MEALDB:
            recipeSystem = new MealDBRecipeSystem(this, loadedIngredients, CueAnimate);
            break;

        default:
        case RecipeSource.OFFLINE:
            break;
        }
        if (recipeSystem == null)
        {
            NotifyOfflineError();
            return;
        }
        else
        {
            recipeSystem.LoadBase();
        }

        recipes = recipeSystem.loadedRecipes;
    }
    public void AddOrder(RecipeBase newOrder)
    {
        orderData = newOrder;
        Debug.Log("Script: OrderSlot, Method: AddOrder, Log: Added Data to Slot.");

        order.SetActive(true);
        orderName.enabled = true;
    }
        public static RecipeItem GenerateRandomRecipeItem(RecipeBase parentRecipe, bool usePrivateRecipe)
        {
            var fixture = new Fixture();
            fixture.Behaviors.Remove(new ThrowingRecursionBehavior());
            fixture.Behaviors.Add(new OmitOnRecursionBehavior());

            fixture.Customizations.Add(usePrivateRecipe
                ? new TypeRelay(typeof(RecipeBase), typeof(PrivateRecipe))
                : new TypeRelay(typeof(RecipeBase), typeof(PublicRecipe)));

            var item = fixture.Build<RecipeItem>().Create();
            item.ParentRecipe = parentRecipe;
            return item;
        }
        private RecipeDto EntityToDtoBase(RecipeBase recipeBase)
        {
            RecipeDto recipeDto = new RecipeDto
            {
                Title       = recipeBase.Title,
                Description = recipeBase.Description,
                //CookTime = recipeBase.CookTime,
                CreationDate = recipeBase.CreationDate,
                Ingredients  = IngredientsFromSingleString(recipeBase.Ingredients),
                Details      = StepDetailsFromSingleString(recipeBase.StepDetails)
            };

            return(recipeDto);
        }
 public void AddOrder(RecipeBase orderData)
 {
     if (orderList.Count >= orderSlots)
     {
         //Debug.Log("Script: OrderList, Method: AddOrder, Log: Not enough room to add Data ");
         return;
         //put some visual and audio feedback in here as well later on.
     }
     orderList.Enqueue(orderData);
     if (orderTime <= 0)
     {
         orderTime = orderList.Peek().orderTime;
         timer     = orderTime;
     }
     Debug.Log(orderList.Count());
     Debug.Log(orderList.Last());
     //Debug.Log("Script: OrderList, Method: AddOrder, Log: Data Added to order list");
 }
        protected override void Update()
        {
            base.Update();
            var itemList = new List <string>();

            foreach (var itemSlot in craftSlots)
            {
                itemList.Add(itemSlot.Item.itemProxy?.Name ?? "");
            }
            var craftProxy = RecipeBase.Get(
                CraftTableBehaviour.ToolName,
                RecipeType.Ordered,
                itemList.ToArray());

            if (craftProxy == null)
            {
                craftProxy = RecipeBase.Get(
                    CraftTableBehaviour.ToolName,
                    RecipeType.NonOrdered,
                    itemList.ToArray());
            }

            if (craftProxy != null)
            {
                resultSolt.Item.itemProxy = craftProxy.Result;
                var minCount = int.MaxValue;
                foreach (var itemSlot in craftSlots)
                {
                    if (itemSlot.Item.itemProxy == null)
                    {
                        continue;
                    }
                    minCount = Mathf.Min(minCount, itemSlot.Item.count);
                }
                resultSolt.Item.count = minCount;
            }
            else
            {
                resultSolt.Item.itemProxy = null;
                resultSolt.Item.count     = 0;
            }
        }
 public void IntervalTimer()
 {
     if (interval > 0 && orderList.Count < orderSlots)
     {
         interval -= Time.deltaTime;
     }
     else if (interval <= 0)
     {
         interval = intervalRestart;
         int randomOrder = Random.Range(1, recipes.allRecipes.Count + 1);
         Debug.Log(randomOrder);
         for (int i = 0; i < recipes.allRecipes.Count; i++)
         {
             if (recipes.allRecipes[i].id == randomOrder)
             {
                 orderData = recipes.allRecipes[i];
                 break;
             }
         }
         AddOrder(orderData);
         //Debug.Log("Script: OrderList, Method: IntervalTimer, Log: Timer hit zero. Timer restart && added new order.");
     }
 }
 public void TimeChecker(RecipeBase recept)
 {
     score += recept.score;
     RemoveOrder();
 }
 public void ChangeRecipe(RecipeBase recept)
 {
     availableRecipe = recept;
 }