diff --git a/popcorn/Assets/MyGame/Scenes/Main/Prefabs/UI/Footer.prefab b/popcorn/Assets/MyGame/Scenes/Main/Prefabs/UI/Footer.prefab index 1df7d8d1..47333e7d 100644 --- a/popcorn/Assets/MyGame/Scenes/Main/Prefabs/UI/Footer.prefab +++ b/popcorn/Assets/MyGame/Scenes/Main/Prefabs/UI/Footer.prefab @@ -939,6 +939,7 @@ MonoBehaviour: stockButton: {fileID: 5274539976409466502} saleButton: {fileID: 3508757909112374925} productManagementButton: {fileID: 4134779366559125937} + stockNotifyIcon: {fileID: 2430043917671370164} --- !u!1 &3310671341662576997 GameObject: m_ObjectHideFlags: 0 @@ -3749,3 +3750,9 @@ RectTransform: type: 3} m_PrefabInstance: {fileID: 6632112567178762520} m_PrefabAsset: {fileID: 0} +--- !u!1 &2430043917671370164 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 9056949049436837036, guid: f8587bb162250fa48947d648e934781e, + type: 3} + m_PrefabInstance: {fileID: 6632112567178762520} + m_PrefabAsset: {fileID: 0} diff --git a/popcorn/Assets/MyGame/Scenes/shopping/Scripts/Shopping.cs b/popcorn/Assets/MyGame/Scenes/shopping/Scripts/Shopping.cs index 047cec4f..b9e4a8b8 100644 --- a/popcorn/Assets/MyGame/Scenes/shopping/Scripts/Shopping.cs +++ b/popcorn/Assets/MyGame/Scenes/shopping/Scripts/Shopping.cs @@ -9,6 +9,8 @@ using UnityEngine; public class Shopping : MonoBehaviour { [SerializeField] private ShopListView listView; + [SerializeField] private GameObject recipeNotifyIcon; + // Start is called before the first frame update private Subject changeCoinSubject = new Subject(); void Start() @@ -103,6 +105,7 @@ public class Shopping : MonoBehaviour AddItem(shopData, 1); itemView.SetStockCount(GetItemAmount(shopData)); GameDataManager.SaveGameData(); + recipeNotifyIcon.SetActive(CheckEarnedRecipe()); }); }).AddTo(itemView); @@ -116,6 +119,8 @@ public class Shopping : MonoBehaviour listView.SetTab(ItemCategory.Material); changeCoinSubject.OnNext(CoinManager.Instance.OwnCoin); + recipeNotifyIcon.SetActive(CheckEarnedRecipe()); + if (isTutorial) { listView.ScrollRect.vertical = false; @@ -133,7 +138,7 @@ public class Shopping : MonoBehaviour } } - private int GetItemAmount(ShopData shopData) + private static int GetItemAmount(ShopData shopData) { var gameData = GameDataManager.GameData; switch (shopData.Category) @@ -184,4 +189,20 @@ public class Shopping : MonoBehaviour throw new ArgumentOutOfRangeException(); } } + + public static bool CheckEarnedRecipe() + { + var shopDataList = SpreadsheetDataManager.Instance.GetBaseDataList(Const.ShopDataSheet); + var adCount = GameDataManager.GameData.adCount; + foreach (var shopData in shopDataList.Where(data => data.Category == ItemCategory.Recipe)) + { + if (GetItemAmount(shopData) > 0) continue; + if (shopData.price <= adCount) + { + return true; + } + } + + return false; + } } diff --git a/popcorn/Assets/MyGame/Scenes/shopping/shopping.unity b/popcorn/Assets/MyGame/Scenes/shopping/shopping.unity index 76eb1628..725b6f1b 100644 --- a/popcorn/Assets/MyGame/Scenes/shopping/shopping.unity +++ b/popcorn/Assets/MyGame/Scenes/shopping/shopping.unity @@ -282,6 +282,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4f77652346b24cc9b0d5da516979f736, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &856397973 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 373226152936786244, guid: 667a93fb2929943078b944050cddd464, + type: 3} + m_PrefabInstance: {fileID: 3078490422721459368} + m_PrefabAsset: {fileID: 0} --- !u!1 &980038342 GameObject: m_ObjectHideFlags: 0 @@ -312,6 +318,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: listView: {fileID: 715888784} + recipeNotifyIcon: {fileID: 856397973} --- !u!4 &980038345 Transform: m_ObjectHideFlags: 0 diff --git a/popcorn/Assets/MyGame/Scripts/FooterManager.cs b/popcorn/Assets/MyGame/Scripts/FooterManager.cs index f30ae2fc..82083bb7 100644 --- a/popcorn/Assets/MyGame/Scripts/FooterManager.cs +++ b/popcorn/Assets/MyGame/Scripts/FooterManager.cs @@ -12,7 +12,8 @@ public class FooterManager : MonoBehaviour [SerializeField] private FooterButton stockButton; [SerializeField] private FooterButton saleButton; [SerializeField] private FooterButton productManagementButton; - + [SerializeField] private GameObject stockNotifyIcon; + private void Start() { if (!Enum.TryParse(SceneManager.GetActiveScene().name, out var currentSceneName)) @@ -35,5 +36,7 @@ public class FooterManager : MonoBehaviour { TransitionManager.Instance.LoadScene(x); }).AddTo(this); + + stockNotifyIcon.SetActive(Shopping.CheckEarnedRecipe()); } } \ No newline at end of file