私はjavascriptとtypescriptにはかなり新しく、プロジェクトにライブラリを追加するのが難しいです。私のタイスクリプトプロジェクトにフェイザースワイプファイルを追加しようとしています
私はVS2017でphaser.ioのtypescriptですプロジェクトを持っていると私はそれには、このライブラリを追加しようとしています:
https://github.com/flogvit/phaser-swipe
私が定義は\ phaser-私のフォルダ「tsDefinitionsにファイルをコピーしましたswipe.d.ts "を開き、jsファイルを" build \ libs \ swipe.js "にコピーしました
私のプロジェクトの定義ファイルへの参照を追加しました。
/// <reference path="phaser-swipe.d.ts" />
ドキュメントでスワイプクラスを作成しようとすると「名前をスワイプできません」というエラーが表示されます。
マイLevel01.ts:
export class Level01 extends Phaser.State {
background: Phaser.Sprite;
music: Phaser.Sound;
player: Player;
swipe: Swipe;
create() {
this.background = this.add.sprite(0, 0, 'level01-sprites','background');
this.player = new Player(this.game, this.world.centerX, this.world.centerX);
this.player.anchor.setTo(0, 5);
//Here is where the intellisense error is occurring
this.swipe = new Swipe(this.game);
}
}
クイックアクションは、ファイルの先頭に以下を追加しますが、それは、同じ「名前プレイヤーを見つけることができません」というエラーを与えることによってPhaser.Playerおよび他の参考文献を破ります。
import Swipe from "phaser-swipe";
swipe.js: https://github.com/flogvit/phaser-swipe/blob/master/swipe.js
フェイザー-swipe.d.ts:https://github.com/flogvit/phaser-swipe/blob/master/phaser-swipe.d.ts
が、私はここに何かが足りないのですか?定義ファイルを正しく動作させるにはどうすればよいですか?ありがとう!