public static bool CreateCooking( CraftUI.CreateItem createItem, List <StuffItem> itemList, float pheromone, bool chef) { if (createItem == null) { return(false); } int count = 1; StuffItem stuffItem = new StuffItem(createItem.item); List <StuffItem> itemListInPantry = Singleton <Game> .Instance.Environment.ItemListInPantry; int pantryCapacity = Singleton <Resources> .Instance.DefinePack.ItemBoxCapacityDefines.PantryCapacity; if (!((IReadOnlyCollection <StuffItem>)itemListInPantry).CanAddItem(pantryCapacity, stuffItem, count)) { return(false); } RecipeDataInfo info = createItem.info; foreach (RecipeDataInfo.NeedData need in info.NeedList) { StuffItem.RemoveStorages(new StuffItem(need.CategoryID, need.ID, need.Sum * count), (IReadOnlyCollection <List <StuffItem> >) new List <StuffItem>[2] { itemList, itemListInPantry }); } float num1 = 50f; StatusProfile statusProfile = Singleton <Resources> .Instance.StatusProfile; float t = Mathf.InverseLerp(statusProfile.FlavorCookSuccessBoostMinMax.min, statusProfile.FlavorCookSuccessBoostMinMax.max, pheromone); float num2 = statusProfile.FlavorCookSuccessBoost.Lerp(t); float num3 = 0.0f; if (chef) { num3 += (float)statusProfile.ChefCookSuccessBoost; } if ((double)Random.Range(0.0f, 100f) <= (double)(num1 + num2 + num3)) { itemListInPantry.AddItem(stuffItem, info.CreateSum * count); } else { stuffItem.CategoryID = 7; stuffItem.ID = 12; itemListInPantry.AddItem(stuffItem, info.CreateSum * count); } return(true); }
public void Bind(CraftUI craftUI, int count, RecipeDataInfo data) { this._data = data; ((ReactiveProperty <string>) this._name).set_Value("レシピ" + (object)(count + 1)); List <RecipeItemNodeUI> recipeItemNodeUiList = new List <RecipeItemNodeUI>(); foreach (RecipeDataInfo.NeedData need in data.NeedList) { RecipeItemNodeUI recipeItemNodeUi = (RecipeItemNodeUI)Object.Instantiate <RecipeItemNodeUI>(RecipeItemTitleNodeUI.nodeBase.GetComponent <RecipeItemNodeUI>(), (Transform)this._content, false); recipeItemNodeUi.Bind(craftUI, need); recipeItemNodeUiList.Add(recipeItemNodeUi); } this.recipeItemNodeUIs = (IReadOnlyList <RecipeItemNodeUI>)recipeItemNodeUiList; this.Refresh(); }