public void RemoveWaiter(WaiterItem item) { for (int i = 0; i < Waiters.Count; i++) { if (item.id == Waiters[i].id) { Waiters[i].state = 0; SendNotification(OrderSystemEvent.ResfrshWarite); return; } } }
public override void HandleNotification(INotification notification) { Debug.Log(notification.Name); switch (notification.Name) { case OrderSystemEvent.CALL_WAITER: ClientItem client = notification.Body as ClientItem; Debug.Log(client.id + " 号桌顾客呼叫服务员 , 索要菜单 "); // SendNotification(OrderSystemEvent.CALL_WAITER,client); break; case OrderSystemEvent.ORDER: Order order1 = notification.Body as Order; if (null == order1) { throw new Exception("order1 is null ,please check it!"); } order1.client.state++; View.UpdateState(order1.client); break; case OrderSystemEvent.PAY: // Order finishOrder = notification.Body as Order; WaiterItem item = notification.Body as WaiterItem; // if ( null == finishOrder ) // throw new Exception("finishOrder is null ,please check it!"); View.UpdateState(item.order.client); ////-------------------------------- ////自己填的 //SendNotification(OrderSystemEvent.CALL_Room); ////------------------------------------- break; case OrderSystemEvent.ADD_GUEST: Debug.Log("刷新界面"); //clientProxy = Facade.RetrieveProxy(ClientProxy.NAME) as ClientProxy; ClientItem clientItem = notification.Body as ClientItem; if (null == clientProxy) { throw new Exception("获取" + ClientProxy.NAME + "代理失败"); } View.UpdateState(clientItem); break; } }
/// <summary> /// 查找空闲状态的服务员 /// </summary> public void ChangeWaiter(Order order) { //UnityEngine.Debug.LogWarning(Waiters[0].name+""+ Waiters[0].state); //UnityEngine.Debug.LogWarning(Waiters[1].name + "" + Waiters[1].state); //UnityEngine.Debug.LogWarning(Waiters[2].name + "" + Waiters[2].state); WaiterItem item = GetIdleWaiter(); if (item != null) { UnityEngine.Debug.LogWarning("2222"); item.state = 1; item.order = order; //发送消息改变了服务员的属性 SendNotification(OrderSystemEvent.ResfrshWarite); SendNotification(OrderSystemEvent.FOOD_TO_CLIENT, item);//发送炒好的菜单信息 } }
public override void HandleNotification(INotification notification) { switch (notification.Name) { case OrderSystemEvent.CALL_WAITER: ClientItem client = notification.Body as ClientItem; Debug.Log("aaa"); SendNotification(OrderSystemEvent.GET_ORDER, client, "Get"); //请求获取菜单的命令 GetAndExitOrderCommed break; case OrderSystemEvent.ORDER: SendNotification(OrderSystemEvent.CALL_COOK, notification.Body); break; case OrderSystemEvent.GET_PAY: Debug.Log(" 服务员拿到顾客的付款 "); ClientItem item = notification.Body as ClientItem; // SendNotification(OrderSystemEvent.selectWaiter, item, "WANSHI"); //付完款之和将服务员状态变更 //SendNotification(OrderSystemEvent.GUEST_BE_AWAY, item, "Remove"); SendNotification(OrderSystemEvent.GET_ORDER, item, "GetHouse"); SendNotification(OrderSystemEvent.GUEST_BE_AWAY, item, "Remove"); break; case OrderSystemEvent.FOOD_TO_CLIENT: Debug.Log(" 服务员上菜 "); // Debug.Log(notification.Body.GetType()); WaiterItem waiterItem = notification.Body as WaiterItem; waiterItem.order.client.state++; SendNotification(OrderSystemEvent.PAY, waiterItem); break; case OrderSystemEvent.ResfrshWarite: waiterProxy = Facade.RetrieveProxy(WaiterProxy.NAME) as WaiterProxy; WaiterView.Move(waiterProxy.Waiters); //刷新一下服务员的状态 break; case OrderSystemEvent.EndPay: Order order = notification.Body as Order; break; } }
public void RemoveWaiter(WaiterItem item) { Waiters.Remove(item); }
public void AddWaiter(WaiterItem item) { Waiters.Add(item); }
public void Move(WaiterItem waiter, ClientItem client) { }
IEnumerator WaiterServing(WaiterItem item, float time = 4) { yield return(new WaitForSeconds(time)); ServerFood.Invoke(item); }