お客さんの吹き出しに買う個数を表示
This commit is contained in:
parent
2f986d19b5
commit
9504909bcc
|
|
@ -5624,6 +5624,7 @@ MonoBehaviour:
|
||||||
rightPopcornTarget: {fileID: 8759972247495498057}
|
rightPopcornTarget: {fileID: 8759972247495498057}
|
||||||
frontPopcornTarget: {fileID: 2262857044639259982}
|
frontPopcornTarget: {fileID: 2262857044639259982}
|
||||||
wantFlavorSpriteTarget: {fileID: 4886416730275037410}
|
wantFlavorSpriteTarget: {fileID: 4886416730275037410}
|
||||||
|
wantFlavorAmountText: {fileID: 364609804150918069}
|
||||||
--- !u!114 &7213583640106143312
|
--- !u!114 &7213583640106143312
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
|
using TMPro;
|
||||||
using UniRx;
|
using UniRx;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class CustomerAnimator : MonoBehaviour
|
public class CustomerAnimator : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public static readonly string WantFlavorAmountFormat = "x{0}";
|
||||||
|
|
||||||
public static readonly int WalkFront = Animator.StringToHash("WalkFront");
|
public static readonly int WalkFront = Animator.StringToHash("WalkFront");
|
||||||
public static readonly int WalkSide = Animator.StringToHash("WalkSide");
|
public static readonly int WalkSide = Animator.StringToHash("WalkSide");
|
||||||
public static readonly int WalkBack = Animator.StringToHash("WalkBack");
|
public static readonly int WalkBack = Animator.StringToHash("WalkBack");
|
||||||
|
|
@ -22,6 +25,7 @@ public class CustomerAnimator : MonoBehaviour
|
||||||
[SerializeField] private Transform rightPopcornTarget;
|
[SerializeField] private Transform rightPopcornTarget;
|
||||||
[SerializeField] private Transform frontPopcornTarget;
|
[SerializeField] private Transform frontPopcornTarget;
|
||||||
[SerializeField] private Transform wantFlavorSpriteTarget;
|
[SerializeField] private Transform wantFlavorSpriteTarget;
|
||||||
|
[SerializeField] private TextMeshPro wantFlavorAmountText;
|
||||||
|
|
||||||
private readonly ReactiveProperty<int> triggerName = new ReactiveProperty<int>();
|
private readonly ReactiveProperty<int> triggerName = new ReactiveProperty<int>();
|
||||||
|
|
||||||
|
|
@ -83,7 +87,7 @@ public class CustomerAnimator : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetWantFlavor(MarketPopcornView prefab, ProductRarity rarity)
|
public void SetWantFlavor(MarketPopcornView prefab, ProductRarity rarity, int amount)
|
||||||
{
|
{
|
||||||
leftPopcornTarget.DestroyAllChildrens();
|
leftPopcornTarget.DestroyAllChildrens();
|
||||||
rightPopcornTarget.DestroyAllChildrens();
|
rightPopcornTarget.DestroyAllChildrens();
|
||||||
|
|
@ -93,6 +97,8 @@ public class CustomerAnimator : MonoBehaviour
|
||||||
Instantiate(prefab, rightPopcornTarget).ChangeRarity(rarity);
|
Instantiate(prefab, rightPopcornTarget).ChangeRarity(rarity);
|
||||||
Instantiate(prefab, frontPopcornTarget).ChangeRarity(rarity);
|
Instantiate(prefab, frontPopcornTarget).ChangeRarity(rarity);
|
||||||
Instantiate(prefab, wantFlavorSpriteTarget).ChangeRarity(rarity);
|
Instantiate(prefab, wantFlavorSpriteTarget).ChangeRarity(rarity);
|
||||||
|
|
||||||
|
wantFlavorAmountText.text = String.Format(WantFlavorAmountFormat, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowWantFlavor()
|
public void ShowWantFlavor()
|
||||||
|
|
|
||||||
|
|
@ -302,17 +302,22 @@ public class MarketManager : MonoBehaviour
|
||||||
customerAnimator.SetSide(x);
|
customerAnimator.SetSide(x);
|
||||||
}).AddTo(customerAnimator);
|
}).AddTo(customerAnimator);
|
||||||
// フレーバー設定
|
// フレーバー設定
|
||||||
if (productDataList.FirstOrDefault(data => data.id == (controller.WantFlavor.Value?.FlavorId ?? -1))?.GetMarketPrefab() is MarketPopcornView initialPrefab)
|
controller.WantFlavor
|
||||||
{
|
.FirstOrDefault()
|
||||||
customerAnimator.SetWantFlavor(initialPrefab, controller.WantFlavor.Value.Rarity);
|
.Subscribe(wantData =>
|
||||||
}
|
{
|
||||||
|
if (productDataList.FirstOrDefault(data => data.id == wantData?.FlavorId)?.GetMarketPrefab() is MarketPopcornView prefab)
|
||||||
|
{
|
||||||
|
customerAnimator.SetWantFlavor(prefab, wantData.Rarity, controller.OrderCount);
|
||||||
|
}
|
||||||
|
}).AddTo(customerAnimator);
|
||||||
controller.WantFlavor
|
controller.WantFlavor
|
||||||
.SkipLatestValueOnSubscribe()
|
.SkipLatestValueOnSubscribe()
|
||||||
.Subscribe(wantData =>
|
.Subscribe(wantData =>
|
||||||
{
|
{
|
||||||
if (productDataList.FirstOrDefault(data => data.id == wantData.FlavorId)?.GetMarketPrefab() is MarketPopcornView prefab)
|
if (productDataList.FirstOrDefault(data => data.id == wantData.FlavorId)?.GetMarketPrefab() is MarketPopcornView prefab)
|
||||||
{
|
{
|
||||||
customerAnimator.SetWantFlavor(prefab, wantData.Rarity);
|
customerAnimator.SetWantFlavor(prefab, wantData.Rarity, controller.OrderCount);
|
||||||
customerAnimator.ShowWantFlavor();
|
customerAnimator.ShowWantFlavor();
|
||||||
}
|
}
|
||||||
}).AddTo(customerAnimator);
|
}).AddTo(customerAnimator);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue