レシピ獲得可能時にお知らせアイコン表示対応(フッターと仕入れ内レシピタブ)

This commit is contained in:
kimura 2021-12-14 14:33:27 +09:00
parent 0f9e805224
commit e52e854481
4 changed files with 40 additions and 2 deletions

View File

@ -939,6 +939,7 @@ MonoBehaviour:
stockButton: {fileID: 5274539976409466502} stockButton: {fileID: 5274539976409466502}
saleButton: {fileID: 3508757909112374925} saleButton: {fileID: 3508757909112374925}
productManagementButton: {fileID: 4134779366559125937} productManagementButton: {fileID: 4134779366559125937}
stockNotifyIcon: {fileID: 2430043917671370164}
--- !u!1 &3310671341662576997 --- !u!1 &3310671341662576997
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3749,3 +3750,9 @@ RectTransform:
type: 3} type: 3}
m_PrefabInstance: {fileID: 6632112567178762520} m_PrefabInstance: {fileID: 6632112567178762520}
m_PrefabAsset: {fileID: 0} 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}

View File

@ -9,6 +9,8 @@ using UnityEngine;
public class Shopping : MonoBehaviour public class Shopping : MonoBehaviour
{ {
[SerializeField] private ShopListView listView; [SerializeField] private ShopListView listView;
[SerializeField] private GameObject recipeNotifyIcon;
// Start is called before the first frame update // Start is called before the first frame update
private Subject<int> changeCoinSubject = new Subject<int>(); private Subject<int> changeCoinSubject = new Subject<int>();
void Start() void Start()
@ -103,6 +105,7 @@ public class Shopping : MonoBehaviour
AddItem(shopData, 1); AddItem(shopData, 1);
itemView.SetStockCount(GetItemAmount(shopData)); itemView.SetStockCount(GetItemAmount(shopData));
GameDataManager.SaveGameData(); GameDataManager.SaveGameData();
recipeNotifyIcon.SetActive(CheckEarnedRecipe());
}); });
}).AddTo(itemView); }).AddTo(itemView);
@ -116,6 +119,8 @@ public class Shopping : MonoBehaviour
listView.SetTab(ItemCategory.Material); listView.SetTab(ItemCategory.Material);
changeCoinSubject.OnNext(CoinManager.Instance.OwnCoin); changeCoinSubject.OnNext(CoinManager.Instance.OwnCoin);
recipeNotifyIcon.SetActive(CheckEarnedRecipe());
if (isTutorial) if (isTutorial)
{ {
listView.ScrollRect.vertical = false; 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; var gameData = GameDataManager.GameData;
switch (shopData.Category) switch (shopData.Category)
@ -184,4 +189,20 @@ public class Shopping : MonoBehaviour
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
} }
public static bool CheckEarnedRecipe()
{
var shopDataList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopData>(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;
}
} }

View File

@ -282,6 +282,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f77652346b24cc9b0d5da516979f736, type: 3} m_Script: {fileID: 11500000, guid: 4f77652346b24cc9b0d5da516979f736, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: 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 --- !u!1 &980038342
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -312,6 +318,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
listView: {fileID: 715888784} listView: {fileID: 715888784}
recipeNotifyIcon: {fileID: 856397973}
--- !u!4 &980038345 --- !u!4 &980038345
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -12,6 +12,7 @@ public class FooterManager : MonoBehaviour
[SerializeField] private FooterButton stockButton; [SerializeField] private FooterButton stockButton;
[SerializeField] private FooterButton saleButton; [SerializeField] private FooterButton saleButton;
[SerializeField] private FooterButton productManagementButton; [SerializeField] private FooterButton productManagementButton;
[SerializeField] private GameObject stockNotifyIcon;
private void Start() private void Start()
{ {
@ -35,5 +36,7 @@ public class FooterManager : MonoBehaviour
{ {
TransitionManager.Instance.LoadScene(x); TransitionManager.Instance.LoadScene(x);
}).AddTo(this); }).AddTo(this);
stockNotifyIcon.SetActive(Shopping.CheckEarnedRecipe());
} }
} }