@Xerxes danke erstmal fürs verschieben
So zum Code ist jetzt nurso ausm Kopf aber sowas meine ich
BlitzBasic: [AUSKLAPPEN] [EINKLAPPEN] Global Window = CreateWindow("Fenster 1",0,0,640,480)
Local FPS = CreateTimer(30)
Global LoggedIn=0 Global LoginTry=0
Repeat ID = WaitEvent() If ID=$803 Then End EndIf If LoggedIn=0 And LoginTry=0 Then Login(FPS) EndIf WaitTimer(FPS) Until KeyHit(1)
Function Login(FPS) LoginTry=1 LoginWindow = CreateWindow("Einloggen.",0,0,320,240) LoginBtn = CreateButton("Einloggen",0,0,300,220,LoginWindow) Repeat If WaitEvent()=$401 Then If EventSource()=LoginBtn Then LoggedIn=1 Notify "Du bist nun eingeloggt!" ActivateWindow(Window) EndIf EndIf WaitTimer(FPS) Until LoggedIn=1 End Function
So ich hoffe es ist nun Klarer was ich meine das Login Fenster soll nicht nur in den Hintergrund sondern einfach "gelöscht" werden
Mfg
EDIT:
Noch ne kleine Frage, braucht man bei Gui´s eig. einen Timer ? Wusste ich nicht und habe ihn sicherheitshalber gesetzt ^-^
PS: Und ich weiß das es unsafe ist das nur mit einer Variable zur überprüfen ob er eingeloggt ist
Hier nochmal mein Code für die dies interressiert Verbresserungsvorschläge sind seeehrrr erwünscht ^-^
BlitzBasic: [AUSKLAPPEN] [EINKLAPPEN] Global ShopWin = CreateWindow("PVP Orbit Shop&Hangar Tool",50,50,550,480)
Global Canvas = CreateCanvas(5,70,500,300,ShopWin) SetBuffer CanvasBuffer(Canvas)
Local FPS = CreateTimer(60)
Global LoginActive=0 Global LoggedIn=0 Global LoggedOut=0
Global GL_passwort$="" Global GL_username$=""
Global G_Label_Konfi Global G_Button_Konfi_1 Global G_Button_Konfi_2 Global G_Button_Ship Global G_Button_Drone Global G_Button_Start Global G_Button_Save Global G_Label_Head
Global Goliath=LoadImage("img/Goliath.png") Global Vengeance=LoadImage("img/Vengeance.png") Global Phoenix=LoadImage("img/Phönix.png") Global LF_3=LoadImage("img/LF_3.png") Global Shield=LoadImage("img/Shield.png") Global Speed=LoadImage("img/Speed.png") Global Iris=LoadImage("img/Iris.png") Global Flax=LoadImage("img/Flax.png")
Global ActiveKonfi=1 Global Start=0 Global Counter=0
Global Handler=1
Global Credits=512000 Global ShipSpeed=0 Global ShipShield=0 Global ShipLaser=0 Global GUI=0
Global DrohneLaser_1=0 Global DrohneLaser_2=0 Global DrohneShield_1=0 Global DrohneShield_2=0
Type Drohne Field Platz Field Slot1 Field Slot2 Field Slot3 Field Slot4 End Type
Type Laser Field Loc Field Place End Type
Type Shield Field Loc Field Place End Type
Type Speed Field Place End Type
Repeat Cls ID=WaitEvent() If LoggedIn=0 And LoginActive=0 Then Login() EndIf If ID=$401 Then ES=EventSource() EventHandler(ES) EndIf Shop() DisplayData() FlipCanvas Canvas WaitTimer(FPS)
Until ID=$803
Function Login() Repeat LoginActive=1 Local username$,password$ Local LoginTry=0 LoginWin = CreateWindow("Login",ClientWidth(Desktop())/2-200,ClientHeight(Desktop())/2-100,400,200,0,1) Label = CreateLabel("",5,5,180,20,LoginWin) SetGadgetText Label,"Username:" username$ = CreateTextField(5,25,250,20,LoginWin,0) Label2 = CreateLabel("",5,50,180,20,LoginWin) SetGadgetText Label2,"Passwort:" password$ = CreateTextField(5,75,250,20,LoginWin,1) LoginButton = CreateButton("Einloggen",5,105,100,30,LoginWin) Label3 = CreateLabel("",5,140,300,40,LoginWin) SetGadgetText Label3,"Kein Account? Registriere dich Kostenlos auf www.asdfasdf.de !" Label4 = CreateLabel("",280,5,30,30,LoginWin) SetGadgetText Label4,"Status:" Label5 = CreateLabel("",280,30,100,80,LoginWin) Repeat If WaitEvent()=$401 Then If EventSource()=LoginButton Then LoginTry=1 Status$="Anfrage gestartet.." EndIf ElseIf WaitEvent()=$803 Then End EndIf Delay 16 Until LoginTry=1 Stream = OpenTCPStream("127.0.0.1",80) SetGadgetText Label5,Status$ If Not Stream Then SetGadgetText Label5,"Konnte nicht zum Server verbinden..versuche es später erneut." Else SetGadgetText Label5,"Mit Server verbunden.." WriteLine Stream,"GET /PVPOrbit/index.php?do=login&username=" + TextFieldText$(username$) + "&passwort=" + TextFieldText$(password$) + " HTTP/1.0" WriteLine Stream,"User-Agent: PVP_Orbit" WriteLine Stream,"Connection: close" WriteLine Stream,Chr$(10) GL_username$=TextFieldText$(username$) GL_passwort$=TextFieldText$(password$) If Eof(Stream) Then SetGadgetText Label5,"Fehler beim Abfragen!" Else While Not Eof(Stream) LoginString$=ReadLine$(Stream) TranslateOutput(LoginString$) SetGadgetText Label5,LoginString$ Delay 128 Wend EndIf EndIf Delay 16 Until LoggedIn=1 CloseTCPStream(Stream) End Function
Function Shop() If LoggedIn=1 Then If GUI=0 LoadGUI() EndIf Else Label1 = CreateLabel("",5,5,300,300,ShopWin) SetGadgetText Label1,"Du musst dich zuerst einloggen!" EndIf End Function
Function TranslateOutput(LoginString$) Local Answer1$="Logged In" Local Answer2$="Logout Failed. Bad Data" Local Answer3$="Logout Succesfully." Local Answer4$="Database Error." If Not LoginString$="" Then Position=Instr(LoginString$,Answer1$) If Not Position=0 Then Notify "Du wurdest erfolgreich eingeloggt!" LoggedIn=1 ActivateWindow ShopWin EndIf Position=Instr(LoginString$,Answer2$,0) If Not Position=0 Then Notify "Logout konnte nicht durchgeführt werden!" LoggedOut=0 EndIf Position=Instr(LoginString$,Answer3$,0) If Not Position=0 Then Notify "Du wurdest erfolgreich ausgeloggt! Deine Daten wurden gespeichert." LoggedOut=1 EndIf Position=Instr(LoginString$,Answer4$,0) If Not Position=0 Then Notify "Fehler in der Datenbank. Bitte kontaktiere den Support!" LoggedOut=1 EndIf EndIf End Function
Function LoadGUI() GUI=1 EditWindow=ShopWin G_Label_Konfi=CreateLabel("Konfiguration",5,8,72,16,EditWindow,0) SetGadgetLayout G_Label_Konfi,1,0,1,0 G_Button_Konfi_1=CreateButton("1",80,8,16,16,EditWindow,1) SetGadgetLayout G_Button_Konfi_1,1,0,1,0 G_Button_Konfi_2=CreateButton("2",100,8,16,16,EditWindow,1) SetGadgetLayout G_Button_Konfi_2,1,0,1,0 G_Button_Ship=CreateButton("Schiff",5,40,80,24,EditWindow,1) SetGadgetLayout G_Button_Ship,1,0,1,0 G_Button_Drone=CreateButton("Drohnen",90,40,80,24,EditWindow,1) SetGadgetLayout G_Button_Drone,1,0,1,0 G_Button_Start=CreateButton("Spiel Starten",285,5,104,56,EditWindow,1) SetGadgetLayout G_Button_Start,1,0,1,0 G_Button_Save=CreateButton("Konfiguration Speichern",5,378,224,24,EditWindow,1) SetGadgetLayout G_Button_Save,1,0,1,0 G_Label_Head=CreateLabel("Konfi-Manager by Bobo2040",128,8,152,24,EditWindow,0) SetGadgetLayout G_Label_Head,1,0,1,0 End Function
Function EventHandler(ID) If ID=G_Button_Konfi_1 Then ActiveKonfi=1 Konfi() ElseIf ID=G_Button_Konfi_2 Then ActiveKonfi=2 Konfi() ElseIf ActiveKonfi=1 And ID=G_Button_Drone Then Handler=2 ElseIf ActiveKonfi=1 And ID=G_Button_Ship Then Handler=1 ElseIf ActiveKonfi=2 And ID=G_Button_Drone Then Handler=4 ElseIf ActiveKonfi=2 And ID=G_Button_Ship Then Handler=3 EndIf End Function
Function Konfi() Local Stream = OpenTCPStream("127.0.0.1",80) If ActiveKonfi=1 Then WriteLine Stream,"GET /pvporbit/inventar.php?do=s_konfi&konfi=1&username=" + GL_username$ + "&passwort=" + GL_passwort$ + " HTTP/1.0" WriteLine Stream,"User-Agent: PVP_Orbit" WriteLine Stream,"Connection: close" WriteLine Stream,Chr$(10) If Eof(Stream) Then Notify "Fehler beim Verbinden zum Server!" Else Counter=0 Start=0 For Drohne.Drohne=Each Drohne Delete Drohne Next While Not Eof(Stream) HandleOutput(ReadLine$(Stream)) Wend EndIf ElseIf ActiveKonfi=2 Then WriteLine Stream,"GET /pvporbit/inventar.php?do=s_konfi&konfi=2&username=" + GL_username$ + "&passwort=" + GL_passwort$ + " HTTP/1.0" WriteLine Stream,"User-Agent: PVP_Orbit" WriteLine Stream,"Connection: close" WriteLine Stream,Chr$(10) If Eof(Stream) Then Notify "Fehler beim Verbinden zum Server!" Else Counter=0 Start=0 For Drohne.Drohne=Each Drohne Delete Drohne Next While Not Eof(Stream) HandleOutput(ReadLine$(Stream)) Wend EndIf EndIf CloseTCPStream(Stream) End Function
Function HandleOutput(Txt$) If Not Txt$="" Then Position = Instr(Txt$,"GO") If Position>0 Then Start=1 EndIf If Start=1 Then If Counter<=8 Then Drohne.Drohne=New Drohne Drohne\Platz=Txt$ Drohne\Slot1=0 Drohne\Slot2=0 Drohne\Slot3=0 Drohne\Slot4=0 ElseIf Counter=9 Then Ship_Typ=Txt$ ElseIf Counter=10 Then ShipLaser=Txt$ ElseIf Counter=11 Then ShipShield=Txt$ ElseIf Counter=12 Then ShipSpeed=Txt$ ElseIf Counter=13 Then DrohneLaser_1=Txt$ ElseIf Counter=14 Then DrohneShield_1=Txt$ ElseIf Counter=15 Then DrohneLaser_2=Txt$ ElseIf Counter=16 Then DrohneShield_2=Txt$ EndIf Counter=Counter+1 EndIf If Instr(Txt$,"Fehler! Bitte versuche es später erneut.") Then Notify "Fehler in der Datenbank!" EndIf EndIf End Function
Function DisplayData() If LoggedIn=1 Then Select Handler Case 1 j=0 For i=0 To ShipLaser-1 Step 1 If i=8 Then j=1 c=8 EndIf k=j*33+5 l=i*33-c*33 DrawImage LF_3,l+5,k Next k=0 l=0 i=0 j=0 c=0 count=0 count2=0 For i=0 To ShipShield Step 1 If i=8 Then j=1 c=8 EndIf k=j*33+69 l=i*33-c*33 DrawImage Shield,l+5,k+10 count=i Next For y=0 To ShipSpeed-1 Step 1 If count+y=8 Then j=1 c=8 EndIf k=(j)*33+69 l=(y+count)*33-c*33 DrawImage Speed,l+5,k+10 Next Case 2 cFlax=0 cIris=0 For Drohne.Drohne=Each Drohne If Drohne\Platz=1 Then cFlax=cFlax+1 ElseIf Drohne\Platz=2 Then cIris=cIris+1 EndIf Next count=0 For i=0 To cIris-1 Step 1 If i=4 Then c=2 j=4 EndIf x=80*c+5 y=i*64-j*64+5 DrawImage Iris,x,y count=count+1 Next For i=0 To cFlax-1 Step 1 If i+count=4 Then c=2 j=4 EndIf x=80*c+5 y=(count+i)*64-j*64+5 DrawImage Flax,x,y Next Case 3 j=0 For i=0 To ShipLaser-1 Step 1 If i=8 Then j=1 c=8 EndIf k=j*33+5 l=i*33-c*33 DrawImage LF_3,l+5,k Next k=0 l=0 i=0 j=0 c=0 count=0 count2=0 For i=0 To ShipShield Step 1 If i=8 Then j=1 c=8 EndIf k=j*33+69 l=i*33-c*33 DrawImage Shield,l+5,k+10 count=i Next For y=0 To ShipSpeed-1 Step 1 If count+y=8 Then j=1 c=8 EndIf k=(j)*33+69 l=(y+count)*33-c*33 DrawImage Speed,l+5,k+10 Next Case 4 cFlax=0 cIris=0 For Drohne.Drohne=Each Drohne If Drohne\Platz=1 Then cFlax=cFlax+1 ElseIf Drohne\Platz=2 Then cIris=cIris+1 EndIf Next count=0 For i=0 To cIris-1 Step 1 If i=4 Then c=2 j=4 EndIf x=80*c+5 y=i*64-j*64+5 DrawImage Iris,x,y count=count+1 Next For i=0 To cFlax-1 Step 1 If i+count=4 Then c=2 j=4 EndIf x=80*c+5 y=(count+i)*64-j*64+5 DrawImage Flax,x,y Next End Select EndIf End Function
Das wichtigste Spielt sich in der "Login()" Funktion ab
Mfg
|