2012-12-27 1 views
0

코로나 SDK를 사용하는 데있어 새로운 기능이며 메인 메뉴 버튼에 약간의 문제가 있습니다. 단추를 누를 때마다보기가 이동하거나 변경되지 않습니다. 제목 화면에서 단추가 사라집니다.메인 메뉴 용 코로나 SDK Ui 버튼

module(..., package.seeall) 

local ui = require ("ui") 
local ui = require ("director") 

local assetPath = "assets/" 

local mainGroup = display.newGroup() 

function new(params) 
    local titleScreen = display.newImageRect(assetPath .. "Law of Magic.jpg", 
     display.contentWidth, display.contentHeight) 
    titleScreen.x = display.contentWidth/2 
    titleScreen.y = 265 
    mainGroup:insert(titleScreen) 
    director:changeScene("titleScreen") 

    local newgame = ui.newButton{ default = assetPath .. "new game.png", 
     onRelease = function(event) director:changeScene("New game") end,} 
    newgame.x = display.contentWidth/2 
    newgame.y = 445 
    mainGroup:insert(newgame) 

    local continue = ui.newButton{ default = assetPath .. "continue.png", 
     onRelease = function(event) director:changeScene("Continue") end,} 
    continue.x = display.contentWidth/2 
    continue.y = 447 
    mainGroup:insert(continue) 

    local option = ui.newButton{ default = assetPath .. "option.png", 
     onRelease = function(event) director:changeScene("Option") end,} 
    option.x = display.contentWidth/2 
    option.y = 449 
    mainGroup:insert(option) 

    local help = ui.newButton{ default = assetPath .. "help.png", 
     onRelease = function(event) director:changeScene("Help") end,} 
    help.x = display.contentWidth/2 
    help.y = 451 
    mainGroup:insert(help) 

    local exitgame = ui.newButton{ default = assetPath .. "exit game.png", 
     onRelease = function(event) director:changeScene("Exit game") end,} 
    exitgame.x = display.contentWidth/2 
    exitgame.y = 453 
    mainGroup:insert(exitgame) 

    return mainGroup 
end 

답변

2

먼저 로컬 ui를 두 번 선언합니다. 감독 :이 코로나가 지원하고 coronaSDk

또한
0

이것에 새로운되기 때문에

두 번째는 스토리 보드를 사용해야합니다 changeScene ("새 게임")이 시도하고에 갈 것

장면, 당신은 장면 파일의 이름을 넣고 있습니다. 이 경우,라는 파일을 찾고 :

새로운 Game.lua

당신의 main.lua 파일과 같은 폴더에. 필자는 개인적으로 파일 이름에 공백이 있어서는 안되며 시뮬레이터는 대소 문자를 구분하지 않지만 장치는 있으며 파일 이름이 대소 문자를 구분하는지 확인해야합니다.

또한 나는이 라인에 대한 걱정 : 감독 : 그것은 당신이 이제까지 당신의 버튼 설정에 도착하기 전에 장면을 변경하려고 할

changeScene ("titleScreen").

0

변경

local director = require ("director") 

그리고 그래 파일 이름이 올바른지 확인이 라인

local ui = require ("director") 

.