phaser-framework
TypeScript로 작업하기
수색…
Phaser 환경 설정 (Asp.Net MVC5 - Typescript - Visual Studio 2015)
새 ASP.Net 프로젝트를 만듭니다.
빈 템플릿을 선택하십시오.
두 개의 새 폴더를 추가하십시오 : 루트 폴더에 App 및 Scripts :
{
"version": "1.0.0",
"name": "phaser.js.environment.setup",
"private": true,
"devDependencies": {
"gulp": "3.9.1",
"phaser": "2.6.2"
}
}
Scripts 폴더에 typings 폴더 추가 :
꿀꺽 마는 일 :
/// <binding ProjectOpened='install' />
var gulp = require('gulp');
gulp.task('phaser-setup-typings', function () {
gulp.src([
'./node_modules/phaser/typescript/pixi.d.ts',
'./node_modules/phaser/typescript/p2.d.ts',
'./node_modules/phaser/typescript/phaser.d.ts',
])
.pipe(gulp.dest('./Scripts/typings'));
});
gulp.task('phaser-setup', function () {
gulp.src([
'./node_modules/phaser/build/phaser.min.js',
])
.pipe(gulp.dest('./Scripts/'));
});
gulp.task('install', ['phaser-setup-typings', 'phaser-setup']);
설치 작업 실행 :
App 폴더에 타이프 스크립트 파일 을 추가하십시오 .
using System.Web.Mvc;
namespace PhaserSetUp.Controllers
{
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
return View();
}
}
}
web optimization nuget 패키지 추가 :
Install-Package Microsoft.AspNet.Web.Optimization
BundleConfig.cs 클래스를 App_Start 폴더에 추가하십시오.
using System.Web.Optimization;
namespace PhaserSetUp.App_Start
{
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/app").Include(
"~/App/app.js"));
}
}
}
Global.asax 편집
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Http;
namespace PhaserSetUp
{
public class Global : HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
보기 추가 :
@using System.Web.Optimization
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
</head>
<body>
<div>
@RenderBody()
</div>
<script src="../../Scripts/phaser.min.js"></script>
@Scripts.Render("~/bundles/app")
</body>
</html>
Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow










