Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_Version=Beta
- #AutoIt3Wrapper_Compression=0
- #AutoIt3Wrapper_UseUpx=y
- #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
- #AutoIt3Wrapper_Res_Language=1031
- #AutoIt3Wrapper_Res_requestedExecutionLevel=None
- #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
- #cs ----------------------------------------------------------------------------
- AutoIt Version: 3.3.12.0
- Author: myName
- Script Function:
- Template AutoIt script.
- Mauszeiger:
- Zahlen aus den Slots dafür bilder von Steinen
- die anzahl der Steine Unter dem Mauszeiger als Zahl
- #ce ----------------------------------------------------------------------------
- #cs --------------------------
- Online Status
- SQL Player online
- wenn spieler sich anmeldet dann wird eintrag in ODB gemacht
- jeder ander spielr chk in timing ob alle in der liste online sind wenn nein wird eintrag in der liste gelöscht
- (sicherstellen fals das programmm oder netzt bei anderen spielern zusammenbrach)
- Login oder registration
- Registration nach ihr wird code an mail gesandt dieser code wird eingeben und dadurch registration aktiviert
- Game starten oder auf einladung warten
- oder anfrage an online spieler
- speichern jedes spiels 7 tage wenn am 7 tag keine züge mehr stattfinden wird spiel gelöscht aus der ODB
- #ce --------------------------
- ; Script Start - Add your code below here
- #include <Includes\includes.au3>
- #Region ### START Koda GUI section ### Form=
- $GUI_Main = GUICreate($ToolNAME, 600, 438, -1, -1)
- $W_pos = WinGetPos ($GUI_Main)
- $GRP_Player_01 = GUICtrlCreateGroup ("", 10, 10, $BTN_size[0] *8 +(20), $BTN_size[1] *2 +(20))
- $pos = ControlGetPos ($GUI_Main, "", $GRP_Player_01)
- Opt ('GUICoordMode', 0)
- ### Player 01 ###
- $Player = 1
- $BTN_Player_1[0] = GUICtrlCreateButton( "", $pos[2]/2 -($BTN_size[0]), ($pos[3]/2) +5, $BTN_size[0], $BTN_size[1], $BS_BITMAP)
- _ArrayAdd ($AR_Player_State_01, $BTN_Player_1[0])
- Opt ('GUICoordMode', 1)
- GUISetState(@SW_SHOW)
- $pos = ControlGetPos ($GUI_Main, "", $BTN_Player_1[0])
- For $1 = 1 To 15
- Sleep ($BTNSpeed)
- If $1 = 4 Then
- $BTN_Player_1[$1] = GUICtrlCreateButton( "", $pos[0], $pos[1] -$BTN_size[1], $BTN_size[0], $BTN_size[1], $BS_BITMAP)
- ElseIf $1 = 12 Then
- $BTN_Player_1[$1] = GUICtrlCreateButton( "", $pos[0], $pos[1] +$BTN_size[1], $BTN_size[0], $BTN_size[1], $BS_BITMAP)
- ElseIf $1 > 12 Then
- $BTN_Player_1[$1] = GUICtrlCreateButton( "", $pos[0] -$BTN_size[0], $pos[1], $BTN_size[0], $BTN_size[1], $BS_BITMAP)
- ElseIf $1 > 4 Then
- $BTN_Player_1[$1] = GUICtrlCreateButton( "", $pos[0] +$BTN_size[0], $pos[1], $BTN_size[0], $BTN_size[1], $BS_BITMAP)
- Else
- $BTN_Player_1[$1] = GUICtrlCreateButton( "", $pos[0] -$BTN_size[0], $pos[1], $BTN_size[0], $BTN_size[1], $BS_BITMAP)
- EndIf
- _ArrayAdd ($AR_Player_State_01, $BTN_Player_1[$1])
- $pos = ControlGetPos ($GUI_Main, "", $BTN_Player_1[$1])
- Next
- ### Player 02 ###
- $pos = ControlGetPos ($GUI_Main, "", $GRP_Player_01)
- $GRP_Player_02 = GUICtrlCreateGroup ("", $pos[0], $pos[1] +$pos[3] +$FeldAbst, $BTN_size[0] *8 +(20), $BTN_size[1] *2 +(20))
- $pos = ControlGetPos ($GUI_Main, "", $GRP_Player_02)
- $Player = 2
- $BTN_Player_2[0] = GUICtrlCreateButton( "", $pos[0] +($pos[2] /2), $pos[1] +10, $BTN_size[0], $BTN_size[1], $BS_BITMAP)
- _ArrayAdd ($AR_Player_State_02, $BTN_Player_2[0])
- $pos = ControlGetPos ($GUI_Main, "", $BTN_Player_2[0])
- Opt ('GUICoordMode', 1)
- For $1 = 1 To 15
- Sleep ($BTNSpeed)
- If $1 = 4 Then
- $BTN_Player_2[$1] = GUICtrlCreateButton( "", $pos[0], $pos[1] +$BTN_size[1], $BTN_size[0], $BTN_size[1], $BS_BITMAP)
- ElseIf $1 = 12 Then
- $BTN_Player_2[$1] = GUICtrlCreateButton( "", $pos[0], $pos[1] -$BTN_size[1], $BTN_size[0], $BTN_size[1], $BS_BITMAP)
- ElseIf $1 > 12 Then
- $BTN_Player_2[$1] = GUICtrlCreateButton( "", $pos[0] +$BTN_size[0], $pos[1], $BTN_size[0], $BTN_size[1], $BS_BITMAP)
- ElseIf $1 > 4 Then
- $BTN_Player_2[$1] = GUICtrlCreateButton( "", $pos[0] -$BTN_size[0], $pos[1], $BTN_size[0], $BTN_size[1], $BS_BITMAP)
- Else
- $BTN_Player_2[$1] = GUICtrlCreateButton( "", $pos[0] +$BTN_size[0], $pos[1], $BTN_size[0], $BTN_size[1], $BS_BITMAP)
- EndIf
- _ArrayAdd ($AR_Player_State_02, $BTN_Player_2[$1])
- $pos = ControlGetPos ($GUI_Main, "", $BTN_Player_2[$1])
- Next
- $BTN_START = GUICtrlCreateButton( "Start", $W_pos[2] /2 -75, $W_pos[3] -100, 140, 40)
- $SatusBar = _GUICtrlStatusBar_Create($GUI_Main)
- Dim $SatusBar_PartsWidth[4] = [100, 200, 300, 400]
- _GUICtrlStatusBar_SetParts($SatusBar, $SatusBar_PartsWidth)
- _GUICtrlStatusBar_SetMinHeight($SatusBar, 25)
- _GUICtrlStatusBar_SetText($SatusBar, "", 0)
- _GUICtrlStatusBar_SetText($SatusBar, "", 1)
- _GUICtrlStatusBar_SetText($SatusBar, "", 2)
- _GUICtrlStatusBar_SetText($SatusBar, "", 3)
- GUISetState(@SW_SHOW)
- #EndRegion ### END Koda GUI section ###
- #Region ### START Koda GUI section ### Form=
- ;~ $GUI_Mouse = GUICreate("BAO - Maus", 100, 100, 0, 0, $WS_POPUP)
- ;~ $LAB_Points = GUICtrlCreateLabel("Label1", 8, 16, 110, 43)
- ;~ GUICtrlSetFont($LAB_Points, 24, 800, 0, "Tahoma")
- ;~ GUICtrlSetColor($LAB_Points, 0x800000)
- ;~ GUISetState(@SW_SHOW)
- #EndRegion ### END Koda GUI section ###
- ;~ _ArrayDisplay ($AR_Player_State_01)
- ;~ _ArrayDisplay ($AR_Player_State_02)
- AdlibRegister ("_GUI_Mouse_Move", 100)
- ;~ _AR_BTN_Sate ()
- Func _Start_Conf ()
- For $1 = 0 To 15
- If $1 < 12 Then
- GUICtrlSetData ($BTN_Player_1[$1], 2)
- ;~ _SetImageToCtrl("02.png", $BTN_Player_1[$1])
- GUICtrlSetData ($BTN_Player_2[$1], 2)
- ;~ _SetImageToCtrl("02.png", $BTN_Player_2[$1])
- Else
- GUICtrlSetData ($BTN_Player_1[$1], "")
- GUICtrlSetData ($BTN_Player_2[$1], "")
- ;~ _SetImageToCtrl("00.png", $BTN_Player_1[$1])
- ;~ _SetImageToCtrl("00.png", $BTN_Player_2[$1])
- EndIf
- GUICtrlSetState ($BTN_Player_1[$1], $GUI_ENABLE )
- GUICtrlSetState ($BTN_Player_2[$1], $GUI_ENABLE )
- GUICtrlSetFont ($BTN_Player_1[$1], 14, 800, "Tahoma")
- GUICtrlSetFont ($BTN_Player_2[$1], 14, 800, "Tahoma")
- Next
- EndFunc
- ;~ Func _AR_BTN_Sate ()
- ;~ Local $1, $Player, $AR_BTN_ID
- ;~ Global $AR_Player_State_01[1][5] ;Player BTN_ID BTN_Handle Mouseover1 Mouseover2
- ;~ Global $AR_Player_State_02[1][5] ;Player BTN_ID BTN_Handle Mouseover1 Mouseover2
- ;~ For $Player = 1 To 2
- ;~ For $1 = 0 To 15
- ;~ If $Player = 1 Then
- ;~ $AR_BTN_ID = $BTN_Player_1
- ;~ Else
- ;~ $AR_BTN_ID = $BTN_Player_2
- ;~ EndIf
- ;~ _ArrayAdd ($AR_Player_State_, $Player & $TR & $1 & $TR & $AR_BTN_ID[$1])
- ;~ Next
- ;~ Next
- ;~ _ArrayDisplay ($AR_Player_State)
- ;~ EndFunc
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- Exit
- Case $BTN_START
- _Start_Conf ()
- AdlibRegister ("_MouseOver", 100)
- EndSwitch
- for $1 = 0 To 15
- If $nMsg = $BTN_Player_1[$1] Then
- _Sound_Play ("Click")
- _CTRL_Player_Contra (2)
- $Player_AKTUELL = 2
- _Player ($1, 1)
- ;~ MsgBox (0,"", $1, 2)
- EndIf
- If $nMsg = $BTN_Player_2[$1] Then
- _Sound_Play ("Click")
- ;~ MsgBox (0,"", $1, 2)
- _CTRL_Player_Contra (1)
- $Player_AKTUELL = 1
- _Player ($1, 2)
- EndIf
- Next
- WEnd
- #cs --------------------------------
- Gibt die ID zurück von dem BTN über dem die Mouse gerade ist
- #ce --------------------------------
- Func _MouseOver ()
- Local $mpos, $1, $Found, $BTN_Player, $Points
- ;~ ToolTip ($Player_AKTUELL)
- ;~ If $Player_AKTUELL = 1 Then
- ;~ $BTN_Player = $BTN_Player_1
- ;~ Else
- ;~ $BTN_Player = $BTN_Player_2
- ;~ EndIf
- $mpos = GUIGetCursorInfo()
- If (IsArray($mpos)) Then
- For $1 = 0 To 15
- If ($mpos[4] = $BTN_Player_2[$1]) Or ($mpos[4] = $BTN_Player_1[$1]) Then
- $BTN_ID_AKT = $mpos[4]
- If $BTN_Aktive = $mpos[4] Then
- Else
- _BTN_setColor ($mpos[4], $1)
- EndIf
- Else
- ;~ _GUICtrlButton_SetStyle($BTN_Player_2[$1], $GUI_SS_DEFAULT_GUI)
- ;~ _GUICtrlButton_SetStyle($BTN_Player_1[$1], $GUI_SS_DEFAULT_GUI)
- ;~ GUICtrlSetFont ($BTN_Player_1[$1], 14, 800)
- EndIf
- Next
- EndIf
- EndFunc
- #cs --------------------------------
- Lässt die Aktivierten BTNs in gewünschter farbe Leuchten
- #ce --------------------------------
- Func _BTN_setColor ($BTN_HDL, $BTN_ID)
- Local $Found, $1, $Points = GUICtrlRead ($BTN_HDL, 1), $AR_Item
- Local $Level = "+"
- If $AR_Player_State_01[$BTN_ID][0] = $BTN_HDL Then
- $AR_BTN = $AR_Player_State_01
- $AR_BTN_C = $AR_Player_State_02
- Else
- $AR_BTN = $AR_Player_State_02
- $AR_BTN_C = $AR_Player_State_01
- EndIf
- ;~ _ArrayDisplay ($AR_BTN_C)
- ;~ GUICtrlSetBkColor($BTN_HDL, $BTN_Aktive_Color)
- If $Points < 2 Then
- $AR_Item = $BTN_ID
- $AR_BTN[$AR_Item][1] = "Fail"
- Else
- $AR_Item = $BTN_ID + $Points
- EndIf
- If $AR_Item > 15 Then
- $AR_Item = $AR_Item -16
- $Level = "-"
- EndIf
- ;~ ToolTip ($AR_BTN[$AR_Item][0] & $Level)
- _GUICtrlStatusBar_SetText($SatusBar, "BTN_HDL:" & $AR_BTN[$AR_Item][0], 0)
- _GUICtrlStatusBar_SetText($SatusBar, "BTN_ID:" & $BTN_ID, 1)
- _GUICtrlStatusBar_SetText($SatusBar, "Lev:" & $Level, 2)
- _GUICtrlStatusBar_SetText($SatusBar, "Punkte:" & $Points, 3)
- ;~ _GUICtrlStatusBar_SetText($SatusBar, "", 3)
- For $1 = 0 To 15
- If $AR_BTN[$1][1] = "Fail" Then
- _GUICtrlButton_SetStyle($AR_BTN[$1][0], $GUI_SS_DEFAULT_GUI)
- GUICtrlSetBkColor($AR_BTN[$1][0], $COLOR_RED)
- ElseIf $1 = $AR_Item Then
- $AR_BTN[$1][1] = 1
- ;~ GUICtrlSetBkColor($AR_BTN[$AR_Item][0], $BTN_Aktive_Color)
- GUICtrlSetBkColor($AR_BTN[$AR_Item][0], $COLOR_GRAY)
- Else
- _GUICtrlButton_SetStyle($AR_BTN[$1][0], $GUI_SS_DEFAULT_GUI)
- EndIf
- _GUICtrlButton_SetStyle($AR_BTN_C[$1][0], $GUI_SS_DEFAULT_GUI)
- Next
- $BTN_Aktive = $BTN_HDL
- EndFunc
- Func _Sound_Play ($SoundName)
- If $SoundName = "Click" Then
- SoundPlay ("BTN_Sound_Click.mp3")
- EndIf
- EndFunc
- #cs --------------------------------
- Lässt Infos Des CTRL in der Gui anzeigen,
- die sich mit der Maus versetzt
- #ce --------------------------------
- Func _GUI_Mouse_Move ()
- ;~ If Not $BTN_ID_AKT = @error Then
- ;~ Local $Points = GUICtrlRead ($BTN_ID_AKT, 1)
- ;~ GUICtrlSetData ($LAB_Points, $Points)
- ;~ Else
- ;~ GUICtrlSetData ($LAB_Points, "")
- ;~ EndIf
- ;~ Local $M_Pos = MouseGetPos ()
- ;~ WinSetOnTop ($GUI_Mouse, "", 1)
- ;~ WinMove ($GUI_Mouse, "", $M_Pos[0] +5, $M_Pos[1] +5)
- EndFunc
- #cs --------------------------------
- CTRLs des Gegeners werden Deaktive
- #ce --------------------------------
- Func _CTRL_Player_Contra ($PlayerContra_ID)
- Local $1, $BTN_PlayerContra, $BTN_Player
- If $PlayerContra_ID = 1 Then
- $BTN_PlayerContra = $BTN_Player_1
- $BTN_Player = $BTN_Player_2
- Else
- $BTN_PlayerContra = $BTN_Player_2
- $BTN_Player = $BTN_Player_1
- EndIf
- For $1 = 0 To 15
- GUICtrlSetState ($BTN_PlayerContra[$1], $GUI_DISABLE )
- GUICtrlSetState ($BTN_Player[$1], $GUI_ENABLE )
- Next
- EndFunc
- Func _Player ($BTN_NR, $Player)
- Local $Do = 0, $PlayerContra_ID
- If $Player = 1 Then
- $BTN_Player = $BTN_Player_1
- $PlayerContra_ID = 2
- Else
- $BTN_Player = $BTN_Player_2
- $PlayerContra_ID = 1
- EndIf
- Local $BTN_Points = GUICtrlRead ($BTN_Player[$BTN_NR], 1), $CTRL_BTN = $BTN_Player[$BTN_NR]
- If $BTN_Points < 2 Then
- MsgBox (0, "Fehler", "In dem Feld müssen mindestens 2 punkte enthalten sein.")
- Else
- GUICtrlSetData ($CTRL_BTN, "")
- _Set_Points ($BTN_Points, $BTN_NR, $Player)
- ;~ $BTN_Points = GUICtrlRead ($BTN_Player[$BTN_NR], 1)
- ;~ GUICtrlSetColor ($CTRL_BTN, $COLOR_RED)
- _Lose_CHECK ()
- _CTRL_Player_Contra ($Player)
- EndIf
- ;~ _BU_Points ()
- EndFunc
- #cs --------------------------------
- Nach jedem Zug wird einBackup der Punkte gemacht zum zurückführen
- #ce --------------------------------
- Func _BU_Points ()
- Local $AR_PlayState = IniReadSection ($INI, $Player_01 & $TR & $Player_02)
- Local $Points_01, $Points_02
- If IsArray ($AR_PlayState) Then
- $Round = $AR_PlayState[0][0]
- ;~ _ArrayDisplay ($AR_PlayState)
- Else
- Local $Round = 0
- EndIf
- MsgBox (0, 'PlayState', $AR_PlayState)
- Local $1
- For $1 = 0 To 15
- If $1 = 0 Then
- $Points_01 = GUICtrlRead ($BTN_Player_1[$1], 1)
- $Points_02 = GUICtrlRead ($BTN_Player_2[$1], 1)
- Else
- $Points_01 = $Points_01 & $TR & GUICtrlRead ($BTN_Player_1[$1], 1)
- $Points_02 = $Points_02 & $TR & GUICtrlRead ($BTN_Player_2[$1], 1)
- EndIf
- Next
- IniWrite ($INI, $Player_01 & $TR & $Player_02, $Round, $Points_01 & "><" & $Points_02)
- EndFunc
- #cs --------------------------------
- Prüft ob noch Züge möglich sind
- #ce --------------------------------
- Func _Lose_CHECK ()
- Local $Var_01 = 0 ,$Var_02 = 0 ,$Points_01 = 0 ,$Points_02 = 0 , $1, $Points_Read_01, $Points_Read_02
- For $1 = 0 To 15
- $Points_Read_01 = GUICtrlRead ($BTN_Player_1[$1], 1)
- $Points_Read_02 = GUICtrlRead ($BTN_Player_2[$1], 1)
- If Not $Points_Read_01 = "" Then
- $Points_01 = $Points_01 +$Points_Read_01
- $Var_01 = $Var_01 +1
- Else
- EndIf
- If Not $Points_Read_02 = "" Then
- $Points_02 = $Points_02 +$Points_Read_02
- $Var_02 = $Var_02 +1
- Else
- EndIf
- Next
- If $Points_02 = $Var_02 Then
- _Player_Lose (2)
- ElseIf $Points_01 = $Var_01 Then
- _Player_Lose (1)
- EndIf
- EndFunc
- Func _AR_CTRL_Player ($ID)
- If $ID = 1 Then
- Return $BTN_Player_1
- ElseIf $ID = 2 Then
- Return $BTN_Player_2
- EndIf
- EndFunc
- Func _PlayerContra_ID ()
- If $Player_AKTUELL = 2 Then
- Return 2
- Else
- Return 1
- EndIf
- EndFunc
- Func _Player_Lose ($Player_Lose)
- MsgBox (0, $Player_Lose, "Spieler " & $Player_Lose & " kann keine Züge mehr machen, Er Verliert")
- _CTRL_Player_Contra (1)
- _CTRL_Player_Contra (2)
- EndFunc
- Func _Set_Points ($BTN_Points, $BTN_NR, $Player)
- Local $1, $Points
- If $Player = 1 Then
- $BTN_Player = $BTN_Player_1
- Else
- $BTN_Player = $BTN_Player_2
- EndIf
- For $1 = 1 To $BTN_Points
- Sleep ($StepSpeed)
- $BTN_NR = $BTN_NR +1
- If $BTN_NR = 16 Then $BTN_NR = 0
- $BTN_ID = $BTN_Player[$BTN_NR]
- GUICtrlSetData ($BTN_ID, GUICtrlRead ($BTN_ID, 1) +1)
- If $1 = $BTN_Points Then
- $BTN_Points = GUICtrlRead ($BTN_ID, 1)
- If $BTN_Points > 1 Then
- GUICtrlSetData ($BTN_ID, "")
- $Points = _Grap_Points ($BTN_NR, $Player)
- _Set_Points ($BTN_Points +$Points, $BTN_NR, $Player)
- EndIf
- Else
- EndIf
- Next
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement