Corona SDK中的转换情节提要效果未正确转换
在我的代码中,我使用故事板在两个.lua文件之间进行转换。但是,即使转换本身正在发生,用于在它们之间转换的效果也不存在。因此,从本质上讲,故事板在两个文件之间成功地转换,但没有指定任何效果。有人知道为什么会这样吗 第一场:Corona SDK中的转换情节提要效果未正确转换,sdk,coronasdk,Sdk,Coronasdk,在我的代码中,我使用故事板在两个.lua文件之间进行转换。但是,即使转换本身正在发生,用于在它们之间转换的效果也不存在。因此,从本质上讲,故事板在两个文件之间成功地转换,但没有指定任何效果。有人知道为什么会这样吗 第一场: local storyboard = require( "storyboard" ) local scene = storyboard.newScene() ------------------------------------------Set Background
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
------------------------------------------Set Background
local backgroundFillColor = {}
--Red RGB
backgroundFillColor[1] = 76/255
--Greeb RGB
backgroundFillColor[2] = 217/255
--Blue RGB
backgroundFillColor[3] = 100/255
display.setDefault("background",backgroundFillColor[1],backgroundFillColor[2],backgroundFillColor[3])
local function changeScene( event )
-- body
if event.phase == "ended" then
storyboard.gotoScene( "scene1", "fade", 500 ) -- go to levels scene
end
end
Runtime:addEventListener( "touch", changeScene )
return scene
第二场:
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
------------------------------------------Set Background
local backgroundFillColor = {}
--Red RGB
backgroundFillColor[1] = 0/255
--Greeb RGB
backgroundFillColor[2] = 0/255
--Blue RGB
backgroundFillColor[3] = 0/255
display.setDefault("background",backgroundFillColor[1],backgroundFillColor[2],backgroundFillColor[3])
local function changeScene( event )
-- body
if event.phase == "ended" then
storyboard.gotoScene( "scene", "fade", 500 ) -- go to levels scene
end
end
Runtime:addEventListener( "touch", changeScene )
return scene
主要内容:
必须将希望情节提要管理的任何显示对象(即周围的过渡)插入到场景的“视图”组中。通常在createScene()函数中创建所有这些对象,在该函数中设置对视图的引用,即
function scene:createScene( event )
local group = self.view
local background = display.newImageRect("somebackgroundimage.png", width, height)
group:insert( background )
...
end
组:插入(背景)对于情节提要(和作曲家)的功能至关重要。看起来您没有正确设置情节提要。缺少脚本正常运行所需的
createScene
、willentersene
、exitScene
和destrouctsene
等功能。我建议您阅读故事板文档。或者是新的作曲家,他正在取代故事板。
function scene:createScene( event )
local group = self.view
local background = display.newImageRect("somebackgroundimage.png", width, height)
group:insert( background )
...
end