Dim intGradiantStep As Integer = 5
Dim intCurrentGradientShift As Integer = 0
Const colW1 As Integer = 250
Const colW2 As Integer = 150
Const rowH As Integer = 30
Dim AddedPlayer As New Player("", "-1")
Dim ArrPlayer As New ArrayList
Dim intCurrentGradientRow As Integer = 110
Public WriteOnly Property AddPlayer() As Player
Set(ByVal Value As Player)
If Value.PlayerName.Length > 14 Then
Value.PlayerName = _
Value.PlayerName.Substring(0, 14)
End If
AddedPlayer = Value
End Set
End Property
Public Sub drawTable()
Me.BackgroundImage = Nothing
Me.BackColor = Color.Moccasin
Application.DoEvents()
Dim g As Graphics = CreateGraphics()
Dim tpen1 As New Pen(Color.Red, 1)
Dim tpen2 As New Pen(Color.Black, 1)
Dim P1 As New Point(2, 80)
Dim P2 As New Point(400, 80)
For i As Integer = 0 To 11
g.DrawLine(tpen1, P1, P2)
P1.Y += 1
P2.Y += 1
g.DrawLine(tpen2, P1, P2)
P1.Y += rowH – 1
P2.Y += rowH – 1
Next
P1.Y = 80
P2.X = P1.X
P2.Y -= rowH
g.DrawLine(tpen2, P1, P2)
P1.X += 1
P2.X += 1
g.DrawLine(tpen1, P1, P2)
P1.X += colW1
P2.X += colW1
g.DrawLine(tpen2, P1, P2)
P1.X += 1
P2.X += 1
g.DrawLine(tpen1, P1, P2)
P1.X += colW2 – 3
P2.X += colW2 – 3
g.DrawLine(tpen1, P1, P2)
P1.X += 1
P2.X += 1
g.DrawLine(tpen2, P1, P2)
SaveScore()
LoadScore()
Timer1.Enabled = True
Timer2.Enabled = True
End Sub
Public Sub LoadScore()
If Not File.Exists("Score.dat") Then
GoTo newScore
End If
Dim FSR As New StreamReader("Score.dat")
Dim s As String
s = FSR.ReadLine
If Trim(s) <> "#Assignment Line#" Then
FSR.Close()
GoTo newScore
End If
For i As Integer = 0 To 9
s = FSR.ReadLine
Dim PlayerName As String = s.Split(CChar(";"))(0)
Dim PlayerScore As String = s.Split(CChar(";"))(1)
ArrPlayer.Add(New Player(PlayerName, PlayerScore))
Next
FSR.Close()
Exit Sub
newScore:
ArrPlayer.Add(New Player("AAA", "5000"))
ArrPlayer.Add(New Player("AAA", "4500"))
ArrPlayer.Add(New Player("AAA", "4000"))
ArrPlayer.Add(New Player("AAA", "3500"))
ArrPlayer.Add(New Player("AAA", "3000"))
ArrPlayer.Add(New Player("AAA", "2500"))
ArrPlayer.Add(New Player("AAA", "2000"))
ArrPlayer.Add(New Player("AAA", "1500"))
ArrPlayer.Add(New Player("AAA", "1000"))
ArrPlayer.Add(New Player("AAA", "500"))
End Sub
Public Sub SaveScore()
LoadScore()
For i As Integer = 0 To 9
If CDbl(AddedPlayer.PlayerScore) >= _
CDbl(CType(ArrPlayer(i), Player).PlayerScore) Then
ArrPlayer.Insert(i, AddedPlayer)
Exit For
End If
Next
Dim FSW As New StreamWriter("Score.dat")
Dim s As String = "#Assignment Line#"
s += Chr(13) + Chr(10)
For i As Integer = 0 To 9
s += CType(ArrPlayer(i), Player).PlayerName + ";" + _
CType(ArrPlayer(i), Player).PlayerScore
s += Chr(13) + Chr(10)
Next
FSW.Write(s)
FSW.Close()
End СКАЧАТЬ