Beispiel #1
0
 def __init__(self, gestor):
     pygame.display.set_caption("Lobby")
     self.gestor = gestor
     self.llama = pygame.image.load(config.avatar['l0'])
     self.perro = pygame.image.load(config.avatar['p1'])
     self.gallo = pygame.image.load(config.avatar['g2'])
     self.cuy = pygame.image.load(config.avatar['c3'])
     self.fondo = pygame.image.load(config.fondo[0])
     self.sala1 = boton.Button(225, 280, 380, 80, "Sala de juego", 80)
     self.salir = boton.Button(700, 550, 100, 40, "Salir")
Beispiel #2
0
    def __init__(self, gestor):
        self.gestor = gestor
        pygame.display.set_caption("Pantalla Baneo")

        self.input_usuario = text_input.InputBox(420, 200, 100, 40, "")
        self.font_grande = pygame.font.Font(None, 64)
        self.font_chica = pygame.font.Font(None, 32)

        self.fondo = pygame.image.load(config.fondo[3])
        self.regresar = boton.Button(100, 550, 100, 40, "Regresar")
        self.salir = boton.Button(700, 550, 100, 40, "Salir")
        self.banear = boton.Button(370, 300, 90, 40, "Banear")
Beispiel #3
0
    def __init__(self, gestor):
        self.gestor = gestor
        pygame.display.set_caption("Pantalla Tiempo")

        self.input_tiempo = text_input.InputBox(400, 300, 100, 40, "")
        self.font_grande = pygame.font.Font(None, 64)
        self.font_chica = pygame.font.Font(None, 32)

        self.fondo = pygame.image.load(config.fondo[3])
        self.regresar = boton.Button(100, 550, 100, 40, "Regresar")
        self.salir = boton.Button(700, 550, 100, 40, "Salir")
        self.tiempo = boton.Button(400,
                                   200,
                                   80,
                                   80,
                                   obtener_datos.obtener_tiempo_actual(),
                                   font=80)
        self.aceptar = boton.Button(370, 360, 90, 40, "Aceptar")
Beispiel #4
0
    def __init__(self, gestor):
        self.gestor = gestor
        pygame.display.set_caption("Pantalla Resultado")
        self.sesion = sesion.Sesion.get_instance()
        self.ganador = 'jugador' + str(self.sesion.ganador)
        self.perdedor = 'jugador' + str(1 - self.sesion.ganador)
        self.font_grande = pygame.font.Font(None, 64)
        self.font_chica = pygame.font.Font(None, 32)

        self.fondo = pygame.image.load(config.fondo[3])
        self.aceptar = boton.Button(330, 400, 100, 40, "Aceptar")
Beispiel #5
0
    def __init__(self, gestor):

        self.gestor = gestor
        pygame.display.set_caption("escogerpersonaje")

        self.fondo = pygame.image.load(config.fondo[0])
        self.postX = 650
        self.postY = 600
        self.ventana = pygame.display.set_mode((800, 600))
        pygame.display.set_caption("listapersonajes")

        self.elegido = pygame.image.load(
            "Imagenes/peru.jpg")  #iniciar con ninguno default peru

        self.personaje1 = pygame.image.load(config.avatar['c0'])
        self.posX_P1, self.posY_P1 = 150, 100
        self.seleccionar1 = boton.Button(150, 200, 140, 40, text='Cuy')

        self.personaje2 = pygame.image.load(config.avatar['g0'])
        self.posX_P2, self.posY_P2 = 150, 250
        self.seleccionar2 = boton.Button(150, 350, 140, 40, text='Gallito')

        self.personaje3 = pygame.image.load(config.avatar['l0'])
        self.posX_P3, self.posY_P3 = 500, 250
        self.seleccionar3 = boton.Button(500, 350, 140, 40, text='Llama')

        self.personaje4 = pygame.image.load(config.avatar['p0'])
        self.posX_P4, self.posY_P4 = 500, 100
        self.seleccionar4 = boton.Button(500, 200, 140, 40, text='Perro')

        self.atras = boton.Button(200, 500, 100, 40, text='Atras')
        self.salir = boton.Button(600, 500, 100, 40, text='Salir')

        self.situado = True
        self.seleccionado = False
Beispiel #6
0
    def __init__(self, gestor):
        self.gestor = gestor
        pygame.display.set_caption("personalizargallo")

        self.fondo = pygame.image.load(config.fondo[0])
        self.postX = 650
        self.postY = 600
        self.ventana = pygame.display.set_mode((800, 600))
        pygame.display.set_caption("listapersonalizacion")

        #Personaje GALLITO
        self.personajeGallito = pygame.image.load(config.avatar['g0'])
        self.posX_PG, self.posY_PG = 150, 100  #Posicion personaje Gallito
        self.seleccionarGallito = boton.Button(150,
                                               200,
                                               140,
                                               40,
                                               text='GallitoBase')

        self.personajeGallito1 = pygame.image.load(config.avatar['g1'])
        self.posX_PG1, self.posY_PG1 = 150, 250
        self.seleccionarG1 = boton.Button(150, 350, 140, 40, text='GallitoV1')

        self.personajeGallito2 = pygame.image.load(config.avatar['g2'])
        self.posX_PG2, self.posY_PG2 = 500, 250
        self.seleccionarG2 = boton.Button(500, 200, 140, 40, text='GallitoV2')

        self.personajeGallito3 = pygame.image.load(config.avatar['g3'])
        self.posX_PG3, self.posY_PG3 = 500, 100
        self.seleccionarG3 = boton.Button(500, 350, 140, 40, text='GallitoV3')

        self.definitivo = boton.Button(
            600, 450, 130, 40,
            text='Seleccionar')  #para seleccionar definitivamente
        self.reset = boton.Button(200, 450, 100, 40, text='Reset')
        self.atras = boton.Button(200, 550, 100, 40, text='Atras')
        self.salir = boton.Button(600, 550, 100, 40, text='Salir')

        self.situado = True
        self.seleccionado = False  #Flag para saber si ya se selecciono un cuy

        self.sesion = sesion.Sesion.get_instance()
        self.personaje = None
Beispiel #7
0
    def __init__(self, gestor):
        self.gestor = gestor
        pygame.display.set_caption("personalizarcuy")

        self.fondo = pygame.image.load(config.fondo[0])
        self.postX = 650
        self.postY = 600
        self.ventana = pygame.display.set_mode((800, 600))
        pygame.display.set_caption("listapersonalizacion")

        #Personaje PERRO
        self.personajePerro = pygame.image.load(config.avatar['p0'])
        self.posX_PP, self.posY_PP = 150, 100  #Posicion personaje perro
        self.seleccionarPerro = boton.Button(150,
                                             200,
                                             140,
                                             40,
                                             text='PerroBase')

        self.personajePerro1 = pygame.image.load(config.avatar['p1'])
        self.posX_PP1, self.posY_PP1 = 150, 250
        self.seleccionarP1 = boton.Button(150, 350, 140, 40, text='PerroV1')

        self.personajePerro2 = pygame.image.load(config.avatar['p2'])
        self.posX_PP2, self.posY_PP2 = 500, 100
        self.seleccionarP2 = boton.Button(500, 200, 140, 40, text='PerroV2')

        self.personajePerro3 = pygame.image.load(config.avatar['p3'])
        self.posX_PP3, self.posY_PP3 = 500, 250
        self.seleccionarP3 = boton.Button(500, 350, 140, 40, text='PerroV3')

        self.definitivo = boton.Button(
            600, 450, 130, 40,
            text='Seleccionar')  #para seleccionar definitivamente
        self.reset = boton.Button(200, 450, 100, 40, text='Reset')
        self.atras = boton.Button(200, 550, 100, 40, text='Atras')
        self.salir = boton.Button(600, 550, 100, 40, text='Salir')

        self.situado = True
        self.seleccionado = False  #flag
        self.sesion = sesion.Sesion.get_instance()
        self.personaje = None
    def __init__(self, gestor):
        self.gestor = gestor
        pygame.display.set_caption("personalizarllama")

        self.fondo = pygame.image.load(config.fondo[0])
        self.postX = 650
        self.postY = 600
        self.ventana = pygame.display.set_mode((800, 600))
        pygame.display.set_caption("listapersonalizacion")

        self.personajeLlama = pygame.image.load(config.avatar['l0'])
        self.posX_PL, self.posY_PL = 150, 100  #Posicion personaje Llama
        self.seleccionarLlama = boton.Button(150,
                                             200,
                                             140,
                                             40,
                                             text='LlamaBase')

        self.personajeLlama1 = pygame.image.load(config.avatar['l1'])
        self.posX_PL1, self.posY_PL1 = 150, 250
        self.seleccionarL1 = boton.Button(150, 350, 140, 40, text='LlamaV1')

        self.personajeLlama2 = pygame.image.load(config.avatar['l2'])
        self.posX_PL2, self.posY_PL2 = 500, 100
        self.seleccionarL2 = boton.Button(500, 200, 140, 40, text='LlamaV2')

        self.personajeLlama3 = pygame.image.load(config.avatar['l3'])
        self.posX_PL3, self.posY_PL3 = 500, 250
        self.seleccionarL3 = boton.Button(500, 350, 140, 40, text='LlamaV3')

        self.definitivo = boton.Button(
            600, 450, 130, 40,
            text='Seleccionar')  #para seleccionar definitivamente
        self.reset = boton.Button(200, 450, 100, 40, text='Reset')
        self.atras = boton.Button(200, 550, 100, 40, text='Atras')
        self.salir = boton.Button(600, 550, 100, 40, text='Salir')

        self.situado = True
        self.seleccionado = False  #flag

        self.sesion = sesion.Sesion.get_instance()
        self.personaje = None
Beispiel #9
0
    def __init__(self, gestor):
        self.gestor = gestor
        pygame.display.set_caption("personalizarcuy")

        self.fondo = pygame.image.load(config.fondo[0])
        self.postX = 650
        self.postY = 600
        self.ventana = pygame.display.set_mode((800, 600))
        pygame.display.set_caption("listacuy")

        #Personaje CUY
        self.personajeCuy = pygame.image.load(config.avatar['c0'])
        self.posX_PC, self.posY_PC = 150, 100  #Posicion personaje cuy
        self.seleccionarCuy = boton.Button(150, 200, 140, 40, text='CuyBase')

        self.personajeCuy1 = pygame.image.load(config.avatar['c1'])
        self.posX_PC1, self.posY_PC1 = 150, 250
        self.seleccionarC1 = boton.Button(150, 350, 140, 40, text='CuyV1')

        self.personajeCuy2 = pygame.image.load(config.avatar['c2'])
        self.posX_PC2, self.posY_PC2 = 500, 100
        self.seleccionarC2 = boton.Button(500, 200, 140, 40, text='CuyV2')

        self.personajeCuy3 = pygame.image.load(config.avatar['c3'])
        self.posX_PC3, self.posY_PC3 = 500, 250
        self.seleccionarC3 = boton.Button(500, 350, 140, 40, text='CuyV3')

        self.definitivo = boton.Button(
            600, 450, 130, 40,
            text='Seleccionar')  #para seleccionar definitivamente
        self.reset = boton.Button(200, 450, 100, 40, text='Reset')
        self.atras = boton.Button(200, 550, 100, 40, text='Atras')
        self.salir = boton.Button(600, 550, 100, 40, text='Salir')

        self.situado = True
        self.seleccionado = False  #Flag para saber si ya se selecciono un cuy

        self.sesion = sesion.Sesion.get_instance()
        self.personaje = None  #guardar ruta del personaje
Beispiel #10
0
class PantallaLogin(pantallas.Pantalla):
    fondo = pygame.image.load(config.fondo[0])
    input_usuario = text_input.InputBox(
        (config.ANCHO - config.text_input_ancho) / 2, 300,
        config.text_input_ancho, config.text_input_alto)
    input_password = text_input.InputBox(
        (config.ANCHO - config.text_input_ancho) / 2, 400,
        config.text_input_ancho, config.text_input_alto)
    font_grande = pygame.font.Font(None, 64)
    font_chica = pygame.font.Font(None, 32)
    login = boton.Button(370, 480, 100, 40, text='Ingreso')
    registrar = boton.Button(370, 550, 100, 40, text='Registro')

    def get_input(self):
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_RETURN:
                    self.login.active = True
            self.input_usuario.handle_event(event)
            self.input_password.handle_event(event)
            self.registrar.handle_event(event)
            self.login.handle_event(event)

    def update(self):
        self.input_usuario.update()
        self.input_password.update()
        if self.registrar.active:
            self.registrar.active = False
            self.gestor.pantalla_actual.ir_registro()
        if self.login.active:
            self.login.active = False
            r = requests.get('http://165.227.76.18:3000/login?username='******'&password='******'/')

            if result[0] == 'true':
                '''if result[1] == 'admin':
                    self.gestor.pantalla_actual.ir_lobby_admin()
                elif result[1] == 'user':
                    self.gestor.pantalla_actual.ir_lobby()'''
                self.gestor.pantalla_actual.ir_lobby()
            else:
                self.input_password.text = ""
                self.input_usuario.text = ""

    def render(self):
        self.gestor.pantalla.blit(self.gestor.superficie, (0, 0))
        self.gestor.pantalla.blit(self.fondo, (0, 0))
        self.input_usuario.draw(self.gestor.pantalla)
        self.input_password.draw(self.gestor.pantalla)
        self.login.draw(self.gestor.pantalla)
        self.registrar.draw(self.gestor.pantalla)
        titulo = self.font_grande.render("Login", 1, (255, 255, 0))
        nombre_usuario = self.font_chica.render("Nombre de usuario", 1,
                                                (255, 255, 0))
        password = self.font_chica.render("Password", 1, (255, 255, 0))
        self.gestor.pantalla.blit(titulo, (370, 200))
        self.gestor.pantalla.blit(nombre_usuario, (330, 270))
        self.gestor.pantalla.blit(password, (380, 370))
        pygame.display.update()

    def ir_lobby(self):
        print("Se va al Lobby")
        self.gestor.pantalla_actual = pantalla_lobby.PantallaLobby(self.gestor)

    def ir_registro(self):
        self.gestor.pantalla_actual = pantalla_registro.PantallaRegistro(
            self.gestor)

    def ir_jugador(self):
        pass

    def ir_admin(self):
        pass
Beispiel #11
0
class PantallaRegistro(pantallas.Pantalla):
    fondo = pygame.image.load(config.fondo[0])
    input_usuario = text_input.InputBox(
        (config.ANCHO - config.text_input_ancho) / 2, 300,
        config.text_input_ancho, config.text_input_alto)
    input_password = text_input.InputBox(
        (config.ANCHO - config.text_input_ancho) / 2, 400,
        config.text_input_ancho, config.text_input_alto)
    input_passwordconfirm = text_input.InputBox(
        (config.ANCHO - config.text_input_ancho) / 2, 450,
        config.text_input_ancho, config.text_input_alto)
    font_grande = pygame.font.Font(None, 64)
    font_chica = pygame.font.Font(None, 32)
    registrar = boton.Button(370, 480, 135, 40, text='Registrarse')
    regresar = boton.Button(370, 550, 110, 40, text='Regresar')

    def get_input(self):
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_RETURN:
                    if self.input_password.text == self.input_passwordconfirm.text:
                        r = requests.get(
                            'http://165.227.76.18:3000/registrar?username='******'&password='******'true':
                            self.gestor.pantalla_actual.ir_login()
                        self.input_password.text = ""
                        self.input_usuario.text = ""
            self.input_usuario.handle_event(event)
            self.input_password.handle_event(event)
            self.input_passwordconfirm.handle_event(event)
            self.registrar.handle_event(event)
            self.regresar.handle_event(event)

    def update(self):
        self.input_usuario.update()
        self.input_password.update()
        if self.regresar.active:
            self.regresar.active = False
            self.gestor.pantalla_actual.ir_login()
        if self.registrar.active:
            self.registrar.active = False
            if self.input_password.text == self.input_passwordconfirm.text:
                r = requests.get(
                    'http://165.227.76.18:3000/registrar?username='******'&password='******'true':
                    self.gestor.pantalla_actual.ir_login()
                self.input_password.text = ""
                self.input_usuario.text = ""

    def render(self):
        # self.gestor.superficie.fill(config.BACKGROUND_COLOR)
        self.gestor.pantalla.blit(self.gestor.superficie, (0, 0))
        self.gestor.pantalla.blit(self.fondo, (0, 0))
        self.input_usuario.draw(self.gestor.pantalla)
        self.input_password.draw(self.gestor.pantalla)
        self.input_passwordconfirm.draw(self.gestor.pantalla)
        self.registrar.draw(self.gestor.pantalla)
        self.regresar.draw(self.gestor.pantalla)
        titulo = self.font_grande.render("Registro", 1, (255, 255, 0))
        nombre_usuario = self.font_chica.render("Nombre de usuario", 1,
                                                (255, 255, 0))
        password = self.font_chica.render("Password", 1, (255, 255, 0))
        self.gestor.pantalla.blit(titulo, (360, 200))
        self.gestor.pantalla.blit(nombre_usuario, (330, 270))
        self.gestor.pantalla.blit(password, (380, 370))
        pygame.display.update()

    def ir_login(self):
        self.gestor.pantalla_actual = pantalla_login.PantallaLogin(self.gestor)

    def ir_jugador(self):
        pass

    def ir_admin(self):
        pass