Пример #1
0
 void OnGUI()
 {
     canCount++;
     if (status == 2)
     {
         GUI.Label(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 85, 100, 50), "Lose!", style);
         if (GUI.Button(new Rect(Screen.width / 2 - 70, Screen.height / 2, 140, 70), "Again", buttonStyle))
         {
             status = 0;
             action.restart();
         }
     }
     else if (status == 1)
     {
         GUI.Label(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 85, 100, 50), "Win!", style);
         if (GUI.Button(new Rect(Screen.width / 2 - 70, Screen.height / 2, 140, 70), "Again", buttonStyle))
         {
             status = 0;
             action.restart();
         }
     }
     else
     {
         if (GUI.Button(new Rect(Screen.width / 3 - 200, Screen.height / 2, 100, 50), "Next", buttonStyle))
         {
             action.setMovingObj(null);
             if (next == NextStatus.ON)
             {
                 if (canCount < 60.0f)
                 {
                     return;
                 }
                 canCount = 0;
                 action.nextOnBoat();
                 next = NextStatus.MOVE;
             }
             else if (next == NextStatus.MOVE)
             {
                 if (canCount < 75.0f)
                 {
                     return;
                 }
                 canCount = 0;
                 action.moveBoat();
                 next = NextStatus.OFF;
             }
             else if (next == NextStatus.OFF)
             {
                 if (canCount < 90.0f)
                 {
                     return;
                 }
                 canCount = 0;
                 action.nextOffBoat();
                 next = NextStatus.ON;
             }
         }
     }
 }
Пример #2
0
        /// <summary>
        /// Получить детали заказа.
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public async Task <IncomingOrderDetailsDto> GetDetailsAsync(int orderId)
        {
            var order = await _dbContext.Orders
                        .FirstOrDefaultAsync(x => x.Id == orderId);

            if (order is null)
            {
                throw new AppException(AppMessage.OrderNotExists);
            }

            //
            var orderStatusCodeId   = order.OrderStatusCodeId;
            var nextOrderStatusCode = await GetOrderStatusCodeAsync(orderStatusCodeId + 1);

            NextStatus nextStatus = null;

            if (orderStatusCodeId == (int)OrderStatusCode.CourierAccepted ||
                orderStatusCodeId == (int)OrderStatusCode.Prepared)
            {
                nextStatus = new NextStatus
                {
                    Id   = nextOrderStatusCode.Id,
                    Name = nextOrderStatusCode.Text
                };
            }

            var supplierInfo = await _supplierInfoService.GetSupplierInfo(orderId);

            var orderInfo = await _orderInfoSrv.GetOrderInfoAsync(orderId);

            var orderDetails = new IncomingOrderDetailsDto
            {
                Id           = orderId,
                CreatedAt    = order.CreatedAt.Format(),
                TotalCost    = orderInfo.SubTotal,
                DeliveryCost = orderInfo.DeliveryCost,
                Comment      = order.DeliveryCustomerNote,
                NextStatus   = nextStatus,
                Vendor       = _mapper.Map <IncomingOrderDetailsSupplierDto>(supplierInfo),
                Client       = new IncomingOrderDetailsCustomerDto
                {
                    Name            = order.Customer.Name,
                    Phone           = order.Customer.PhoneNumber,
                    DeliveryAddress = order.DeliveryAddress
                },
                Products = _mapper.Map <List <ProductDto> >(orderInfo.OrderItems)
            };

            return(orderDetails);
        }
Пример #3
0
    void Start()
    {
        action = Director.getInstance().scene_controller as UserAction;

        style           = new GUIStyle();
        style.fontSize  = 40;
        style.alignment = TextAnchor.MiddleCenter;

        buttonStyle          = new GUIStyle("button");
        buttonStyle.fontSize = 30;

        next     = NextStatus.ON;
        canCount = 0.0f;
    }
Пример #4
0
        public async Task <NextStatus> UpdateStatus(int orderId, int statusId)
        {
            var order = await _dbContext.Orders
                        .FirstOrDefaultAsync(x => x.Id == orderId);

            if (order is null)
            {
                throw new AppException(AppMessage.OrderNotExists);
            }

            int currentOrderStatusCodeId = order.OrderStatusCodeId;
            int nextOrderStatusCodeId    = 0;

            if (order.OrderStatusCodeId == (int)OrderStatusCode.CourierAccepted)
            {
                currentOrderStatusCodeId = (int)OrderStatusCode.Prepared;
                nextOrderStatusCodeId    = (int)OrderStatusCode.Delivered;
            }
            else if (order.OrderStatusCodeId == (int)OrderStatusCode.Prepared)
            {
                currentOrderStatusCodeId = (int)OrderStatusCode.Delivered;
                nextOrderStatusCodeId    = -1;
            }

            order.OrderStatusCodeId = currentOrderStatusCodeId;
            await _dbContext.SaveChangesAsync();

            var nextOrderStatusCode = await GetOrderStatusCodeAsync(nextOrderStatusCodeId);

            if (nextOrderStatusCode is null)
            {
                return(null);
            }

            var nextStatus = new NextStatus
            {
                Id   = nextOrderStatusCode.Id,
                Name = nextOrderStatusCode.Text
            };

            await WebSocketService.ShiftChanged((int)order.CourierId);

            return(nextStatus);
        }
Пример #5
0
 public void setNS(NextStatus n)
 {
     user_gui.next = n;
 }