Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/208.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 为什么我的应用程序被卡住了_Android_Lua_Coronasdk_Corona Storyboard - Fatal编程技术网

Android 为什么我的应用程序被卡住了

Android 为什么我的应用程序被卡住了,android,lua,coronasdk,corona-storyboard,Android,Lua,Coronasdk,Corona Storyboard,我正在为一个应用程序编写介绍和演示代码。一切都很好,但当我试图使用它时,我发现了一个bug,我不知道如何摆脱它 这就是应用程序所做的:首先,你会看到resume中的说明“当正方形出现时触摸,如果出现其他图形,请不要触摸屏幕”。因此,演示开始了,如果你不触摸正方形,就会出现一条信息,上面写着“记住触摸正方形”,但是如果你触摸屏幕以消除该信息,则会像触摸其他图形一样读取该信息。我一直在想如何管理该信息,但这真的很难 所以,我请求一些帮助。当信息显示在屏幕上时阻止触摸屏的一种方式,或者逻辑绕过此方式

我正在为一个应用程序编写介绍和演示代码。一切都很好,但当我试图使用它时,我发现了一个bug,我不知道如何摆脱它

这就是应用程序所做的:首先,你会看到resume中的说明“当正方形出现时触摸,如果出现其他图形,请不要触摸屏幕”。因此,演示开始了,如果你不触摸正方形,就会出现一条信息,上面写着“记住触摸正方形”,但是如果你触摸屏幕以消除该信息,则会像触摸其他图形一样读取该信息。我一直在想如何管理该信息,但这真的很难

所以,我请求一些帮助。当信息显示在屏幕上时阻止触摸屏的一种方式,或者逻辑绕过此方式

Thx

这是密码

---------------------------------------------------------------------------------
-- SCENE NAME
-- Scene notes go here
---------------------------------------------------------------------------------

local storyboard = require( "storyboard" )
local scene = storyboard.newScene()

-- Clear previous scene
--storyboard.removeAll()

-- local forward references should go here --

---------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION

 --tiempoVisible = 150                                             --Tiempo de visibilidad del circulo
 --tiempoNoVisible = 1850                                          --Intervalo de timepo entre un circulo y otro

 tiempoVisible = 200                                             --Tiempo de visibilidad del circulo
 tiempoNoVisible = 2250                                          --Intervalo de timepo entre un circulo y otro


 aciertos = 0                                                    --Registra los aciertos del paciente
 comisiones = 0                                                  --Registra las comisiones del paciente
 omisiones = 0                                                   --Registra las omisiones del paciente
 tiempo = tiempoNoVisible                --Entrega el tiempo que debe estar el circulo y el tiempo de intervalo

--Contiene la secuencia de circulos buenos (1) y circulos malos (0)
 tablaSecuencia = {0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1}
 contadorSecuencia = 0                          --Registra en que lugar de la tabla va la secuencia

 esTransparente = true                                           --Verifica si el circulo esta transparente o no
 estaRespondido = false                                          --Verifica si el circulo fue presionado


---------------------------------------------------------------------------------

-- Called when the scene's view does not exist:
function scene:createScene( event )
  local group = self.view

  --print("inside")
    imagenINTRU = display.newImage("test2/instrucciones.png", 0, 0, true);
    imagenINTRU:scale(display.contentWidth/imagenINTRU.contentWidth+0.15, display.contentHeight/imagenINTRU.contentHeight+0.1);
    imagenINTRU.x= display.contentWidth/2;
    imagenINTRU.y= display.contentHeight/2+40;

    group:insert(imagenINTRU);
    empezoTest = false

  circulo = display.newCircle(display.contentCenterX-20, display.contentCenterY-30, 80)
  circulo.alpha = 0

  group:insert(circulo)
  circulo.isVisible=false;

imagenP = display.newImage("test2/pentagonox.png", 0, 0, true);
    imagenP:scale(1, 1);
    imagenP.x= display.contentWidth/2;
    imagenP.y= display.contentHeight/2;
    group:insert(imagenP);
    imagenP.isVisible=false;


 imagenC = display.newImage("test2/cuadradox.png", 0, 0, true);
    imagenC:scale(1, 1);
    imagenC.x= display.contentWidth/2;
    imagenC.y= display.contentHeight/2;
    group:insert(imagenC);
    imagenC.isVisible=false;

mensajeA = display.newText("¡Eso es!", 0, 0, 400, 0, native.systemFontBold, 60)
  mensajeA.x = (display.contentWidth/2) + 100
  mensajeA.y = 600 --display.contentHeight/2
  mensajeA:setFillColor(144/255, 173/255, 193/255, 1)
  mensajeA.align = "center"
  group:insert(mensajeA)

  mensajeB = display.newText("¡Recuerde que debe presionar cuando\n          aparezca un cuadrado!", 0, 0, 950, 0, native.systemFontBold, 50)
  mensajeB.x = 550
  mensajeB.y = 600 --display.contentHeight/2
  mensajeB:setFillColor(144/255, 173/255, 193/255, 1)
  mensajeB.align = "center"
  group:insert(mensajeB)

  mensajeC = display.newText("¡Recuerde que NO debe presionar cuando\n      aparezca otra figura geométrica!", 0, 0, 1100, 0, native.systemFontBold, 50)
  mensajeC.x = 550
  mensajeC.y = 600 --display.contentHeight/2
  mensajeC:setFillColor(144/255, 173/255, 193/255, 1)
  mensajeC.align = "center"
  group:insert(mensajeC)


mensajeA.isVisible=false;
mensajeB.isVisible=false;
mensajeC.isVisible=false;

end

-- Called BEFORE scene has moved onscreen:
function scene:willEnterScene( event )
  local group = self.view

end

-- Called immediately after scene has moved onscreen:
function scene:enterScene( event )
  local group = self.view

end

-- Called when scene is about to move offscreen:
function scene:exitScene( event )
  local group = self.view

end

-- Called AFTER scene has finished moving offscreen:
function scene:didExitScene( event )
  local group = self.view

end


 function finalizar()
   Runtime:removeEventListener("touch", primerTouch)
 Runtime:removeEventListener("touch", touch)
 imagenINTRU:removeSelf()
 imagenINTRU=nil;
 end

-- Called prior to the removal of scene's "view" (display view)
function scene:destroyScene( event )
  local group = self.view

end

-- Called if/when overlay scene is displayed via storyboard.showOverlay()
function scene:overlayBegan( event )
  local group = self.view
  local overlay_name = event.sceneName  -- name of the overlay scene

end

-- Called if/when overlay scene is hidden/removed via storyboard.hideOverlay()
function scene:overlayEnded( event )
  local group = self.view
  local overlay_name = event.sceneName  -- name of the overlay scene

end


 function img()
    imagenINTRU:removeSelf();
    imagenINTRU = null;
    imagenINTRU = display.newImage("test2/backGprueba.png", 0, 0, true);
    imagenINTRU:scale(display.contentWidth/imagenINTRU.contentWidth+0.15, display.contentHeight/imagenINTRU.contentHeight+0.1);
    imagenINTRU.x= display.contentWidth/2;
    imagenINTRU.y= display.contentHeight/2+80;
    imagenINTRU:toBack();
end

function primerTouch(event)
  if ((event.phase == "ended" or event.phase == "cancelled") and not empezoTest) then
    empezoTest = true

    img()
    timer.performWithDelay(tiempo, CambiarAlpha)
  end
end


function CambiarAlpha()
  if empezoTest then
  if msjeVisible()==false then
  if esTransparente then
    print(contadorSecuencia.." turno")
    if contadorSecuencia == 16 then
    --if contadorSecuencia == 3 then
      if tablaSecuencia[contadorSecuencia] == 1 and not estaRespondido then
        no_msj()
        print("OmisionA")
        mensajeB.isVisible=true; 
        timer.performWithDelay(1600, delayB)
        --omisiones = omisiones + 1
      end

      contadorSecuencia = 0
      storyboard.purgeScene("ini_prueba2")
      storyboard.removeScene("ini_prueba2")
      storyboard.removeAll("ini_prueba2")
      storyboard.gotoScene("ini_prueba2", "fade", 1500)

      empezoTest=false;
      finalizar()
    else
      delay=false;
      --contadorSecuencia = contadorSecuencia - 1
      if tablaSecuencia[contadorSecuencia] == 1 and not estaRespondido then
        print("Omisionb")
        no_msj()
        mensajeB.isVisible=true; 
        timer.performWithDelay(1600, delayB)
        delay=true;

      end
      if delay==false then
        contadorSecuencia = contadorSecuencia + 1


        if tablaSecuencia[contadorSecuencia] == 0 then
          imagenP.isVisible=true;
        else
          imagenC.isVisible=true;
        end

        esTransparente = false
        circulo.alpha = 1
      --estaRespondido = false

        tiempo = tiempoVisible
        print("tmpo no visi ."..tiempo)
        timer.performWithDelay(tiempo, CambiarAlpha)

      --end
      else -- if 199
        contadorSecuencia = contadorSecuencia + 1
      end -- end delay
    end
  else-- else transparente 177
    esTransparente = true
    circulo.alpha = 0
    no_TPC()

        tiempo = tiempoNoVisible
        estaRespondido = false
        timer.performWithDelay(tiempo, CambiarAlpha)

    --tiempo = tiempoNoVisible
    --estaRespondido = false
    --timer.performWithDelay(tiempo, CambiarAlpha)
  end
else
  tiempo = tiempoNoVisible
timer.performWithDelay(tiempo, CambiarAlpha)
  end --if mensaje visible
  end --if empezoTest
end

function msjeVisible()
  is=false;
  if mensajeA.isVisible==true then
    is= true;
  end
  if mensajeB.isVisible==true then
    is= true;
  end
  if mensajeC.isVisible==true then
    is= true;
  end
  return is;
end


function no_TPC()
  imagenP.isVisible=false;
  imagenC.isVisible=false;
end

function no_msj()
mensajeA.isVisible=false;
mensajeB.isVisible=false;
mensajeC.isVisible=false;

end

function no_msj2()
mensajeA.isVisible=false;
mensajeB.isVisible=false;
mensajeC.isVisible=false;
end

function delayA(event)
  if mensajeA.isVisible  then
    mensajeA.isVisible=false;
    tiempo = 100--tiempoNoVisible
--timer.performWithDelay(tiempo, CambiarAlpha)
print("A")
  end
end
function delayB(event)
  if mensajeB.isVisible  then
    mensajeB.isVisible=false;
    tiempo = 100--tiempoNoVisible
timer.performWithDelay(tiempo, CambiarAlpha)
print("B")
  end
end
function delayC(event)
  if mensajeC.isVisible  then
    mensajeC.isVisible=false;
    tiempo = 100--tiempoNoVisible
--timer.performWithDelay(tiempo, CambiarAlpha)
print("C")
  end
end


function touch(event)
  if event.phase == "began" and  empezoTest then
    if tablaSecuencia[contadorSecuencia] == 1 and not estaRespondido then
      no_msj2()
      mensajeA.isVisible=true; 
      timer.performWithDelay(1600, delayA)
      aciertos = aciertos + 1
      estaRespondido = true
    elseif tablaSecuencia[contadorSecuencia] == 0 and not estaRespondido then
      no_msj2()
      mensajeC.isVisible=true; 
      timer.performWithDelay(1600, delayC)
      comisiones = comisiones + 1
      estaRespondido = true
    end
  end
end


--timer.performWithDelay(tiempo, CambiarAlpha)
Runtime:addEventListener("touch", touch)
---------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
---------------------------------------------------------------------------------
 Runtime:addEventListener("touch", primerTouch)
-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene ) 
-- "willEnterScene" event is dispatched before scene transition begins
scene:addEventListener( "willEnterScene", scene )
-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )
-- "exitScene" event is dispatched before next scene's transition begins
scene:addEventListener( "exitScene", scene )
-- "didExitScene" event is dispatched after scene has finished transitioning out
scene:addEventListener( "didExitScene", scene )
-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )
-- "overlayBegan" event is dispatched when an overlay scene is shown
scene:addEventListener( "overlayBegan", scene ) 
-- "overlayEnded" event is dispatched when an overlay scene is hidden/removed
scene:addEventListener( "overlayEnded", scene )

---------------------------------------------------------------------------------

return scene

Amir是正确的,Corona不再支持脚本实现。我建议使用更强大的编译器

Amir是正确的,Corona不再支持脚本实现。我建议使用更强大的编译器

开始使用Corona Composer库

开始使用Corona Composer库

Corona不再支持情节提要。尝试使用composer。

Corona不再支持情节提要。尝试使用composer。

Corona甚至不再支持情节提要。如果试图操作这样的长代码,您需要相当先进。尝试使用composer谢谢amir,我做到了,并将所有代码迁移到composer,它成功了。不用担心,伙计。那么我可以得到要点吗:)Corona甚至不再支持情节提要。如果试图操作这样的长代码,您需要相当先进。尝试使用composer谢谢amir,我做到了,并将所有代码迁移到composer,它成功了。不用担心,伙计。那么我能拿到分数吗:)