def SetLoading(self,text): self.DeleteElement("ButtonA") self.DeleteElement("ButtonB") self.DeleteElement("SpectateButton") self.DeleteElement("TextA") self.DeleteElement("TextB") la = LoadingAnimation(0.6,5) la.x = self.width/2-la.width/2 la.y = 60 self.AddElement(la,"LoadingAnimation") self.SetTextLoading(text)
def SetLoading(self, text): self.DeleteElement("ButtonA") self.DeleteElement("ButtonB") self.DeleteElement("SpectateButton") self.DeleteElement("TextA") self.DeleteElement("TextB") la = LoadingAnimation(0.6, 5) la.x = self.width / 2 - la.width / 2 la.y = 60 self.AddElement(la, "LoadingAnimation") self.SetTextLoading(text)
def SetLoading(self): self.DeleteElement("TextName") self.DeleteElement("inputName") self.DeleteElement("CancelButton") self.DeleteElement("AcceptButton") self.DeleteElement("Selector") self.DeleteElement("Error") loading = LoadingAnimation(0.4,5) loading.x = self.width/2 - loading.width/2 loading.y = self.height/2 - 10 - loading.height self.AddElement(loading,"LoadingA") loadingText = Text(fonts.BebasNeue.c20,"Checking name...",(255,255,255)) loadingText.x = self.width/2 - loadingText.surface.get_size()[0]/2 loadingText.y = self.height/2 + 10 self.AddElement(loadingText,"LoadingT")
def SetLoading(self): self.DeleteElement("TextName") self.DeleteElement("inputName") self.DeleteElement("CancelButton") self.DeleteElement("AcceptButton") self.DeleteElement("Selector") self.DeleteElement("Error") loading = LoadingAnimation(0.4, 5) loading.x = self.width / 2 - loading.width / 2 loading.y = self.height / 2 - 10 - loading.height self.AddElement(loading, "LoadingA") loadingText = Text(fonts.BebasNeue.c20, "Checking name...", (255, 255, 255)) loadingText.x = self.width / 2 - loadingText.surface.get_size()[0] / 2 loadingText.y = self.height / 2 + 10 self.AddElement(loadingText, "LoadingT")
def Start(self, error=None): self.Send({"action": "req_av_players"}) y_act = 40 if error != None: error = Text(fonts.BebasNeue.c20, error, (255, 0, 0)) error.x = self.width / 2 - error.surface.get_size()[0] / 2 error.y = y_act self.AddElement(error, "Error") y_act += error.surface.get_size()[1] + 10 textName = Text(fonts.BebasNeue.c30, "Player Name:", (255, 255, 255)) textName.x = self.width / 4 - textName.surface.get_size()[0] / 2 textName.y = y_act self.AddElement(textName, "TextName") inputName = Input() inputName.x = self.width / 4 * 3 - inputName.size[0] / 2 inputName.y = y_act inputName.AllowAll() inputName.SetSize(200, 30) self.AddElement(inputName, "inputName") y_act += 60 loading = LoadingAnimation(0.4, 5) loading.x = self.width / 2 - loading.width / 2 loading.y = y_act self.AddElement(loading, "LoadingA") y_act += 30 loadingText = Text(fonts.BebasNeue.c20, "Loading players...", (255, 255, 255)) loadingText.x = self.width / 2 - loadingText.surface.get_size()[0] / 2 loadingText.y = y_act self.AddElement(loadingText, "LoadingT") y_act += 70 cancelButton = RejectButton("Cancel") cancelButton.x = self.width / 2 - cancelButton.imageA.get_size()[0] / 2 cancelButton.y = y_act self.AddElement(cancelButton, "CancelButton") y_act += cancelButton.size[1] self.SetHeight(y_act + 10) self.originalPlayer = None
def Start(self,error=None): self.Send({"action":"req_av_players"}) y_act = 40 if error != None: error = Text(fonts.BebasNeue.c20,error,(255,0,0)) error.x = self.width/2-error.surface.get_size()[0]/2 error.y = y_act self.AddElement(error,"Error") y_act += error.surface.get_size()[1]+10 textName = Text(fonts.BebasNeue.c30,"Player Name:",(255,255,255)) textName.x = self.width/4-textName.surface.get_size()[0]/2 textName.y = y_act self.AddElement(textName,"TextName") inputName = Input() inputName.x = self.width/4*3-inputName.size[0]/2 inputName.y = y_act inputName.AllowAll() inputName.SetSize(200,30) self.AddElement(inputName,"inputName") y_act += 60 loading = LoadingAnimation(0.4,5) loading.x = self.width/2-loading.width/2 loading.y = y_act self.AddElement(loading,"LoadingA") y_act += 30 loadingText = Text(fonts.BebasNeue.c20,"Loading players...",(255,255,255)) loadingText.x = self.width/2-loadingText.surface.get_size()[0]/2 loadingText.y = y_act self.AddElement(loadingText,"LoadingT") y_act += 70 cancelButton = RejectButton("Cancel") cancelButton.x = self.width/2-cancelButton.imageA.get_size()[0]/2 cancelButton.y = y_act self.AddElement(cancelButton,"CancelButton") y_act += cancelButton.size[1] self.SetHeight(y_act+10) self.originalPlayer = None
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 SetLoadingAnimation(self): self.DeleteElement("ANI_loading") animation = LoadingAnimation() animation.y = 50 animation.x = self.width / 2 - animation.width / 2 self.AddElement(animation, "ANI_loading")
def AddLoading(self): loading = LoadingAnimation(1, 5) loading.x = self.width / 2 - loading.width / 2 loading.y = 30 self.AddElement(loading, "Loading")
def SetLoadingAnimation(self): self.DeleteElement("ANI_loading") animation = LoadingAnimation() animation.y = 50 animation.x = self.width / 2 - animation.width/2 self.AddElement(animation,"ANI_loading")
def AddLoading(self): loading = LoadingAnimation(1,5) loading.x = self.width/2-loading.width/2 loading.y = 30 self.AddElement(loading,"Loading")
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()