def __init__(self,parent): self.parent = parent Window.__init__(self,"Player select",(36, 107, 97),(43, 76, 111),0,0,500,250,(255,255,255)) self.parent = parent self.parent.SetPlayersDef(self.DataPlayers) self.parent.SetProfileSettingsDef(self.NameConfirmation) self.Start()
def __init__(self, parent): self.parent = parent Window.__init__(self, "Player select", (36, 107, 97), (43, 76, 111), 0, 0, 500, 250, (255, 255, 255)) self.parent = parent self.parent.SetPlayersDef(self.DataPlayers) self.parent.SetProfileSettingsDef(self.NameConfirmation) self.Start()
def __init__(self, parent): self.parent = parent Window.__init__(self, "Add server", (36, 107, 97), (43, 76, 111), 0, 0, 500, 250, (255, 255, 255), 250) y_act = 40 + 5 name = Text(BebasNeue.c30, "Server name", (0, 0, 0)) name.x = self.width / 4 - name.surface.get_size()[0] / 2 name.y = y_act self.AddElement(name, "Name") #y_act += 3+name.surface.get_size()[1] name_input = Input() name_input.AllowAll() name_input.SetSize(200, 30) name_input.x = self.width / 4 * 3 - name_input.size[0] / 2 name_input.y = y_act name_input.SetTextColor(255, 0, 0) name_input.SetBackgroundColor(100, 100, 100) self.AddElement(name_input, "Name input") y_act += name_input.size[1] + name_input.border_size * 2 + 10 ip = Text(BebasNeue.c30, "IP Adress", (0, 0, 0)) ip.x = self.width / 4 - ip.surface.get_size()[0] / 2 ip.y = y_act self.AddElement(ip, "IP") #y_act += ip.surface.get_size()[1]+3 ip_input = Input() ip_input.AllowNumbers() ip_input.SetSize(200, 30) ip_input.x = self.width / 4 * 3 - ip_input.size[0] / 2 ip_input.y = y_act ip_input.SetTextColor(255, 0, 0) ip_input.SetBackgroundColor(100, 100, 100) name_input.SetNextInput(ip_input) self.AddElement(ip_input, "IP input") y_act += ip_input.size[1] + 2 * ip_input.border_size + 15 accept_button = AcceptButton("Create", 150, [self.width / 2 + 20, y_act]) self.AddElement(accept_button, "Create button") cancel_button = RejectButton("Cancel", 150, [self.width / 2 - 150 - 20, y_act]) self.AddElement(cancel_button, "Cancel button") y_act += cancel_button.size[1] + 5 self.height = y_act self.GenerateSurface() self.tab = False self.tab_elements = ["Name input", "IP input"] self.current_tab = -1
def __init__(self): Window.__init__(self,"High ping",(36, 107, 97),(43, 76, 111),0,0,400,150,(255,255,255)) textTitle = Text(fonts.BebasNeue.c30,"Your ping is too high",(255,255,255),0,0) textTitle.x = self.width / 2 - textTitle.surface.get_size()[0]/2 textTitle.y = 60 self.AddElement(textTitle,"info") currentPing = Text(fonts.BebasNeue.c40,"",(255,255,255)) currentPing.x = self.width / 2 - textTitle.surface.get_size()[0]/2 currentPing.y = 90 self.AddElement(currentPing,"ping")
def __init__(self): Window.__init__(self,"Connection lost",(200,100,100),(43, 76, 111),0,0,400,120,(0,0,0),255) textContent = Text(fonts.BebasNeue.c30,"Network game server conection lost",(255,255,255)) textContent.y = 50 textContent.x = self.width/2-textContent.surface.get_size()[0]/2 self.AddElement(textContent) ButtonAccept = NeutralButton("OK") ButtonAccept.y = 90 ButtonAccept.x = self.width/2-ButtonAccept.imageA.get_size()[0]/2 self.AddElement(ButtonAccept,"Accept")
def __init__(self): Window.__init__(self, "High ping", (36, 107, 97), (43, 76, 111), 0, 0, 400, 150, (255, 255, 255)) textTitle = Text(fonts.BebasNeue.c30, "Your ping is too high", (255, 255, 255), 0, 0) textTitle.x = self.width / 2 - textTitle.surface.get_size()[0] / 2 textTitle.y = 60 self.AddElement(textTitle, "info") currentPing = Text(fonts.BebasNeue.c40, "", (255, 255, 255)) currentPing.x = self.width / 2 - textTitle.surface.get_size()[0] / 2 currentPing.y = 90 self.AddElement(currentPing, "ping")
def __init__(self,parent): self.parent = parent Window.__init__(self, "Add server", (36, 107, 97), (43, 76, 111), 0, 0, 500, 250, (255,255,255), 250) y_act = 40 + 5 name = Text(BebasNeue.c30,"Server name",(0,0,0)) name.x = self.width/4 - name.surface.get_size()[0]/2 name.y = y_act self.AddElement(name,"Name") #y_act += 3+name.surface.get_size()[1] name_input = Input() name_input.AllowAll() name_input.SetSize(200,30) name_input.x = self.width/4*3 - name_input.size[0]/2 name_input.y = y_act name_input.SetTextColor(255,0,0) name_input.SetBackgroundColor(100,100,100) self.AddElement(name_input,"Name input") y_act += name_input.size[1]+name_input.border_size*2+10 ip = Text(BebasNeue.c30,"IP Adress",(0,0,0)) ip.x = self.width/4 - ip.surface.get_size()[0]/2 ip.y = y_act self.AddElement(ip,"IP") #y_act += ip.surface.get_size()[1]+3 ip_input = Input() ip_input.AllowNumbers() ip_input.SetSize(200,30) ip_input.x = self.width/4*3 - ip_input.size[0]/2 ip_input.y = y_act ip_input.SetTextColor(255,0,0) ip_input.SetBackgroundColor(100,100,100) name_input.SetNextInput(ip_input) self.AddElement(ip_input,"IP input") y_act += ip_input.size[1]+2*ip_input.border_size+15 accept_button = AcceptButton("Create",150,[self.width/2+20,y_act]) self.AddElement(accept_button,"Create button") cancel_button = RejectButton("Cancel",150,[self.width/2-150-20,y_act]) self.AddElement(cancel_button,"Cancel button") y_act += cancel_button.size[1]+5 self.height = y_act self.GenerateSurface() self.tab = False self.tab_elements = ["Name input","IP input"] self.current_tab = -1
def __init__(self,name,parent,onlyRooms = False): self.original_height = 180 Window.__init__(self,"Welcome to "+str(name),(36, 107, 97),(43, 76, 111),0,0,500,self.original_height,(255,255,255)) self.AddLoading() if onlyRooms: self.SetMSJ("Requesting rooms...") else: self.SetMSJ("Connecting ...") self.AddQuit() self.mode = "loading" parent.SetOptionRoomsDef(self.InfoReceived) self.mousePressed =0
def __init__(self,dataJoin): self.fullA = False self.fullB = False Window.__init__(self,"Join to game",(36, 107, 97),(36, 107, 97),0,0,500,140,(255,255,255),200) self.maxA = dataJoin["max-A"] self.maxB = dataJoin["max-B"] self.availableA = dataJoin["availableA"] self.availableB = dataJoin["availableB"] self.playsA = self.maxA - self.availableA self.playsB = self.maxB - self.availableB self.UpdatePlayersA(dataJoin["availableA"]) self.UpdatePlayersB(dataJoin["availableB"]) self.SS = "A" self.ref = time.time()*1000
def __init__(self): Window.__init__(self, "Connection lost", (200, 100, 100), (43, 76, 111), 0, 0, 400, 120, (0, 0, 0), 255) textContent = Text(fonts.BebasNeue.c30, "Network game server conection lost", (255, 255, 255)) textContent.y = 50 textContent.x = self.width / 2 - textContent.surface.get_size()[0] / 2 self.AddElement(textContent) ButtonAccept = NeutralButton("OK") ButtonAccept.y = 90 ButtonAccept.x = self.width / 2 - ButtonAccept.imageA.get_size()[0] / 2 self.AddElement(ButtonAccept, "Accept")
def LogicUpdate(self): Window.LogicUpdate(self) if not self.sending_data: if (self.references["Accept"].pressed or pygame.key.get_pressed()[pygame.K_RETURN] or pygame.key.get_pressed()[pygame.K_KP_ENTER] ) and self.mouseOut: self.pressed = True else: if self.pressed: self.sending_data = True self.pressed = False data = { "action": "register", "username": self.references["User Input"].text, "password": self.references["Pass Input"].text, "confirmation": self.references["Confirm Password Input"].text, "email": self.references["Email Input"].text } self.parent.Send(data) if self.references["Cancel"].pressed: self.pressed2 = True else: if self.pressed2: self.pressed2 = False self.parent.DeleteWindow("SignUp") self.parent.AddWindowCenteredOnFront( self.save, None, "Login")
def __init__(self,parent,save): self.parent = parent Window.__init__(self,"User selector",(36, 107, 97),(43, 76, 111),0,0,400,200,(255,255,255)) self.save = save Login = NeutralButton("Login") Login.x = self.width/2-Login.size[0]/2 Login.y = (self.height)/2+20-(3*Login.size[1]+10)/2 self.AddElement(Login,"Login") SignIn = NeutralButton("Sign Up") SignIn.x = Login.x SignIn.y = Login.y + Login.size[1] + 5 self.AddElement(SignIn,"Sign Up") Guest = NeutralButton("Enter as guest") Guest.x = Login.x Guest.y = SignIn.y + SignIn.size[1] + 5 self.AddElement(Guest,"Guest")
def LogicUpdate(self): Window.LogicUpdate(self) if not self.loging_in: if self.references["Accept"].pressed or pygame.key.get_pressed( )[pygame.K_RETURN] or pygame.key.get_pressed()[pygame.K_KP_ENTER]: self.was_pressed2 = True else: if self.was_pressed2: self.was_pressed2 = False self.loging_in = True self.parent.Send({ "action": "check_login", "username": self.references["User Input"].text, "password": self.references["Pass Input"].text }) self.username = self.references["User Input"].text self.password = self.references["Pass Input"].text if self.references["Cancel"].pressed: self.was_pressed1 = True else: if self.was_pressed1: self.parent.DeleteWindow("Login window") self.parent.AddWindowCenteredOnFront( self.save, None, "Login") else: self.was_pressed1 = False
def __init__(self, dataJoin): self.fullA = False self.fullB = False Window.__init__(self, "Join to game", (36, 107, 97), (36, 107, 97), 0, 0, 500, 140, (255, 255, 255), 200) self.maxA = dataJoin["max-A"] self.maxB = dataJoin["max-B"] self.availableA = dataJoin["availableA"] self.availableB = dataJoin["availableB"] self.playsA = self.maxA - self.availableA self.playsB = self.maxB - self.availableB self.UpdatePlayersA(dataJoin["availableA"]) self.UpdatePlayersB(dataJoin["availableB"]) self.SS = "A" self.ref = time.time() * 1000
def __init__(self, parent, save): self.parent = parent Window.__init__(self, "User selector", (36, 107, 97), (43, 76, 111), 0, 0, 400, 200, (255, 255, 255)) self.save = save Login = NeutralButton("Login") Login.x = self.width / 2 - Login.size[0] / 2 Login.y = (self.height) / 2 + 20 - (3 * Login.size[1] + 10) / 2 self.AddElement(Login, "Login") SignIn = NeutralButton("Sign Up") SignIn.x = Login.x SignIn.y = Login.y + Login.size[1] + 5 self.AddElement(SignIn, "Sign Up") Guest = NeutralButton("Enter as guest") Guest.x = Login.x Guest.y = SignIn.y + SignIn.size[1] + 5 self.AddElement(Guest, "Guest")
def __init__(self,server_name,room_data,parent): self.room_data = room_data ww,hh = pygame.display.get_surface().get_size() ww -= 50 hh -= 50 Window.__init__(self,server_name,(170, 102, 57),(221, 202, 11),0,0,ww,hh,(255,255,255)) title = Text(fonts.BebasNeue.c40,"GAMES",(255,255,255)) title.y = 35 title.x = self.width/2-title.surface.get_size()[0]/2 self.AddElement(title,"Title") listRooms = ListSystem(0,0,False,) listRooms.AddUpKey("Name",250) listRooms.AddUpKey("Mode",150) listRooms.AddUpKey("Stadium",250) listRooms.AddUpKey("Players",120) listRooms.SetBackground((200,150,150),(50,50,50)) listRooms.SetUpBackground((41,0,69),(149,0,255)) listRooms.SetItemColor((23,0,45),(86,0,173)) listRooms.SetSendInfoDef(self.NewSelected) rooms = room_data["info"] for x in range(len(rooms)): listRooms.AddRow({"Name":rooms[x]["name"],"Mode":rooms[x]["mode"],"Stadium":rooms[x]["stadium"],"Players":str(rooms[x]["players"]["clients"])+"/"+str(rooms[x]["players"]["max-clients"])}) listRooms.y = 100 listRooms.x = self.width/2-listRooms.width/2 self.AddElement(listRooms,"LIST") disconnect = NeutralButton("Disconnect",120,(0,0),fonts.BebasNeue.c20) disconnect.y = 30 disconnect.x = 10 self.AddElement(disconnect,"Disconnect") cPlayer = NeutralButton("Change player",120,(0,0),fonts.BebasNeue.c20) cPlayer.y = 30 cPlayer.x = self.width - 10 - cPlayer.imageA.get_size()[0] self.AddElement(cPlayer,"cplayer") connect = AdvancedButton((350,80),(0,0),"Play",(50,50,200),(50,50,50)) distance_to_back_list = (listRooms.y + 70 + listRooms.height) connect.y = (self.height - distance_to_back_list)/2 + distance_to_back_list - connect.image.get_size()[1]/2 connect.x = self.width/2 - connect.image.get_size()[0]/2 self.AddElement(connect,"Connect") parent.SetUpdateRoomsDef(self.RoomChanges)
def __init__(self,data): Window.__init__(self,"Match statistics",(36, 107, 97),(36, 107, 97),0,0,500,300,(255,255,255),200) textWin = Text(fonts.CTProLamina.c40,data["textWin"],(255,255,255),0,0) textWin.y = 40 textWin.x = self.width/2 - textWin.surface.get_size()[0]/2 self.AddElement(textWin,"textWin") self.sum_y = 100 self.SetGoalsFHalf(data["goalsData"]) self.SetGoalsSHalf(data["goalsData"]) self.SetGoalsFinal(data["goalsData"]) self.ref = time.time() self.left = 20 self.wait = 20 self.AddTimeSurface()
def LogicUpdate(self): Window.LogicUpdate(self) if self.ButtonCheck("Cancel"): self.Kill() session_query.SessionDeclareDisconnect() elif self.ButtonCheck("Accept"): self.RestoreSession(self.data) elif self.ButtonCheck("okButton"): self.SendName(self.references["inputField"].text)
def __init__(self): ww, hh = pygame.display.get_surface().get_size() ww -= 50 hh -= 50 Window.__init__(self, "MULTITPLAYER GAME", (36, 107, 97), (43, 76, 111), 0, 0, ww, hh, (255, 255, 255)) self.enabled = False self.locked = True title = Text(fonts.BebasNeue.c40, "SERVER BROWSER", (255, 255, 255)) title.x = self.width / 2 - title.surface.get_size()[0] / 2 title.y = 35 self.AddElement(title) #bar = Bar(10,400,0.1,self.width-50,100) #self.AddElement(bar) listSystem = list_system.ListSystem(0, 0, True, self.height - 250) listSystem.AddUpKey("Name", 400) listSystem.AddUpKey("IP", 150) listSystem.AddUpKey("Mode", 150) listSystem.y = 100 listSystem.x = self.width / 2 - listSystem.width / 2 self.AddElement(listSystem, "ListSystem") connectButton = AdvancedButton((350, 80), (0, 0), "Connect", (63, 20, 57), (43, 11, 39)) distance_to_back_list = (listSystem.y + 70 + listSystem.height) connectButton.y = ( self.height - distance_to_back_list ) / 2 + distance_to_back_list - connectButton.image.get_size()[1] / 2 connectButton.x = self.width / 2 - connectButton.image.get_size()[0] / 2 self.AddElement(connectButton, "ConnectButton") add = ClassicButton("+", (0, 255, 0), (0, listSystem.y + listSystem.height + 50)) add.x = listSystem.x + listSystem.width - add.imageA.get_size()[0] self.AddElement(add, "AddButton") remove = ClassicButton("-", (255, 0, 0), (0, add.y)) remove.x = add.x - remove.size[0] self.AddElement(remove, "RemoveButton") self.LoadLocalSevers()
def __init__(self, parent, save): self.save = save Window.__init__(self, "Login", (36, 107, 97), (43, 76, 111), 0, 0, 400, 160, (255, 255, 255)) self.parent = parent font = fonts.AldoTheApache UserText = Text(font.c30, "Username:"******"User Text") PassText = Text(font.c30, "Password:"******"Pass Text") UserInput = Input() UserInput.AllowAll() UserInput.SetParent(self) UserInput.SetSize(150, 30) UserInput.x = self.width / 2 + 5 UserInput.y = self.height / 2 - UserInput.size[1] - 2 - 15 self.AddElement(UserInput, "User Input") PassInput = copy.copy(UserInput) PassInput.y += PassInput.size[1] + 5 PassInput.password = True self.AddElement(PassInput, "Pass Input") UserInput.SetNextInput(PassInput) Accept = AcceptButton("Login", 150, (0, 0), font) Accept.x = self.width / 2 + 10 Accept.y = PassInput.y + PassInput.size[1] + 20 self.AddElement(Accept, "Accept") Reject = RejectButton("Cancel", 150, (0, 0), font) Reject.x = self.width / 2 - 10 - Reject.size[0] Reject.y = Accept.y self.AddElement(Reject, "Cancel") self.was_pressed1 = False self.was_pressed2 = False self.parent.SetLoginDef(self.Login) self.loging_in = False self.username = "" self.password = ""
def __init__(self,parent,save): self.save = save Window.__init__(self,"Login",(36, 107, 97),(43, 76, 111),0,0,400,160,(255,255,255)) self.parent = parent font = fonts.AldoTheApache UserText = Text(font.c30,"Username:"******"User Text") PassText = Text(font.c30,"Password:"******"Pass Text") UserInput = Input() UserInput.AllowAll() UserInput.SetParent(self) UserInput.SetSize(150,30) UserInput.x = self.width/2 + 5 UserInput.y = self.height/2 - UserInput.size[1] - 2-15 self.AddElement(UserInput,"User Input") PassInput = copy.copy(UserInput) PassInput.y += PassInput.size[1] + 5 PassInput.password = True self.AddElement(PassInput,"Pass Input") UserInput.SetNextInput(PassInput) Accept = AcceptButton("Login",150,(0,0),font) Accept.x = self.width/2+10 Accept.y = PassInput.y + PassInput.size[1] + 20 self.AddElement(Accept,"Accept") Reject = RejectButton("Cancel",150,(0,0),font) Reject.x = self.width/2 - 10 - Reject.size[0] Reject.y = Accept.y self.AddElement(Reject,"Cancel") self.was_pressed1 = False self.was_pressed2 = False self.parent.SetLoginDef(self.Login) self.loging_in = False self.username = "" self.password = ""
def __init__(self): ww,hh = pygame.display.get_surface().get_size() ww -= 50 hh -= 50 Window.__init__(self,"MULTITPLAYER GAME",(36, 107, 97),(43, 76, 111),0,0,ww,hh,(255,255,255)) self.enabled = False self.locked = True title = Text(fonts.BebasNeue.c40,"SERVER BROWSER",(255,255,255)) title.x = self.width/2-title.surface.get_size()[0]/2 title.y = 35 self.AddElement(title) #bar = Bar(10,400,0.1,self.width-50,100) #self.AddElement(bar) listSystem = list_system.ListSystem(0,0,True,self.height-250) listSystem.AddUpKey("Name",400) listSystem.AddUpKey("IP",150) listSystem.AddUpKey("Mode",150) listSystem.y = 100 listSystem.x = self.width/2-listSystem.width/2 self.AddElement(listSystem,"ListSystem") connectButton = AdvancedButton((350,80),(0,0),"Connect",(63,20,57),(43,11,39)) distance_to_back_list = (listSystem.y + 70 + listSystem.height) connectButton.y = (self.height - distance_to_back_list)/2 + distance_to_back_list - connectButton.image.get_size()[1]/2 connectButton.x = self.width/2 - connectButton.image.get_size()[0]/2 self.AddElement(connectButton,"ConnectButton") add = ClassicButton("+",(0,255,0),(0, listSystem.y + listSystem.height + 50)) add.x = listSystem.x + listSystem.width - add.imageA.get_size()[0] self.AddElement(add,"AddButton") remove = ClassicButton("-",(255,0,0),(0,add.y)) remove.x = add.x - remove.size[0] self.AddElement(remove,"RemoveButton") self.LoadLocalSevers()
def LogicUpdate(self): Window.LogicUpdate(self) if self.references["Login"].pressed: self.parent.AddWindowCenteredOnFront(Login(self.parent, self), None, "Login window") self.parent.DeleteWindow("Login") if self.references["Sign Up"].pressed: self.parent.AddWindowCenteredOnFront(SignUp(self.parent, self), None, "SignUp") self.parent.DeleteWindow("Login") if self.references["Guest"].pressed: self.parent.DeleteWindow("Login") self.parent.AddWindowCenteredOnFront(self.save, None, "loading") self.parent.references["loading"].SetNameInput()
def __init__(self, server_name, room_data, parent): self.room_data = room_data ww, hh = pygame.display.get_surface().get_size() ww -= 50 hh -= 50 Window.__init__(self, server_name, (170, 102, 57), (221, 202, 11), 0, 0, ww, hh, (255, 255, 255)) title = Text(fonts.BebasNeue.c40, "GAMES", (255, 255, 255)) title.y = 35 title.x = self.width / 2 - title.surface.get_size()[0] / 2 self.AddElement(title, "Title") listRooms = ListSystem( 0, 0, False, ) listRooms.AddUpKey("Name", 250) listRooms.AddUpKey("Mode", 150) listRooms.AddUpKey("Stadium", 250) listRooms.AddUpKey("Players", 120) listRooms.SetBackground((200, 150, 150), (50, 50, 50)) listRooms.SetUpBackground((41, 0, 69), (149, 0, 255)) listRooms.SetItemColor((23, 0, 45), (86, 0, 173)) listRooms.SetSendInfoDef(self.NewSelected) rooms = room_data["info"] for x in range(len(rooms)): listRooms.AddRow({ "Name": rooms[x]["name"], "Mode": rooms[x]["mode"], "Stadium": rooms[x]["stadium"], "Players": str(rooms[x]["players"]["clients"]) + "/" + str(rooms[x]["players"]["max-clients"]) }) listRooms.y = 100 listRooms.x = self.width / 2 - listRooms.width / 2 self.AddElement(listRooms, "LIST") disconnect = NeutralButton("Disconnect", 120, (0, 0), fonts.BebasNeue.c20) disconnect.y = 30 disconnect.x = 10 self.AddElement(disconnect, "Disconnect") cPlayer = NeutralButton("Change player", 120, (0, 0), fonts.BebasNeue.c20) cPlayer.y = 30 cPlayer.x = self.width - 10 - cPlayer.imageA.get_size()[0] self.AddElement(cPlayer, "cplayer") connect = AdvancedButton((350, 80), (0, 0), "Play", (50, 50, 200), (50, 50, 50)) distance_to_back_list = (listRooms.y + 70 + listRooms.height) connect.y = ( self.height - distance_to_back_list ) / 2 + distance_to_back_list - connect.image.get_size()[1] / 2 connect.x = self.width / 2 - connect.image.get_size()[0] / 2 self.AddElement(connect, "Connect") parent.SetUpdateRoomsDef(self.RoomChanges)
def __init__(self,x,y,server_name,server_ip,parent): self.ip = server_ip Window.__init__(self,server_name,(36, 107, 97),(43, 76, 111),x,y,500,330,(255,255,255),250) self.parent = parent textIP = Text(fonts.BebasNeue.c30,server_ip,(255,255,255)) textIP.y = 30 textIP.x = self.width / 2 - textIP.surface.get_size()[0]/2 self.AddElement(textIP) textDetails = Text(fonts.BebasNeue.c20,"DETAILS:",(255,255,255)) textDetails.y = 70 textDetails.x = self.width / 2 - textDetails.surface.get_size()[0]/2 self.AddElement(textDetails) Mode = Text(fonts.BebasNeue.c20,"MODE:",(255,255,255)) Mode.y = 100 Mode.x = self.width/4 - Mode.surface.get_size()[0]/2 self.AddElement(Mode) Players = Text(fonts.BebasNeue.c20,"PLAYERS:",(255,255,255)) Players.y = 140 Players.x = self.width/4 - Players.surface.get_size()[0]/2 self.AddElement(Players) Ping = Text(fonts.BebasNeue.c20,"TCP PING:",(255,255,255)) Ping.y = 180 Ping.x = self.width/4 - Ping.surface.get_size()[0]/2 self.AddElement(Ping) PingUDP = Text(fonts.BebasNeue.c20,"UDP PING:",(255,255,255)) PingUDP.y = 200 PingUDP.x = self.width/4- PingUDP.surface.get_size()[0]/2 self.AddElement(PingUDP) ModeContent = Text(fonts.BebasNeue.c20,"NN",(255,255,255)) ModeContent.y = 100 ModeContent.x = self.width*3/4 - ModeContent.surface.get_size()[0]/2 self.AddElement(ModeContent,"ModeShown") PlayersContent = Text(fonts.BebasNeue.c20,"NN",(255,255,255)) PlayersContent.y = 140 PlayersContent.x = self.width*3/4 - PlayersContent.surface.get_size()[0]/2 self.AddElement(PlayersContent,"PlayersShown") PingContent = Text(fonts.BebasNeue.c20,"NN",(255,255,255)) PingContent.y = 180 PingContent.x = self.width*3/4 - PingContent.surface.get_size()[0]/2 self.AddElement(PingContent,"PingShown") PingUDPcontent = Text(fonts.BebasNeue.c20,"NN",(255,255,255)) PingUDPcontent.y = 200 PingUDPcontent.x = self.width/4*3 - PingUDPcontent.surface.get_size()[0]/2 self.AddElement(PingUDPcontent,"PingUDP") self.status = "reject" ##### LOADING #### loadingText = Text(fonts.BebasNeue.c15,"Connecting...",(255,255,255)) loadingText.y = 230 loadingText.x = self.width/2-loadingText.surface.get_size()[0]/2 self.AddElement(loadingText,"LoadingText") loadingA = LoadingAnimation(squares=4) loadingA.y = 250 loadingA.x = self.width/2-loadingA.width/2 self.AddElement(loadingA,"LoadingA") ##### BUTTON REJECT ##### rejectButton = RejectButton("Cancel") rejectButton.y = 290 rejectButton.x = self.width/2 - rejectButton.imageA.get_size()[0]/2 self.AddElement(rejectButton,"Reject") ##### NETWORK ##### self.parent.SetErrorDef(self.Network_error) self.parent.SetConnectDef(self.Network_connected) self.parent.SetRBasicDef(self.Network_RBasic) self.parent.SetUDPsignalDef(self.UDPsignal) self.allowConnect = False self.Connect()
def __init__(self,parent,dataSession): Window.__init__(self,"Restore game",(253,245,230),(30,144,255),0,0,400,330,(0,0,0),255,(0,0,0)) self.parent = parent self.data = dataSession textColor = 255,255,255 title = Text(fonts.BebasNeue.c15,"Your last connection data:",textColor) title.x = self.width/2 - title.surface.get_size()[0]/2 title.y = 30 self.AddElement(title,"Tittle") if dataSession["status"] == "TryConnect" or dataSession["status"] == "TryConnectRoom": server = Text(fonts.BebasNeue.c20,"Server Address: ",textColor); server.x = self.width / 4 - server.surface.get_size()[0]/2 server.y = 80 - server.surface.get_size()[1]/2 self.AddElement(server,"Server title") server_IP = Text(fonts.BebasNeue.c30,str(dataSession["ip"]),textColor) server_IP.x = self.width / 4 * 3 - server_IP.surface.get_size()[0]/2 server_IP.y = 80 - server_IP.surface.get_size()[1]/2 self.AddElement(server_IP,"ip data") if dataSession["logData"]["type"] == "needGuestName": textInfo = Text(fonts.BebasNeue.c30,"You need to be asigned a name!",textColor) textInfo.x = self.width / 2 - textInfo.surface.get_size()[0]/2 textInfo.y = 90 - textInfo.surface.get_size()[1]/2 self.AddElement(textInfo,"textInfo") else: textSession = Text(fonts.BebasNeue.c15,"Your login data:",textColor) textSession.x = self.width / 2 - textSession.surface.get_size()[0]/2 textSession.y = 130 - textSession.surface.get_size()[1]/2 self.AddElement(textSession,"sessionData") textType = Text(fonts.BebasNeue.c20,"Type:",textColor) textType.x = self.width / 4 - textType.surface.get_size()[0]/2 textType.y = 160 - textSession.surface.get_size()[1]/2 self.AddElement(textType,"sessionTypeText") if dataSession["logData"]["type"] == "guest": textContentType = Text(fonts.BebasNeue.c30,"Guest",textColor) else: textContentType = Text(fonts.BebasNeue.c20,"Login",textColor) ### ADD PASSWORD FIELD passTitle = Text(fonts.BebasNeue.c20,"password:"******"passTitle") passContent = Text(fonts.BebasNeue.c30,"****",textColor) passContent.y = 225 - passContent.surface.get_size()[1]/2 passContent.x = self.width / 4 * 3 - passContent.surface.get_size()[0]/2 self.AddElement(passContent,"passContent") titleName = Text(fonts.BebasNeue.c20,"User:"******"titleName") nameContent = Text(fonts.BebasNeue.c20,dataSession["logData"]["name"],textColor) nameContent.x = self.width / 4 * 3 - nameContent.surface.get_size()[0]/2 nameContent.y = 200 - nameContent.surface.get_size()[1]/2 self.AddElement(nameContent,"name") ### ADD TEXT CONTENT TYPE, GUEST OR LOGIN textContentType.x = self.width/4*3 - textContentType.surface.get_size()[0]/2 textContentType.y = 160 - textContentType.surface.get_size()[1]/2 self.AddElement(textContentType,"contentType") if dataSession["status"] == "TryConnectRoom": titleRoom = Text(fonts.BebasNeue.c20,"Room",textColor) titleRoom.x = self.width / 4 - titleRoom.surface.get_size()[0]/2 titleRoom.y = 240 - titleRoom.surface.get_size()[1]/2 self.AddElement(titleRoom,"titleRoom") roomContent = Text(fonts.BebasNeue.c20,dataSession["room"],textColor) roomContent.x = self.width / 4 * 3 - roomContent.surface.get_size()[0]/2 roomContent.y = 240 - roomContent.surface.get_size()[1]/2 self.AddElement(roomContent,"roomName") self.AddButtons() self.parent.SetOptionRoomsDef(self.JoiningActions) self.parent.SetErrorDef(self.Network_Error) self.parent.SetConnectDef(self.Network_connected) self.parent.SetRBasicDef(self.Network_RBasic) self.parent.SetLoginDef(self.LoginSuccess)
def __init__(self,parent,save): Window.__init__(self,"Sign up",(36, 107, 97),(43, 76, 111),0,0,400,210,(255,255,255)) self.parent = parent self.save = save font = fonts.BebasNeue.c25 y_act = 29 ### User text ### UserText = Text(font,"Username:"******"User Text") ### User input ### UserInput = Input() UserInput.AllowAll() UserInput.SetParent(self) UserInput.SetSize(150,30) UserInput.x = self.width/2 + 5 UserInput.y = UserText.y + (UserText.surface.get_size()[1]/2 - UserInput.size[1]/2) self.AddElement(UserInput,"User Input") ### Password text ### y_act += UserText.surface.get_size()[1] + 5 PassText = Text(font,"Password:"******"Pass Text") ### Password input ### PassInput = copy.copy(UserInput) PassInput.y = PassText.y + (PassText.surface.get_size()[1]/2 - PassInput.size[1]/2) PassInput.password = True self.AddElement(PassInput,"Pass Input") ### Pass Confirm text ### y_act += PassText.surface.get_size()[1] + 5 PassConfText = Text(font,"Confirm password:"******"Confirm Password Text") ### Pass Confirm input ### PassConfInput = copy.copy(PassInput) PassConfInput.y = PassConfText.y + (PassConfText.surface.get_size()[1]/2 - PassConfInput.size[1]/2) self.AddElement(PassConfInput,"Confirm Password Input") ### Email text ### y_act += PassConfText.surface.get_size()[1] + 5 EmailText = Text(font,"Email:",(0,0,0)) EmailText.x = self.width/2 - EmailText.surface.get_size()[0] - 5 EmailText.y = y_act self.AddElement(EmailText,"Email Text") ### Email input ### EmailInput = copy.copy(PassConfInput) EmailInput.password = False EmailInput.y = EmailText.y - (EmailText.surface.get_size()[1]/2 - EmailInput.size[1]/2) self.AddElement(EmailInput,"Email Input") ### Setting next inputs ### UserInput.next_input = PassInput PassInput.next_input = PassConfInput PassConfInput.next_input = EmailInput EmailInput.next_input = UserInput ### Accept button ### y_act += EmailText.surface.get_size()[1] + 10 Accept = AcceptButton("Sign up",150,(0,0),font) Accept.x = self.width/2+10 Accept.y = y_act self.AddElement(Accept,"Accept") ### Reject button ### Reject = RejectButton("Cancel",150,(0,0),font) Reject.x = self.width/2 - 10 - Reject.size[0] Reject.y = y_act self.AddElement(Reject,"Cancel") ### Extra variables ### self.pressed = False self.pressed2 = False self.parent.SetRegisterDef(self.RegisterConfirm) self.sending_data = False
def __init__(self): Window.__init__(self,"Client sync configuration",(43, 76, 111),(117, 108, 163),0,0,400,170,(255,255,255),255) self.AddInput() self.AddAcceptButtons()
def __init__(self, x, y, server_name, server_ip, parent): self.ip = server_ip Window.__init__(self, server_name, (36, 107, 97), (43, 76, 111), x, y, 500, 330, (255, 255, 255), 250) self.parent = parent textIP = Text(fonts.BebasNeue.c30, server_ip, (255, 255, 255)) textIP.y = 30 textIP.x = self.width / 2 - textIP.surface.get_size()[0] / 2 self.AddElement(textIP) textDetails = Text(fonts.BebasNeue.c20, "DETAILS:", (255, 255, 255)) textDetails.y = 70 textDetails.x = self.width / 2 - textDetails.surface.get_size()[0] / 2 self.AddElement(textDetails) Mode = Text(fonts.BebasNeue.c20, "MODE:", (255, 255, 255)) Mode.y = 100 Mode.x = self.width / 4 - Mode.surface.get_size()[0] / 2 self.AddElement(Mode) Players = Text(fonts.BebasNeue.c20, "PLAYERS:", (255, 255, 255)) Players.y = 140 Players.x = self.width / 4 - Players.surface.get_size()[0] / 2 self.AddElement(Players) Ping = Text(fonts.BebasNeue.c20, "TCP PING:", (255, 255, 255)) Ping.y = 180 Ping.x = self.width / 4 - Ping.surface.get_size()[0] / 2 self.AddElement(Ping) PingUDP = Text(fonts.BebasNeue.c20, "UDP PING:", (255, 255, 255)) PingUDP.y = 200 PingUDP.x = self.width / 4 - PingUDP.surface.get_size()[0] / 2 self.AddElement(PingUDP) ModeContent = Text(fonts.BebasNeue.c20, "NN", (255, 255, 255)) ModeContent.y = 100 ModeContent.x = self.width * 3 / 4 - ModeContent.surface.get_size( )[0] / 2 self.AddElement(ModeContent, "ModeShown") PlayersContent = Text(fonts.BebasNeue.c20, "NN", (255, 255, 255)) PlayersContent.y = 140 PlayersContent.x = self.width * 3 / 4 - PlayersContent.surface.get_size( )[0] / 2 self.AddElement(PlayersContent, "PlayersShown") PingContent = Text(fonts.BebasNeue.c20, "NN", (255, 255, 255)) PingContent.y = 180 PingContent.x = self.width * 3 / 4 - PingContent.surface.get_size( )[0] / 2 self.AddElement(PingContent, "PingShown") PingUDPcontent = Text(fonts.BebasNeue.c20, "NN", (255, 255, 255)) PingUDPcontent.y = 200 PingUDPcontent.x = self.width / 4 * 3 - PingUDPcontent.surface.get_size( )[0] / 2 self.AddElement(PingUDPcontent, "PingUDP") self.status = "reject" ##### LOADING #### loadingText = Text(fonts.BebasNeue.c15, "Connecting...", (255, 255, 255)) loadingText.y = 230 loadingText.x = self.width / 2 - loadingText.surface.get_size()[0] / 2 self.AddElement(loadingText, "LoadingText") loadingA = LoadingAnimation(squares=4) loadingA.y = 250 loadingA.x = self.width / 2 - loadingA.width / 2 self.AddElement(loadingA, "LoadingA") ##### BUTTON REJECT ##### rejectButton = RejectButton("Cancel") rejectButton.y = 290 rejectButton.x = self.width / 2 - rejectButton.imageA.get_size()[0] / 2 self.AddElement(rejectButton, "Reject") ##### NETWORK ##### self.parent.SetErrorDef(self.Network_error) self.parent.SetConnectDef(self.Network_connected) self.parent.SetRBasicDef(self.Network_RBasic) self.parent.SetUDPsignalDef(self.UDPsignal) self.allowConnect = False self.Connect()
def __init__(self): Window.__init__(self, "Client sync configuration", (43, 76, 111), (117, 108, 163), 0, 0, 400, 170, (255, 255, 255), 255) self.AddInput() self.AddAcceptButtons()
def __init__(self, parent, save): Window.__init__(self, "Sign up", (36, 107, 97), (43, 76, 111), 0, 0, 400, 210, (255, 255, 255)) self.parent = parent self.save = save font = fonts.BebasNeue.c25 y_act = 29 ### User text ### UserText = Text(font, "Username:"******"User Text") ### User input ### UserInput = Input() UserInput.AllowAll() UserInput.SetParent(self) UserInput.SetSize(150, 30) UserInput.x = self.width / 2 + 5 UserInput.y = UserText.y + (UserText.surface.get_size()[1] / 2 - UserInput.size[1] / 2) self.AddElement(UserInput, "User Input") ### Password text ### y_act += UserText.surface.get_size()[1] + 5 PassText = Text(font, "Password:"******"Pass Text") ### Password input ### PassInput = copy.copy(UserInput) PassInput.y = PassText.y + (PassText.surface.get_size()[1] / 2 - PassInput.size[1] / 2) PassInput.password = True self.AddElement(PassInput, "Pass Input") ### Pass Confirm text ### y_act += PassText.surface.get_size()[1] + 5 PassConfText = Text(font, "Confirm password:"******"Confirm Password Text") ### Pass Confirm input ### PassConfInput = copy.copy(PassInput) PassConfInput.y = PassConfText.y + ( PassConfText.surface.get_size()[1] / 2 - PassConfInput.size[1] / 2) self.AddElement(PassConfInput, "Confirm Password Input") ### Email text ### y_act += PassConfText.surface.get_size()[1] + 5 EmailText = Text(font, "Email:", (0, 0, 0)) EmailText.x = self.width / 2 - EmailText.surface.get_size()[0] - 5 EmailText.y = y_act self.AddElement(EmailText, "Email Text") ### Email input ### EmailInput = copy.copy(PassConfInput) EmailInput.password = False EmailInput.y = EmailText.y - (EmailText.surface.get_size()[1] / 2 - EmailInput.size[1] / 2) self.AddElement(EmailInput, "Email Input") ### Setting next inputs ### UserInput.next_input = PassInput PassInput.next_input = PassConfInput PassConfInput.next_input = EmailInput EmailInput.next_input = UserInput ### Accept button ### y_act += EmailText.surface.get_size()[1] + 10 Accept = AcceptButton("Sign up", 150, (0, 0), font) Accept.x = self.width / 2 + 10 Accept.y = y_act self.AddElement(Accept, "Accept") ### Reject button ### Reject = RejectButton("Cancel", 150, (0, 0), font) Reject.x = self.width / 2 - 10 - Reject.size[0] Reject.y = y_act self.AddElement(Reject, "Cancel") ### Extra variables ### self.pressed = False self.pressed2 = False self.parent.SetRegisterDef(self.RegisterConfirm) self.sending_data = False
def __init__(self, parent, dataSession): Window.__init__(self, "Restore game", (253, 245, 230), (30, 144, 255), 0, 0, 400, 330, (0, 0, 0), 255, (0, 0, 0)) self.parent = parent self.data = dataSession textColor = 255, 255, 255 title = Text(fonts.BebasNeue.c15, "Your last connection data:", textColor) title.x = self.width / 2 - title.surface.get_size()[0] / 2 title.y = 30 self.AddElement(title, "Tittle") if dataSession["status"] == "TryConnect" or dataSession[ "status"] == "TryConnectRoom": server = Text(fonts.BebasNeue.c20, "Server Address: ", textColor) server.x = self.width / 4 - server.surface.get_size()[0] / 2 server.y = 80 - server.surface.get_size()[1] / 2 self.AddElement(server, "Server title") server_IP = Text(fonts.BebasNeue.c30, str(dataSession["ip"]), textColor) server_IP.x = self.width / 4 * 3 - server_IP.surface.get_size( )[0] / 2 server_IP.y = 80 - server_IP.surface.get_size()[1] / 2 self.AddElement(server_IP, "ip data") if dataSession["logData"]["type"] == "needGuestName": textInfo = Text(fonts.BebasNeue.c30, "You need to be asigned a name!", textColor) textInfo.x = self.width / 2 - textInfo.surface.get_size()[0] / 2 textInfo.y = 90 - textInfo.surface.get_size()[1] / 2 self.AddElement(textInfo, "textInfo") else: textSession = Text(fonts.BebasNeue.c15, "Your login data:", textColor) textSession.x = self.width / 2 - textSession.surface.get_size( )[0] / 2 textSession.y = 130 - textSession.surface.get_size()[1] / 2 self.AddElement(textSession, "sessionData") textType = Text(fonts.BebasNeue.c20, "Type:", textColor) textType.x = self.width / 4 - textType.surface.get_size()[0] / 2 textType.y = 160 - textSession.surface.get_size()[1] / 2 self.AddElement(textType, "sessionTypeText") if dataSession["logData"]["type"] == "guest": textContentType = Text(fonts.BebasNeue.c30, "Guest", textColor) else: textContentType = Text(fonts.BebasNeue.c20, "Login", textColor) ### ADD PASSWORD FIELD passTitle = Text(fonts.BebasNeue.c20, "password:"******"passTitle") passContent = Text(fonts.BebasNeue.c30, "****", textColor) passContent.y = 225 - passContent.surface.get_size()[1] / 2 passContent.x = self.width / 4 * 3 - passContent.surface.get_size( )[0] / 2 self.AddElement(passContent, "passContent") titleName = Text(fonts.BebasNeue.c20, "User:"******"titleName") nameContent = Text(fonts.BebasNeue.c20, dataSession["logData"]["name"], textColor) nameContent.x = self.width / 4 * 3 - nameContent.surface.get_size( )[0] / 2 nameContent.y = 200 - nameContent.surface.get_size()[1] / 2 self.AddElement(nameContent, "name") ### ADD TEXT CONTENT TYPE, GUEST OR LOGIN textContentType.x = self.width / 4 * 3 - textContentType.surface.get_size( )[0] / 2 textContentType.y = 160 - textContentType.surface.get_size( )[1] / 2 self.AddElement(textContentType, "contentType") if dataSession["status"] == "TryConnectRoom": titleRoom = Text(fonts.BebasNeue.c20, "Room", textColor) titleRoom.x = self.width / 4 - titleRoom.surface.get_size( )[0] / 2 titleRoom.y = 240 - titleRoom.surface.get_size()[1] / 2 self.AddElement(titleRoom, "titleRoom") roomContent = Text(fonts.BebasNeue.c20, dataSession["room"], textColor) roomContent.x = self.width / 4 * 3 - roomContent.surface.get_size( )[0] / 2 roomContent.y = 240 - roomContent.surface.get_size()[1] / 2 self.AddElement(roomContent, "roomName") self.AddButtons() self.parent.SetOptionRoomsDef(self.JoiningActions) self.parent.SetErrorDef(self.Network_Error) self.parent.SetConnectDef(self.Network_connected) self.parent.SetRBasicDef(self.Network_RBasic) self.parent.SetLoginDef(self.LoginSuccess)