Example #1
0
        public void Render(double deltaTime)
        {
            var ent = EntityManager.GetEntiy <GameObject>(EntID);
            var com = ent.GetComponent <CirclePostionCom>(RectPosAlais);

            ShapeExtensions.DrawCircle(SpriteBatch, com.ToMonogameCircle(), 50, Color, (float)com.Radius);
        }
Example #2
0
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            // Draws the button "bar" (the color changes based on if the button is being hovered or clicked)
            var color = _baseColor;

            if (_isHovering)
            {
                color = _hoverColor;
            }
            if (_isClicked)
            {
                color = _clickedColor;
            }

            ShapeExtensions.FillRectangle(spriteBatch, Rectangle, color);

            // Draws the text
            if (!string.IsNullOrEmpty(Text))
            {
                var x = (Rectangle.X + (Rectangle.Width / 2)) - (_font.MeasureString(Text).X / 2);
                var y = (Rectangle.Y + (Rectangle.Height / 2)) - (_font.MeasureString(Text).Y / 2);

                spriteBatch.DrawString(_font, Text, new Vector2(x, y + TextTopPadding), TextColor);
            }
        }
Example #3
0
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            ShapeExtensions.FillRectangle(spriteBatch, Rectangle, _boxColor);

            if (IsEnabled)
            {
                ShapeExtensions.FillRectangle(spriteBatch,
                                              new Rectangle(Rectangle.X + ((Rectangle.Width - ((int)(_size * 0.6f))) / 2), Rectangle.Y + ((Rectangle.Height - ((int)(_size * 0.6f))) / 2), (int)(_size * 0.6f), (int)(_size * 0.6f)),
                                              _markedColor);
            }
        }
 private void AddShapeCharges(Order order, int formatWidth)
 {
     foreach (Shape shape in Enum.GetValues(typeof(Shape)))
     {
         _stringBuilder.AppendFormat($"{{0, {-formatWidth}}}", shape + "s");
         var quantity = order.Blocks.Count(b => b.Shape == shape);
         var price    = ShapeExtensions.GetPrice(shape);
         var subtotal = quantity * price;
         _stringBuilder.AppendLine($"{quantity} @ ${price} each = ${subtotal}");
     }
 }
Example #5
0
        public void Draw(SpriteBatch spriteBatch, bool editing, float itemDepth = -1)
        {
            if (!editing || !MapEntity.SelectedList.Contains(item))
            {
                return;
            }

            Vector2 pos = new Vector2(item.DrawPosition.X, -item.DrawPosition.Y);

            ShapeExtensions.DrawLine(spriteBatch, pos + Vector2.UnitY * range, pos - Vector2.UnitY * range, Color.Cyan * 0.5f, 2);
            ShapeExtensions.DrawLine(spriteBatch, pos + Vector2.UnitX * range, pos - Vector2.UnitX * range, Color.Cyan * 0.5f, 2);
            ShapeExtensions.DrawCircle(spriteBatch, pos, range, 32, Color.Cyan * 0.5f, 3);
        }
Example #6
0
        public void Render(double deltaTime)
        {
            var ent             = EntityManager.GetEntiy <GameObject>(EntID);
            var outlineColorCom = ent.GetComponent <ColorValueCom>(OutlineColorAlias);
            var barColorCom     = ent.GetComponent <ColorValueCom>(BarColorAlias);
            var rectPosCom      = ent.GetComponent <IHaveHitBoxCom>(RectPosAlais);
            var timerCom        = ent.GetComponent <TimerCom>(TimerValueAlias);

            var timeRectangle = new Paultangle(rectPosCom.HitBox);

            timeRectangle.Width = (timerCom.Value / timerCom.EndTime) * timeRectangle.Width;

            ShapeExtensions.FillRectangle(SpriteBatch, timeRectangle.ToRectangleF(), barColorCom.Value);

            ShapeExtensions.DrawRectangle(SpriteBatch, rectPosCom.HitBox.ToRectangleF(), outlineColorCom.Value, (float)Thickness);
        }
Example #7
0
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            if (Active)
            {
                ShapeExtensions.FillRectangle(spriteBatch, _bar, _activeBarColor);
            }
            else
            {
                ShapeExtensions.FillRectangle(spriteBatch, _bar, _barColor);
            }

            Renderer.Draw(spriteBatch);

            if (Active)
            {
                Cursor.Draw(spriteBatch);
            }
        }
Example #8
0
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            // Draws the bar and the knob
            var barColor  = _barColor;
            var knobColor = _knobColor;

            if (_isHovering)
            {
                knobColor = _hoverColor;
            }
            if (_isClicked)
            {
                knobColor = _clickedColor;
            }

            ShapeExtensions.FillRectangle(spriteBatch, _barRectangle, barColor);

            ShapeExtensions.FillRectangle(spriteBatch, _knobRectangle, knobColor);
        }
Example #9
0
        private void GameDraw()
        {
            GraphicsDevice.Clear(new Color(46, 204, 113));
            GraphicsDevice.BlendState = BlendState.NonPremultiplied;

            mapRenderer.Draw(seaMap, cam.GetViewMatrix());

            // world space here
            spriteBatch.Begin(transformMatrix: cam.GetViewMatrix(), samplerState: SamplerState.PointClamp);

            player.playerOffset = new Vector2(playerSprite.Width / 2, playerSprite.Height / 2);
            //spriteBatch.Draw(splashScreen, new Vector2(0, 0), Color.Silver);

            foreach (Projectile can in player.projectiles)
            {
                spriteBatch.Draw(cannonballSprite, can.CannonPosition, null, Color.White, 0, Vector2.Zero, 0.5f, SpriteEffects.None, 0);
            }
            //spriteBatch.Draw(playerSprite, player.Position, Color.White);
            spriteBatch.Draw(playerSprite, player.PlayerPosition, null, Color.White, player.playerRotation, player.playerOffset, 1, SpriteEffects.None, 0);

            foreach (Enemy e in enemies)
            {
                spriteBatch.Draw(e.texture, e.Position, null, Color.White, e.enemyRotation, new Vector2(e.texture.Width / 2, e.texture.Height / 2), 1, SpriteEffects.None, 1);
                ShapeExtensions.DrawLine(spriteBatch, e.Position + new Vector2(18, -e.texture.Height / 1.5f), 44, 0, Color.Black, 6);
                ShapeExtensions.DrawLine(spriteBatch, e.Position + new Vector2(20, -e.texture.Height / 1.5f), e.health * 40 / e.maxHealth, 0, Color.Green, 4);
            }


            spriteBatch.End();
            spriteBatch.Begin();

            spriteBatch.DrawString(gameText, "Score: " + score, new Vector2(30, 30), Color.Black, 0, new Vector2(0, 0), 1 * 1.5f, SpriteEffects.None, 0);
            for (int i = 0; i < player.PlayerHealth; i++)
            {
                spriteBatch.Draw(health, new Vector2(ScreenX - (health.Width + 30) - (i * 64), 30), Color.White);
            }
            spriteBatch.End();
        }
        public async Task <IActionResult> GetDelinquencyReport(ReportResourceParameters parameters)
        {
            if (!ShapeExtensions.ArePropertiesValidFor <DelinquencySummary>(parameters.Fields))
            {
                return(BadRequest());
            }
            var reportData = await _repository.GetDelinquencySummaryReport(parameters);

            var previousPageLink = reportData.HasPrevious ?
                                   CreateReportResourceUri(parameters, parameters.PageNumber - 1) : null;

            var nextPageLink = reportData.HasNext ?
                               CreateReportResourceUri(parameters, parameters.PageNumber + 1) : null;

            var paginationMetadata = new
            {
                previousPageLink = previousPageLink,
                nextPageLink     = nextPageLink,
                totalCount       = reportData.TotalCount,
                pageSize         = reportData.PageSize,
                currentPage      = reportData.CurrentPage,
                totalPages       = reportData.TotalPages
            };

            Response.Headers.Add("X-Pagination",
                                 System.Text.Json.JsonSerializer.Serialize(paginationMetadata));

            var dtoResponse    = _mapper.Map <IEnumerable <DelinquencySummaryDto> >(reportData);
            var reportResponse = new
            {
                data       = dtoResponse.ShapeData(parameters.Fields),
                pagination = paginationMetadata
            };

            return(Ok(reportResponse));
        }