我有一个简单的switch语句并不那么简单.
switch(bubble?.name){ //bubble is SKPhysicsBody
case "largeBubble": // <= error
newBubbleSize = "medium"
break;
default:
newBubbleSize = "large"
break;
}
Run Code Online (Sandbox Code Playgroud)
在这里,我得到了我在标题中提到的错误Binary operator '~=' cannot be applied to operands of type 'String' and 'String?'.我不知道为什么其中一个是可选的问题.
我总是在我的日志文件中收到错误"应用程序ID未设置",而我在此示例中设置了此ID :
const APP_ID = 'amzn1.ask.skill.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
我刚刚提交了一个新版本的认证,并希望开始在我的下一个版本上开发新功能.
但不知何故 - 由于我的技能处于认证模式,我无法启动新的开发版本.
在这个漫长的(4-7天)认证模式下,有没有办法开发新版本?
情况:我的iOS屏幕上有两艘或更多船.两者都有不同的属性,如名称,大小,生命值和得分.它们显示为SKSpriteNodes每个都添加了一个physicsBody.
目前,这些额外属性是扩展SKSpriteNode类的变量.
import SpriteKit
class ship: SKSpriteNode {
var hitpoints: Int = nil?
var score: Int = nil?
func createPhysicsBody(){
self.physicsBody = SKPhysicsBody(circleOfRadius: self.size.width / 2)
self.physicsBody?.dynamic = true
...
}
}
Run Code Online (Sandbox Code Playgroud)
在这个"游戏"中,你可以在那些船上射击,一旦子弹击中一艘船,你就可以获得积分.通过碰撞检测到"击中船".
func didBeginContact(contact: SKPhysicsContact){
switch(contact.bodyA.categoryBitMask + contact.bodyB.categoryBitMask){
case shipCategory + bulletCategory:
contactShipBullet(contact.bodyA, bodyB: contact.bodyB)
break;
default:
break;
}
}
Run Code Online (Sandbox Code Playgroud)
问题:碰撞检测只返回一个physicsBody,我不知道如何SKSpriteNode通过这个physicsBody 来获取我的扩展类.
思考:这是一种正确的方法来延伸SKSpriteNode让我的物体像船一样生命吗?当我将一艘船添加到我的屏幕时,它看起来像:
var ship = Ship(ship(hitpoints: 1, score: 100), position: <CGPosition>)
self.addChild(ship)
Run Code Online (Sandbox Code Playgroud)
或者这只是一个错误的方法,有一个更好的方法来找出具有统计数据的对象,所以通过碰撞检测被子弹击中?
这个问题与我的另一个问题 …
在我的粉丝页面上,我添加了我的小应用程序,这使得粉丝可以将照片上传到此粉丝页面的特殊相册.
这是可能的,因为我使用粉丝页管理员权限("manage_pages,publish_stream和offline_access").
但现在 - 每次有人使用这个应用程序,我都会在我的粉丝页面上发布照片发布新闻.如何将照片添加到粉丝页面而不将其发布到新闻流?
实际上我的发布php代码看起来像:
<?php
$post_data = array(
'image' => ('@' . realpath($photo)),
'message' => $msg)
);
$facebook->setAccessToken(_FANPAGE_ACCESS_TOKEN);
$data = $facebook->api('/'. _ALBUM_ID . '/photos', 'post', $post_data);
?>
Run Code Online (Sandbox Code Playgroud)
当我使用我的粉丝页面管理员帐户删除"publish_stream"权限时,会出现一个"有趣"的错误.上传的照片不会显示在相册中,也不会显示在新闻流中.但是在照片条中你可以看到所有新照片,当你点击它时,它会与所有上传的照片连成一片......它看起来像是在某个"隐藏的"照片中.
那么有没有人有线索,如何在图表api上发布照片而不将其发布到新闻流?
在此先感谢,Jurik
我在我的应用程序中使用了多个场景,但遇到的问题是每次最后一个场景都会覆盖第一个场景.
public function rules()
{
return array(
[...]
array('cost_spares', 'cost_spare_func', 'match',
'pattern' => '/^[a-zA-Z]+$/',
'message' => 'Do not enter zero or/and characters for Spare parts!',
'on' => 'cost_spare_func'),
array('cost_labour', 'cost_labour_func', 'match',
'pattern' => '/^[a-zA-Z]+$/',
'message' => 'Do not enter zero or/and characters for Labour Charges!',
'on' => 'cost_labour_func'),
);
}
Run Code Online (Sandbox Code Playgroud)
public function actionUpdate ($id)
{
if (isset($_POST['TblEnquiry']))
{
[...]
$model->setScenario('cost_spare_func');
$model->setScenario('cost_labour_func');
}
}
Run Code Online (Sandbox Code Playgroud) 我想在运行OSX 10.8.4的本地机器和PHP 5.4.1的MAMP Pro上使用phpunit测试.此外,我想将它用于Yii和我的IDE Netbeans.
我通过pear阅读了一些像这种方法的教程,或者通过作曲家阅读这个教程.我甚至试图在Windows上看起来像ppl一样- 没有成功.
我的方法总是导致错误
PHP警告:include():打开'PHP_Invoker.php'失败
PHP警告:include():打开'PHPUnit_Extensions_Database_TestCase.php'失败
PHP警告:include():打开'PHPUnit_Extensions_Story_TestCase.php'失败
打开所需的'PHPUnit/Extensions/SeleniumTestCase.php'失败
PHP致命错误:找不到类'CTestCase'
或者根本找不到phpunit.
通过这段代码,我可以从数据库中检索前五条记录。
但我需要在按分页箭头后显示数据库中剩余的 5 行。我正在做一个视频分享网站,就像 YouTube 一样。
<?php
include "config.php";
$q = mysql_query("SELECT * FROM register r
JOIN videos v ON r.id = v.video_id
ORDER BY r.id LIMIT 5") or die (mysql_error());
$headers = $col = "";
$row=mysql_num_rows($q);
$s=null;
echo "<h1> Top Most Videos </h1>";
while ($row = mysql_fetch_array($q))
{
if($row['id']!=$s)
{
$s = $row['id'];
echo "<div class='property'>";
echo "<div class='property1' >";
echo "<a href='#'><video src=\"".$row['path']."\" height='100' width='170' style= margin:5px; controls='controls'></video></a>";
echo "</div>";
echo "<div class='property2'>";
echo $row['videoname'];
echo "</div>";
echo …Run Code Online (Sandbox Code Playgroud) 我想避免几个if,我的问题是:
是否有一个函数或方法将几个数组($ a,$ b)添加到数组中,但仅当数组($ a,$ b)不为空时?
鉴于:
$a = ['foo' => 'bar'];
$b = [];
Run Code Online (Sandbox Code Playgroud)
我的代码:
$c = [];
if (count($a))
{
$c['a'] = $a;
}
if (count($b))
{
$c['b'] = $b;
}
Run Code Online (Sandbox Code Playgroud)
是的,我需要具有特定名称的字符串键.
我想知道为什么我的CSS不适用于我的HTML.我不认为我做错了什么,但它不适用.这可能是一些非常愚蠢的初学者错误,但我不知道我做错了什么.
我的HTML:
<head>
<link rel="stylesheet" type="text/css" src="imagetest.css">
<link href='http://fonts.googleapis.com/css?family=Antic+Didone' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="imagesWrapper">
<!-------------------------------DEVIDER------------------------------->
<div id="img1Wrap" class="imgWrapGlobal">
<img id="img1" class="images" src="img/img1.png">
</div>
<div id="img2Wrap" class="imgWrapGlobal">
<img id="img2" class="images" src="img/img2.png">
</div>
<div id="img3Wrap" class="imgWrapGlobal">
<img id="img3" class="images" src="img/img3.png">
</div>
<div id="img4Wrap" class="imgWrapGlobal">
<img id="img4" class="images" src="img/img4.png">
</div>
<div id="img5Wrap" class="imgWrapGlobal">
<img id="img5" class="images" src="img/img5.png">
</div>
<div id="img6Wrap" class="imgWrapGlobal">
<img id="img6" class="images" src="img/img6.png">
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
我的CSS:
.images{
width:200px;
}
Run Code Online (Sandbox Code Playgroud) php ×5
alexa ×2
swift ×2
yii ×2
alexa-skill ×1
amazon-echo ×1
arrays ×1
aws-lambda ×1
collision ×1
css ×1
facebook ×1
html ×1
ios ×1
javascript ×1
mamp ×1
mysql ×1
netbeans ×1
node.js ×1
object ×1
phpunit ×1
scenarios ×1
sprite-kit ×1