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