예제 #1
0
        public async void ThenThereIsANotificationThatAnItemHasBeenTakenOut()
        {
            var createdItem = _scenarioContext["CreatedItem"] as ItemModel;

            using (RabbitMqNotificationBus bus = new RabbitMqNotificationBus())
            {
                ItemTaken notification = new ItemTaken(new CallContext());
                await bus.SubscribeAndWaitFirstMessage <ItemTaken>(a => { notification = a; });

                notification.Should().BeOfType(typeof(ItemTaken));
                notification.Label.Should().BeEquivalentTo(createdItem.Label);
            }
        }
예제 #2
0
        public void Mouse_Click()
        {
            Point mousLoc = new Point(model.MouseCoord.X - 300 + model.ThisUser.userLocation.X, model.MouseCoord.Y - 300 + model.ThisUser.userLocation.Y);

            foreach (Item item in model.Map.ListItems)
            {
                if ((mousLoc.X >= item.Location.X - 15 && mousLoc.X <= item.Location.X + 15) && (mousLoc.Y >= item.Location.Y - 15 && mousLoc.Y <= item.Location.Y + 15))
                {
                    if (Math.Abs(model.ThisUser.userLocation.X - item.Location.X) < 50 && Math.Abs(model.ThisUser.userLocation.Y - item.Location.Y) < 50)
                    {
                        ItemTaken itemTaken = new ItemTaken();
                        itemTaken.item = item;
                        itemTaken.num  = model.number;

                        CTransfers.Writing(itemTaken, model.NStream);
                        break;
                    }
                    else
                    {
                        // Сообщение о том, что игрок слишком далеко от желаемого предмета
                    }
                }
            }
        }