#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiToolbar.au3>
#include <StaticConstants.au3>
#include <ToolbarConstants.au3>
#include <WindowsConstants.au3>
Global $Stats = 0, $sTime = 0, $mTime = 0, $hFile
#Region ### START Koda GUI section ###
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Eat Me so fast how you can!", 1201, 882, 239, 93)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "No")
$Label1 = GUICtrlCreateLabel($Mtime & ":" & $STime, 1144, 3, 51, 20)
$Label2 = GUICtrlCreateLabel("Очки: " & $stats, 160, 3, 90, 20)
$Label3 = GUICtrlCreateLabel("", 584, 3, 90, 20)
$Button1 = GUICtrlCreateButton("Eat Me", 576, 400, 51, 25)
GUICtrlSetOnEvent($Button1, "Eat_Button")
$Button2 = GUICtrlCreateButton("Load", 0, 1, 75, 23)
GUICtrlSetOnEvent($Button2, "Load_Game")
$Button3 = GUICtrlCreateButton("Save", 80, 1, 75, 23)
GUICtrlSetOnEvent($Button3, "Save_Game")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AdlibRegister("Time", 1000)
While 1
GUICtrlSetPos( $button1, Random(0,1140), Random(30,770), 60)
Text()
WEnd
Func Eat_Button()
$stats += 2
$Label2 = GUICtrlCreateLabel("Очки: " & $stats, 160, 3, 90, 20)
EndFunc
Func No()
$stats -= 1
$label2 = GUICtrlCreateLabel("Очки: " & $stats, 160, 3, 90, 20)
EndFunc
Func Load_Game()
$stats += 1
$hFile = FileOpen(@ScriptDir & "\SetsEatGame.txt", 0)
If $hFile = -1 Then MsgBox(4096, "Ошибка", "Невозможно открыть файл настроек!")
$Stats = FileReadLine($hFile, 1)
$sTime = FileReadLine($hFile, 2)
$mTime = FileReadLine($hFile, 3)
EndFunc
Func Save_Game()
$stats += 1
FileDelete(@ScriptDir & "\SetsEatGame.txt")
$hFile = FileOpen(@ScriptDir & "\SetsEatGame.txt", 1)
If $hFile = -1 Then MsgBox(4096, "Ошибка", "Невозможно открыть файл настроек!")
FileWriteLine($hFile, $Stats)
FileWriteLine($hFile, $sTime)
FileWriteLine($hFile, $mTime)
EndFunc
Func Time()
$STime += 1
If $STime > 59 Then
$STime = 0
$Mtime += 1
EndIf
GUICtrlDelete($label1)
$labelTime = GUICtrlCreateLabel($Mtime & ":" & $STime, 1144, 3, 90, 20)
EndFunc
Func CLOSE()
AdlibUnRegister("Time")
FileClose($hFile)
Exit
EndFunc
Func Text()
If $stats < 0 Then Sleep(1050)
If $stats >= 0 And $stats <= 10 Then
GUICtrlDelete($Label3)
$Label3 = GUICtrlCreateLabel("Звание: Никто", 584, 3, 320, 20)
Sleep(1000)
EndIf
If $stats >= 11 And $stats <= 25 Then
GUICtrlDelete($Label3)
$Label3 = GUICtrlCreateLabel("Звание: Новичок", 584, 3, 320, 20)
Sleep(950)
EndIf
If $stats >= 26 And $stats <= 50 Then
GUICtrlDelete($Label3)
$Label3 = GUICtrlCreateLabel("Звание: Опытный", 584, 3,320, 20)
Sleep(900)
EndIf
If $stats >= 51 And $stats <= 100 Then
GUICtrlDelete($Label3)
$Label3 = GUICtrlCreateLabel("Звание: Магистр", 584, 3, 320, 20)
Sleep(850)
EndIf
If $stats >= 101 And $stats <= 250 Then
GUICtrlDelete($Label3)
$Label3 = GUICtrlCreateLabel("Звание: Мастер", 584, 3, 320, 20)
Sleep(800)
EndIf
If $stats >= 251 And $stats <= 500 Then
GUICtrlDelete($Label3)
$Label3 = GUICtrlCreateLabel("Звание: Эксперт", 584, 3, 320, 20)
Sleep(750)
EndIf
If $stats >= 501 And $stats <= 750 Then
GUICtrlDelete($Label3)
$Label3 = GUICtrlCreateLabel("Звание: Профи", 584, 3, 320, 20)
Sleep(700)
EndIf
If $stats >= 751 And $stats <= 1000 Then
GUICtrlDelete($Label3)
$Label3 = GUICtrlCreateLabel("Звание: Ас", 584, 3, 320, 20)
Sleep(650)
EndIf
If $stats >= 1001 And $stats <= 2000 Then
GUICtrlDelete($Label3)
$Label3 = GUICtrlCreateLabel("Звание: Победитель", 584, 3, 320, 20)
Sleep(600)
EndIf
If $stats >= 2001 Then
GUICtrlDelete($Label3)
$Label3 = GUICtrlCreateLabel("Звание: БОГ", 584, 3, 320, 20)
Sleep(550)
EndIf
EndFunc