素材消費処理をpublic化/ 続けて調理する場合に使用
This commit is contained in:
parent
59b0f85d2f
commit
ad0ea26505
|
|
@ -127,6 +127,7 @@ public class CookingResult : MonoBehaviour
|
|||
{
|
||||
// 獲得、遷移
|
||||
AddStock(productData, result.Value == CornResult.Perfect ? rarityData.Rarity : ProductRarity.Normal);
|
||||
RecipeDetailView.ConsumeMaterial(productData);
|
||||
Market.Instance.IsPause.Value = false;
|
||||
SoundManager.Instance.ChangeVolumeUniqueBGM(1f);
|
||||
TransitionManager.Instance.UnloadScene(GameScenes.CookingResults);
|
||||
|
|
|
|||
|
|
@ -80,16 +80,7 @@ public class RecipeDetailView : MonoBehaviour
|
|||
{
|
||||
LocalCacheManager.Save(PopcornGameManager.PanDataTag, panSelector.SelectedPanData.Value);
|
||||
// 消費
|
||||
gameData.CornSeed -= data.MaterialList[0].amount;
|
||||
if (gameData.Material.FirstOrDefault(x => x.Id == data.MaterialList[1].id) is MaterialData material1)
|
||||
{
|
||||
material1.Amount -= data.MaterialList[1].amount;
|
||||
}
|
||||
if (data.GetMaterialCount() == 3 && gameData.Material.FirstOrDefault(x => x.Id == data.MaterialList[2].id) is MaterialData material2)
|
||||
{
|
||||
material2.Amount -= data.MaterialList[2].amount;
|
||||
}
|
||||
GameDataManager.SaveGameData();
|
||||
ConsumeMaterial(data);
|
||||
TransitionManager.Instance.LoadScene(GameScenes.Cooking);
|
||||
}).AddTo(this);
|
||||
|
||||
|
|
@ -116,6 +107,21 @@ public class RecipeDetailView : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
public static void ConsumeMaterial(ProductData productData)
|
||||
{
|
||||
var gameData = GameDataManager.GameData;
|
||||
gameData.CornSeed -= productData.MaterialList[0].amount;
|
||||
if (gameData.Material.FirstOrDefault(x => x.Id == productData.MaterialList[1].id) is MaterialData material1)
|
||||
{
|
||||
material1.Amount -= productData.MaterialList[1].amount;
|
||||
}
|
||||
if (productData.GetMaterialCount() == 3 && gameData.Material.FirstOrDefault(x => x.Id == productData.MaterialList[2].id) is MaterialData material2)
|
||||
{
|
||||
material2.Amount -= productData.MaterialList[2].amount;
|
||||
}
|
||||
GameDataManager.SaveGameData();
|
||||
}
|
||||
|
||||
public void SetRecipe(ProductData data, ProductViewType viewType)
|
||||
{
|
||||
var gameData = GameDataManager.GameData;
|
||||
|
|
|
|||
Loading…
Reference in New Issue