게임 도중 또는 사용자가 게임을 얻거나 잃은 후에 사용자에게 질문하는 방법이 있습니까? 아래의 코드는 내가 동의 한 플레이어를 요청하기 위해 작성한 코드이며 조금 변경했습니다. 나는 그것을 어떻게 바꿔야하는지 잘 모르겠다. 그리고 응답을 나에게 이메일로 보내고 싶었다.게임 도중에 코로나에서 뭔가를 대답하도록 사용자에게 묻습니다.
--Asking user a question, response is printed out in the Simulator Output and emailed to me
local alert = native.showAlert("Question", "Are the controls difficult to master?", { "Yes", "No" }, gameFun)
local function gameFun(event)
print("User's decision is ".. event.index .. " User answered the question " .. event.action)
local action = event.action
if "clicked" == event.action then
if 2 == event.index then
end
elseif "cancelled" == event.action then
-- our cancelAlert timer function dismissed the alert so do nothing
end
end
좋아, 난 이제 조금 내 코드를 변경, 나는 그래서이 한 번만 경고 상자를 사용할 수 있다고 생각이 : 나는 새로운 기능을 만들었습니다
function gameFun()
balloonText.isVisible = false
balloonTextt.isVisible = false
balloonTexttt.isVisible = false
questionText.isVisible = false
askUser = display.newText(
'Is the cannon hard to use? Rate it at a scale of 1-5(5 the best)',
display.contentCenterX,
display.contentWidth/4,
native.systemFont, 20)
askUser:setFillColor(135, 75, 44)
yesBtn = display.newImage("Yes.png",120,290)
noBtn = display.newImage("No.png",190,290)
end
function gameFunListener(action)
if (action=='add') then
yesBtn:addEventListener ('tap', sendMail())
noBtn:addEventListener ('tap', sendMail())
else
yesBtn:removeEventListener ('tap', sendMail())
noBtn:removeEventListener ('tap', sendMail())
end
end
하는 사용자에게 질문을하고, 예 또는 아니오를 누르면 이메일 옵션으로 이동하여 이메일을 보내고 알려줄 수 있습니다. 그러나 어떤 이유로 버튼이 작동하지 않고 전자 메일을 쓰기 위해 점프합니다.
나는 스토리 보드를 사용하지 않지만 스토리 보드는 편리하지만 스토리 보드를 사용하는 대신 다른 방법이 있습니까? – user3305142
@ user3305142 이것은 내 대답이지만 분명하지는 않지만 아직 편집하지 않은 경우 의견을 편집합니다. – Schollii
1 시간 전에 게시 한 것과 같은가요? – user3305142