From 822e194979b4e5581d897313277d4540ac91f008 Mon Sep 17 00:00:00 2001 From: kimura Date: Fri, 29 Oct 2021 10:11:31 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=87=E3=83=90=E3=83=83=E3=82=B0=E3=83=AD?= =?UTF-8?q?=E3=82=B0=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Scenes/marketing/Scripts/Market.cs | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) 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)