我需要一些建议.我正在开发一种类似于Flow Free的游戏,其中游戏板由网格和彩色点组成,用户必须将相同的彩色点连接在一起而不与其他线重叠,并且用尽所有板中的空闲空间.
我的问题是关于水平创造.我希望随机生成各级(并且至少应该能够自己解决,以便它可以给玩家提示)并且我在使用什么算法.有什么建议?
注意:图像显示了Flow Free的目标,它与我正在开发的目标相同.
谢谢你的帮助.:)
我已经阅读了有关如何使用Google API的文档,示例和教程,我已经运行了一个显示您最新活动和信息的迷你应用程序,但我使用会话来存储令牌.
我的问题是,如何从数据库中存储和检索令牌,以便当用户(已经注册)点击"登录"时,它可以立即使用API而无需重复授权?请注意,我使用该示例作为我的迷你应用程序的起点.
这是一段代码片段:
$client = new apiClient();
$client->setApplicationName(APP_NAME);
$client->setClientId(CLIENT_ID);
$client->setClientSecret(CLIENT_SECRET);
$client->setRedirectUri(REDIRECT_URL);
$client->setDeveloperKey(DEV_KEY);
$plus = new apiPlusService($client);
$google_userinfo = new apiOauth2Service($client);
$message = "";
// In a real application this would be stored in a database, and not in the session!
if (isset($_SESSION['token']))
$client->setAccessToken($_SESSION['token']);
$_SESSION['token'] = $client->getAccessToken();
if (isset($_GET['code'])) {
$client->authenticate();
// In a real application this would be stored in a database, and not in the session!
$_SESSION['token'] = $client->getAccessToken();
header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
}
...
//Somewhere …
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个Feed阅读器,每小时左右检查一次Feed的更新版本.
我的问题是,事件页面似乎在不到20秒后变为非活动状态.
如何让它持续更长时间?
以下是代码的一些重要部分:
在manifest.json中:
"background": {
"scripts": ["eventPage.js"],
"persistent": false
},
Run Code Online (Sandbox Code Playgroud)
并在eventPage.js中:
function testFunc () {
alert("test")
}
setInterval(testFunc, 10 * 1000) // was testing the number of seconds here
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
谢谢!
问候,
约翰