phaser-framework
टाइपस्क्रिप्ट के साथ काम करना
खोज…
फेजर पर्यावरण सेटअप (Asp.Net MVC5 - टाइपस्क्रिप्ट - विज़ुअल स्टूडियो 2015)
एक नया ASP.Net प्रोजेक्ट बनाएं:
खाली टेम्पलेट का चयन करें:
रूट फ़ोल्डर में दो नए फ़ोल्डर जोड़ें: App और Scripts :
रूट फ़ोल्डर में 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 फ़ोल्डर में एक टाइपस्क्रिप्ट फ़ाइल जोड़ें :
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










