タンク購入修正
This commit is contained in:
parent
f177694d10
commit
e63423a875
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue