販売プロモーション時のアニメーション挙動修正
This commit is contained in:
parent
82bb891385
commit
e3bb5c1c67
|
|
@ -98,10 +98,11 @@ public class BrotherPinkView : SingletonMonoBehaviour<BrotherPinkView>
|
|||
target.localPosition = pinkTransform.localPosition;
|
||||
target.localRotation = pinkTransform.localRotation;
|
||||
}).AddTo(animator);
|
||||
if (!isManyCustomer)
|
||||
if (isManyCustomer || isPromotion)
|
||||
{
|
||||
SetPinkMove();
|
||||
return;
|
||||
}
|
||||
SetPinkMove();
|
||||
}
|
||||
|
||||
private void SetPinkMove()
|
||||
|
|
@ -158,24 +159,28 @@ public class BrotherPinkView : SingletonMonoBehaviour<BrotherPinkView>
|
|||
|
||||
public void StopPromotion()
|
||||
{
|
||||
if (animator == null)
|
||||
if (animator != null)
|
||||
{
|
||||
isPromotion = false;
|
||||
ResetMove();
|
||||
return;
|
||||
var stateInfo = animator.GetCurrentAnimatorStateInfo(0);
|
||||
if (stateInfo.IsName("Brother_pink_promotion"))
|
||||
{
|
||||
var length = stateInfo.length;
|
||||
var time = stateInfo.normalizedTime;
|
||||
this.CallWaitForSeconds((1 - time % 1) * length - .3f, () =>
|
||||
{
|
||||
ResetMove();
|
||||
isPromotion = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
var length = animator.GetCurrentAnimatorStateInfo(0).length;
|
||||
var time = animator.GetCurrentAnimatorStateInfo(0).normalizedTime;
|
||||
this.CallWaitForSeconds((1 - time % 1) * length - .3f, () =>
|
||||
{
|
||||
isPromotion = false;
|
||||
ResetMove();
|
||||
});
|
||||
ResetMove();
|
||||
isPromotion = false;
|
||||
}
|
||||
|
||||
public void SetWalk()
|
||||
{
|
||||
if (isLocked)
|
||||
if (isLocked || isPromotion)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
private readonly ReactiveCollection<CustomerController> waitCustomerList = new ReactiveCollection<CustomerController>();
|
||||
private readonly Subject<Unit> orderSubject = new Subject<Unit>();
|
||||
public readonly BoolReactiveProperty IsPause = new BoolReactiveProperty(false);
|
||||
public IReadOnlyReactiveProperty<bool> IsPromotion => isPromotion;
|
||||
private readonly BoolReactiveProperty isPromotion = new BoolReactiveProperty();
|
||||
|
||||
public Subject<int> SellObservable => sellObservable;
|
||||
private readonly Subject<int> sellObservable = new Subject<int>();
|
||||
|
|
@ -59,6 +61,7 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
requestSubject.AddTo(this);
|
||||
orderSubject.AddTo(this);
|
||||
IsPause.AddTo(this);
|
||||
isPromotion.AddTo(this);
|
||||
|
||||
var gameData = GameDataManager.GameData;
|
||||
|
||||
|
|
@ -99,7 +102,7 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
Debug.Log($"aa order:{count} Request {Time.time} {customer.GetHashCode()}");
|
||||
if (count >= maxOrder)
|
||||
{
|
||||
shopState.Value = ShopState.Busy;
|
||||
// shopState.Value = ShopState.Busy;
|
||||
return;
|
||||
}
|
||||
waitCustomerList.Remove(customer);
|
||||
|
|
@ -149,7 +152,15 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
orders.AddRange(tmpOrders);
|
||||
|
||||
// コーンの味吹き出しを設定
|
||||
controller.SetWantFlavor(displayFlavors[tmpOrders.RandomChoose()]);
|
||||
try
|
||||
{
|
||||
controller.SetWantFlavor(displayFlavors[tmpOrders.RandomChoose()]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"d:{displayFlavors.Count}, {string.Join("", tmpOrders)}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
foreach (var customerController in dontBuyCustomerList)
|
||||
{
|
||||
|
|
@ -513,8 +524,12 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
|
||||
public void AdClickAction()
|
||||
{
|
||||
BrotherPinkView.Instance.StartPromotion();
|
||||
customerFlow.StartAdWalker(() => BrotherPinkView.Instance.StopPromotion());
|
||||
isPromotion.Value = true;
|
||||
customerFlow.StartAdWalker(() =>
|
||||
{
|
||||
isPromotion.Value = false;
|
||||
BrotherPinkView.Instance.StopPromotion();
|
||||
});
|
||||
}
|
||||
|
||||
private void CheckAndFixStock()
|
||||
|
|
|
|||
|
|
@ -28,20 +28,20 @@ public class MarketManager : MonoBehaviour
|
|||
private void Start()
|
||||
{
|
||||
resetRefreshTimer.AddTo(this);
|
||||
market = Market.Instance;
|
||||
|
||||
SoundManager.Instance.PlayBGM("bgm_marketing");
|
||||
var gameData = GameDataManager.GameData;
|
||||
CoinManager.Instance.ChangeCoin(gameData.Coin);
|
||||
HeartMeter.Instance.Initialize(gameData.ViewedShopLevel, gameData.Heart);
|
||||
GameDataObserver.Instance.ShopLevelUpdate
|
||||
.Where(x => x)
|
||||
.Where(x => x && !market.IsPromotion.Value)
|
||||
.Subscribe(x =>
|
||||
{
|
||||
LocalCacheManager.Save(ShopLevelUp.DataTag, gameData.ViewedShopLevel + 1);
|
||||
TransitionManager.Instance.LoadSceneAdditive(GameScenes.StoreLevel);
|
||||
}).AddTo(this);
|
||||
|
||||
market = Market.Instance;
|
||||
productDataList = SpreadsheetDataManager.Instance.GetBaseDataList<ProductData>(Const.ProductDataSheet);
|
||||
stockView.SetStock(gameData.StorageTanks);
|
||||
var startStocks = market.ShuffledOrder.Select(x => (x, market.DisplayFlavors[x])).ToList();
|
||||
|
|
@ -82,6 +82,19 @@ public class MarketManager : MonoBehaviour
|
|||
|
||||
var remaining = (int) DateTime.FromBinary(gameData.increaseCustomerTime).Subtract(DateTime.UtcNow).TotalSeconds;
|
||||
resetRefreshTimer.OnNext(remaining);
|
||||
|
||||
market.IsPromotion.Subscribe(active =>
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
SoundManager.Instance.PlayBGM("bgm_publicity");
|
||||
BrotherPinkView.Instance.StartPromotion();
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundManager.Instance.PlayBGM("bgm_marketing");
|
||||
}
|
||||
}).AddTo(this);
|
||||
|
||||
|
||||
// Customerの各アニメーション設定
|
||||
|
|
@ -127,7 +140,15 @@ public class MarketManager : MonoBehaviour
|
|||
// 補充したフレーバーのスキンを設定
|
||||
foreach (var order in x.refillList)
|
||||
{
|
||||
cartView.Refill(order, market.DisplayFlavors[order]);
|
||||
try
|
||||
{
|
||||
cartView.Refill(order, market.DisplayFlavors[order]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"order:{order}, displayFlavors:{market.DisplayFlavors.Count}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}).AddTo(this);
|
||||
|
|
|
|||
Loading…
Reference in New Issue