3
下面是我写的一个简单游戏的代码的一部分,我试图发送一个包含用户在菜单屏幕上花费的时间的电子邮件。我不确定在哪里调用选项功能。如何在corona中调用此代码发送电子邮件的功能?
--Send a email to my own address
local options =
{
to = "[email protected]",
subject = "Time spent at the menu screen",
body = "This is the time I spent to look at the menu"..(os.time() - startTime),
}
native.showPopup("mail", options)
--Function that initializes all game logic
function Main()
splash:removeSelf()
splash = nil
playGame = display.newImage("Play Button.png")
tutorial = display.newImage("Tutorial Button.png")
credits = display.newImage("Credits Button.png")
playGame.x = display.contentWidth/2
playGame.y = display.contentWidth - 187
tutorial.x = display.contentWidth/2
tutorial.y = display.contentWidth - 130
credits.x = display.contentWidth/2
credits.y = display.contentWidth - 73
startButtonListeners('add')
end
--Adds listeners to the button in menu screen
function startButtonListeners(action)
if (action == 'add') then
playGame:addEventListener ('tap', showGameView)
credits: addEventListener ('tap', showCredits)
tutorial: addEventListener ("tap", showTutorial)
else
playGame:removeEventListener ('tap', showGameView)
print("Time spent at menu screen: ", (os.time() - startTime))
credits: removeEventListener ('tap', showCredits)
tutorial: removeEventListener ('tap', showTutorial)
end
end
谢谢,这是重量我在找。顺便说一句,有没有一种方法来测试,而不是代码在电脑上工作?我跑了代码,但似乎没有发生任何事,我找不到电子邮件。 – user3305142
电晕本机邮件弹出窗口在电晕模拟器上不起作用。您必须构建Xcode模拟器或设备来测试它... –