int SizeX = 25;
int SizeY = 15;
int X = 50;
int Y = 50;
int CellId = 0;
for (int i = 0; i < 40; i++)
{
for (int j = 0; j < 14; j++)
{
e.Graphics.DrawPolygon(myPen, new Point[] { new Point(X, Y), new Point((X + SizeX), (Y + SizeY)), new Point((X + SizeX * 2), Y), new Point((X + SizeX), (Y - SizeY)) });
X += SizeX * 2;
this.myCells.Add(new CellData(CellId, new Point[] { new Point(X, Y), new Point((X + SizeX), (Y + SizeY)), new Point((X + SizeX * 2), Y), new Point((X + SizeX), (Y - SizeY)) }));
CellId++;
}
Y += SizeY;
X = 50;
if (Math.Round(double.Parse((i / 2).ToString())) == (double.Parse(i.ToString()) / 2)) // pair
X += SizeX; // pour le suivant, i sera impair
}
Private Sub DrawMap()
Dim _Map = Bot.map_infos
g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
Dim cells = _Map.CellData
Dim x = 0
Dim y = 0
For j = 0 To 39
For i = 0 To 13
If j And 1 Then ' j est impaire
x = i * 64 + 64
Else ' j est paire
x = i * 64 + 32
End If
y = j * 18 + 18
Dim couleur As Color = Color.Green
Dim centre As New Point(x, y)
If Not cells(j * 14 + i).Mov Then couleur = Color.Red
'If cells(j * 14 + i).Visible Then
Dim brush = New SolidBrush(couleur)
Dim points(3) As Point
points(0) = New Point(centre.X, centre.Y - 18)
points(1) = New Point(centre.X + 32, centre.Y)
points(2) = New Point(centre.X, centre.Y + 18)
points(3) = New Point(centre.X - 32, centre.Y)
' dessiner le polygone
g.FillPolygon(brush, points)
g.DrawPolygon(Pens.White, points)
'centre = New Point(centre.X - 10, centre.Y - 7)
'g.DrawString(j * 14 + i, Me.Font, Brushes.AliceBlue, centre)
'End If
Next
Next
'mise en picturebox
PictureBox1.Image = b.Clone
End Sub
Private Sub DrawOnMap()
DrawMap()
For Each Actor In Bot.MapComplementaryInformations.Actors
Dim couleur As New Color
Select Case Actor.protocolId 'En fonction du type on affiche
Case 36 'Joueurs
If Actor.contextualId = Bot.ID Then ' Bot
couleur = Color.Yellow
Else
couleur = Color.White
End If
Case 129, 146 'Marchand (Avec ou sans guilde)
couleur = Color.BlanchedAlmond
Case 148 'Percepteur
couleur = Color.Orange
Case 156 'PNJ
couleur = Color.Blue
Case 160 'Monstres
couleur = Color.Red
Case 180 'Dragodinde
couleur = Color.Yellow
Case Else
couleur = Color.Black
End Select
Dim Y As UInteger = Actor.disposition.cellId \ 14
Dim X As UInteger = Actor.disposition.cellId Mod 14
If Y And 1 Then ' est sur ligne impaire
X = X * 64 + 64
Else ' est sur une ligne paire
X = X * 64 + 32 ' pour dessiner
End If
Y = Y * 18 + 18
Dim centre As New Point(X, Y)
Dim brush = New SolidBrush(couleur)
Dim rect As System.Drawing.Rectangle
rect.X = centre.X - 16
rect.Y = centre.Y - 9
rect.Width = 32
rect.Height = 18
' dessiner l'Ellipse
g.FillEllipse(brush, rect)
g.DrawEllipse(Pens.White, rect)
Next
'mise en picturebox
PictureBox1.Image = b.Clone
End Sub