コード例 #1
0
        public void when_ride_count_attained_then_promotion_unlocked()
        {
            var accountId = Guid.NewGuid();
            var orderId1  = Guid.NewGuid();
            var orderId2  = Guid.NewGuid();

            var newOrderStatus = new OrderStatusChanged
            {
                IsCompleted = true,
                Status      = new OrderStatusDetail {
                    AccountId = accountId, Status = OrderStatus.Completed
                }
            };

            _orderCreatedCommand.AccountId = accountId;
            _orderCreatedCommand.SourceId  = orderId1;
            newOrderStatus.SourceId        = orderId1;

            OrderGenerator.Handle(_orderCreatedCommand);
            OrderGenerator.Handle(newOrderStatus);
            TriggerSut.Handle(newOrderStatus);

            _orderCreatedCommand.SourceId = orderId2;
            newOrderStatus.SourceId       = orderId2;

            OrderGenerator.Handle(_orderCreatedCommand);
            OrderGenerator.Handle(newOrderStatus);
            TriggerSut.Handle(newOrderStatus);

            var commands = Commands.OfType <AddUserToPromotionWhiteList>().Where(c => c.AccountIds.Contains(accountId)).ToArray();

            Assert.AreEqual(1, commands.Count());
            Assert.AreEqual(2, commands[0].LastTriggeredAmount);
        }
コード例 #2
0
        private async Task ServiceBusMessagePump_PublishServiceBusMessage_MessageSuccessfullyProcessed(Encoding messageEncoding, string connectionStringKey)
        {
            // Arrange
            var operationId      = Guid.NewGuid().ToString();
            var transactionId    = Guid.NewGuid().ToString();
            var connectionString = Configuration.GetValue <string>(connectionStringKey);
            ServiceBusConnectionStringProperties serviceBusConnectionString = ServiceBusConnectionStringProperties.Parse(connectionString);

            await using (var client = new ServiceBusClient(connectionString))
                await using (ServiceBusSender messageSender = client.CreateSender(serviceBusConnectionString.EntityPath))
                {
                    var order        = OrderGenerator.Generate();
                    var orderMessage = order.AsServiceBusMessage(operationId, transactionId, encoding: messageEncoding);

                    // Act
                    await messageSender.SendMessageAsync(orderMessage);

                    // Assert
                    var receivedEvent = _serviceBusEventConsumerHost.GetReceivedEvent(operationId);
                    Assert.NotEmpty(receivedEvent);
                    var deserializedEventGridMessage = EventParser.Parse(receivedEvent);
                    Assert.NotNull(deserializedEventGridMessage);
                    var orderCreatedEvent = Assert.Single(deserializedEventGridMessage.Events);
                    Assert.NotNull(orderCreatedEvent);
                    var orderCreatedEventData = orderCreatedEvent.GetPayload <OrderCreatedEventData>();
                    Assert.NotNull(orderCreatedEventData);
                    Assert.NotNull(orderCreatedEventData.CorrelationInfo);
                    Assert.Equal(order.Id, orderCreatedEventData.Id);
                    Assert.Equal(order.Amount, orderCreatedEventData.Amount);
                    Assert.Equal(order.ArticleNumber, orderCreatedEventData.ArticleNumber);
                    Assert.Equal(transactionId, orderCreatedEventData.CorrelationInfo.TransactionId);
                    Assert.Equal(operationId, orderCreatedEventData.CorrelationInfo.OperationId);
                    Assert.NotEmpty(orderCreatedEventData.CorrelationInfo.CycleId);
                }
        }
コード例 #3
0
        static void Main()
        {
            // Use the following request URI if you're running this console
            // application in a Docker container
            var requestUri = "http://*****:*****@customer} placed {@order}", customer, order);

                Thread.Sleep(1000);
            }
        }
コード例 #4
0
        public int UpdateArticle()
        {
            IArticleService articleService = new ArticleService();
            var             model          = new ArticleInfo();

            model.Id            = Convert.ToInt32(HttpContext.Current.Request.Params["ArticleId"]);
            model.CategoryId    = Convert.ToInt32(HttpContext.Current.Request.Params["ArticleCategoryId"]);
            model.Title         = HttpContext.Current.Request.Params["Title"];
            model.SubTitle      = HttpContext.Current.Request.Params["SubTitle"];
            model.Summary       = HttpContext.Current.Request.Params["Summary"];
            model.Content       = HttpContext.Current.Request.Params["Content"];
            model.Keywords      = HttpContext.Current.Request.Params["Keywords"];
            model.MetaDesc      = HttpContext.Current.Request.Params["MetaDesc"];
            model.Source        = HttpContext.Current.Request.Params["Source"];
            model.AllowComments = true;//(int)HttpContext.Current.Request.Params["AllowComments"];
            model.Clicks        = Convert.ToInt32(HttpContext.Current.Request.Params["Clicks"] ?? "0");
            model.ReadPassword  = HttpContext.Current.Request.Params["ReadPassword"];
            model.UserId        = 0;
            model.DisplayOrder  = OrderGenerator.NewOrder();
            model.PublishDate   = Convert.ToDateTime(HttpContext.Current.Request.Params["PublishDate"]);
            model.InDate        = DateTime.Now;
            model.EditDate      = DateTime.Now;
            model.FocusPicture  = HttpContext.Current.Request.Params["FocusPicture"];
            return(articleService.Update(model));
        }
コード例 #5
0
        public void when_amount_spent_attained_then_promotion_unlocked()
        {
            var accountId = Guid.NewGuid();
            var orderId1  = Guid.NewGuid();
            var orderId2  = Guid.NewGuid();

            var newOrderStatus = new OrderStatusChanged
            {
                IsCompleted = true,
                Status      = new OrderStatusDetail {
                    AccountId = accountId, Status = OrderStatus.Completed
                }
            };

            var newPaymentInit = new CreditCardPaymentInitiated
            {
                Meter = (decimal)15.31
            };

            var newPayment = new CreditCardPaymentCaptured_V2
            {
                FeeType           = FeeTypes.None,
                Meter             = (decimal)15.31,
                AuthorizationCode = Guid.NewGuid().ToString(),
                AccountId         = accountId
            };

            _orderCreatedCommand.AccountId = accountId;

            _orderCreatedCommand.SourceId = orderId1;
            newOrderStatus.SourceId       = orderId1;
            newPaymentInit.SourceId       = orderId1;
            newPaymentInit.OrderId        = orderId1;
            newPayment.SourceId           = orderId1;
            newPayment.OrderId            = orderId1;

            OrderGenerator.Handle(_orderCreatedCommand);
            OrderGenerator.Handle(newOrderStatus);
            CreditCardGenerator.Handle(newPaymentInit);
            CreditCardGenerator.Handle(newPayment);
            TriggerSut.Handle(newPayment);

            _orderCreatedCommand.SourceId = orderId2;
            newOrderStatus.SourceId       = orderId2;
            newPaymentInit.SourceId       = orderId2;
            newPaymentInit.OrderId        = orderId2;
            newPayment.SourceId           = orderId2;
            newPayment.OrderId            = orderId2;

            OrderGenerator.Handle(_orderCreatedCommand);
            OrderGenerator.Handle(newOrderStatus);
            CreditCardGenerator.Handle(newPaymentInit);
            CreditCardGenerator.Handle(newPayment);
            TriggerSut.Handle(newPayment);

            var commands = Commands.OfType <AddUserToPromotionWhiteList>().Where(c => c.AccountIds.Contains(accountId)).ToArray();

            Assert.AreEqual(1, commands.Count());
            Assert.AreEqual(30.62, commands[0].LastTriggeredAmount);
        }
コード例 #6
0
        public Runner(string pickingPath, double simulationSpeed, double orderChance)
        {
            var pickNScrape = new PickingScrape(pickingPath);

            pickNScrape.GetOrdersFromPicking();

            var orders = pickNScrape.OrderList;

            List <Article> articleList = orders
                                         .SelectMany(o => o.LineList)
                                         .Distinct()
                                         .Select(line => line.Article)
                                         .ToList();


            OrderGenerator = new OrderGenerator(articleList, orderChance);

            StartTime = DateTime.Now;

            var t = new Thread(() => TimeKeeper.StartTicking(simulationSpeed, StartTime));

            t.Start();

            Handler = new Handler();

            Scheduler = new Scheduler(OrderGenerator, Handler, 0.001);
        }
コード例 #7
0
        public void Dispose()
        {
            Disposing = true;

            if (OrderGenerator != null)
            {
                OrderGenerator.Deactivate();
            }

            frameEndActions.Clear();

            Game.Sound.StopAudio();
            Game.Sound.StopVideo();
            if (IsLoadingGameSave)
            {
                Game.Sound.DisableAllSounds = false;
            }

            ModelCache.Dispose();

            // Dispose newer actors first, and the world actor last
            foreach (var a in actors.Values.Reverse())
            {
                a.Dispose();
            }

            // Actor disposals are done in a FrameEndTask
            while (frameEndActions.Count != 0)
            {
                frameEndActions.Dequeue()(this);
            }

            Game.FinishBenchmark();
        }
コード例 #8
0
        public object InsertProduct()
        {
            var model = new ProductInfo();

            //model.Id = Convert.ToInt32(HttpContext.Current.Request.Params["id"]);
            model.Title      = (string)HttpContext.Current.Request.Params["title"];
            model.CategoryId = Convert.ToInt32(HttpContext.Current.Request.Params["productCategory"]);
            //model.Price = Convert.ToDouble(HttpContext.Current.Request.Params["price"]);
            model.Content = (string)HttpContext.Current.Request.Params["Content"];
            model.Desc    = (string)HttpContext.Current.Request.Params["Desc"];//产品简介
            //model.IsOnline = HttpContext.Current.Request.Params["isonline"];
            model.BigPicture     = HttpContext.Current.Request.Params["bigpicture"];
            model.SmallPicture   = HttpContext.Current.Request.Params["smallpicture"];
            model.MediumPicture  = (string)HttpContext.Current.Request.Params["mediumpicture"];
            model.Specifications = (string)HttpContext.Current.Request.Params["specifications"];
            model.AfterService   = (string)HttpContext.Current.Request.Params["afterservice"];
            model.InDate         = DateTime.Now;
            model.FileUrl        = HttpContext.Current.Request.Params["filedown"];
            model.Keywords       = HttpContext.Current.Request.Params["Keywords"];
            model.MetaDesc       = HttpContext.Current.Request.Params["Description"];
            model.DisplayOrder   = OrderGenerator.NewOrder();
            IProductService productService = new ProductService();

            return(productService.Add(model) > 0);
        }
コード例 #9
0
 public Supervisor(ActorPaths actorPaths
                   , long time
                   , bool debug
                   , ProductionDomainContext productionDomainContext
                   , IMessageHub messageHub
                   , Configuration configuration
                   , List <FSetEstimatedThroughputTime> estimatedThroughputTimes
                   , IActorRef principal
                   )
     : base(actorPaths: actorPaths, time: time, debug: debug, principal: principal)
 {
     _productionDomainContext = productionDomainContext;
     _dataBaseConnection      = _productionDomainContext.Database.GetDbConnection();
     _articleCache            = new ArticleCache(connectionString: _dataBaseConnection.ConnectionString);
     _messageHub     = messageHub;
     _orderGenerator = new OrderGenerator(simConfig: configuration, productionDomainContext: _productionDomainContext
                                          , productIds: estimatedThroughputTimes.Select(x => x.ArticleId).ToList());
     _orderCounter     = new OrderCounter(maxQuantity: configuration.GetOption <OrderQuantity>().Value);
     _configID         = configuration.GetOption <SimulationId>().Value;
     _simulationType   = configuration.GetOption <SimulationKind>().Value;
     _transitionFactor = configuration.GetOption <TransitionFactor>().Value;
     estimatedThroughputTimes.ForEach(SetEstimatedThroughputTime);
     Send(instruction: Instruction.PopOrder.Create(message: "Pop", target: Self), waitFor: 1);
     Send(instruction: Instruction.EndSimulation.Create(message: true, target: Self), waitFor: configuration.GetOption <SimulationEnd>().Value);
     Send(instruction: Instruction.SystemCheck.Create(message: "CheckForOrders", target: Self), waitFor: 1);
     DebugMessage(msg: "Agent-System ready for Work");
 }
コード例 #10
0
        public async Task WithServiceBusMessageRouting_WithMessageHandlerMessageBodyFilter_GoesThroughRegisteredMessageHandlers()
        {
            // Arrange
            var services       = new ServiceCollection();
            var collection     = new ServiceBusMessageHandlerCollection(services);
            var ignoredHandler = new StubServiceBusMessageHandler <Order>();
            var spyHandler     = new StubServiceBusMessageHandler <Order>();

            collection.WithServiceBusMessageHandler <StubServiceBusMessageHandler <Order>, Order>(
                messageBodyFilter: body => true, implementationFactory: serviceProvider => spyHandler)
            .WithServiceBusMessageHandler <StubServiceBusMessageHandler <Order>, Order>(
                messageBodyFilter: body => false, implementationFactory: serviceProvider => ignoredHandler);

            // Act
            services.AddServiceBusMessageRouting();

            // Assert
            IServiceProvider provider = services.BuildServiceProvider();
            var router = provider.GetRequiredService <IAzureServiceBusMessageRouter>();
            AzureServiceBusMessageContext context = AzureServiceBusMessageContextFactory.Generate();
            var correlationInfo = new MessageCorrelationInfo("operation-id", "transaction-id");

            Order order = OrderGenerator.Generate();
            ServiceBusReceivedMessage message = order.AsServiceBusReceivedMessage();
            await router.RouteMessageAsync(message, context, correlationInfo, CancellationToken.None);

            Assert.True(spyHandler.IsProcessed);
            Assert.False(ignoredHandler.IsProcessed);
        }
コード例 #11
0
        static void Main()
        {
            // NOTE: Use of ElasticsearchJsonFormatter is optional (but recommended as it produces
            // 'idiomatic' json). If you don't want to take a dependency on
            // Serilog.Formatting.Elasticsearch package you can also use other json formatters
            // such as Serilog.Formatting.Json.JsonFormatter.

            // Console sink send logs to stdout which will then be read by logspout
            ILogger logger = new LoggerConfiguration()
                             .Enrich.WithExceptionDetails()
                             .WriteTo.Console(new ElasticsearchJsonFormatter())
                             .CreateLogger()
                             .ForContext <Program>();

            var customerGenerator  = new CustomerGenerator();
            var orderGenerator     = new OrderGenerator();
            var exceptionGenerator = new ExceptionGenerator();

            while (true)
            {
                var customer = customerGenerator.Generate();
                var order    = orderGenerator.Generate();

                logger.Information("{@customer} placed {@order}", customer, order);

                var exception = exceptionGenerator.Generate();
                if (exception != null)
                {
                    logger.Error(exception, "Problem with {@order} placed by {@customer}", order, customer);
                }

                Thread.Sleep(1000);
            }
        }
コード例 #12
0
 public void SetOrder(CustomerWalk t)
 {
     Debug.Log("HERE");
     theCustomer    = t;
     orderGenerator = theCustomer.GetComponent <OrderGenerator>();
     //    foodTrayDropArea.Order = orderGenerator.Order;
 }
コード例 #13
0
        public async Task WithServiceBusRouting_WithMessageHandlerMessageBodySerializer_DeserializesCustomMessage()
        {
            // Arrange
            var services       = new ServiceCollection();
            var collection     = new ServiceBusMessageHandlerCollection(services);
            var ignoredHandler = new StubServiceBusMessageHandler <TestMessage>();
            var spyHandler     = new StubServiceBusMessageHandler <Order>();

            var expectedMessage = new TestMessage {
                TestProperty = "Some value"
            };
            string expectedBody = JsonConvert.SerializeObject(expectedMessage);
            var    serializer   = new TestMessageBodySerializer(expectedBody, OrderGenerator.Generate());

            collection.WithServiceBusMessageHandler <StubServiceBusMessageHandler <Order>, Order>(messageBodySerializer: serializer, implementationFactory: serviceProvider => spyHandler)
            .WithServiceBusMessageHandler <StubServiceBusMessageHandler <TestMessage>, TestMessage>(implementationFactory: serviceProvider => ignoredHandler);

            // Act
            services.AddServiceBusMessageRouting();

            // Assert
            IServiceProvider provider = services.BuildServiceProvider();
            var router = provider.GetRequiredService <IAzureServiceBusMessageRouter>();
            AzureServiceBusMessageContext context = AzureServiceBusMessageContextFactory.Generate();
            var correlationInfo = new MessageCorrelationInfo("operation-id", "transaction-id");

            ServiceBusReceivedMessage message = expectedMessage.AsServiceBusReceivedMessage();
            await router.RouteMessageAsync(message, context, correlationInfo, CancellationToken.None);

            Assert.True(spyHandler.IsProcessed);
            Assert.False(ignoredHandler.IsProcessed);
        }
コード例 #14
0
        public async Task ServiceBusQueueMessagePumpWithServiceBusDeadLetterOnFallback_PublishServiceBusMessage_MessageSuccessfullyProcessed()
        {
            // Arrange
            var    config           = TestConfig.Create();
            string connectionString = config.GetServiceBusConnectionString(ServiceBusEntityType.Queue);
            var    options          = new WorkerOptions();

            options.AddServiceBusQueueMessagePump(
                configuration => connectionString,
                opt => opt.AutoComplete = false)
            .WithServiceBusMessageHandler <ShipmentAzureServiceBusMessageHandler, Shipment>((AzureServiceBusMessageContext context) => true)
            .WithServiceBusFallbackMessageHandler <OrdersAzureServiceBusDeadLetterFallbackMessageHandler>();

            Order order = OrderGenerator.Generate();

            await using (var worker = await Worker.StartNewAsync(options))
                await using (var service = await TestMessagePumpService.StartNewAsync(config, _logger))
                {
                    // Act
                    await service.SendMessageToServiceBusAsync(connectionString, order.AsServiceBusMessage());

                    // Assert
                    await service.AssertDeadLetterMessageAsync(connectionString);
                }
        }
コード例 #15
0
 // Start is called before the first frame update
 void Start()
 {
     orderGenerator = GameObject.Find("Game Manager").GetComponent <OrderGenerator>();
     orderGenerator.StartGame();
     score = 0;
     //setPlayerPreferences();
 }
コード例 #16
0
        private async Task ServiceBusMessagePump_PublishServiceBusMessage_MessageSuccessfullyProcessed(Encoding messageEncoding, string connectionStringKey)
        {
            // Arrange
            var operationId   = Guid.NewGuid().ToString();
            var transactionId = Guid.NewGuid().ToString();
            var messageSender = CreateServiceBusSender(connectionStringKey);

            var order        = OrderGenerator.Generate();
            var orderMessage = order.WrapInServiceBusMessage(operationId, transactionId, encoding: messageEncoding);

            // Act
            await messageSender.SendAsync(orderMessage);

            // Assert
            var receivedEvent = _serviceBusEventConsumerHost.GetReceivedEvent(operationId);

            Assert.NotEmpty(receivedEvent);
            var deserializedEventGridMessage = EventGridParser.Parse <OrderCreatedEvent>(receivedEvent);

            Assert.NotNull(deserializedEventGridMessage);
            var orderCreatedEvent     = Assert.Single(deserializedEventGridMessage.Events);
            var orderCreatedEventData = orderCreatedEvent.GetPayload <OrderCreatedEventData>();

            Assert.NotNull(orderCreatedEventData);
            Assert.NotNull(orderCreatedEventData.CorrelationInfo);
            Assert.Equal(order.Id, orderCreatedEventData.Id);
            Assert.Equal(order.Amount, orderCreatedEventData.Amount);
            Assert.Equal(order.ArticleNumber, orderCreatedEventData.ArticleNumber);
            Assert.Equal(transactionId, orderCreatedEventData.CorrelationInfo.TransactionId);
            Assert.Equal(operationId, orderCreatedEventData.CorrelationInfo.OperationId);
            Assert.NotEmpty(orderCreatedEventData.CorrelationInfo.CycleId);
        }
コード例 #17
0
        private static ServiceBusReceivedMessage CreateMessage(string key = null, object value = null, string correlationId = null)
        {
            Order order = OrderGenerator.Generate();
            ServiceBusReceivedMessage message = order.AsServiceBusReceivedMessage(key, value, correlationId);

            return(message);
        }
コード例 #18
0
    private void scoreLog(string tableName, ParamScore p, long score, GMUser user)
    {
        long remainMoney = ItemHelp.getRemainMoney(p.m_toAcc, p.isToPlayer(), user);

        // 操作账号余额
        long opSrcRemainMoney = ItemHelp.getRemainMoney(user.m_user, false, user);

        /*string cmd = string.Format(SqlStrCMD.SQL_CMD_PLAYER_SCORE,
         *                         tableName,
         *                         DateTime.Now.ToString(ConstDef.DATE_TIME24),
         *                         user.m_user,
         *                         p.m_toAcc,
         *                         p.m_op,
         *                         score,
         *                         user.m_moneyType,
         *                         user.m_depth,
         *                         user.m_createCode,
         *                         p.isToPlayer() ? AccType.ACC_PLAYER : 0,
         *                         remainMoney);
         *
         * user.sqlDb.executeOp(cmd, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);
         */
        // 生成上下分记录
        OrderInfo oinfo =
            OrderGenerator.genOfflineSuccessOrder(user.m_user, p.m_toAcc, score,
                                                  p.m_op,
                                                  p.isToPlayer() ? AccType.ACC_PLAYER : 0,
                                                  remainMoney, p.m_orderFrom);
        // 生成上下分记录
        string cmd = OrderGenerator.genSqlForLogScore(oinfo, user.m_createCode, opSrcRemainMoney);

        user.sqlDb.executeOp(cmd, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);
    }
コード例 #19
0
        static void Main()
        {
            Console.WriteLine("Starting application producing log events...");

            var configuration = new ConfigurationBuilder()
                                .AddInMemoryCollection(new[]
            {
                new KeyValuePair <string, string>("apiKey", "secret-api-key")
            })
                                .Build();

            var logger = new LoggerConfiguration()
                         .WriteTo.Console()
                         .WriteTo.Http(
                requestUri: "http://*****:*****@customer} placed {@order}", customer, order);

                Thread.Sleep(1000);
            }
        }
        public ActionResult Index(int length, int alphabetCardinality, int typeGenerate)
        {
            return(CreateTask(() =>
            {
                ISequenceGenerator sequenceGenerator = null;
                var orderGenerator = new OrderGenerator();
                var orders = new List <int[]>();
                switch (typeGenerate)
                {
                case 0:
                    sequenceGenerator = new StrictSequenceGenerator();
                    orders = orderGenerator.StrictGenerateOrders(length, alphabetCardinality);
                    break;

                case 1:
                    sequenceGenerator = new SequenceGenerator();
                    orders = orderGenerator.GenerateOrders(length, alphabetCardinality);
                    break;

                case 2:
                    sequenceGenerator = new NonRedundantStrictSequenceGenerator();
                    orders = orderGenerator.StrictGenerateOrders(length, alphabetCardinality);
                    break;

                case 3:
                    sequenceGenerator = new NonRedundantSequenceGenerator();
                    orders = orderGenerator.GenerateOrders(length, alphabetCardinality);
                    break;

                default: throw new ArgumentException("Invalid type of generate");
                }
                var sequences = sequenceGenerator.GenerateSequences(length, alphabetCardinality);
                var SequecesOrdersDistribution = new Dictionary <int[], List <BaseChain> >(new OrderEqualityComparer());
                foreach (var order in orders)
                {
                    SequecesOrdersDistribution.Add(order, new List <BaseChain>());
                }

                foreach (var sequence in sequences)
                {
                    SequecesOrdersDistribution[sequence.Building].Add(sequence);
                }

                var result = new Dictionary <string, object>
                {
                    {
                        "result", SequecesOrdersDistribution.Select(r => new
                        {
                            order = r.Key,
                            sequences = r.Value.Select(s => s.ToString(",")).ToArray()
                        })
                    }
                };

                return new Dictionary <string, string> {
                    { "data", JsonConvert.SerializeObject(result) }
                };
            }));
        }
コード例 #21
0
        public void CalculateTransformations(int length)
        {
            var orderGenerator = new OrderGenerator();

            Orders = orderGenerator.GenerateOrders(length);
            TransformationsData = new OrderTransformationData[Orders.Count];
            TransformOrders();
        }
コード例 #22
0
        public OrderGeneratorTests(OrderDataFixture orderData)
        {
            var mock = new MockRepoHelper(orderData);

            _manageOrderRepo = mock.MockManagerOrderRepository;
            _orderGen        = new OrderGenerator(_manageOrderRepo.Object);
            _orderData       = orderData;
        }
コード例 #23
0
    private bool addOrderToMySql(OrderInfo info, string createCode, long opRemainMoney)
    {
        //string sqlCmd = OrderGenerator.genCmdOrderToMySql(info, createCode);
        // 生成上下分记录
        string sqlCmd = OrderGenerator.genSqlForLogScore(info, createCode, opRemainMoney);
        int    count  = m_sqlDb.executeOp(sqlCmd, CMySqlDbName.DB_XIANXIA);

        return(count > 0);
    }
コード例 #24
0
 void Start()
 {
     actualPosition = this.transform.position;
     gameManager    = GameObject.Find("Game Manager").GetComponent <OnlineGameManager>();
     orderGenerator = GameObject.Find("Game Manager").GetComponent <OrderGenerator>();
     audioSource    = this.GetComponent <AudioSource>();
     active         = false;
     completed      = false;
 }
コード例 #25
0
ファイル: GameController.cs プロジェクト: AlexKLWS/ff1317dgm
 private void Awake()
 {
     if (current == null){
         current = this;
         orderGenerator = GetComponent<OrderGenerator>();
     } else {
         Destroy(this.gameObject);
     }
 }
コード例 #26
0
ファイル: Cambio.cs プロジェクト: harudes/Simon-dice-Unity
 void Awake()
 {
     recognizer = new KeywordRecognizer(words);
     recognizer.OnPhraseRecognized += Recognizer_OnPhraseRecognized;
     gameManager    = GameObject.Find("Game Manager").GetComponent <GameManager>();
     orderGenerator = GameObject.Find("Game Manager").GetComponent <OrderGenerator>();
     audioSource    = this.GetComponent <AudioSource>();
     active         = false;
 }
コード例 #27
0
    private IEnumerator PlaceOrderDelayed(int startDelay, int timeLimitForOrder)
    {
        yield return(new WaitForSeconds(startDelay));

        var order = OrderGenerator.NewOrder(timeLimitForOrder, OnOrderCompleted);

        OrderContainerUi.CreateOrderCardFrom(order);
        order.StartCountDown();
    }
コード例 #28
0
ファイル: OrderApp.cs プロジェクト: rajakondla/SmartBuy
 public OrderApp(IManageOrderRepository manageOrderRepository
                 , IReferenceRepository <GasStation> gasStationRepository
                 , OrderGenerator orderGenerator
                 , ILogger <OrderApp> logger)
 {
     _manageOrderRepository = manageOrderRepository;
     _gasStationRepository  = gasStationRepository;
     _orderGenerator        = orderGenerator;
     _logger = logger;
 }
コード例 #29
0
    private void ConstructBehaviourTree()
    {
        OrderGenerator       orderGenerator     = new OrderGenerator(gameM.stockItems, gameM.nbItemsOrdered, this);
        ArriveAtPosition     arriveAtPosition   = new ArriveAtPosition(this);
        IsQueueSpotAvailable queueSpotAvailable = new IsQueueSpotAvailable(spawnM.availableQueue, gameM.playerTransform, this);
        GoToQueueSpot        goToQueueSpot      = new GoToQueueSpot(agent, this);
        IsLootSpotAvailable  lootSpotAvailable  = new IsLootSpotAvailable(spawnM.availableLoot, gameM.playerTransform, this);
        GoToLootSpot         goToLootSpot       = new GoToLootSpot(agent, this);
        RandomStateNode      randomStateNode    = new RandomStateNode(spawnM);
        ClientStateNode      clientStateNode    = new ClientStateNode(spawnM.clientOnly, gameM.nbClient, agent.speed, this);
        ThiefStateNode       thiefStateNode     = new ThiefStateNode(spawnM.thiefOnly, gameM.nbThief, agent.speed, this);
        FindState            findState          = new FindState(this);



        Sequence orderSequence = new Sequence(new List <Node> {
            orderGenerator
        });

        //Sequence goingToCounter = new Sequence(new List<Node> { goToQueueSpot, goToPosition);
        //Selector goToposition = new Selector(new List<Node> { orderSequence, goingToCounter });
        repeatMovingToSpot = new Repeator(goToQueueSpot);
        Sequence goToQueueSpotSequence = new Sequence(new List <Node> {
            queueSpotAvailable, repeatMovingToSpot, orderSequence
        });
        Sequence goToLootSpotSequence = new Sequence(new List <Node> {
            lootSpotAvailable, goToLootSpot
        });

        Sequence thiefSequence = new Sequence(new List <Node> {
            thiefStateNode, goToLootSpotSequence
        });
        Sequence clientSequence = new Sequence(new List <Node> {
            clientStateNode, goToQueueSpotSequence
        });

        Selector GoToStateSelector = new Selector(new List <Node> {
            clientSequence, thiefSequence
        });
        Sequence randomBoolSequence = new Sequence(new List <Node> {
            findState, GoToStateSelector
        });
        Sequence randomSequence = new Sequence(new List <Node> {
            randomBoolSequence, randomStateNode
        });

        topNode = new Selector(new List <Node> {
            randomSequence, clientSequence, thiefSequence
        });

        //Debug.Log(findState.Evaluate());
        //Debug.Log(clientSequence.Evaluate());
        //Debug.Log(randomBoolSequence.Evaluate());
    }
コード例 #30
0
        public given_a_view_model_generator()
        {
            var bus = new Mock <ICommandBus>();

            bus.Setup(x => x.Send(It.IsAny <Envelope <ICommand> >()))
            .Callback <Envelope <ICommand> >(x => Commands.Add(x.Body));
            bus.Setup(x => x.Send(It.IsAny <IEnumerable <Envelope <ICommand> > >()))
            .Callback <IEnumerable <Envelope <ICommand> > >(x => Commands.AddRange(x.Select(e => e.Body)));

            Sut = new OrderGenerator(() => new BookingDbContext(DbName), new Logger(), new TestServerSettings());
        }
コード例 #31
0
    // Use this for initialization
    void Awake()
    {
        orderGenerator = FindObjectOfType <OrderGenerator>();

        SnapZones = FindObjectsOfType <VRTK_SnapDropZone>();

        foreach (var snapZone in SnapZones)
        {
            snapZone.ObjectSnappedToDropZone += GetSnappedObjects;
        }
    }