カスタマイズ機能購入処理追加/ボーナス情報取得処理追加
This commit is contained in:
parent
391f6a8d1b
commit
a137e3e259
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UniRx;
|
using UniRx;
|
||||||
using UnityEngine;
|
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<ShopCustomizeLevelData>(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<ShopCustomizeBonusData>(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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue