我一直在尝试将SCNScene子类化,因为这似乎是保持场景相关逻辑的最佳位置.现在我不确定是否已经推荐了所以我的第一个问题是 - 我是否应该继承SCNScene,如果不是为什么不呢?文档似乎表明它很常见,但我在线阅读的评论表明我不应该将其子类化.废话,我正在查看文档SKScene.在SCNScene类引用只字不提子类.
假设以这种方式构建我的游戏是可以的,这是我的进步
// GameScene.swift
import Foundation
import SceneKit
class GameScene: SCNScene {
lazy var enityManager: BREntityManager = {
return BREntityManager(scene: self)
}()
override init() {
print("GameScene init")
super.init()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
func someMethod() {
// Here's where I plan to setup the GameplayKit stuff
// for the scene
print("someMethod called")
}
}
Run Code Online (Sandbox Code Playgroud)
注意:我正在lazy var按照这个问题的答案使用
在我的视图控制器中,我试图像这样使用GameScene
class GameViewController: UIViewController {
override func viewDidLoad() …Run Code Online (Sandbox Code Playgroud) 图像不会被破坏(您可以看到它),也不是链接.但IE6和7都在它周围放了一个盒子,上面有一个红叉.它还剥离了造型.
替代文字http://i44.tinypic.com/287pzf8.png
更新:图像不是背景图像,图像绝对不会被破坏.您实际上可以看到图像,在Safari,Firefox,Chrome和Opera中正常工作.
这是一个普通的旧常规图像标签
<div class='container'>
<img src='../images/leader_concierge.png' class='page_leader' width="917" height="257" />
</div>
Run Code Online (Sandbox Code Playgroud)
这是css
.page_leader { margin: 10px 0; }
Run Code Online (Sandbox Code Playgroud)
这是野生动物园中完全相同的事情
我有两张桌子,一张用于机场,一张用于路线.
机场看起来有点像这样
Airports
-------------------------------------
id | code | name |
-------------------------------------
01 | LGW | London Gatwick |
-------------------------------------
02 | LHR | London Gatwick |
Run Code Online (Sandbox Code Playgroud)
等等....
和另一个像这样的路线
Routes
---------------------------
id | ORIGIN | DESTINATION |
---------------------------
01 | LGW | VCE |
---------------------------
02 | TSF | LHR |
Run Code Online (Sandbox Code Playgroud)
等等...
我需要从表中选择路线,但我也想获得机场名称.令人困惑的是,我需要两次查询机场代码.我正在尝试这样的事情
SELECT routes.*, airports.name as origin_name FROM routes
LEFT JOIN airports ON airports.IATA = routes.origin
LEFT JOIN airports ON airports.IATA = routes.destination
WHERE origin = 'LHR' AND destination = …Run Code Online (Sandbox Code Playgroud) 我在想,创建一个基本上只是一个带Web视图的界面的Cocoa应用程序是否可行?做这样的事情会有一些严重的限制吗?
如果它"可行",那是否也意味着你可以为Windows应用程序做同样的事情?
我有以下代码,它应该更新NSUserDefaults中的值:
- (id) createBoardWithTitle:(NSString *)pTitle withScores:(NSArray *)pScores andNames:(NSArray *)pNames andDisplayStrings:(NSArray *)pStrings orderBy:(NSString *)pOrder ofType:(NSString *)pType
{
if((self == [super init]))
{
boardEntries = [NSMutableArray arrayWithCapacity:10];
// Build the data
for(...){
// populate boardEntries
}
// create an Dictionary to save
NSDictionary *savedData = [NSDictionary dictionaryWithObjectsAndKeys:pType, @"type", pOrder, @"order", boardEntries, @"entries", nil];
// Load the old boards
NSDictionary *existingBoards = [[NSUserDefaults standardUserDefaults] objectForKey:@"BlockDepotLeaderboards"];
// Create a mutable dictionary to replace the old immutable dictionary
NSMutableDictionary *newBoards = [NSMutableDictionary dictionaryWithCapacity:[existingBoards count]+1];
// …Run Code Online (Sandbox Code Playgroud) 我刚刚交给了一个对我来说有点奇怪的数据库模式.数据库位于Soap Web服务的后面,我注意到所有表ID都是十六进制格式的字符串
例如:0x1D283F
我将不得不将数据复制到MySQL数据库中.我从来没有使用过Hex作为ID,所以我不知道这是一个好主意/坏主意,或者无关紧要.我猜测自动增量在这里不起作用,这让我觉得这将是一个坏主意.
我可以将它们转换为整数,或者将它们保持原样,但其含义是什么.
我不是特别谈论加密,而是整体安全.是否有任何安全措施可以用于保护数据和/或系统,即使在假设的时间内能够承受假设的数量的资源?
我认为答案是否定的,但我认为在对人们大声说出来之前我会仔细检查,因为我不是安全专家.
更新:我应该指出,我不是在问这个因为我需要实现一些东西.这是好奇心.我还应该提一下,我可以在这里处理假设.如果存在任何相关性,请随意将量子计算等内容纳入等式中.
我一直试图ngCookie在我的应用程序中存储和检索cookie.由于我无法设置创建的cookie的路径或到期ngCookie,我不得不寻找其他地方.
所以我试图使用这个jQuery cookie插件.
However, I can't figure out how to make it available in an angular service. Gooling around for how to make jQuery plugins available in controllers and services, the answers unanimously point to using directive, but I don't think that's the right approach in this case since cookies are something controllers and services should be aware of.
So, how would someone make a jQuery plugin available to an Angular service?
我使用 XCode 级别编辑器设置了一个非常简单的场景。
如您所见,其中一个 1x5 矩形长方体已旋转 90º。这是通过在 Node Inspector 中将 Euler Angles 属性的 y 属性设置为 90 来实现的。
但请注意,边界框不考虑长方体旋转。当我遍历场景中的 SCNNodes 时也是如此。两个长方体具有相同的边界体积
for wall:SCNNode in walls.childNodes {
var v1 = SCNVector3Zero
var v2 = SCNVector3Zero
wall.getBoundingBoxMin(&v1, max:&v2)
print(v1, v2)
}
// Prints
// SCNVector3(x: -0.5, y: 0.0, z: -2.5) SCNVector3(x: 0.5, y: 0.5, z: 2.5)
// SCNVector3(x: -0.5, y: 0.0, z: -2.5) SCNVector3(x: 0.5, y: 0.5, z: 2.5)
Run Code Online (Sandbox Code Playgroud)
所以看起来边界体积是使用子节点自己的坐标系计算的,而不是节点父节点(或场景)的坐标系。这让我想知道;如何计算场景中的 SCNNodes 边界体积?
查看 SCNNode 的文档,似乎所有信息都在那里。我可以阅读eulerAngles它让我围绕 y 轴正确旋转。我可以阅读transform财产。
我以为我可以将向量乘以节点变换矩阵,但变换矩阵 (4x4) …
很抱歉必须这样做,但是我没有得到运行这个特定网络服务的人的爱.我以前从未使用过SOAP.
这是我认为应该工作的代码
public function soapTest(){
echo "start <br />";
use_soap_error_handler(true);
$client = new SoapClient("https://cwi.rezexchange.com:9991/?wsdl");
// here's the problem. What goes in the parenthesis?
$result = $client->CwiRateDetails(????);
echo($result);
echo "<br /> end";
}
Run Code Online (Sandbox Code Playgroud)
现在我猜这会告诉我括号应该包含什么.
POST /Service.asmx HTTP/1.1
Host: cwi.rezexchange.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://hotelconcepts.com/CwiRateDetails"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CwiRateDetails xmlns="http://hotelconcepts.com/">
<PropertyCode>string</PropertyCode>
<DateFrom>dateTime</DateFrom>
<DateTo>dateTime</DateTo>
<RatePlan>string</RatePlan>
<RoomType>string</RoomType>
<PromotionalRates>boolean</PromotionalRates>
</CwiRateDetails>
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
我猜是有点像
$result = $client->CwiRateDetails($PCode, $DateFrom, $DateTo, $RatePlan, $RoomType, false);
Run Code Online (Sandbox Code Playgroud)
应该管用.但我不知道日期格式是什么,或者房间类型是什么或如何引用费率计划.
现在.在我通过电子邮件与他们一起去猿人之前,我错误地认为他们需要提供更多信息吗?或者是否有某种SOAP技巧可以用来从某个地方获取信息?