gpt4 book ai didi

ios - NativeScript 中的 SpriteKit View

转载 作者:行者123 更新时间:2023-11-28 23:32:29 25 4
gpt4 key购买 nike

是否可以使用 Nativescript 显示屏幕我在互联网上搜索了很少的信息。找到代码。

const GameViewController = (UIViewController as any).extend(
{
get willPopCb() { return this._willPopCb; },
set willPopCb(x) { this._willPopCb = x; },
viewDidLoad: function(){
UIViewController.prototype.viewDidLoad.apply(this, arguments);

this.view = SKView.alloc().initWithFrame(this.view.bounds);
if(this.view instanceof SKView){
const scene = BattlefieldScene.alloc().initWithSize(
this.view.bounds.size
);
scene.view.backgroundColor = UIColor.alloc().initWithRedGreenBlueAlpha(0,1,0,1);

scene.scaleMode = SKSceneScaleMode.AspectFill;

this.view.presentScene(scene);
this.view.showsPhysics = false;
this.view.ignoresSiblingOrder = true;
this.view.showsFPS = true;
this.view.showsNodeCount = true;
}
},
willMoveToParentViewController: function(parent: UIViewController|null){
if(parent === null){
if(this.willPopCb){
this.willPopCb();
}
}
}
},
{
name: "GameViewController",
protocols: [],
exposedMethods: {}
}

);

现在,我不明白如何显示这个 Controller

提前致谢

最佳答案

尝试,

import * as utils from "tns-core-modules/utils/utils";

const gameViewController = GameViewController.alloc().init();
const app = utils.ios.getter(UIApplication, UIApplication.sharedApplication);
app.keyWindow.rootViewController.presentViewControllerAnimatedCompletion(gameViewController, true, null);

关于ios - NativeScript 中的 SpriteKit View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55975735/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com