diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs index c8f908c5..44017713 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs @@ -88,13 +88,13 @@ public class ProductManagement : MonoBehaviour tankView.SetState(isSmallest ? TankState.Lock : TankState.Unavailable); // タンク購入 var shopData = shopDataList.First(data => data.id == Const.ShopTankId); - shopData.price = PriceList[tankView.TankNumber - 1]; + var price = PriceList[tankView.TankNumber - 1]; // 購入可否 - tankView.SetCanBuy(shopData.price <= CoinManager.Instance.OwnCoin); + tankView.SetCanBuy(price <= CoinManager.Instance.OwnCoin); tankView.PurchaseButtonObservable - .Where(_ => shopData.price <= CoinManager.Instance.OwnCoin) + .Where(_ => price <= CoinManager.Instance.OwnCoin) .TakeWhile(_ => tankView.State.Value == TankState.Lock || tankView.State.Value == TankState.Unavailable) .Subscribe(_ => { @@ -104,7 +104,7 @@ public class ProductManagement : MonoBehaviour gameData.StorageTanks.Add(new StorageTank { Capacity = Const.TankCapacity }); tankView.SetData(gameData.StorageTanks[tankView.TankNumber - 1]); tankView.SetState(TankState.Unlock); - CoinManager.Instance.SubCoin(shopData.price); + CoinManager.Instance.SubCoin(price); gameData.Coin = CoinManager.Instance.OwnCoin; GameDataManager.SaveGameData(); // 次に大きいタンクの購入ボタンを表示 @@ -115,7 +115,7 @@ public class ProductManagement : MonoBehaviour } } - shopData.price = PriceList[tankView.TankNumber - 1]; + shopData.price = price; ShopItemPurchaseView.ShowDialog((shopData, 0), PurchaseAction); }).AddTo(tankView); }