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 Sub
Public Sub PlashScreen()
Me.BackgroundImage = Image.FromFile("GameOver.gif")
Application.DoEvents()
Threading.Thread.Sleep(2000)
End Sub
Ниже формы Form2 дважды щёлкаем по значку первого таймера Timer. Появляется шаблон метода, который после записи нашего кода принимает следующий вид.
Листинг 21.13. Метод-обработчик события Tick.
Private Sub Timer1_Tick(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Timer1.Tick