Esempio n. 1
0
        public override void HandleNotification(INotification notification)
        {
            switch (notification.Name)
            {
            case OrderSystemEvent.CALL_COOK:
                Order order = notification.Body as Order;
                if (null == order)
                {
                    throw new Exception("order is null ,please check it.");
                }
                //todo 分配一个厨师开始做菜
                Debug.Log("厨师接收到前台的订单,开始炒菜:" + order.names);
                SendNotification(OrderSystemEvent.CookCooking, order);
                break;

            case OrderSystemEvent.SERVER_FOOD:
                Debug.Log("厨师通知服务员上菜");
                CookItem cook = notification.Body as CookItem;
                //  Debug.Log(cook.cookOrder.GetType());
                SendNotification(OrderSystemEvent.ResfrshCook);    //刷新一下厨师界面
                SendNotification(OrderSystemEvent.selectWaiter, cook.cookOrder, "SHANGCAI");
                cook.cookOrder = null;
                break;

            case OrderSystemEvent.ResfrshCook:
                cookProxy = Facade.RetrieveProxy(CookProxy.NAME) as CookProxy;
                Debug.Log("刷新厨师状态");
                if (null == cookProxy)
                {
                    throw new Exception(CookProxy.NAME + "is null.");
                }
                CookView.ResfrshCook(cookProxy.Cooks);
                break;;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 炒菜完成
        /// </summary>
        /// <param name="item"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        IEnumerator Cooking(CookItem item, float time = 4)
        {
            item.state = -1;
            yield return(new WaitForSeconds(time));

            item.state = 0;
            Debug.Log(item.cookOrder);
            ServerFood.Invoke(item);
        }
Esempio n. 3
0
 public void RemoveCook(CookItem item)
 {
     Cooks.Remove(item);
 }
Esempio n. 4
0
 public void AddCook(CookItem item)
 {
     Cooks.Add(item);
 }