如何在新的xcode3中更改初始场景?我找到了很多说明,但所有这些都在使用这段代码:
extension SKNode {
class func unarchiveFromFile(file : String) -> SKNode? {
if let path = NSBundle.mainBundle().pathForResource(file, ofType: "sks") {
var sceneData = NSData(contentsOfFile: path, options: .DataReadingMappedIfSafe, error: nil)!
var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData)
archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene")
let scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as! MenuScene
archiver.finishDecoding()
return scene
} else {
return nil
}
}
}
但是新的Xcode项目,GameViewController不包含这部分代码,当我尝试复制时,它无法正常工作。所以我制作了MainScene.swift和MainScene.sks,并希望将这些场景设置为main。接下来是什么?
感谢!!!!
答案 0 :(得分:2)
如果您使用.sks文件进行场景布局,请使用以下代码。
@Service
public class TestService {
@Autowired
private EmailService emailService;
public void sendEmail() throws UnsupportedEncodingException {
final Email email = DefaultEmail.builder()
.from(new InternetAddress("hari.seldon@the-foundation.gal",
"Hari Seldon"))
.to(newArrayList(
new InternetAddress("the-real-cleon@trantor.gov",
"Cleon I")))
.subject("You shall die! It's not me, it's Psychohistory")
.body("Hello Planet!")
.encoding("UTF-8").build();
emailService.send(email);
}
}