Exemplo 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;;
            }
        }
Exemplo n.º 2
0
        public override void Execute(INotification notification)
        {
            //菜单代理
            MenuProxy menuProxy = new MenuProxy();

            Facade.RegisterProxy(menuProxy);

            //住房菜单代理
            HomeMenuProxy homeMenuProxy = new HomeMenuProxy();

            Facade.RegisterProxy(homeMenuProxy);


            //客户端代理
            ClientProxy clientProxy = new ClientProxy();

            Facade.RegisterProxy(clientProxy);

            //服务员代理
            WaiterProxy waitProxy = new WaiterProxy();

            Facade.RegisterProxy(waitProxy);

            //厨师代理
            CookProxy cookProxy = new CookProxy();

            Facade.RegisterProxy(cookProxy);

            OrderProxy orderProxy = new OrderProxy();

            Facade.RegisterProxy(orderProxy);

            MainUI mainUI = notification.Body as MainUI;
            //客房代理
            HomeProxy homeProxy = new HomeProxy();

            Facade.RegisterProxy(homeProxy);


            if (null == mainUI)
            {
                throw new Exception("程序启动失败..");
            }
            Facade.RegisterMediator(new MenuMediator(mainUI.MenuView));
            Facade.RegisterMediator(new HomeMenuMediator(mainUI.HomeMenuView));
            Facade.RegisterMediator(new ClientMediator(mainUI.ClientView));
            Facade.RegisterMediator(new WaiterMediator(mainUI.WaitView));
            Facade.RegisterMediator(new CookMediator(mainUI.CookView));
            Facade.RegisterMediator(new HomeMedator(mainUI.HomeView));


            Facade.RegisterCommand(OrderSystemEvent.GUEST_BE_AWAY, typeof(GuestBeAwayCommed));
            Facade.RegisterCommand(OrderSystemEvent.GET_ORDER, typeof(GetAndExitOrderCommed));
            Facade.RegisterCommand(OrderSystemEvent.CookCooking, typeof(CookCommend));
            Facade.RegisterCommand(OrderSystemEvent.selectWaiter, typeof(WaiterCommend));
            Facade.RegisterCommand(OrderSystemEvent.FindHouse, typeof(HomeAwayCommed));
        }
Exemplo n.º 3
0
 public override void OnRegister( )
 {
     base.OnRegister();
     cookProxy = Facade.RetrieveProxy(CookProxy.NAME) as CookProxy;
     if (null == cookProxy)
     {
         throw new Exception(CookProxy.NAME + "is null.");
     }
     CookView.UpdateCook(cookProxy.Cooks);
 }
Exemplo n.º 4
0
        public override void Execute(INotification notification)
        {
            //菜单代理
            MenuProxy menuProxy = new MenuProxy();

            Facade.RegisterProxy(menuProxy);

            //客户端代理
            ClientProxy clientProxy = new ClientProxy();

            Facade.RegisterProxy(clientProxy);

            //服务员代理
            WaiterProxy waitProxy = new WaiterProxy();

            Facade.RegisterProxy(waitProxy);

            //厨师代理
            CookProxy cookProxy = new CookProxy();

            Facade.RegisterProxy(cookProxy);

            //-----------------------------------------
            //自己填的客房代理
            RoomProxy roomProxy = new RoomProxy();

            Facade.RegisterProxy(roomProxy);
            //---------------------------------------

            OrderProxy orderProxy = new OrderProxy();

            Facade.RegisterProxy(orderProxy);

            MainUI mainUI = notification.Body as MainUI;

            if (null == mainUI)
            {
                throw new Exception("程序启动失败..");
            }
            Facade.RegisterMediator(new MenuMediator(mainUI.MenuView));
            Facade.RegisterMediator(new ClientMediator(mainUI.ClientView));
            Facade.RegisterMediator(new WaiterMediator(mainUI.WaitView));
            Facade.RegisterMediator(new CookMediator(mainUI.CookView));
            //----------------------------
            //自己填的客房命令
            Facade.RegisterMediator(new RoomMediator(mainUI.roomView));

            //--------------------------------------
            Facade.RegisterCommand(OrderSystemEvent.GUEST_BE_AWAY, typeof(GuestBeAwayCommed));
            Facade.RegisterCommand(OrderSystemEvent.GET_ORDER, typeof(GetAndExitOrderCommed));
            Facade.RegisterCommand(OrderSystemEvent.CookCooking, typeof(CookCommend));
            Facade.RegisterCommand(OrderSystemEvent.selectWaiter, typeof(WaiterCommend));
            Facade.RegisterCommand(OrderSystemEvent.Rooming, typeof(RoomCommand));
        }
Exemplo n.º 5
0
        public override void Execute(INotification notification)
        {
            //菜单代理
            MenuProxy menuProxy = new MenuProxy();

            Facade.RegisterProxy(menuProxy);

            //客户端代理
            ClientProxy clientProxy = new ClientProxy();

            Facade.RegisterProxy(clientProxy);

            //服务员代理
            WaiterProxy waitProxy = new WaiterProxy();

            Facade.RegisterProxy(waitProxy);

            //厨师代理
            CookProxy cookProxy = new CookProxy();

            Facade.RegisterProxy(cookProxy);

            //订单代理
            OrderProxy orderProxy = new OrderProxy();

            Facade.RegisterProxy(orderProxy);

            MainUI mainUI = notification.Body as MainUI;

            if (null == mainUI)
            {
                throw new Exception("程序启动失败..");
            }


            Facade.RegisterMediator(new MenuMediator(mainUI.MenuView));
            Facade.RegisterMediator(new ClientMediator(mainUI.ClientView));
            Facade.RegisterMediator(new WaiterMediator(mainUI.WaitView));
            Facade.RegisterMediator(new CookMediator(mainUI.CookView));
        }