我该如何在卡罗纳中调用发送电子邮件的函数?
2014-2-26 23:26:16
收藏:0
阅读:100
评论:1
以下是我正在编写的简单游戏的代码部分,我正在尝试发送一封电子邮件,其中包含用户在菜单屏幕上花费的时间。我不确定在哪里调用选项函数。
-- 发送邮件到我的邮箱
local options =
{
to = "richard@gmail.com",
subject = "在菜单屏幕上花费的时间",
body = "这是我花费的时间,查看菜单" .. (os.time() - startTime),
}
native.showPopup("mail", options)
-- 初始化所有游戏逻辑的函数
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
-- 在菜单屏幕上添加按钮监听器
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("在菜单屏幕上花费的时间:", (os.time() - startTime))
credits: removeEventListener ('tap', showCredits)
tutorial: removeEventListener ('tap', showTutorial)
end
end
点赞
评论区的留言会收到邮件通知哦~
推荐文章
- 如何将两个不同的lua文件合成一个 东西有点长 大佬请耐心看完 我是小白研究几天了都没搞定
- 如何在roblox studio中1:1导入真实世界的地形?
- 求解,lua_resume的第二次调用继续执行协程问题。
- 【上海普陀区】内向猫网络招募【Skynet游戏框架Lua后端程序员】
- SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
- Lua实现网站后台开发
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?
- addEventListener 返回 nil Lua
- Lua中获取用户配置主目录的跨平台方法
我无法完全理解您的需要。我认为,当您离开屏幕或游戏结束时,您需要发送电子邮件到特定的地址。因此,当您的游戏结束或通过触发按钮离开屏幕时,您可以调用一个带有
options参数的函数。就像下面这样:local function sendMail() local options = { to = "richard@gmail.com", 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) end ... ... ... sendMail() -- 当游戏结束/离开场景前调用此函数欲知更多信息,请参考此链接: 如何使用Corona SDK邮寄屏幕截图图像
保持编码............. :)