試食でのお客さん増加追加
This commit is contained in:
parent
a7b2b1dd6f
commit
f28aaa818d
|
|
@ -46,8 +46,6 @@ public class BulkOrder : MonoBehaviour
|
|||
}).AddTo(this);
|
||||
|
||||
var gameData = GameDataManager.GameData;
|
||||
// キャンセルすると試食と同じ扱い
|
||||
// 試食時のお客さんの増加ってどれくらいなんだろ
|
||||
var bulkOrderList = SpreadsheetDataManager.Instance.GetBaseDataList<BulkOrderData>(Const.BulkOrderDataSheet);
|
||||
var messageList = SpreadsheetDataManager.Instance.GetBaseDataList<BulkOrderTextData>(Const.BulkOrderTextDataSheet);
|
||||
var bulkOrderData = bulkOrderList.First(data => data.id == gameData.OrderIdInProgress);
|
||||
|
|
@ -61,7 +59,19 @@ public class BulkOrder : MonoBehaviour
|
|||
{
|
||||
LocalCacheManager.Save(CancelCallbackTag, new Action(() =>
|
||||
{
|
||||
// 試食フラグ
|
||||
// 試食数追加
|
||||
if (gameData.CompletedProductList.Exists(data => data.Number == 1))
|
||||
{
|
||||
gameData.AddTastingCustomerCount(bulkOrderData.count1);
|
||||
}
|
||||
else if (gameData.CompletedProductList.Exists(data => data.Number == 2))
|
||||
{
|
||||
gameData.AddTastingCustomerCount(bulkOrderData.count2);
|
||||
}
|
||||
else if (gameData.CompletedProductList.Exists(data => data.Number == 3))
|
||||
{
|
||||
gameData.AddTastingCustomerCount(bulkOrderData.count3);
|
||||
}
|
||||
gameData.CancelOrderId = gameData.OrderIdInProgress;
|
||||
// カウントリセット
|
||||
gameData.OrderConditionCount = 0;
|
||||
|
|
|
|||
|
|
@ -9,11 +9,14 @@ public class CustomerFlow : MonoBehaviour
|
|||
private IObservable<bool> walkerObservable;
|
||||
private IObservable<bool> adWalkerObservable;
|
||||
private readonly Subject<IObservable<Unit>> adStartObservable = new Subject<IObservable<Unit>>();
|
||||
private IObservable<bool> tastingCustomerObservable;
|
||||
private static readonly float checkHeartInterval = 1f;
|
||||
// 歩行者の出現間隔
|
||||
private static readonly float walkerInterval = 60f / 6;
|
||||
// 試食で来るお客さん間隔
|
||||
private static readonly float tastingCustomerInterval = 5f;
|
||||
|
||||
public IObservable<bool> Flow => walkerObservable.Merge(customerObservable, adWalkerObservable);
|
||||
public IObservable<bool> Flow => walkerObservable.Merge(customerObservable, adWalkerObservable, tastingCustomerObservable);
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
|
@ -32,15 +35,15 @@ public class CustomerFlow : MonoBehaviour
|
|||
// お客さん出現タイマー
|
||||
customerObservable = changeCustomerFlowObservable
|
||||
.DistinctUntilChanged()
|
||||
.Do(x => Debug.Log($"changeInterval:{x}"))
|
||||
.Select(customerInterval => Observable.Interval(TimeSpan.FromSeconds(customerInterval))
|
||||
.Do(_ => Debug.Log($"customer:{GetHashCode()}"))
|
||||
.Select(_ => true))
|
||||
.Switch();
|
||||
// .Do(x => Debug.Log($"changeInterval:{x}"))
|
||||
.Select(customerInterval => Observable.Interval(TimeSpan.FromSeconds(customerInterval)))
|
||||
.Switch()
|
||||
// .Do(_ => Debug.Log($"customer:{GetHashCode()}"))
|
||||
.Select(_ => true);
|
||||
|
||||
// 歩行者出現頻度、立ち止まり確率も設定(歩行者タイマー1分間に6人
|
||||
walkerObservable = Observable.Interval(TimeSpan.FromSeconds(walkerInterval))
|
||||
.Do(l => Debug.Log($"walker:{GetHashCode()}"))
|
||||
// .Do(l => Debug.Log($"walker:{GetHashCode()}"))
|
||||
.Select(x => false);
|
||||
|
||||
// 宣伝時、タップすると60秒だけ稼働するストリーム
|
||||
|
|
@ -54,6 +57,19 @@ public class CustomerFlow : MonoBehaviour
|
|||
// Observable.Timer(TimeSpan.FromSeconds(1f), TimeSpan.FromSeconds(70f)).Subscribe(_ => { adStartObservable.OnNext(default); }).AddTo(this);
|
||||
}
|
||||
#endif
|
||||
// 試食
|
||||
var tastingTimer = Observable.Interval(TimeSpan.FromSeconds(tastingCustomerInterval))
|
||||
.Where(_ => GameDataManager.GameData.TastingCount > 0)
|
||||
.Publish()
|
||||
.RefCount();
|
||||
// 試食残りカウントを減らす
|
||||
tastingTimer.Subscribe(_ =>
|
||||
{
|
||||
GameDataManager.GameData.TastingCount--;
|
||||
});
|
||||
tastingCustomerObservable = tastingTimer
|
||||
// .Do(_ => Debug.Log($"tastingCustomer remain:{GameDataManager.GameData.TastingCount}"))
|
||||
.Select(_ => true);
|
||||
}
|
||||
|
||||
public void StartAdWalker(Action onComplete = null)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ public class TastingView : MonoBehaviour
|
|||
[SerializeField] private Button closeButton;
|
||||
[SerializeField] private Button tastingButton;
|
||||
[SerializeField] private Text popcornName;
|
||||
[SerializeField] private Image popcornImage;
|
||||
[SerializeField] private Transform packageImageTarget;
|
||||
|
||||
private void Start()
|
||||
|
|
|
|||
|
|
@ -98,8 +98,8 @@ public sealed class GameData {
|
|||
[DataMember(Name = "Data25")]
|
||||
private int[] achievedMission;
|
||||
public List<int> AchievedMission;
|
||||
// [DataMember(Name = "Data26")]
|
||||
|
||||
[DataMember(Name = "Data26")]
|
||||
public int TastingCount;
|
||||
|
||||
// BulkOrder
|
||||
[DataMember(Name = "Data27")]
|
||||
|
|
@ -188,6 +188,11 @@ public sealed class GameData {
|
|||
return TotalSalesList.Where(data => data.FlavorId == id).Sum(data => data.Stock);
|
||||
}
|
||||
|
||||
public void AddTastingCustomerCount(int value)
|
||||
{
|
||||
TastingCount += Mathf.FloorToInt(value / 2f);
|
||||
}
|
||||
|
||||
// public void ChangeAvatar(AvatarData avatarData){
|
||||
// newAvatarIdList.Remove(avatarData.id);
|
||||
// }
|
||||
|
|
|
|||
Loading…
Reference in New Issue