예제 #1
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));
        }
예제 #2
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));
        }
예제 #3
0
 public override void OnRegister( )
 {
     base.OnRegister();
     waiterProxy = Facade.RetrieveProxy(WaiterProxy.NAME) as WaiterProxy;
     orderProxy  = Facade.RetrieveProxy(OrderProxy.NAME) as OrderProxy;
     if (null == waiterProxy)
     {
         throw new Exception(WaiterProxy.NAME + "is null,please check it!");
     }
     if (null == orderProxy)
     {
         throw new Exception(OrderProxy.NAME + "is null,please check it!");
     }
     WaiterView.UpdateWaiter(waiterProxy.Waiters);
 }
예제 #4
0
        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;
            }
        }
예제 #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));
        }