非消費アイテムの購入ポップアップ挙動変更
This commit is contained in:
parent
7d6f00927c
commit
91534c9272
|
|
@ -277,6 +277,7 @@ MonoBehaviour:
|
|||
name: {fileID: 9133304336883555433}
|
||||
icon: {fileID: 9133304335605570096}
|
||||
price: {fileID: 9133304336128604254}
|
||||
text: {fileID: 9133304336181127572}
|
||||
stockCount: {fileID: 9133304336153810480}
|
||||
totalPrice: {fileID: 9133304335494687832}
|
||||
purchaseCount: {fileID: 9133304336756314526}
|
||||
|
|
@ -285,6 +286,8 @@ MonoBehaviour:
|
|||
closeButton: {fileID: 9133304335940276437}
|
||||
purchaseOnButton: {fileID: 9133304335268316946}
|
||||
purchaseOffButton: {fileID: 7845949066005219734}
|
||||
quantitySelectObject: {fileID: 9133304337054428179}
|
||||
explanationObject: {fileID: 9133304336181127570}
|
||||
--- !u!1 &9133304335268316944
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using UnityEngine.UI;
|
|||
public class ShopItemPurchaseView : MonoBehaviour
|
||||
{
|
||||
public static readonly string ItemPurchaseTag = "ItemPurcahse";
|
||||
private static readonly string redColorString= "fb6346";
|
||||
private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger");
|
||||
private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger");
|
||||
private static readonly int MaxPurchaseCount = 999;
|
||||
|
|
@ -15,6 +16,7 @@ public class ShopItemPurchaseView : MonoBehaviour
|
|||
[SerializeField] private Text name;
|
||||
[SerializeField] private Transform icon;
|
||||
[SerializeField] private Text price;
|
||||
[SerializeField] private Text text;
|
||||
[SerializeField] private Text stockCount;
|
||||
[SerializeField] private Text totalPrice;
|
||||
[SerializeField] private Text purchaseCount;
|
||||
|
|
@ -23,13 +25,18 @@ public class ShopItemPurchaseView : MonoBehaviour
|
|||
[SerializeField] private Button closeButton;
|
||||
[SerializeField] private Button purchaseOnButton;
|
||||
[SerializeField] private GameObject purchaseOffButton;
|
||||
[SerializeField] private GameObject quantitySelectObject;
|
||||
[SerializeField] private GameObject explanationObject;
|
||||
|
||||
private Color redColor;
|
||||
private Color defaultColor;
|
||||
private readonly IntReactiveProperty currentCount = new IntReactiveProperty();
|
||||
private void Start()
|
||||
{
|
||||
currentCount.AddTo(this);
|
||||
defaultColor = totalPrice.color;
|
||||
ColorUtility.TryParseHtmlString(redColorString, out redColor);
|
||||
// 表示データを受け取る
|
||||
var data = LocalCacheManager.Load<(ShopData shopData, int stockCount, Action<int> callback)>(ItemPurchaseTag);
|
||||
LocalCacheManager.Remove(ItemPurchaseTag);
|
||||
SetData(data.shopData, data.stockCount);
|
||||
|
|
@ -58,10 +65,12 @@ public class ShopItemPurchaseView : MonoBehaviour
|
|||
{
|
||||
var total = data.shopData.price * x;
|
||||
SetButtonActive(total <= CoinManager.Instance.OwnCoin);
|
||||
totalPrice.color = total <= CoinManager.Instance.OwnCoin ? defaultColor : Color.red;
|
||||
totalPrice.color = total <= CoinManager.Instance.OwnCoin ? defaultColor : redColor;
|
||||
totalPrice.text = $"{total}";
|
||||
purchaseCount.text = $"{x}";
|
||||
}).AddTo(this);
|
||||
quantitySelectObject.SetActive(data.shopData.ConsumeType == ShopItemType.Consumable);
|
||||
explanationObject.SetActive(data.shopData.ConsumeType == ShopItemType.NonConsumable);
|
||||
if (data.shopData.ConsumeType == ShopItemType.Consumable)
|
||||
{
|
||||
addCountButton.OnClickAsObservable().Select(_ => 1)
|
||||
|
|
@ -82,6 +91,7 @@ public class ShopItemPurchaseView : MonoBehaviour
|
|||
name.text = shopData.name;
|
||||
price.text = $"{shopData.price}";
|
||||
stockCount.text = $"所持数 :{count}";
|
||||
text.text = shopData.text;
|
||||
}
|
||||
|
||||
private void SetButtonActive(bool active)
|
||||
|
|
|
|||
Loading…
Reference in New Issue