From a137e3e2598ed7417f814d15717c4b532601540a Mon Sep 17 00:00:00 2001 From: kimura Date: Fri, 13 May 2022 10:54:30 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=AB=E3=82=B9=E3=82=BF=E3=83=9E=E3=82=A4?= =?UTF-8?q?=E3=82=BA=E6=A9=9F=E8=83=BD=E8=B3=BC=E5=85=A5=E5=87=A6=E7=90=86?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0/=E3=83=9C=E3=83=BC=E3=83=8A=E3=82=B9?= =?UTF-8?q?=E6=83=85=E5=A0=B1=E5=8F=96=E5=BE=97=E5=87=A6=E7=90=86=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scenes/marketing/Scripts/ShopCustomize.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomize.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomize.cs index 714391bf..67a49d12 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomize.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ShopCustomize.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using UniRx; using UnityEngine; @@ -80,5 +81,42 @@ namespace MyGame.Scenes.marketing.Scripts } } } + + private void PurchaseItem(ShopCustomizeData customizeData) + { + var gameData = GameDataManager.GameData; + gameData.ShopCustomizeCoin -= customizeData.price; + gameData.ShopCustomizePoint += customizeData.point; + gameData.MyRecipes = gameData.MyRecipes.Append(customizeData.id).ToArray(); + + var customizeLevelList = SpreadsheetDataManager.Instance.GetBaseDataList(Const.ShopCustomizeLevelDataSheet); + 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) + { + var customizeBonusList = SpreadsheetDataManager.Instance.GetBaseDataList(Const.ShopCustomizeBonusDataSheet); + var categories = (ShopCustomizeBonusCategory[])Enum.GetValues(typeof(ShopCustomizeBonusCategory)); + var list = new List<(ShopCustomizeBonusCategory, (int, int))>(); + foreach (var category in categories) + { + if (!(customizeBonusList.LastOrDefault(data => data.level <= level) is ShopCustomizeBonusData bonusData)) + { + bonusData = new ShopCustomizeBonusData() + { + bonusLevel = 0, + value = 0, + }; + } + list.Add((category, (bonusData.bonusLevel, bonusData.value))); + } + return list; + } } } \ No newline at end of file