Jo, ich hab ein Bischen gebraucht, da ich noch was anderes machen musste voher! Und ich hab es gleich mit Array gemacht, damit es nicht so lang wird, wenn man es noch weiter ausbaut!
Aber jetzt ist es fertig!
Spoiler anzeigen
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
Dim $Bau [6]
#Region ### START Koda GUI section ### Form=Burgia.kxf\Burgia.kxf
$Form1 = GUICreate("Form1", 625, 445, 193, 125)
GUISetBkColor(0x00FF00)
$Bau[0] = GUICtrlCreateButton("Stall", 56, 48, 121, 89, 0)
$Bau[1] = GUICtrlCreateButton("Kaserne", 240, 48, 121, 89, 0)
$Bau[2] = GUICtrlCreateButton("Rathaus", 56, 208, 121, 89, 0)
$Bau[3] = GUICtrlCreateButton("Haus", 240, 208, 121, 89, 0)
$Bau[4] = GUICtrlCreateButton("Burg", 408, 104, 121, 121, 0)
$Bau[5] = GUICtrlCreateButton("Bauernhof", 400, 312, 185, 121, 0)
GUICtrlSetBkColor(-1, 0x808000)
$Date1 = GUICtrlCreateDate("2009/05/09 09:32:2", 504, 8, 113, 33)
$MonthCal1 = GUICtrlCreateMonthCal("2009/05/09", 392, 8, 97, 33)
$AusBau = GUICreate ("Ausbau",200,100,100,100,-1,-1,$Form1)
$BauB = GUICtrlCreateButton ("",10,70,180,25)
$Text = GUICtrlCreateLabel ("d",10,10,180,60)
GUISwitch ($Form1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$BauArten = StringSplit ("Stall|Kaserne|Rathaus|Haus|Burg|Bauernhof","|")
$BauZeiten = StringSplit ("2000|3000|1000|1000|5000|1500","|")
$Stufen = StringSplit ("0|0|0|0|0|0","|")
$Zahl = 0
$Time = 0
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg[1]
Case $Form1
Switch $nMsg[0]
Case -3
Exit
EndSwitch
For $1 = 0 To UBound ($Bau) -1
If $nMsg[0] = $Bau[$1] Then
If $Time = 0 Then
_Bau($1+1)
$Zahl = $1 +1
Else
MsgBox (16,"Error","Du kannst nur ein Gebäude auf einmal Ausbauen")
EndIf
EndIf
Next
Case $AusBau
Switch $nMsg[0]
Case -3
GUISetState (@SW_HIDE,$AusBau)
Case $BauB
$Time = $BauZeiten[$Zahl]
GUICtrlSetState ($BauB,$GUI_DISABLE)
AdlibEnable ("_Bautime",1000)
EndSwitch
EndSwitch
WEnd
Func _Bau($Art)
GUICtrlSetData ($Text,$BauArten[$Art] & " auf Stufe " & $Stufen[$Art] +1 & " ausbauen?")
GUICtrlSetData ($BauB, $BauArten[$Art] & " Ausbauen")
GUISetState (@SW_SHOW,$AusBau)
EndFunc
Func _Bautime()
$Time -= 100
GUICtrlSetData ($Text,"Noch " & $Time /100 & " sec bis zu Fertigstellung")
If $Time = 0 Then
GUISetState (@SW_HIDE,$AusBau)
AdlibDisable ()
$Stufen[$Zahl] += 1
GUICtrlSetData ($Bau[$Zahl -1],$BauArten[$Zahl] & " (" & $Stufen[$Zahl] & ")")
GUICtrlSetState ($BauB,$GUI_ENABLE)
EndIf
EndFunc