Пример #1
0
 public void Render(GraphicsBuffer buffer)
 {
     var pattern = new[]
     {
         scheme.Base,
         scheme.Light,
         scheme.Lighter,
         scheme.Light,
         scheme.Base
     };
     foreach (var index in Enumerable.Range(0, pattern.Length))
         buffer.DrawFrame(
             topRow + index,
             leftColumn + index,
             width - 2 * index,
             height - 2 * index,
             pattern[index]);
     buffer.DrawBackground(
         background,
         topRow + pattern.Length,
         leftColumn + pattern.Length,
         width - 2 * pattern.Length,
         height - 2 * pattern.Length,
         paletteIndex);
 }
Пример #2
0
 public override void Render(GraphicsBuffer buffer)
 {
     foreach (var index in Enumerable.Range(0, 8))
     {
         var baseLeftColumn = leftColumn + index * 16;
         preview.Render(buffer, topRow + 1, baseLeftColumn + 1);
         if (index == GameState.Current.Data.SelectedBase)
             buffer.DrawFrame(topRow, baseLeftColumn, 16, 16, Color.White);
         if (index >= GameState.Current.Data.Bases.Count)
             continue;
         foreach (var facility in GameState.Current.Data.Bases[index].Facilities)
         {
             var facilityTopRow = topRow + 2 + facility.Row * 2;
             var facilityLeftColumn = baseLeftColumn + 2 + facility.Column * 2;
             var image = GetFacilityPreviewImage(facility);
             image.Render(buffer, facilityTopRow, facilityLeftColumn);
         }
     }
 }
Пример #3
0
 private void RenderFocusRectangle(GraphicsBuffer buffer)
 {
     if (mode != Mode.BuildFacility)
         return;
     var position = GameState.Current.PointerPosition;
     var facilityPoint = GetFacilityPoint(position.X, position.Y);
     if (facilityPoint != null && IsSpaceAvailable(facilityPoint.Row, facilityPoint.Column))
         buffer.DrawFrame(
             facilityPoint.Row * 32 + 8,
             facilityPoint.Column * 32,
             FacilitySize * 32,
             FacilitySize * 32,
             Color.FromArgb(255, 255, 0));
 }
Пример #4
0
        private void DrawSelection(GraphicsBuffer buffer)
        {
            if (selection == null)
                return;

            Font.Normal.DrawString(buffer, 20, 0, selection.Name, ColorScheme.Green);

            if (selection.Rounds > 0)
            {
                Font.Normal.DrawString(buffer, 64, 272, "AMMO:", ColorScheme.Green);
                Font.Normal.DrawString(buffer, 72, 272, "ROUNDS", ColorScheme.Green);
                Font.Normal.DrawString(buffer, 80, 272, "LEFT=", ColorScheme.Green);
                Font.Normal.DrawString(buffer, 80, 298, $"{selection.Rounds}", ColorScheme.Orange);
                buffer.DrawFrame(88, 272, 32, 48, Color.Gray);
                var ammunitionItem = selection.Ammunition == null ? selection : new BattleItem { Item = selection.Ammunition };
                DrawCenteredBattleItem(buffer, ammunitionItem, 88, 272);
            }

            var cursor = GameState.Current.PointerPosition;
            var width = selection.Width * 16;
            var height = selection.Height * 16;
            buffer.DrawItem(cursor.Y - height / 2, cursor.X - width / 2, selection.Image);
        }
Пример #5
0
 private static void DrawGridLines(GraphicsBuffer buffer)
 {
     buffer.DrawFrame(40, 16, 32, 16, Color.Gray);
     buffer.DrawVerticalLine(40, 32, 16, Color.Gray);
     buffer.DrawFrame(40, 112, 32, 16, Color.Gray);
     buffer.DrawVerticalLine(40, 128, 16, Color.Gray);
     buffer.DrawFrame(64, 0, 32, 48, Color.Gray);
     buffer.DrawFrame(64, 128, 32, 48, Color.Gray);
     buffer.DrawFrame(120, 0, 32, 16, Color.Gray);
     buffer.DrawVerticalLine(120, 16, 16, Color.Gray);
     buffer.DrawFrame(120, 128, 32, 16, Color.Gray);
     buffer.DrawVerticalLine(120, 144, 16, Color.Gray);
     buffer.DrawFrame(40, 192, 48, 48, Color.Gray);
     buffer.DrawVerticalLine(40, 208, 48, Color.Gray);
     buffer.DrawVerticalLine(40, 224, 48, Color.Gray);
     buffer.DrawHorizontalLine(56, 192, 48, Color.Gray);
     buffer.DrawHorizontalLine(72, 192, 48, Color.Gray);
     buffer.DrawFrame(104, 192, 64, 16, Color.Gray);
     buffer.DrawFrame(119, 192, 17, 16, Color.Gray);
     buffer.DrawFrame(119, 240, 16, 16, Color.Gray);
     buffer.DrawVerticalLine(104, 208, 16, Color.Gray);
     buffer.DrawVerticalLine(104, 224, 16, Color.Gray);
     buffer.DrawVerticalLine(104, 240, 16, Color.Gray);
     buffer.DrawFrame(152, 0, 320, 48, Color.Gray);
     buffer.DrawHorizontalLine(168, 0, 320, Color.Gray);
     buffer.DrawHorizontalLine(184, 0, 320, Color.Gray);
     for (var column = 16; column < 320; column += 16)
         buffer.DrawVerticalLine(152, column, 48, Color.Gray);
 }