素材不足時の赤色対応をレシピに追加/ 指定色 fb6346 に対応
This commit is contained in:
parent
669ed4350e
commit
db6da0f6eb
|
|
@ -21,8 +21,15 @@ public class BulkOrderItemView : MonoBehaviour
|
||||||
[SerializeField] private Transform material2IconTarget;
|
[SerializeField] private Transform material2IconTarget;
|
||||||
[SerializeField] private Transform packageIconTarget;
|
[SerializeField] private Transform packageIconTarget;
|
||||||
|
|
||||||
|
private Color redColor;
|
||||||
|
|
||||||
public IObservable<Unit> CookingButton => cookingButton.OnClickAsObservable().TakeUntilDestroy(this);
|
public IObservable<Unit> CookingButton => cookingButton.OnClickAsObservable().TakeUntilDestroy(this);
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
ColorUtility.TryParseHtmlString(Const.RedColorString, out redColor);
|
||||||
|
}
|
||||||
|
|
||||||
public void SetData(ProductData data)
|
public void SetData(ProductData data)
|
||||||
{
|
{
|
||||||
stockText.text = data.volume.ToString();
|
stockText.text = data.volume.ToString();
|
||||||
|
|
@ -57,17 +64,17 @@ public class BulkOrderItemView : MonoBehaviour
|
||||||
if (gameData.CornSeed < productData.MaterialList[0].amount)
|
if (gameData.CornSeed < productData.MaterialList[0].amount)
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
cornText.color = Color.red;
|
cornText.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;
|
flag = false;
|
||||||
material1Text.color = Color.red;
|
material1Text.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;
|
flag = false;
|
||||||
material2Text.color = Color.red;
|
material2Text.color = redColor;
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,11 @@ public class RecipeDetailView : MonoBehaviour
|
||||||
[SerializeField] private Transform flavor2IconTarget;
|
[SerializeField] private Transform flavor2IconTarget;
|
||||||
[SerializeField] private GameObject flavor2View;
|
[SerializeField] private GameObject flavor2View;
|
||||||
|
|
||||||
|
private Color redColor;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
ColorUtility.TryParseHtmlString(Const.RedColorString, out redColor);
|
||||||
var viewType = LocalCacheManager.Load(Const.ProductViewTypeTag, ProductViewType.Default);
|
var viewType = LocalCacheManager.Load(Const.ProductViewTypeTag, ProductViewType.Default);
|
||||||
var data = LocalCacheManager.Load<ProductData>(PopcornGameManager.CookingDataTag);
|
var data = LocalCacheManager.Load<ProductData>(PopcornGameManager.CookingDataTag);
|
||||||
|
|
||||||
|
|
@ -146,17 +149,17 @@ public class RecipeDetailView : MonoBehaviour
|
||||||
if (gameData.CornSeed < productData.MaterialList[0].amount)
|
if (gameData.CornSeed < productData.MaterialList[0].amount)
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
cornAmountText.color = Color.red;
|
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;
|
flag = false;
|
||||||
flavor1AmountText.color = Color.red;
|
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;
|
flag = false;
|
||||||
flavor2AmountText.color = Color.red;
|
flavor2AmountText.color = redColor;
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,12 @@ public class RecipeView : MonoBehaviour
|
||||||
private static readonly string amountFormat = "x{0}";
|
private static readonly string amountFormat = "x{0}";
|
||||||
private static readonly string lockPanelTextFormat = "店舗レベル{0}で開放";
|
private static readonly string lockPanelTextFormat = "店舗レベル{0}で開放";
|
||||||
private static readonly string lockPanelTextShopFormat = "仕入れから購入可能";
|
private static readonly string lockPanelTextShopFormat = "仕入れから購入可能";
|
||||||
|
private Color redColor;
|
||||||
public IObservable<Unit> RecipeClickObservable => detailButton.OnClickAsObservable().TakeUntilDestroy(this);
|
public IObservable<Unit> RecipeClickObservable => detailButton.OnClickAsObservable().TakeUntilDestroy(this);
|
||||||
|
|
||||||
private void Start()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
ColorUtility.TryParseHtmlString(Const.RedColorString, out redColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRecipe(ProductData data)
|
public void SetRecipe(ProductData data)
|
||||||
|
|
@ -55,6 +57,7 @@ public class RecipeView : MonoBehaviour
|
||||||
{
|
{
|
||||||
flavor2View.SetActive(false);
|
flavor2View.SetActive(false);
|
||||||
}
|
}
|
||||||
|
CheckAmount(data);
|
||||||
|
|
||||||
if (data.shopLevel == Const.SpecialShopLevel)
|
if (data.shopLevel == Const.SpecialShopLevel)
|
||||||
{
|
{
|
||||||
|
|
@ -66,6 +69,28 @@ public class RecipeView : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CheckAmount(ProductData productData)
|
||||||
|
{
|
||||||
|
var flag = true;
|
||||||
|
var gameData = GameDataManager.GameData;
|
||||||
|
if (gameData.CornSeed < productData.MaterialList[0].amount)
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
cornAmountText.color = redColor;
|
||||||
|
}
|
||||||
|
if ((gameData.Material.FirstOrDefault(data => data.Id == productData.MaterialList[1].id)?.Amount ?? 0) < productData.MaterialList[1].amount)
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
flavor1AmountText.color = redColor;
|
||||||
|
}
|
||||||
|
if (productData.GetMaterialCount() == 3 && (gameData.Material.FirstOrDefault(data => data.Id == productData.MaterialList[2].id)?.Amount ?? 0) < productData.MaterialList[2].amount)
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
flavor2AmountText.color = redColor;
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetLockPanel(bool hasRecipe)
|
public void SetLockPanel(bool hasRecipe)
|
||||||
{
|
{
|
||||||
lockPanel.SetActive(hasRecipe);
|
lockPanel.SetActive(hasRecipe);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ using UnityEngine.UI;
|
||||||
public class ShopItemPurchaseView : MonoBehaviour
|
public class ShopItemPurchaseView : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static readonly string ItemPurchaseTag = "ItemPurcahse";
|
public static readonly string ItemPurchaseTag = "ItemPurcahse";
|
||||||
private static readonly string redColorString= "#fb6346";
|
|
||||||
private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger");
|
private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger");
|
||||||
private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger");
|
private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger");
|
||||||
private static readonly int MaxPurchaseCount = 999;
|
private static readonly int MaxPurchaseCount = 999;
|
||||||
|
|
@ -36,7 +35,7 @@ public class ShopItemPurchaseView : MonoBehaviour
|
||||||
{
|
{
|
||||||
currentCount.AddTo(this);
|
currentCount.AddTo(this);
|
||||||
defaultColor = totalPrice.color;
|
defaultColor = totalPrice.color;
|
||||||
ColorUtility.TryParseHtmlString(redColorString, out redColor);
|
ColorUtility.TryParseHtmlString(Const.RedColorString, out redColor);
|
||||||
// 表示データを受け取る
|
// 表示データを受け取る
|
||||||
var data = LocalCacheManager.Load<(ShopData shopData, int stockCount, Action<int> callback)>(ItemPurchaseTag);
|
var data = LocalCacheManager.Load<(ShopData shopData, int stockCount, Action<int> callback)>(ItemPurchaseTag);
|
||||||
LocalCacheManager.Remove(ItemPurchaseTag);
|
LocalCacheManager.Remove(ItemPurchaseTag);
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ public static class Const {
|
||||||
public static readonly int DefaultPanId = 1;
|
public static readonly int DefaultPanId = 1;
|
||||||
public static readonly int SpecialShopLevel = 9999;
|
public static readonly int SpecialShopLevel = 9999;
|
||||||
public static readonly int NotSetMaterialId = 0;
|
public static readonly int NotSetMaterialId = 0;
|
||||||
|
public static readonly string RedColorString = "#fb6346";
|
||||||
|
|
||||||
// tag
|
// tag
|
||||||
public static readonly string GameDataTag = "GameData";
|
public static readonly string GameDataTag = "GameData";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue