diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomize.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomize.cs index aefe7280..8e6dbc51 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomize.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomize.cs @@ -87,6 +87,7 @@ namespace MyGame.Scenes.marketing.Scripts ShopCustomizePurchaseDialog.ShowDialog(customizeData, false, () => { PurchaseItem(customizeData); + Market.Instance.UpdateBonus(GetBonusList(gameData.ShopCustomizeLevel)); selectSubject.OnNext(Unit.Default); }); }).AddTo(this); @@ -112,28 +113,24 @@ namespace MyGame.Scenes.marketing.Scripts var level = customizeLevelList.LastOrDefault(data => data.point <= gameData.ShopCustomizePoint)?.level ?? 1; gameData.ShopCustomizeLevel = level; GameDataManager.SaveGameData(); - // update bonus } /* * 現在のボーナスレベルと値 */ - public static List<(ShopCustomizeBonusCategory category, (int bonusLevel, int value) bonusData)> GetBonusList(int level) + public static Dictionary GetBonusList(int level) { var customizeBonusList = SpreadsheetDataManager.Instance.GetBaseDataList(Const.ShopCustomizeBonusDataSheet); var categories = (ShopCustomizeBonusCategory[])Enum.GetValues(typeof(ShopCustomizeBonusCategory)); - var list = new List<(ShopCustomizeBonusCategory, (int, int))>(); + var list = new Dictionary(); foreach (var category in categories) { - if (!(customizeBonusList.LastOrDefault(data => data.level <= level) is ShopCustomizeBonusData bonusData)) + if (customizeBonusList.LastOrDefault(data => data.level <= level) is ShopCustomizeBonusData bonusData) { - bonusData = new ShopCustomizeBonusData() - { - bonusLevel = 0, - value = 0, - }; + list.Add(category, (bonusData.bonusLevel, bonusData.value)); + continue; } - list.Add((category, (bonusData.bonusLevel, bonusData.value))); + list.Add(category, (0, 0)); } return list; } diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizeInfoDialog.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizeInfoDialog.cs index 6841cd95..c9552180 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizeInfoDialog.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomizeInfoDialog.cs @@ -48,9 +48,9 @@ namespace MyGame.Scenes.marketing.Scripts pointText.text = "--"; } var list = ShopCustomize.GetBonusList(gameData.ShopCustomizeLevel); - var sales = list.FirstOrDefault(data => data.category == ShopCustomizeBonusCategory.Sales).bonusData.value; - var customer = list.FirstOrDefault(data => data.category == ShopCustomizeBonusCategory.Customer).bonusData.bonusLevel; - var adWalker = list.FirstOrDefault(data => data.category == ShopCustomizeBonusCategory.AdWalker).bonusData.bonusLevel; + var sales = list[ShopCustomizeBonusCategory.Sales].value; + var customer = list[ShopCustomizeBonusCategory.Customer].bonusLevel; + var adWalker = list[ShopCustomizeBonusCategory.AdWalker].bonusLevel; salesBonusText.text = sales == 0 ? "--" : $"+{sales}"; customerBonusText.text = customer == 0 ? "--" : $"Lv.{customer}"; adWalkerBonusText.text = adWalker == 0 ? "--" : $"Lv.{adWalker}";