Exemple #1
0
    def calculatePunctuation(self):
        points = self.player.getPuntos() - self.player.getMiss()

        totalpoints = len(self.__song.getAllSteps())

        escritor.flog("se consiguieron un total de: " + str(points) +
                      " de un total de " + str(totalpoints) + " con : " +
                      str(self.player.getMiss()) + " fallas ")
        if points <= 0:
            return ("f")
        else:
            percent = (points * 100) / totalpoints
            if percent >= 95:
                return ("s")
            elif percent >= 80:
                return ("a")
            elif percent >= 60:
                return ("b")
            elif percent >= 40:
                return ("c")
            elif percent >= 20:
                return ("d")
            elif percent >= 10:
                return ("e")
            else:
                return ("f")
def _replaseArgs(mes, arreglo):
    #escritor.flog("reemplasando los siguientes argumentos : " + str(args) + " en el mensage " + mes)

    for a in range(0, len(arreglo)):
        mes = mes.replace("%" + str(a), str(arreglo[a]))
        escritor.flog("el mensage queda que va es: " + mes)

    return (mes)
def _replaseArgs(mes, arreglo):
    #escritor.flog("reemplasando los siguientes argumentos : " + str(args) + " en el mensage " + mes)

    for a in range(0,len(arreglo)):
        mes= mes.replace("%"+str(a),str(arreglo[a]))
        escritor.flog("el mensage queda que va es: " + mes)

    return(mes)
Exemple #4
0
def getKey(key):
    if key==K_LCTRL or key==K_RCTRL:
        speechManager.stop()
        return("stop")


    for k in keys.items():
        if k[1] == key:
            escritor.flog("se detecto un:  "+k[0])
            return(k[0])
    return('null')
Exemple #5
0
def startWindow(width, height, cancion, modo=0):
    res = (width, height)
    pygame.init()
    pygame.display.set_caption("Modo juego!")
    escape = False
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciado modo de juego de la canción: " + cancion.name)

    jugo = juego.Juego(cancion, 1, modo)
    reloj = pygame.time.Clock()
    global end
    end = False
    pantalla.fill((134, 230, 120))

    mensaje = "precione las teclas a, s, z y x al ritmo de la canción a medida que el sonido correspondiente suena!!!"
    mensaje2 = "Precione escape para retornar al menú y detener el juego"

    pygame.display.flip()

    jugo.start()
    juego.endSongEvent += endSong

    while (not end):
        reloj.tick_busy_loop(60)

        juego.nextTickEvent()

        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end = True
                jugo.stop()
                #del jugo
                escritor.flog("cierre modo juego por evento de salida")
                escape = True
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey != 'back' and pressKey != 'null':

                    juego.stepEvent(pressKey)
                    escritor.flog("precionada la tecla " + pressKey)

                elif (pressKey == 'back'):
                    pygame.display.quit()
                    jugo.stop()
                    #del jugo
                    escape = True
                    return (None)

                    escritor.flog("cierre por escape")
                    end = True

    pygame.display.quit()
    if escape == False:

        jugo.stop()
    if (jugo is None) == False:

        return (jugo)
def startWindow( width, height,cancion):
    res = (width,height)
    pygame.init()
    pygame.display.set_caption("Modo grabación!")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciado modo de grabación de la canción: " + cancion.name)
    escape=False
    jugo = juego.Juego(cancion,0)
    reloj = pygame.time.Clock()
    global end
    end = False
    pantalla.fill((134,230,120))
    
    
    mensaje = m.getMessage('recordwindow:help', pygame.key.name(keyManager.getConfiguredKey("back")))
    
    pygame.display.flip()
    m.sayCustomMessage(mensaje,1)
    
    jugo.start()
    juego.endSongEvent+=endSong
    


    while (not end):
        reloj.tick_busy_loop(60)
        
        juego.nextTickEvent()
        
        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                jugo.stop()
                
                escritor.flog("cierre modo prueba por evento de salida")
                escape=True
                return(None)
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey!='back' and pressKey!='null':
                    juego.hitEvent(pressKey)
                    escritor.flog("precionada la tecla " + pressKey)

                elif(pressKey== 'back' and pressKey!='null'):
                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    
                    jugo.stop()
                    
                    end=True
                    escape=True
                    return(None)

    pygame.display.quit()
    if escape == False:

        jugo.stop()
        return(jugo.getSong())
def startWindow(width, height, cancion):
    res = (width, height)
    pygame.init()
    pygame.display.set_caption("Modo grabación!")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciado modo de grabación de la canción: " +
                  cancion.name)
    escape = False
    jugo = juego.Juego(cancion, 0)
    reloj = pygame.time.Clock()
    global end
    end = False
    pantalla.fill((134, 230, 120))

    mensaje = m.getMessage(
        'recordwindow:help',
        pygame.key.name(keyManager.getConfiguredKey("back")))

    pygame.display.flip()
    m.sayCustomMessage(mensaje, 1)

    jugo.start()
    juego.endSongEvent += endSong

    while (not end):
        reloj.tick_busy_loop(60)

        juego.nextTickEvent()

        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end = True
                jugo.stop()

                escritor.flog("cierre modo prueba por evento de salida")
                escape = True
                return (None)
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey != 'back' and pressKey != 'null':
                    juego.hitEvent(pressKey)
                    escritor.flog("precionada la tecla " + pressKey)

                elif (pressKey == 'back' and pressKey != 'null'):
                    pygame.display.quit()
                    escritor.flog("cierre por escape")

                    jugo.stop()

                    end = True
                    escape = True
                    return (None)

    pygame.display.quit()
    if escape == False:

        jugo.stop()
        return (jugo.getSong())
Exemple #8
0
def start():
    songs_dir = "songs/"
    option = -1 
    pg.init()
    pg.display.set_caption("tiflojuegos")
    pg.display.set_mode((1024,768))

    soundevents.musicLoad("bgm/tiflojuegoslogo.ogg")
    soundevents.musicPlay()

    while soundevents.musicIsPlay():
        for ev in pg.event.get():
            if ev.type==pg.KEYDOWN:
                if ev.key==K_RETURN or ev.key==K_SPACE or ev.key==K_ESCAPE:
                    soundevents.musicStop()




    while option!=4:
        option = menuScreen.startWindow(screen_width,screen_height)
        escritor.flog("capturada la opcion: "+ str(option) + " en el menu ")
        if option==0 or option==1:
            s = selectSonScreen.startWindow(screen_width,screen_height)
            if s is None:
                continue
            else:
            

                j = playWindow.startWindow(screen_width,screen_height,s,option)
                if j is not None:
                    resultsWindow.startWindow(screen_width,screen_height,j)

        elif option == 2:
            testkeysWindow.startWindow(screen_width,screen_height)
        elif option == 3:
            recordMenuScreen.startWindow(1024,768)
def startWindow(width, height):
    res = (width, height)
    pygame.init()
    pygame.display.set_caption("modo prueba de teclas")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciado modo de prueba")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134, 230, 120))
    soundevents.twoHands = 2
    mensage = m.getMessage(
        "testwindow:help", pygame.key.name(keyManager.getConfiguredKey("l1")),
        pygame.key.name(keyManager.getConfiguredKey("l2")),
        pygame.key.name(keyManager.getConfiguredKey("l3")),
        pygame.key.name(keyManager.getConfiguredKey("l4")),
        pygame.key.name(keyManager.getConfiguredKey("r1")),
        pygame.key.name(keyManager.getConfiguredKey("r2")),
        pygame.key.name(keyManager.getConfiguredKey("r3")),
        pygame.key.name(keyManager.getConfiguredKey("r4")),
        pygame.key.name(keyManager.getConfiguredKey("back")))

    pygame.display.flip()
    m.sayCustomMessage(mensage, 1)

    while (not end):
        reloj.tick(60)
        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end = True
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)

                if pressKey != 'back' and pressKey != 'null':
                    juego.hitEvent(pressKey)
                    escritor.flog("precionada la tecla  " + pressKey)

                elif (pressKey == 'back'):
                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end = True
                else:
                    m.sayCustomMessage(mensage, 1)
def startWindow( width, height, jg):
    res = (width,height)
    pygame.init()
    pygame.display.set_caption(" Resultados")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciado modo de prueba")
    reloj = pygame.time.Clock()
    end = False
    



    pantalla.fill((134,230,120))
    
    if jg.player.getHP() == 0:
        soundevents.musicLoad("bgm/death.mp3")
        soundevents.musicPlay(-1)
        mensaje = m.getMessage("resultswindow:death", jg.player.getPuntos())
    else:
        soundevents.musicLoad("bgm/results.mp3")
        soundevents.musicSetVolume(0.5)
        soundevents.musicPlay(-1)
        mensaje = m.getMessage('resultswindow:congratulations', jg.player.getPuntos(), jg.player.getMiss(), jg.calculatePunctuation())

    
    pygame.display.flip()
    m.sayCustomMessage(mensaje,1)



    


    while (not end):
        reloj.tick(60)
        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)

                if  pressKey=='accept':
                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end=True
                else:
                    m.sayCustomMessage(mensaje)
def startWindow( width, height):
    res = (width,height)
    pygame.init()
    pygame.display.set_caption("modo prueba de teclas")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciado modo de prueba")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    soundevents.twoHands=2
    mensage = m.getMessage("testwindow:help", pygame.key.name(keyManager.getConfiguredKey("l1")), pygame.key.name(keyManager.getConfiguredKey("l2")), pygame.key.name(keyManager.getConfiguredKey("l3")), pygame.key.name(keyManager.getConfiguredKey("l4")), pygame.key.name(keyManager.getConfiguredKey("r1")), pygame.key.name(keyManager.getConfiguredKey("r2")), pygame.key.name(keyManager.getConfiguredKey("r3")), pygame.key.name(keyManager.getConfiguredKey("r4")), pygame.key.name(keyManager.getConfiguredKey("back")))
    
    
    pygame.display.flip()
    m.sayCustomMessage(mensage,1)



    while (not end):
        reloj.tick(60)
        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)

                if pressKey!= 'back' and pressKey!='null':
                    juego.hitEvent(pressKey)
                    escritor.flog("precionada la tecla  " + pressKey)

                elif(pressKey=='back'):
                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end=True
                else:
                    m.sayCustomMessage(mensage,1)
Exemple #12
0
def startWindow(width, height, jg):
    res = (width, height)
    pygame.init()
    pygame.display.set_caption(" Resultados")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciado modo de prueba")
    reloj = pygame.time.Clock()
    end = False

    pantalla.fill((134, 230, 120))

    if jg.player.getHP() == 0:
        soundevents.musicLoad("bgm/death.mp3")
        soundevents.musicPlay(-1)
        mensaje = m.getMessage("resultswindow:death", jg.player.getPuntos())
    else:
        soundevents.musicLoad("bgm/results.mp3")
        soundevents.musicSetVolume(0.5)
        soundevents.musicPlay(-1)
        mensaje = m.getMessage('resultswindow:congratulations',
                               jg.player.getPuntos(), jg.player.getMiss(),
                               jg.calculatePunctuation())

    pygame.display.flip()
    m.sayCustomMessage(mensaje, 1)

    while (not end):
        reloj.tick(60)
        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end = True
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)

                if pressKey == 'accept':
                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end = True
                else:
                    m.sayCustomMessage(mensaje)
Exemple #13
0
def startWindow( width, height,cancion, modo=0):
    res = (width,height)
    pygame.init()
    pygame.display.set_caption("Modo juego!")
    escape = False
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciado modo de juego de la canción: " + cancion.name)
    
    jugo = juego.Juego(cancion,1,modo)
    reloj = pygame.time.Clock()
    global end
    end = False
    pantalla.fill((134,230,120))
    
    mensaje = "precione las teclas a, s, z y x al ritmo de la canción a medida que el sonido correspondiente suena!!!"
    mensaje2 = "Precione escape para retornar al menú y detener el juego"
    
    
    
    pygame.display.flip()
    
    jugo.start()
    juego.endSongEvent+=endSong

    while (not end):
        reloj.tick_busy_loop(60)
        
        juego.nextTickEvent()
        
        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                jugo.stop()
                #del jugo
                escritor.flog("cierre modo juego por evento de salida")
                escape=True
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey!='back' and pressKey!='null':

                    juego.stepEvent(pressKey)
                    escritor.flog("precionada la tecla " + pressKey)

                elif(pressKey=='back'):
                    pygame.display.quit()
                    jugo.stop()
                    #del jugo
                    escape=True
                    return(None)

                    escritor.flog("cierre por escape")
                    end=True

    pygame.display.quit()
    if escape==False:

        jugo.stop()
    if (jugo is None) == False:

        return(jugo)
Exemple #14
0
def startWindow( width, height):
    res = (width,height)
    pygame.init()
    pygame.display.set_caption("RitmSounds: main menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("Iniciado menu principal")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    menuitems=[]
    menuitems.append("menuwindow:option0")
    menuitems.append("menuwindow:option1")
    menuitems.append("menuwindow:option2")
    menuitems.append("menuwindow:option3")
    menuitems.append("menuwindow:optionexit")

    titulo = "menuwindow:title"
    last= titulo
    menuhelp = "menuwindow:help"
    
    pygame.display.flip()
    estitulo =True
    
    soundevents.musicLoad("songs/rtms.ogg")
    soundevents.musicPlay(True)
    soundevents.musicSetVolume(0.3)

    
    option=0
    m.sayMessage(titulo)

    while (not end):
        reloj.tick(60)
        pantalla.fill((134,230,120))

        pygame.display.flip()
        

        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey== 'accept':
                    
                    soundevents.playAccept()
                    if estitulo==True:
                        estitulo=False
                        m.sayMessage(menuhelp)
                        last=menuhelp
                    else:
                        if option==4:
                            pygame.display.quit()
                            soundevents.musicFade(1500)
                            time.sleep(2)
                            

                            return(4)
                        else:
                            pygame.display.quit()
                            end=True
                            soundevents.musicFade(1500)
                            return(option)
                elif pressKey == 'down':
                    if estitulo:
                        continue 

                    soundevents.playMove()
                    option+=1
                    if option>=5:
                        option=0
                    m.sayMessage(menuitems[option])



                elif pressKey == 'up':
                    if estitulo:
                        continue 

                    soundevents.playMove()
                    option -= 1 
                    if option<0:
                        option=4
                    m.sayMessage(menuitems[option])

                elif(pressKey=='back'):
                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end=True
                    return(4)

                else:
                    if pressKey!= "stop":
                        m.sayMessage(last)
def startWindow( width, height):
    res = (width,height)
    pygame.init()
    pygame.display.set_caption("RitmSounds: main menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciada pantalla de seleccion")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    
    
    menuitems=[]
    songs = escritor.loadAllSongs()

    mensage = m.getMessage("selectwindow:help")
    mensage2 = m.getMessage("selectwindow:help2")
    mensage3 = m.getMessage("selectwindow:help3", pygame.key.name(keyManager.getConfiguredKey("l1")), pygame.key.name(keyManager.getConfiguredKey("l2")), pygame.key.name(keyManager.getConfiguredKey("l3")), pygame.key.name(keyManager.getConfiguredKey("l4")), pygame.key.name(keyManager.getConfiguredKey("r1")), pygame.key.name(keyManager.getConfiguredKey("r2")), pygame.key.name(keyManager.getConfiguredKey("r3")), pygame.key.name(keyManager.getConfiguredKey("r4")))


    pygame.display.flip()
    estitulo =True
    esayuda=False
    

    
    option=0
    m.sayCustomMessage(mensage,1)
    repeat = mensage
    dificultad = 0 

    if len(songs) == 0:
        m.sayMessage("selectwindow:nosongs",1)
        return(None)

    soundevents.musicLoad(songs[option].songpath)
    soundevents.musicPlay(-1)
    m.sayCustomMessage(songs[option].name,0)


    while (not end):
        reloj.tick(60)
        pantalla.fill((134,230,120))
        pygame.display.flip()
        soundevents.musicSetVolume(0.2)


        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey== 'accept':
                    
                    soundevents.playAccept()
                    if estitulo==True and esayuda== False:
                        estitulo=False
                        m.sayCustomMessage(mensage2,1)
                        repeat=mensage2
                        songs[option].selectSteplist(dificultad)
                        h = songs[option].getHands()
                        if h ==2:
                            m.sayMessage('selectwindow:difdescription2', 0, songs[option].getSteplistname(), songs[option].getStartHp(), songs[option].getPressSpeed())
                        else:
                            m.sayMessage('selectwindow:difdescription', 0, songs[option].getSteplistname(), songs[option].getStartHp(), songs[option].getPressSpeed())

                        
                    elif estitulo==False and esayuda == False:
                        esayuda = True
                        m.sayCustomMessage(mensage3,1)
                        repeat = mensage3


                    else:
                        soundevents.playGoSound()
                        pygame.display.quit()
                        end=True
                        soundevents.musicFade(1500)
                        return(songs[option])
                elif pressKey == 'down':
                    if estitulo:
                        

                        soundevents.playMove()
                        option+=1
                        if option>=len(songs):
                            option=0
                        soundevents.musicLoad(songs[option].songpath)
                        soundevents.musicPlay(-1)
                        m.sayCustomMessage(songs[option].name,1)


                    elif estitulo == False and esayuda:
                        continue
                    else:
                        soundevents.playChange()
                        dificultad+=1
                        if dificultad>= len(songs[option].getAllStepslist()):
                            dificultad=0
                        songs[option].selectSteplist(dificultad)
                        h = songs[option].getHands()
                        if h ==2:
                            m.sayMessage('selectwindow:difdescription2', 1, songs[option].getSteplistname(), songs[option].getStartHp(), songs[option].getPressSpeed())
                        else:
                            m.sayMessage('selectwindow:difdescription', 1, songs[option].getSteplistname(), songs[option].getStartHp(), songs[option].getPressSpeed())

                elif pressKey == 'up':
                    if estitulo:
                        

                        soundevents.playMove()
                        option -= 1 
                        if option<0:
                            option=len(songs)-1
                        soundevents.musicLoad(songs[option].songpath)
                        soundevents.musicPlay(-1)
                        m.sayCustomMessage(songs[option].name,1)


                    elif esayuda:
                        continue
                    else:
                        soundevents.playChange()
                        dificultad-=1
                        if dificultad< 0:
                            dificultad=len(songs[option].getAllStepslist())-1
                        songs[option].selectSteplist(dificultad)
                        h = songs[option].getHands()
                        if h ==2:
                            m.sayMessage('selectwindow:difdescription2', 1, songs[option].getSteplistname(), songs[option].getStartHp(), songs[option].getPressSpeed())
                        else:
                            m.sayMessage('selectwindow:difdescription', 1, songs[option].getSteplistname(), songs[option].getStartHp(), songs[option].getPressSpeed())

                        


                elif(pressKey=='back'):
                    if estitulo:

                        pygame.display.quit()
                        escritor.flog("cierre por escape")
                        end=True
                    else:
                        estitulo=True
                        esayuda=False
                        option=0
                        dificultad=0
                        repeat= mensage
                        m.sayCustomMessage(mensage,1)
                        soundevents.musicLoad(songs[option].songpath)
                        soundevents.musicPlay()
                        m.sayCustomMessage(songs[option].name,0)



                else:
                    if pressKey!="stop":
                        m.sayCustomMessage(repeat)
Exemple #16
0
def startWindow(width, height):
    res = (width, height)
    pygame.init()
    pygame.display.set_caption("RitmSounds: main menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("Iniciado menu principal")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134, 230, 120))
    menuitems = []
    menuitems.append("menuwindow:option0")
    menuitems.append("menuwindow:option1")
    menuitems.append("menuwindow:option2")
    menuitems.append("menuwindow:option3")
    menuitems.append("menuwindow:optionexit")

    titulo = "menuwindow:title"
    last = titulo
    menuhelp = "menuwindow:help"

    pygame.display.flip()
    estitulo = True

    soundevents.musicLoad("songs/rtms.ogg")
    soundevents.musicPlay(True)
    soundevents.musicSetVolume(0.3)

    option = 0
    m.sayMessage(titulo)

    while (not end):
        reloj.tick(60)
        pantalla.fill((134, 230, 120))

        pygame.display.flip()

        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end = True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey == 'accept':

                    soundevents.playAccept()
                    if estitulo == True:
                        estitulo = False
                        m.sayMessage(menuhelp)
                        last = menuhelp
                    else:
                        if option == 4:
                            pygame.display.quit()
                            soundevents.musicFade(1500)
                            time.sleep(2)

                            return (4)
                        else:
                            pygame.display.quit()
                            end = True
                            soundevents.musicFade(1500)
                            return (option)
                elif pressKey == 'down':
                    if estitulo:
                        continue

                    soundevents.playMove()
                    option += 1
                    if option >= 5:
                        option = 0
                    m.sayMessage(menuitems[option])

                elif pressKey == 'up':
                    if estitulo:
                        continue

                    soundevents.playMove()
                    option -= 1
                    if option < 0:
                        option = 4
                    m.sayMessage(menuitems[option])

                elif (pressKey == 'back'):
                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end = True
                    return (4)

                else:
                    if pressKey != "stop":
                        m.sayMessage(last)
def _confirmNewDif(song):
    pygame.init()
    pygame.display.set_caption("RitmSounds: record menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciada pantalla de seleccion")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    
    
    menuitems=[]
    menuitems.append(m.getMessage('test'))
    menuitems.append(m.getMessage('cancel'))
    menuitems.append(m.getMessage('confirm'))
    pygame.display.flip()
    
    option=0
    mens=m.getMessage('recordmenu:confirmhelp', len(song.getAllSteps()))
    m.sayCustomMessage(mens,1)
    repeat = mensage

    
    soundevents.musicLoad("bgm/results.mp3")
    soundevents.musicPlay(-1)
    soundevents.musicSetVolume(0.2)
    m.sayCustomMessage(menuitems[option],0)


    while (not end):
        reloj.tick(60)
        pantalla.fill((134,230,120))
        pygame.display.flip()
        soundevents.musicSetVolume(0.2)


        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey== 'accept':
                    
                    soundevents.playAccept()
                    if option==0:
                        song.restartSong()
                        playWindow.startWindow(res[0],res[1],song,1)
                        _confirmNewDif(song)
                        end=True
                        break

                    elif option==1:
                        end=True
                        song.resetSteplist()
                        startWindow(res[0],res[1])
                        break
                    else:
                        end=True
                        song.saveSteplist()
                        escritor.saveSong(song)
                        startWindow(res[0],res[1])
                        break





                    
                    break
                elif pressKey == 'down':
                    
                    

                    soundevents.playMove()
                    option+=1
                    if option>=len(menuitems):
                        option=0
                    m.sayCustomMessage(menuitems[option],1)


                elif pressKey == 'up':
                    
                    

                    soundevents.playMove()
                    option -= 1 
                    if option<0:
                        option=len(menuitems)-1
                    m.sayCustomMessage(menuitems[option],1)


                    
                elif(pressKey=='back'):
                    

                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end=True
                    startWindow(res[0],res[1])

                
                else:
                    if pressKey!='stop':
                        m.sayCustomMessage(repeat)
def _configureNewDif(song):
    
    pygame.init()
    pygame.display.set_caption("RitmSounds: record menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciada pantalla de seleccion")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    
    
    menuitems=_buildConfigureDifMenu(song)
    
    pygame.display.flip()
    
    option=0
    m.sayCustomMessage(mensage2,1)
    repeat = mensage2

    m.sayCustomMessage(menuitems[option],0)
    esconfirm=False
    mensage3 = m.getMessage('recordmenu:help3',  pygame.key.name(keyManager.getConfiguredKey("l1")), pygame.key.name(keyManager.getConfiguredKey("l2")), pygame.key.name(keyManager.getConfiguredKey("l3")), pygame.key.name(keyManager.getConfiguredKey("l4")), pygame.key.name(keyManager.getConfiguredKey("r1")), pygame.key.name(keyManager.getConfiguredKey("r2")), pygame.key.name(keyManager.getConfiguredKey("r3")), pygame.key.name(keyManager.getConfiguredKey("r4")))

    while (not end):
        reloj.tick(60)
        pantalla.fill((134,230,120))
        pygame.display.flip()
        soundevents.musicSetVolume(0.2)


        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey== 'accept':
                    if option==len(menuitems)-1 or esconfirm==True:
                        soundevents.playAccept()
                        if esconfirm==False:
                            esconfirm=True
                            m.sayCustomMessage(mensage3,1)
                            repeat=mensage3
                        else:
                            end=True
                            soundevents.playGoSound()
                            soundevents.musicSetVolume(1)
                            soundevents.musicFade(1500)
                            time.sleep(1)
                            song.resetSteps()
                            j=recordWindow.startWindow(res[0],res[1],song)
                            if j is not None:
                                _confirmNewDif(j)
                            else:
                                startWindow(res[0],res[1])

                            break

                    else:
                        soundevents.playChange()
                        if option==0:
                            m.sayMessage('recordmenu:setdifname')
                            t= textInput.start()
                            if t is not None:
                                song.setSteplistname(t)
                        elif option ==1:
                            h=song.getHands()
                            if h==1:
                                song.setHands(2)
                            else:
                                song.setHands(1)
                        elif option==2:
                            m.sayMessage('recordmenu:setdifhp')
                            t= textInput.start(True)
                            if t is not None:
                                song.setStartHp(int(t))
                        elif option ==3:
                            m.sayMessage('recordmenu:setdifrestorehp')
                            t=textInput.start(True)
                            if t is not None:
                                song.setRestoreHp(int(t))
                        elif option ==4:
                            m.sayMessage('recordmenu:setdifpressspeed')
                            t=textInput.start(True)
                            if t is not None:
                                song.setPressSpeed(int(t))
                        elif option ==5:
                            m.sayMessage('recordmenu:setdifantisipationtime')
                            t=textInput.start(True)
                            if t is not None:
                                song.setAntisipateTime(int(t))

                        menuitems=_buildConfigureDifMenu(song)

                    
                    
                elif pressKey == 'down':
                    
                    
                    if esconfirm==False:

                        soundevents.playMove()
                        option+=1
                        if option>=len(menuitems):
                            option=0
                        m.sayCustomMessage(menuitems[option],1)
                    else:
                        continue

                elif pressKey == 'up':
                    
                    
                    if esconfirm==False:

                        soundevents.playMove()
                        option -= 1 
                        if option<0:
                            option=len(menuitems)-1
                        m.sayCustomMessage(menuitems[option],1)

                    else:
                        continue

                    
                elif(pressKey=='back'):
                    

                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end=True
                    startWindow(res[0],res[1])
                    return()
                
                else:
                    if pressKey!='stop':
                        m.sayCustomMessage(repeat)
def startWindow( width, height):
    global res
    res = (width,height)
    pygame.init()
    pygame.display.set_caption("RitmSounds: record menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciada pantalla de seleccion")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    
    
    menuitems=[]
    songs = escritor.loadAllTotalItems()


    pygame.display.flip()
    

    
    option=0
    m.sayCustomMessage(mensage,1)
    repeat = mensage

    if len(songs) == 0:
        m.sayMessage("selectwindow:nosongs",1)
        return(None)

    soundevents.musicLoad(songs[option].songpath)
    soundevents.musicPlay(-1)
    m.sayCustomMessage(songs[option].name,0)


    while (not end):
        reloj.tick(60)
        pantalla.fill((134,230,120))
        pygame.display.flip()
        soundevents.musicSetVolume(0.2)


        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey== 'accept':
                    
                    soundevents.playAccept()
                    

                    _selectDif(songs[option])
                    end=True
                    break
                elif pressKey == 'down':
                    
                    

                    soundevents.playMove()
                    option+=1
                    if option>=len(songs):
                        option=0
                    soundevents.musicLoad(songs[option].songpath)
                    soundevents.musicPlay(-1)
                    m.sayCustomMessage(songs[option].name,1)


                elif pressKey == 'up':
                    
                    

                    soundevents.playMove()
                    option -= 1 
                    if option<0:
                        option=len(songs)-1
                    soundevents.musicLoad(songs[option].songpath)
                    soundevents.musicPlay(-1)
                    m.sayCustomMessage(songs[option].name,1)


                    
                elif(pressKey=='back'):
                    

                    pygame.display.quit()
                    escritor.flog("cierre por escape")
                    end=True
                
                else:
                    if pressKey!='stop':
                        m.sayCustomMessage(repeat)
def _selectDif(song):
    
    pygame.init()
    pygame.display.set_caption("RitmSounds: record menu")
    pantalla = pygame.display.set_mode(res)
    escritor.flog("iniciada pantalla de seleccion")
    reloj = pygame.time.Clock()
    end = False
    pantalla.fill((134,230,120))
    
    if len(song.getAllStepslist()) == 0:
        _configureNewDif(song)
        return()
    pygame.display.flip()
    option=0
    m.sayCustomMessage(mensaje4,1)
    repeat = mensaje4

    m.sayMessage('recordmenu:existmenuitem0',0)
    esconfirm=False
    selectedDif =0


    while (not end):
        reloj.tick(60)
        pantalla.fill((134,230,120))
        pygame.display.flip()
        soundevents.musicSetVolume(0.2)


        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end=True
                exit()
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)
                if pressKey== 'accept':
                    
                    soundevents.playAccept()
                    if esconfirm==False and option!=0:
                        esconfirm=True
                        m.sayCustomMessage(mensaje5)
                        selectedDif=option-1
                        escritor.flog("la dificultad seleccionada es: "+str(selectedDif))
                        repeat=mensaje5
                        option=0
                        escritor.flog("la dificultad seleccionada es: "+str(selectedDif))
                    elif esconfirm == True:
                        if option==1:
                            song.deleteSteplist(selectedDif)
                            _configureNewDif(song)
                            end=True
                            break
                            

                        else:
                            option=0
                            esconfirm=False
                            m.sayCustomMessage(mensaje4)
                            repeat=mensaje4


                    else:
                        _configureNewDif(song)
                        end=True
                        break


                elif pressKey == 'down':
                    
                    

                    soundevents.playMove()
                    option+=1
                    if esconfirm:
                        if option>1:
                            option=0
                        if option==0:
                            m.sayMessage('cancel')
                        else:
                            m.sayMessage('confirm')


                    else:
                        if option >len(song.getAllStepslist()):
                            option=0
                        if option==0:
                            song.resetSteplist()
                            m.sayMessage('recordmenu:existmenuitem0')
                        else:
                            song.selectSteplist(option-1)
                            h = song.getHands()
                            if h ==2:
                                m.sayMessage('selectwindow:difdescription2', 1, song.getSteplistname(), song.getStartHp(), song.getPressSpeed())
                            else:
                                m.sayMessage('selectwindow:difdescription', 1, song.getSteplistname(), song.getStartHp(), song.getPressSpeed())






                elif pressKey == 'up':
                    
                    

                    soundevents.playMove()
                    option -= 1
                    if esconfirm:
                        if option<0:
                            option=1
                        if option==0:
                            m.sayMessage('cancel')
                        else:
                            m.sayMessage('confirm')

                    else:
                        if option < 0:
                            option=len(song.getAllStepslist())
                        if option==0:
                            song.resetSteplist()
                            m.sayMessage('recordmenu:existmenuitem0')
                        else:
                            song.selectSteplist(option-1)
                            h = song.getHands()
                            if h ==2:
                                m.sayMessage('selectwindow:difdescription2', 1, song.getSteplistname(), song.getStartHp(), song.getPressSpeed())
                            else:
                                m.sayMessage('selectwindow:difdescription', 1, song.getSteplistname(), song.getStartHp(), song.getPressSpeed())







                elif(pressKey=='back'):
                    

                    
                    escritor.flog("cierre por escape")
                    end=True
                    startWindow(1024,768)
                    end=True
                    break
                    


                
                else:
                    if pressKey!='stop':
                        m.sayCustomMessage(repeat)
Exemple #21
0
def start(onlyNums=False):
    res = (1024, 768)

    pygame.init()
    pantalla = pygame.display.set_mode(res)

    end = False
    simbols = "Z/X/C/V/B/N/M/A/S/D/F/G/H/J/K/L/Ñ/Q/W/E/R/T/Y/U/I/O/P/1/2/3/4/5/6/7/8/9/0/z/x/c/v/b/n/m/,/./-/;/:/_/a/s/d/f/g/h/j/k/l/ñ/q/w/e/r/t/y/u/i/o/p/'/¿/?/¡/!/#/$/%/&/(/)/=/á/Á/é/É/í/Í/ó/Ó/ú/Ú"
    numbersimbols = "1/2/3/4/5/6/7/8/9/0"
    if onlyNums:
        validSimbols = numbersimbols.split('/')
    else:

        validSimbols = simbols.split('/')
    text = ""
    reloj = pygame.time.Clock()
    mensage = m.getMessage("text:help")
    m.sayCustomMessage(mensage, 0)

    while (not end):
        reloj.tick(60)
        pygame.display.flip()
        for event in pygame.event.get():
            if (event.type == pygame.quit):
                pygame.display.quit()
                end = True
                escritor.flog("cierre modo prueba por evento de salida")
            elif (event.type == pygame.KEYDOWN):
                pressKey = keyManager.getKey(event.key)

                if pressKey == 'accept':
                    if len(text) == 0:
                        m.sayMessage("text:empty")
                    else:
                        end = True
                        soundevents.playAccept()

                elif (pressKey == 'back'):
                    #pygame.display.quit()
                    soundevents.playback()
                    escritor.flog("cierre por escape")
                    end = True
                    return (None)
                elif event.key == K_BACKSPACE and len(text) > 0:
                    m.sayMessage("text:delete", 1, text[-1])
                    text = text[:-1]
                    soundevents.playChange()

                elif event.key == K_SPACE:
                    text += " "
                    m.sayCustomMessage(text, 1)
                    soundevents.playRestoreHP()

                else:
                    chara = pygame.key.name(event.key)
                    if chara in validSimbols:
                        m.sayCustomMessage(chara, 1)
                        text += chara
                        soundevents.playRestoreHP()
                    else:
                        m.sayCustomMessage(mensage, 1)

    return (text)