수색…


Phaser 환경 설정 (Asp.Net MVC5 - Typescript - Visual Studio 2015)

새 ASP.Net 프로젝트를 만듭니다.

여기에 이미지 설명을 입력하십시오.

빈 템플릿을 선택하십시오.

여기에 이미지 설명을 입력하십시오.

두 개의 새 폴더를 추가하십시오 : 루트 폴더에 AppScripts :

여기에 이미지 설명을 입력하십시오.

루트 폴더에 npm 구성 파일을 추가하십시오 .

여기에 이미지 설명을 입력하십시오.

{
    "version": "1.0.0",
    "name": "phaser.js.environment.setup",
    "private": true,
      "devDependencies": {
        "gulp": "3.9.1",
        "phaser": "2.6.2"
      }
}

gulp 구성 파일을 루트 폴더에 추가하십시오 .

여기에 이미지 설명을 입력하십시오.

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 폴더에 타이프 스크립트 파일추가하십시오 .

여기에 이미지 설명을 입력하십시오.

MVC 컨트롤러 추가 :

여기에 이미지 설명을 입력하십시오.

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