調理可能判定をstatic化
This commit is contained in:
parent
66a41b4151
commit
c33f4bc4cd
|
|
@ -94,7 +94,7 @@ public class RecipeDetailView : MonoBehaviour
|
||||||
}).AddTo(this);
|
}).AddTo(this);
|
||||||
|
|
||||||
SetRecipe(data, viewType);
|
SetRecipe(data, viewType);
|
||||||
var isPassedAmount = CheckAmount(data);
|
var isPassedAmount = CheckAmountAndChangeTextColor(data);
|
||||||
var isPassedTank = CheckTank(data);
|
var isPassedTank = CheckTank(data);
|
||||||
|
|
||||||
switch (viewType)
|
switch (viewType)
|
||||||
|
|
@ -167,29 +167,44 @@ public class RecipeDetailView : MonoBehaviour
|
||||||
flavor2View.SetActive(data.GetMaterialCount() == 3);
|
flavor2View.SetActive(data.GetMaterialCount() == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckAmount(ProductData productData)
|
private bool CheckAmountAndChangeTextColor(ProductData productData)
|
||||||
{
|
{
|
||||||
var flag = true;
|
var checkResult = CheckAmount(productData);
|
||||||
|
if (!checkResult.material1)
|
||||||
|
{
|
||||||
|
cornAmountText.color = redColor;
|
||||||
|
}
|
||||||
|
if (!checkResult.material2)
|
||||||
|
{
|
||||||
|
flavor1AmountText.color = redColor;
|
||||||
|
}
|
||||||
|
if (!checkResult.material3)
|
||||||
|
{
|
||||||
|
flavor2AmountText.color = redColor;
|
||||||
|
}
|
||||||
|
return checkResult.material1 && checkResult.material2 && checkResult.material3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static (bool material1, bool material2, bool material3) CheckAmount(ProductData productData)
|
||||||
|
{
|
||||||
|
(bool a, bool b, bool c) flags = (true, true, true);
|
||||||
var gameData = GameDataManager.GameData;
|
var gameData = GameDataManager.GameData;
|
||||||
if (gameData.CornSeed < productData.MaterialList[0].amount)
|
if (gameData.CornSeed < productData.MaterialList[0].amount)
|
||||||
{
|
{
|
||||||
flag = false;
|
flags.a = false;
|
||||||
cornAmountText.color = redColor;
|
|
||||||
}
|
}
|
||||||
if ((gameData.Material.FirstOrDefault(data => data.Id == productData.MaterialList[1].id)?.Amount ?? 0) < productData.MaterialList[1].amount)
|
if ((gameData.Material.FirstOrDefault(data => data.Id == productData.MaterialList[1].id)?.Amount ?? 0) < productData.MaterialList[1].amount)
|
||||||
{
|
{
|
||||||
flag = false;
|
flags.b = false;
|
||||||
flavor1AmountText.color = redColor;
|
|
||||||
}
|
}
|
||||||
if (productData.GetMaterialCount() == 3 && (gameData.Material.FirstOrDefault(data => data.Id == productData.MaterialList[2].id)?.Amount ?? 0) < productData.MaterialList[2].amount)
|
if (productData.GetMaterialCount() == 3 && (gameData.Material.FirstOrDefault(data => data.Id == productData.MaterialList[2].id)?.Amount ?? 0) < productData.MaterialList[2].amount)
|
||||||
{
|
{
|
||||||
flag = false;
|
flags.c = false;
|
||||||
flavor2AmountText.color = redColor;
|
|
||||||
}
|
}
|
||||||
return flag;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckTank(ProductData data)
|
public static bool CheckTank(ProductData data)
|
||||||
{
|
{
|
||||||
var gameData = GameDataManager.GameData;
|
var gameData = GameDataManager.GameData;
|
||||||
// 店頭の空き確認
|
// 店頭の空き確認
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue