Exemple #1
0
        public SnakeSprite(GameMain game, int id) : base(game)
        {
            _id        = id;
            _game      = game;
            _spawnTime = game.gameTime.TotalGameTime;
            _hitBounds = new Rectangle();
            _container = game.newSprite <Sprite>();

            addChild(_container);

            _colors = new List <Color>();


            _baseJointSize = new Size(12, 12);
            _jointSize     = _baseJointSize;

            _baseMoveSpeedValue = 3.0f;
            _moveSpeedValue     = _baseMoveSpeedValue;

            _headContainer = game.newSprite <Sprite>();
            _bodyContainer = game.newSprite <Sprite>();
            _container.addChild(_bodyContainer);
            _container.addChild(_headContainer);
            _bodyUpdate = new BodyUpdate(this);
        }
        public IActionResult UpdateProcessAction(Guid actionGuid, [FromBody] BodyUpdate data)
        {
            if (actionGuid == Guid.Empty)
            {
                return(Problem("Empty GUID is invalid."));
            }
            if (data == null)
            {
                return(Problem("Input data is required"));
            }
            if (String.IsNullOrEmpty(data.Result))
            {
                return(Problem("Result of the action (success/error/failed) is required"));
            }
            if (String.IsNullOrEmpty(data.Summary))
            {
                return(Problem("Summary (accepted/rejected/processed) is required"));
            }

            _logger.LogInformation("Enter UpdateProcessAction.");

            PreingestAction currentAction = null;

            using (var context = new PreIngestStatusContext())
            {
                try
                {
                    currentAction = context.Find <PreingestAction>(actionGuid);
                    if (currentAction != null)
                    {
                        currentAction.ActionStatus      = data.Result;
                        currentAction.StatisticsSummary = data.Summary;
                    }
                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    _logger.LogError(e, "An exception was thrown : {0}, '{1}'.", e.Message, e.StackTrace);
                    return(ValidationProblem(String.Format("An exception was thrown : {0}, '{1}'.", e.Message, e.StackTrace)));
                }
                finally
                {
                    _logger.LogInformation("Exit UpdateProcessAction.");
                }
            }

            if (currentAction == null)
            {
                return(NotFound());
            }

            return(new JsonResult(currentAction));
        }