diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs index 977b9521..1ab96f6d 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs @@ -99,16 +99,17 @@ public class Market : SingletonMonoBehaviour // 購入リクエスト var maxOrder = orderPosisionObject.transform.childCount; - orderSubject.Do(_ => { Debug.Log($"aa orderSubject");}) - .Merge(waitCustomerList.ObserveAdd().AsUnitObservable().Do(_ => { Debug.Log($"aa waitCustomerListAdd");})) - .Merge(shopState.Where(x => x == ShopState.Open).AsUnitObservable().Do(_ => { Debug.Log($"aa shopStateOpen");})) + Observable.Merge( + orderSubject /*.Do(_ => { Debug.Log($"aa orderSubject");})*/, + waitCustomerList.ObserveAdd().AsUnitObservable() /*.Do(_ => { Debug.Log($"aa waitCustomerListAdd");})*/, + shopState.Where(x => x == ShopState.Open).AsUnitObservable() /*.Do(_ => { Debug.Log($"aa shopStateOpen");})*/ + ) .BatchFrame() .Where(_ => waitCustomerList.Count > 0) .SelectMany(_ => waitCustomerList.ToList().GetRange(0, Mathf.Min(maxOrder, waitCustomerList.Count))) .Subscribe(customer => { var count = customerList.Count(x => x.State.Value == CustomerState.Order); - Debug.Log($"aa order:{count} Request {Time.time} {customer.GetHashCode()}"); if (count >= maxOrder) { // shopState.Value = ShopState.Busy; @@ -171,8 +172,17 @@ public class Market : SingletonMonoBehaviour } catch (Exception e) { - Debug.LogError($"d:{displayFlavors.Count}, {string.Join("", tmpOrders)}"); - throw; + Debug.LogError($"d:{displayFlavors.Count}, {string.Join("", tmpOrders)}" + + $"\nshuffled:{shuffledOrder.Count}, maxNum:{shuffledOrder.Max()}"); + /* + * 例外握りつぶし + * 存在しないorderを引いたのでそのまま処理せず逃がす + */ + controller.CallWaitForSeconds(1.5f, () => + { + controller.ChangeCustomerState(CustomerState.Leave); + }); + dontBuyCustomerList.Add(controller); } } foreach (var customerController in dontBuyCustomerList)