カスタマイズ素材の獲得処理をstatic化

This commit is contained in:
kimura 2022-08-10 15:38:14 +09:00
parent 1da69ea22e
commit 950c9fe8f5
1 changed files with 11 additions and 6 deletions

View File

@ -101,7 +101,7 @@ myItems {string.Join(",", gameData.ShopCustomizeMyItems.Select(x => x.ToString()
ShopCustomizePurchaseDialog.ShowDialog(customizeData, false, () =>
{
PurchaseItem(customizeData);
Market.Instance.UpdateBonus(GetBonusList(gameData.ShopCustomizeLevel));
customizeView.SetLevel(gameData.ShopCustomizeLevel);
selectSubject.OnNext(Unit.Default);
});
}).AddTo(this);
@ -116,19 +116,24 @@ myItems {string.Join(",", gameData.ShopCustomizeMyItems.Select(x => x.ToString()
}
}
private void PurchaseItem(ShopCustomizeData customizeData)
private static void PurchaseItem(ShopCustomizeData customizeData)
{
ShopCustomizeCoinManager.Instance.SubCoin(customizeData.price);
GameDataManager.GameData.ShopCustomizeCoin = ShopCustomizeCoinManager.Instance.OwnCoin;
GetItem(customizeData);
GameDataManager.SaveGameData();
}
public static void GetItem(ShopCustomizeData customizeData)
{
var gameData = GameDataManager.GameData;
ShopCustomizeCoinManager.Instance.SubCoin(customizeData.price);
gameData.ShopCustomizeCoin = ShopCustomizeCoinManager.Instance.OwnCoin;
gameData.ShopCustomizePoint += customizeData.point;
gameData.ShopCustomizeMyItems = gameData.ShopCustomizeMyItems.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();
customizeView.SetLevel(gameData.ShopCustomizeLevel);
Market.Instance.UpdateBonus(GetBonusList(gameData.ShopCustomizeLevel));
}
/*