Commit dc37cda4 by liangjiajun

Initial commit

parents
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Wing Player",
"type": "chrome",
"request": "launch",
"file": "index.html",
"runtimeExecutable": "${execPath}",
"useBuildInServer": true,
"sourceMaps": true,
"webRoot": "${workspaceRoot}",
"preLaunchTask":"build",
"port":5008
},
{
"name": "Launch Chrome",
"type": "chrome",
"request": "launch",
"file": "index.html",
"useBuildInServer": true,
"sourceMaps": true,
"webRoot": "${workspaceRoot}",
"preLaunchTask":"build",
"userDataDir":"${tmpdir}",
"port":5008
}
]
}
\ No newline at end of file
{
"search.exclude": {
"**/bin-debug": true,
"**/bin-release": true
}
}
\ No newline at end of file
{
"version": "0.1.0",
"command": "egret",
"isShellCommand": true,
"suppressTaskName": true,
"tasks": [
{
"taskName": "build",
"showOutput": "always",
"args": [
"build",
"-sourcemap"
],
"problemMatcher": "$tsc"
},
{
"taskName": "clean",
"showOutput": "always",
"args": [
"build",
"-e"
],
"problemMatcher": "$tsc"
},
{
"taskName": "publish",
"showOutput": "always",
"args": [
"publish"
],
"problemMatcher": "$tsc"
}
]
}
\ No newline at end of file
var __reflect = (this && this.__reflect) || function (p, c, t) {
p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __extends = this && this.__extends || function __extends(t, e) {
function r() {
this.constructor = t;
}
for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
r.prototype = e.prototype, t.prototype = new r();
};
/**
* 可滚动的底图
*/
var BgMap = (function (_super) {
__extends(BgMap, _super);
function BgMap() {
var _this = _super.call(this) || this;
/**控制滚动速度*/
_this.speed = 4;
_this.addEventListener(egret.Event.ADDED_TO_STAGE, _this.onAddToStage, _this);
return _this;
}
/**初始化*/
BgMap.prototype.onAddToStage = function (event) {
this.removeEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
this.stageW = this.stage.stageWidth;
this.stageH = this.stage.stageHeight;
console.log('width:', this.stage.$stageWidth);
var texture = RES.getRes("background_png");
this.textureHeight = texture.textureHeight; //保留原始纹理的高度,用于后续的计算
this.rowCount = Math.ceil(this.stageH / this.textureHeight) + 1; //计算在当前屏幕中,需要的图片数量
this.bmpArr = [];
//创建这些图片,并设置y坐标,让它们连接起来
for (var i = 0; i < this.rowCount; i++) {
var result = new egret.Bitmap();
var texture = RES.getRes("background_png");
result.texture = texture;
var bgBmp = result;
bgBmp.y = this.textureHeight * i - (this.textureHeight * this.rowCount - this.stageH);
this.bmpArr.push(bgBmp);
this.addChild(bgBmp);
}
};
/**开始滚动*/
BgMap.prototype.start = function () {
this.removeEventListener(egret.Event.ENTER_FRAME, this.enterFrameHandler, this);
this.addEventListener(egret.Event.ENTER_FRAME, this.enterFrameHandler, this);
};
/**逐帧运动*/
BgMap.prototype.enterFrameHandler = function (event) {
for (var i = 0; i < this.rowCount; i++) {
var bgBmp = this.bmpArr[i];
bgBmp.y += this.speed;
//判断超出屏幕后,回到队首,这样来实现循环反复
if (bgBmp.y > this.stageH) {
bgBmp.y = this.bmpArr[0].y - this.textureHeight;
this.bmpArr.pop();
this.bmpArr.unshift(bgBmp);
}
}
};
/**暂停滚动*/
BgMap.prototype.pause = function () {
this.removeEventListener(egret.Event.ENTER_FRAME, this.enterFrameHandler, this);
};
return BgMap;
}(egret.DisplayObjectContainer));
__reflect(BgMap.prototype, "BgMap");
//# sourceMappingURL=BgMap.js.map
\ No newline at end of file
{"version":3,"file":"BgMap.js","sourceRoot":"","sources":["../src/BgMap.ts"],"names":[],"mappings":"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"}
\ No newline at end of file
//////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014-2015, Egret Technology Inc.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Egret nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////////////
var __reflect = (this && this.__reflect) || function (p, c, t) {
p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __extends = this && this.__extends || function __extends(t, e) {
function r() {
this.constructor = t;
}
for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
r.prototype = e.prototype, t.prototype = new r();
};
var LoadingUI = (function (_super) {
__extends(LoadingUI, _super);
function LoadingUI() {
var _this = _super.call(this) || this;
_this.createView();
return _this;
}
LoadingUI.prototype.createView = function () {
this.textField = new egret.TextField();
this.addChild(this.textField);
this.textField.y = 300;
this.textField.width = 480;
this.textField.height = 100;
this.textField.textAlign = "center";
};
LoadingUI.prototype.setProgress = function (current, total) {
this.textField.text = "Loading..." + current + "/" + total;
};
LoadingUI.prototype.setCustomProgress = function (current, total, message) {
this.textField.text = "[" + message + "] \u52A0\u8F7D\u4E2D..." + current + "/" + total;
};
return LoadingUI;
}(egret.Sprite));
__reflect(LoadingUI.prototype, "LoadingUI");
//# sourceMappingURL=LoadingUI.js.map
\ No newline at end of file
{"version":3,"file":"LoadingUI.js","sourceRoot":"","sources":["../src/LoadingUI.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,EAAE;AACF,kDAAkD;AAClD,wBAAwB;AACxB,sEAAsE;AACtE,+EAA+E;AAC/E,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,0EAA0E;AAC1E,4EAA4E;AAC5E,6EAA6E;AAC7E,8CAA8C;AAC9C,6EAA6E;AAC7E,8EAA8E;AAC9E,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,2EAA2E;AAC3E,gFAAgF;AAChF,gFAAgF;AAChF,8EAA8E;AAC9E,6EAA6E;AAC7E,wEAAwE;AACxE,gFAAgF;AAChF,sDAAsD;AACtD,EAAE;AACF,sFAAsF;;;;;;;;;;;AAEtF;IAAwB,6BAAY;IAGhC;QAAA,YAEI,iBAAO,SAEV;QADG,KAAI,CAAC,UAAU,EAAE,CAAC;;IACtB,CAAC;IAIO,8BAAU,GAAlB;QAEI,IAAI,CAAC,SAAS,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9B,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,GAAG,CAAC;QAC3B,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,GAAG,CAAC;QAC5B,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,QAAQ,CAAC;IACxC,CAAC;IAEM,+BAAW,GAAlB,UAAmB,OAAe,EAAC,KAAa;QAE5C,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,eAAa,OAAO,SAAI,KAAO,CAAC;IAC1D,CAAC;IACM,qCAAiB,GAAxB,UAAyB,OAAe,EAAC,KAAa,EAAC,OAAe;QAElE,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,MAAI,OAAO,gCAAY,OAAO,SAAI,KAAO,CAAC;IACpE,CAAC;IACL,gBAAC;AAAD,CAAC,AA7BD,CAAwB,KAAK,CAAC,MAAM,GA6BnC;AA7BK,UAAA,SAAS,wBA6Bd,CAAA"}
\ No newline at end of file
var __reflect = (this && this.__reflect) || function (p, c, t) {
p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
/**
*
* @author
*
*/
var Bullet = (function () {
/*
* 子弹
*/
function Bullet() {
}
return Bullet;
}());
__reflect(Bullet.prototype, "Bullet");
//# sourceMappingURL=Bullet.js.map
\ No newline at end of file
{"version":3,"file":"Bullet.js","sourceRoot":"","sources":["../../src/Model/Bullet.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH;IAEI;;OAEG;IACH;IAEA,CAAC;IAaL,aAAC;AAAD,CAAC,AApBD,IAoBC;AApBK,UAAA,MAAM,qBAoBX,CAAA"}
\ No newline at end of file
var __reflect = (this && this.__reflect) || function (p, c, t) {
p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
/**
*
* @author
*
*/
var Plane = (function () {
function Plane() {
}
//开枪
Plane.prototype.Shoot = function () {
var bullet = new Bullet();
bullet.Type = this.Type;
bullet.Image = new egret.Bitmap(RES.getRes(this.bulletImage));
bullet.Image.width = 64;
bullet.Image.height = 64;
bullet.Plane = this;
if (this.Type == "Donw") {
bullet.Image.rotation = 180;
bullet.X = this.X + 31 - (this.Image.width / 2);
bullet.Y = this.Y + 60;
}
else {
if (this.Image != null) {
bullet.bulletSound = this.bulletSound;
bullet.X = this.X + (this.Image.width / 2 - 35);
bullet.Y = this.Y - 45;
}
}
bullet.Image.x = bullet.X;
bullet.Image.y = bullet.Y;
return bullet;
};
;
return Plane;
}());
__reflect(Plane.prototype, "Plane");
//# sourceMappingURL=Plane.js.map
\ No newline at end of file
{"version":3,"file":"Plane.js","sourceRoot":"","sources":["../../src/Model/Plane.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH;IAAA;IA6CA,CAAC;IA7BG,IAAI;IACG,qBAAK,GAAZ;QAEI,IAAI,MAAM,GAAW,IAAI,MAAM,EAAE,CAAC;QAClC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACxB,MAAM,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAC9D,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;QACxB,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC;QACzB,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,EAAE,CAAA,CAAC,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,CACvB,CAAC;YACG,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC;YAC5B,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAChD,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;QAC3B,CAAC;QAAC,IAAI,CACN,CAAC;YACG,EAAE,CAAA,CAAC,IAAI,CAAC,KAAK,IAAE,IAAI,CAAC,CAAA,CAAC;gBACjB,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;gBACtC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;gBAChD,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;YAC3B,CAAC;QACL,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QAC1B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;QAC1B,MAAM,CAAC,MAAM,CAAC;IAClB,CAAC;IAAA,CAAC;IAIN,YAAC;AAAD,CAAC,AA7CD,IA6CC;AA7CK,UAAA,KAAK,oBA6CV,CAAA"}
\ No newline at end of file
var __reflect = (this && this.__reflect) || function (p, c, t) {
p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
/**
*
* @author
*
*/
var Resources = (function () {
/**
* 资源
*/
function Resources(name, chinese) {
this.name = name;
this.chinese = chinese;
this.isOver = false;
}
return Resources;
}());
__reflect(Resources.prototype, "Resources");
//# sourceMappingURL=Resources.js.map
\ No newline at end of file
{"version":3,"file":"Resources.js","sourceRoot":"","sources":["../../src/Model/Resources.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH;IAEI;;OAEG;IACH,mBAAmB,IAAY,EAAC,OAAe;QAE3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAOL,gBAAC;AAAD,CAAC,AAjBD,IAiBC;AAjBK,UAAA,SAAS,wBAiBd,CAAA"}
\ No newline at end of file
var __reflect = (this && this.__reflect) || function (p, c, t) {
p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __extends = this && this.__extends || function __extends(t, e) {
function r() {
this.constructor = t;
}
for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
r.prototype = e.prototype, t.prototype = new r();
};
/**
*
* @author
*
*/
var Blueplane = (function (_super) {
__extends(Blueplane, _super);
function Blueplane() {
return _super.call(this) || this;
}
/**
* 创建主角
*/
Blueplane.prototype.init = function (s) {
var plane = new Plane();
var planeImage = new egret.Bitmap(RES.getRes("BluePlane_png"));
plane.blood = 100;
plane.bulletImage = "bullet_03_png";
plane.Image = planeImage;
plane.Type = "UP";
plane.lives = 0;
var sound = RES.getRes("bullet_mp3");
plane.bulletSound = sound;
this.BottomCenter(plane, s);
planeImage.touchEnabled = true;
s.removeEventListener(egret.TouchEvent.TOUCH_MOVE, this.PlaneMoveHandle, [plane, s]);
s.addEventListener(egret.TouchEvent.TOUCH_MOVE, this.PlaneMoveHandle, [plane, s]);
return plane;
};
/**
* 飞机移动处理
*/
Blueplane.prototype.PlaneMoveHandle = function (e) {
var plane = this[0];
if (plane.Image == null)
return;
var parent = this[1];
var hight = plane.Image.height;
var wight = plane.Image.width;
plane.Image.x = e.stageX - (wight / 2);
plane.Image.y = e.stageY - (hight / 2);
if (plane.Image.x <= 0) {
plane.Image.x = 0;
}
if (e.stageX + wight / 2 >= parent.stage.stageWidth) {
plane.Image.x = parent.stage.stageWidth - wight;
}
if (plane.Image.y <= 0) {
plane.Image.y = 0;
}
if (e.stageY + hight / 2 >= parent.stage.stageHeight) {
plane.Image.y = parent.stage.stageHeight - hight;
}
plane.X = plane.Image.x;
plane.Y = plane.Image.y;
};
/**
* 初始默认底部居中位子
*/
Blueplane.prototype.BottomCenter = function (bit, s) {
var mapHight = s.stage.stageWidth;
var mapwight = s.stage.stageHeight;
var hight = bit.Image.height;
var wight = bit.Image.width;
bit.X = (mapHight / 2) - (bit.Image.width / 2);
bit.Y = mapwight - bit.Image.height;
bit.Image.x = (mapHight / 2) - (bit.Image.width / 2);
bit.Image.y = mapwight - bit.Image.height;
};
return Blueplane;
}(egret.DisplayObjectContainer));
__reflect(Blueplane.prototype, "Blueplane");
//# sourceMappingURL=Blueplane.js.map
\ No newline at end of file
{"version":3,"file":"Blueplane.js","sourceRoot":"","sources":["../../src/Plane/Blueplane.ts"],"names":[],"mappings":"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"}
\ No newline at end of file
var __reflect = (this && this.__reflect) || function (p, c, t) {
p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __extends = this && this.__extends || function __extends(t, e) {
function r() {
this.constructor = t;
}
for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
r.prototype = e.prototype, t.prototype = new r();
};
/**
*
* @author
*
*/
var Enemyplane = (function (_super) {
__extends(Enemyplane, _super);
function Enemyplane() {
return _super.call(this) || this;
}
/**
* 创建敌军
*/
Enemyplane.prototype.init = function (x, y) {
var enmyplanlist = ["GodPlane_png", "GreenPlane_png", "JitPlane_png", "JpPlane_png", "LiPlane_png", "LXPlane_png"];
var planeIndex = Math.floor(Math.random() * enmyplanlist.length);
var plane = new Plane();
var planeImage = new egret.Bitmap(RES.getRes(enmyplanlist[planeIndex]));
plane.blood = 100;
plane.bulletImage = "bullet_02_png";
plane.Image = planeImage;
plane.Image.rotation = 180;
plane.Image.x = x + 128;
plane.Image.y = y + 128;
plane.X = plane.Image.x;
plane.Y = plane.Image.y;
plane.Type = "Donw";
plane.lives = 3;
return plane;
};
return Enemyplane;
}(egret.DisplayObjectContainer));
__reflect(Enemyplane.prototype, "Enemyplane");
//# sourceMappingURL=Enemyplane.js.map
\ No newline at end of file
{"version":3,"file":"Enemyplane.js","sourceRoot":"","sources":["../../src/Plane/Enemyplane.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;GAIG;AACH;IAAyB,8BAA4B;IAEjD;eAEI,iBAAO;IACX,CAAC;IAED;;MAEE;IACK,yBAAI,GAAX,UAAY,CAAS,EAAC,CAAS;QAE3B,IAAI,YAAY,GAAG,CAAC,cAAc,EAAC,gBAAgB,EAAC,cAAc,EAAC,aAAa,EAAC,aAAa,EAAC,aAAa,CAAC,CAAC;QAC9G,IAAI,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACjE,IAAI,KAAK,GAAU,IAAI,KAAK,EAAE,CAAC;QAC/B,IAAI,UAAU,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACxE,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC;QAClB,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC;QACpC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;QACzB,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC;QAC3B,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;QACxB,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;QACxB,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACxB,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACxB,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC;QACpB,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;QAChB,MAAM,CAAC,KAAK,CAAC;IACjB,CAAC;IACL,iBAAC;AAAD,CAAC,AA5BD,CAAyB,KAAK,CAAC,sBAAsB,GA4BpD;AA5BK,UAAA,UAAU,yBA4Bf,CAAA"}
\ No newline at end of file
var __reflect = (this && this.__reflect) || function (p, c, t) {
p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var DebugPlatform = (function () {
function DebugPlatform() {
}
DebugPlatform.prototype.getUserInfo = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, { nickName: "username" }];
});
});
};
DebugPlatform.prototype.login = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/];
});
});
};
return DebugPlatform;
}());
__reflect(DebugPlatform.prototype, "DebugPlatform", ["Platform"]);
if (!window.platform) {
window.platform = new DebugPlatform();
}
//# sourceMappingURL=Platform.js.map
\ No newline at end of file
{"version":3,"file":"Platform.js","sourceRoot":"","sources":["../src/Platform.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA;IAAA;IAOA,CAAC;IANS,mCAAW,GAAjB;;;gBACI,sBAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAA;;;KAClC;IACK,6BAAK,GAAX;;;;;;KAEC;IACL,oBAAC;AAAD,CAAC,AAPD,IAOC;AAPK,UAAA,aAAa,0CAOlB,CAAA;AAGD,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IACnB,MAAM,CAAC,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;AAC1C,CAAC"}
\ No newline at end of file
{
"engineVersion": "5.1.9",
"compilerVersion": "5.1.9",
"template": {},
"target": {
"current": "wxgame"
},
"modules": [
{
"name": "egret"
},
{
"name": "game"
},
{
"name": "tween"
},
{
"name": "assetsmanager"
},
{
"name": "promise"
}
]
}
\ No newline at end of file
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Egret</title>
<meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="true" />
<meta name="screen-orientation" content="auto" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<style>
html, body {
-ms-touch-action: none;
background: #888888;
padding: 0;
border: 0;
margin: 0;
height: 100%;
}
</style>
</head>
<body>
<div style="margin: auto;width: 100%;height: 100%;" class="egret-player"
data-entry-class="Main"
data-orientation="auto"
data-scale-mode="fixedWidth"
data-frame-rate="30"
data-content-width="480"
data-content-height="800"
data-multi-fingered="2"
data-show-fps="false" data-show-log="false"
data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
</div>
<script>
var loadScript = function (list, callback) {
var loaded = 0;
var loadNext = function () {
loadSingleScript(list[loaded], function () {
loaded++;
if (loaded >= list.length) {
callback();
}
else {
loadNext();
}
})
};
loadNext();
};
var loadSingleScript = function (src, callback) {
var s = document.createElement('script');
s.async = false;
s.src = src;
s.addEventListener('load', function () {
s.parentNode.removeChild(s);
s.removeEventListener('load', arguments.callee, false);
callback();
}, false);
document.body.appendChild(s);
};
var xhr = new XMLHttpRequest();
xhr.open('GET', './manifest.json?v=' + Math.random(), true);
xhr.addEventListener("load", function () {
var manifest = JSON.parse(xhr.response);
var list = manifest.initial.concat(manifest.game);
loadScript(list, function () {
/**
* {
* "renderMode":, //Engine rendering mode, "canvas" or "webgl"
* "audioType": 0 //Use the audio type, 0: default, 2: web audio, 3: audio
* "antialias": //Whether the anti-aliasing is enabled in WebGL mode, true: on, false: off, defaults to false
* "calculateCanvasScaleFactor": //a function return canvas scale factor
* }
**/
egret.runEgret({ renderMode: "webgl", audioType: 0, calculateCanvasScaleFactor:function(context) {
var backingStore = context.backingStorePixelRatio ||
context.webkitBackingStorePixelRatio ||
context.mozBackingStorePixelRatio ||
context.msBackingStorePixelRatio ||
context.oBackingStorePixelRatio ||
context.backingStorePixelRatio || 1;
return (window.devicePixelRatio || 1) / backingStore;
}});
});
});
xhr.send(null);
</script>
</body>
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){return"function"==typeof t||"object"==typeof t&&null!==t}function e(t){return"function"==typeof t}function n(t){I=t}function r(t){J=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof H?function(){H(a)}:c()}function s(){var t=0,e=new V(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;G>t;t+=2){var e=$[t],n=$[t+1];e(n),$[t]=void 0,$[t+1]=void 0}G=0}function f(){try{var t=require,e=t("vertx");return H=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=arguments,r=this,o=new this.constructor(p);void 0===o[ee]&&k(o);var i=r._state;return i?!function(){var t=n[i-1];J(function(){return x(i,o,t,r._result)})}():E(r,o,t,e),o}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return w(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return ie.error=e,ie}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){J(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?w(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===re?S(t,e._result):e._state===oe?j(t,e._result):E(e,void 0,function(e){return w(t,e)},function(e){return j(t,e)})}function g(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?b(t,n):r===ie?j(t,ie.error):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function w(e,n){e===n?j(e,v()):t(n)?g(e,n,_(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),P(t)}function S(t,e){t._state===ne&&(t._result=e,t._state=re,0!==t._subscribers.length&&J(P,t))}function j(t,e){t._state===ne&&(t._state=oe,t._result=e,J(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+re]=n,o[i+oe]=r,0===i&&t._state&&J(P,t)}function P(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?x(n,r,o,i):o(i);t._subscribers.length=0}}function T(){this.error=null}function M(t,e){try{return t(e)}catch(n){return se.error=n,se}}function x(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=void 0,a=void 0;if(i){if(s=M(r,o),s===se?(a=!0,u=s.error,s=null):c=!0,n===s)return void j(n,d())}else s=o,c=!0;n._state!==ne||(i&&c?w(n,s):a?j(n,u):t===re?S(n,s):t===oe&&j(n,s))}function C(t,e){try{e(function(e){w(t,e)},function(e){j(t,e)})}catch(n){j(t,n)}}function O(){return ue++}function k(t){t[ee]=ue++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[ee]||k(this.promise),B(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):j(this.promise,q())}function q(){return new Error("Array Methods must be provided an Array")}function F(t){return new Y(this,t).promise}function D(t){var e=this;return new e(B(t)?function(n,r){for(var o=t.length,i=0;o>i;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function K(t){var e=this,n=new e(p);return j(n,t),n}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function N(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(t){this[ee]=O(),this._result=this._state=void 0,this._subscribers=[],p!==t&&("function"!=typeof t&&L(),this instanceof U?C(this,t):N())}function W(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if("undefined"!=typeof egret_native&&egret_native.capability&&!egret_native.capability("Promise")&&(n=void 0),n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=U}var z=void 0;z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var B=z,G=0,H=void 0,I=void 0,J=function(t,e){$[G]=t,$[G+1]=e,G+=2,2===G&&(I?I(a):te())},Q="undefined"!=typeof window?window:void 0,R=Q||{},V=R.MutationObserver||R.WebKitMutationObserver,X="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,$=new Array(1e3),te=void 0;te=X?o():V?s():Z?u():void 0===Q&&"function"==typeof require?f():c();var ee=Math.random().toString(36).substring(16),ne=void 0,re=1,oe=2,ie=new T,se=new T,ue=0;return Y.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===ne&&t>n;n++)this._eachEntry(e[n],n)},Y.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=_(t);if(o===l&&t._state!==ne)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===U){var i=new n(p);g(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},Y.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===ne&&(this._remaining--,t===oe?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},Y.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){return n._settledAt(re,e,t)},function(t){return n._settledAt(oe,e,t)})},U.all=F,U.race=D,U.resolve=h,U.reject=K,U._setScheduler=n,U._setAsap=r,U._asap=J,U.prototype={constructor:U,then:l,"catch":function(t){return this.then(null,t)}},U.polyfill=W,U.Promise=U,U}),ES6Promise.polyfill();
\ No newline at end of file
{
"initial": [
"libs/modules/egret/egret.js",
"libs/modules/egret/egret.web.js",
"libs/modules/game/game.js",
"libs/modules/tween/tween.js",
"libs/modules/assetsmanager/assetsmanager.js",
"libs/modules/promise/promise.js"
],
"game": [
"bin-debug/BgMap.js",
"bin-debug/LoadingUI.js",
"bin-debug/Main.js",
"bin-debug/Platform.js",
"bin-debug/Model/Bullet.js",
"bin-debug/Model/Plane.js",
"bin-debug/Model/Resources.js",
"bin-debug/Plane/Blueplane.js",
"bin-debug/Plane/Enemyplane.js"
]
}
\ No newline at end of file
[
"<font color=0x00ff0c>Open-source</font>,<font color=0x00ff0c>Free</font>,<font color=0x00ff0c>Multi-platform</font>",
"Push <font color=0x00ff0c>Game </font>Forward",
"<font color=0x00ff0c>HTML5 </font>Game Engine"
]
\ No newline at end of file
{
"groups":[
{
"keys":"BluePlane_png,GodPlane_png,GreenPlane_png,JitPlane_png,JpPlane_png,LiPlane_png,LXPlane_png,PaperPlane_png,PaperPlane_01_png,RedPlane_png,ToonPlane_png,XPlane_png,YePlane_png",
"name":"Plane"
},
{
"keys":"BeiJi_01_png,BeiJi_02_png,bullet_02_png,bullet_03_png,bullet_04_png,EnemyFire_01_png,EnemyFire_02_png,EnemyFire_03_png",
"name":"Bullet"
},
{
"keys":"game_music_mp3,bullet_mp3,bonus_wav,background_png,game_over_mp3,btn_finish_png,gameover_png",
"name":"Bgm"
}
],
"resources":[
{
"name":"BluePlane_png",
"type":"image",
"url":"assets/BluePlane.png"
},
{
"name":"GodPlane_png",
"type":"image",
"url":"assets/GodPlane.png"
},
{
"name":"GreenPlane_png",
"type":"image",
"url":"assets/GreenPlane.png"
},
{
"name":"JitPlane_png",
"type":"image",
"url":"assets/JitPlane.png"
},
{
"name":"JpPlane_png",
"type":"image",
"url":"assets/JpPlane.png"
},
{
"name":"LiPlane_png",
"type":"image",
"url":"assets/LiPlane.png"
},
{
"name":"LXPlane_png",
"type":"image",
"url":"assets/LXPlane.png"
},
{
"name":"PaperPlane_png",
"type":"image",
"url":"assets/PaperPlane.png"
},
{
"name":"PaperPlane_01_png",
"type":"image",
"url":"assets/PaperPlane_01.png"
},
{
"name":"RedPlane_png",
"type":"image",
"url":"assets/RedPlane.png"
},
{
"name":"ToonPlane_png",
"type":"image",
"url":"assets/ToonPlane.png"
},
{
"name":"XPlane_png",
"type":"image",
"url":"assets/XPlane.png"
},
{
"name":"YePlane_png",
"type":"image",
"url":"assets/YePlane.png"
},
{
"name":"description_json",
"type":"json",
"url":"config/description.json"
},
{
"name":"BeiJi_01_png",
"type":"image",
"url":"assets/Bullet/BeiJi_01.png"
},
{
"name":"BeiJi_02_png",
"type":"image",
"url":"assets/Bullet/BeiJi_02.png"
},
{
"name":"bullet_02_png",
"type":"image",
"url":"assets/Bullet/bullet_02.png"
},
{
"name":"bullet_03_png",
"type":"image",
"url":"assets/Bullet/bullet_03.png"
},
{
"name":"bullet_04_png",
"type":"image",
"url":"assets/Bullet/bullet_04.png"
},
{
"name":"EnemyFire_01_png",
"type":"image",
"url":"assets/Bullet/EnemyFire_01.png"
},
{
"name":"EnemyFire_02_png",
"type":"image",
"url":"assets/Bullet/EnemyFire_02.png"
},
{
"name":"EnemyFire_03_png",
"type":"image",
"url":"assets/Bullet/EnemyFire_03.png"
},
{
"name":"bullet_mp3",
"type":"sound",
"url":"assets/Bullet/bullet.mp3"
},
{
"name":"bonus_wav",
"type":"sound",
"url":"assets/Bullet/bonus.wav"
},
{
"name":"game_music_mp3",
"type":"sound",
"url":"assets/BgM/game_music.mp3"
},
{
"name":"background_png",
"type":"image",
"url":"assets/BgM/background.png"
},
{
"name":"game_over_mp3",
"type":"sound",
"url":"assets/BgM/game_over.mp3"
},
{
"name":"btn_finish_png",
"type":"image",
"url":"assets/BgM/btn_finish.png"
},
{
"name":"gameover_png",
"type":"image",
"url":"assets/BgM/gameover.png"
}
]
}
\ No newline at end of file
/**
* ResourceManager 配置文件
*/
type ResourceManagerConfig = {
/**
* 构建与发布配置
*/
buildConfig: (param: BuildConfigParam) => UserConfig,
/**
* 设置资源类型
*/
typeSelector: (path: string) => (string | null | undefined)
/**
* 设置资源的合并策略
*/
mergeSelector?: (path: string) => (string | null | undefined),
/**
* 设置资源的命名策略
* beta 功能,请勿随意使用
*/
nameSelector?: (path: string) => (string | null | undefined)
}
/**
* 构建配置
*/
type UserConfig = {
/**
* 输出路径
*/
outputDir: string,
/**
* 插件
*/
commands: (string | plugins.Command) []
}
type BuildConfigParam = {
/**
* 当前命令,build 或者 command
*/
readonly command: string;
/**
* 发布平台
*/
readonly target: string;
/**
* 开发者指定的版本号
*/
readonly version: string;
/**
* 项目名称
*/
readonly projectName: string;
/**
* 项目路径
*/
readonly projectRoot: string;
/**
* 项目配置
*/
readonly projectConfig: ProjectConfig;
}
type ProjectConfig = {
entryClassName: string;
orientation: string;
frameRate: number;
scaleMode: string;
contentWidth: number;
contentHeight: number;
showFPS: boolean;
fpsStyles: string;
showLog: boolean;
maxTouches: number;
}
declare namespace plugins {
interface CommandContext {
/**
* 可以用此接口进行文件创建
*/
createFile(relativeFilePath: string, contents: Buffer);
/**
* 构建配置
*/
buildConfig: BuildConfigParam;
/**
* 项目绝对路径
*/
projectRoot: string;
/**
* 项目输出绝对路径
*/
outputDir: string;
}
/**
* 构建管线命令
*/
interface Command {
/**
* 项目中的每个文件都会执行此函数,返回 file 表示保留此文件,返回 null 表示将此文件从构建管线中删除,即不会发布
*/
onFile?(file: File): Promise<File | null>
/**
* 项目中所有文件均执行完后,最终会执行此函数。
* 这个函数主要被用于创建新文件
*/
onFinish?(pluginContext?: CommandContext): Promise<void>
[options: string]: any;
}
interface File {
/**
* 文件内容的二进制流,如果开发者需要修改文件内容,请修改此属性
*/
contents: Buffer;
/**
* 文件绝对路径,如果开发者需要对文件进行重命名,请修改此属性
*/
path: string;
/**
* 文件所在的项目的项目路径
*/
readonly base: string;
/**
* 文件的相对于 base 属性的相对路径
*/
readonly relative: string;
/**
* 文件变更历史,history[0] 即 origin 属性
*/
readonly history: ReadonlyArray<string>;
/**
* 文件所在的文件夹的绝对路径
*/
readonly dirname: string;
/**
* 文件的文件名
*/
readonly basename: string;
/**
* 文件的扩展名
*/
readonly extname: string;
/**
* 文件的初始文件名
*/
readonly origin: string;
/**
* 其他自定义属性
*/
[customProperty: string]: any;
}
}
declare module 'built-in' {
/**
* 混淆插件参数,设置源代码和目标代码
*/
type UglifyPluginOption = { sources: string[], target: string };
type UglifyPluginOptions = UglifyPluginOption[];
/**
* 混淆插件
*/
export class UglifyPlugin implements plugins.Command {
constructor(mergeSelector: UglifyPluginOptions);
}
type LibraryType = "debug" | "release";
type CompilePluginOptions = { libraryType: LibraryType, defines?: any };
/**
* 编译命令
*/
export class CompilePlugin implements plugins.Command {
constructor(options: CompilePluginOptions);
}
/**
* EXML 插件,用于发布 EXML 文件
*/
export class ExmlPlugin implements plugins.Command {
constructor(publishPolicy: EXML_Publish_Policy);
}
/**
* 发布策略
* * default : 使用 egretProperties.json 中的 exmlPublishPolicy 中的策略
* * debug : 默认策略,用于开发环境
* * contents : 将 EXML 的内容写入到主题文件中
* * gjs : 将生成的JS文件写入到主题文件中
* * commonjs : 将EXML合并为一个 CommonJS 风格的文件
*/
type EXML_Publish_Policy = "default" | "debug" | "contents" | "gjs" | "commonjs"
/**
* 生成 manifest 文件,这个文件会被用于记录 JavaScript 文件的版本号
*/
export class ManifestPlugin implements plugins.Command {
constructor(options?: ManifestPluginOptions)
}
/**
* 生成文件的文件名
* 支持 json 与 js 两种格式
*/
type ManifestPluginOptions = {
output: string,
hash?: "crc32",
/**
* 是否输出转换过程
*/
verbose?: boolean
}
/**
* EmitResConfigFilePlugin 的参数
* * output: 生成路径,可以指定生成为 *.res.js 文件或者 *.res.json 文件
* * typeSelector: 根据文件路径决定文件类型
* * nameSelector: 根据文件路径决定文件的资源名
* * groupSelector: 根据文件路径决定资源所述的资源组
*/
type EmitResConfigFilePluginOptions = {
output: string,
typeSelector: (path: string) => string | null | undefined,
nameSelector: (path: string) => string | null | undefined,
groupSelector: (path: string) => string | null | undefined,
}
/**
* 生成 res.json 文件或者 res.js 文件
*/
export class EmitResConfigFilePlugin implements plugins.Command {
constructor(options: EmitResConfigFilePluginOptions)
}
/**
* 增量编译
* 这个插件生成的 JavaScript 代码不会被添加到构建管线中,后续其他插件无法获取生成的 js 文件
* 这个功能将会在未来被 watch 模式代替掉
*/
export class IncrementCompilePlugin implements plugins.Command {
}
/**
* 使用 TextureMerger 实现纹理自动合并,依赖 TextureMerger 1.7 以上的版本
*/
export class TextureMergerPlugin implements plugins.Command {
constructor();
}
type CleanPluginOptions = {
matchers: string[]
}
export class CleanPlugin implements plugins.Command {
constructor(options: CleanPluginOptions);
}
type RenamePluginOptions = {
verbose?: boolean
hash?: "crc32"
matchers: { from: string, to: string }[]
}
export class RenamePlugin implements plugins.Command {
constructor(options: RenamePluginOptions);
}
type ResSplitPluginOptions = {
verbose?: boolean
matchers: { from: string, to: string }[]
}
export class ResSplitPlugin implements plugins.Command {
constructor(options: ResSplitPluginOptions);
}
}
\ No newline at end of file
import * as fs from 'fs';
import * as path from 'path';
type ManifestConfig = {
initial: string[],
game: string[]
}
export class BricksPlugin implements plugins.Command {
constructor() {
}
async onFile(file: plugins.File) {
const filename = file.origin;
if (filename == 'manifest.json') {
const contents = file.contents.toString();
const jsonData: ManifestConfig = JSON.parse(contents);
let content = '';
for (let item of jsonData.initial) {
if (item != 'js/promise.js' && item != 'js/promise.min.js') {
content += `BK.Script.loadlib("GameRes://${item}");\n`
}
if (item == "js/egret.js" || item == 'js/egret.min.js') {
content += `BK.Script.loadlib("GameRes://egret.bricks.js");\n`
}
}
for (let item of jsonData.game) {
content += `BK.Script.loadlib("GameRes://${item}");\n`
}
file.path = file.dirname + '/manifest.js'
file.contents = new Buffer(content);
} else if (filename == 'main.js') {
const content = file.contents.toString();
let result = content.replace(/RES\.loadConfig\("resource\/default\.res\.json", "resource\/"\)/gm, 'RES.loadConfig("GameRes://resource/default.res.json", "GameRes://resource/")');
result = result.replace(/eui\.Theme\("resource\/default\.thm\.json", _this\.stage\)/gm, 'eui.Theme("GameRes://resource/default.thm.json", _this.stage)');
file.path = file.dirname + '/main.js'
file.contents = new Buffer(result);
}
return file;
}
async onFinish(pluginContext) {
}
}
\ No newline at end of file
/// 阅读 api.d.ts 查看文档
///<reference path="api.d.ts"/>
import * as path from 'path';
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin } from 'built-in';
import { BricksPlugin } from './bricks/bricks';
import { CustomPlugin } from './myplugin';
import * as defaultConfig from './config';
const config: ResourceManagerConfig = {
buildConfig: (params) => {
const { target, command, projectName, version } = params;
const outputDir = `../${projectName}_android/assets/game`;
return {
outputDir,
commands: [
// new CompilePlugin({ libraryType: "debug", defines: { DEBUG: false, RELEASE: true } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
new UglifyPlugin([{
sources: ["main.js"],
target: "main.min.js"
}]),
new ManifestPlugin({ output: 'manifest.json' })
]
}
},
mergeSelector: defaultConfig.mergeSelector,
typeSelector: defaultConfig.typeSelector
}
export = config;
/// 阅读 api.d.ts 查看文档
///<reference path="api.d.ts"/>
import * as path from 'path';
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin } from 'built-in';
import { BricksPlugin } from './bricks/bricks';
import { CustomPlugin } from './myplugin';
import * as defaultConfig from './config';
const config: ResourceManagerConfig = {
buildConfig: (params) => {
const { target, command, projectName, version } = params;
const outputDir = `../${projectName}_bricks/PublicBrickEngineGame/Res`;
return {
outputDir,
commands: [
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new ManifestPlugin({ output: 'manifest.json' }),
new BricksPlugin()
]
}
},
mergeSelector: defaultConfig.mergeSelector,
typeSelector: defaultConfig.typeSelector
}
export = config;
/// 阅读 api.d.ts 查看文档
///<reference path="api.d.ts"/>
import * as path from 'path';
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin } from 'built-in';
import { BricksPlugin } from './bricks/bricks';
import { CustomPlugin } from './myplugin';
import * as defaultConfig from './config';
const config: ResourceManagerConfig = {
buildConfig: (params) => {
const { target, command, projectName, version } = params;
const outputDir = `../${projectName}_ios/assets/game`;
return {
outputDir,
commands: [
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: false, RELEASE: true } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
new UglifyPlugin([{
sources: ["main.js"],
target: "main.min.js"
}]),
new ManifestPlugin({ output: 'manifest.json' })
]
}
},
mergeSelector: defaultConfig.mergeSelector,
typeSelector: defaultConfig.typeSelector
}
export = config;
/// 阅读 api.d.ts 查看文档
///<reference path="api.d.ts"/>
import * as path from 'path';
import { UglifyPlugin, IncrementCompilePlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin } from 'built-in';
import { WxgamePlugin } from './wxgame/wxgame';
import { BricksPlugin } from './bricks/bricks';
import { CustomPlugin } from './myplugin';
const config: ResourceManagerConfig = {
buildConfig: (params) => {
const { target, command, projectName, version } = params;
if (command == 'build') {
const outputDir = '.';
return {
outputDir,
commands: [
// new EmitResConfigFilePlugin({
// output: "resource/default.res.json",
// typeSelector: config.typeSelector,
// nameSelector: p => path.basename(p).replace(/\./gi, "_"),
// groupSelector: p => "preload"
// }),
new ExmlPlugin('debug'), // 非 EUI 项目关闭此设置
new IncrementCompilePlugin(),
]
}
}
else if (command == 'publish') {
const outputDir = `bin-release/web/${version}`;
return {
outputDir,
commands: [
new CustomPlugin(),
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new UglifyPlugin([{
sources: ["main.js"],
target: "main.min.js"
}]),
new ManifestPlugin({ output: "manifest.json", hash: "crc32" })
]
}
}
else {
throw `unknown command : ${params.command}`
}
},
mergeSelector: (path) => {
if (path.indexOf("assets/bitmap/") >= 0) {
return "assets/bitmap/sheet.sheet"
}
else if (path.indexOf("armature") >= 0 && path.indexOf(".json") >= 0) {
return "assets/armature/1.zip";
}
},
typeSelector: (path) => {
const ext = path.substr(path.lastIndexOf(".") + 1);
const typeMap = {
"jpg": "image",
"png": "image",
"webp": "image",
"json": "json",
"fnt": "font",
"pvr": "pvr",
"mp3": "sound",
"zip": "zip",
"sheet": "sheet",
"exml": "text"
}
let type = typeMap[ext];
if (type == "json") {
if (path.indexOf("sheet") >= 0) {
type = "sheet";
} else if (path.indexOf("movieclip") >= 0) {
type = "movieclip";
};
}
return type;
}
}
export = config;
/// 阅读 api.d.ts 查看文档
///<reference path="api.d.ts"/>
import * as path from 'path';
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin, CleanPlugin } from 'built-in';
import { WxgamePlugin } from './wxgame/wxgame';
import { CustomPlugin } from './myplugin';
import * as defaultConfig from './config';
const config: ResourceManagerConfig = {
buildConfig: (params) => {
const { target, command, projectName, version } = params;
const outputDir = `../${projectName}_wxgame`;
if (command == 'build') {
return {
outputDir,
commands: [
new CleanPlugin({ matchers: ["js", "resource"] }),
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new WxgamePlugin(),
new ManifestPlugin({ output: 'manifest.js' })
]
}
}
else if (command == 'publish') {
return {
outputDir,
commands: [
new CleanPlugin({ matchers: ["js", "resource"] }),
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new WxgamePlugin(),
new UglifyPlugin([{
sources: ["main.js"],
target: "main.min.js"
}
]),
new ManifestPlugin({ output: 'manifest.js' })
]
}
}
else {
throw `unknown command : ${params.command}`;
}
},
mergeSelector: defaultConfig.mergeSelector,
typeSelector: defaultConfig.typeSelector
}
export = config;
/**
* 示例自定义插件,您可以查阅 http://developer.egret.com/cn/2d/projectConfig/cmdExtensionPluginin/
* 了解如何开发一个自定义插件
*/
export class CustomPlugin implements plugins.Command {
constructor() {
}
async onFile(file: plugins.File) {
return file;
}
async onFinish(commandContext: plugins.CommandContext) {
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"compilerOptions": {
/* Basic Options */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */
"lib": [
"es5",
"es2015.promise"
], /* Specify library files to be included in the compilation: */
"allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
/* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
}
}
\ No newline at end of file
import * as fs from 'fs';
import * as path from 'path';
export class WxgamePlugin implements plugins.Command {
constructor() {
}
async onFile(file: plugins.File) {
if (file.extname == '.js') {
const filename = file.origin;
if (filename == "libs/modules/promise/promise.js" || filename == 'libs/modules/promise/promise.min.js') {
return null;
}
if (filename == 'libs/modules/egret/egret.js' || filename == 'libs/modules/egret/egret.min.js') {
let content = file.contents.toString();
content += `;window.egret = egret;`;
content = content.replace(/definition = __global/, "definition = window");
file.contents = new Buffer(content);
}
else {
let content = file.contents.toString();
if (
filename == "libs/modules/res/res.js" ||
filename == 'libs/modules/res/res.min.js' ||
filename == 'libs/modules/assetsmanager/assetsmanager.min.js' ||
filename == 'libs/modules/assetsmanager/assetsmanager.js'
) {
content += ";window.RES = RES;"
}
if (filename == "libs/modules/eui/eui.js" || filename == 'libs/modules/eui/eui.min.js') {
content += ";window.eui = eui;"
}
if (filename == 'libs/modules/dragonBones/dragonBones.js' || filename == 'libs/modules/dragonBones/dragonBones.min.js') {
content += ';window.dragonBones = dragonBones';
}
content = "var egret = window.egret;" + content;
if (filename == 'main.js') {
content += ";window.Main = Main;"
}
file.contents = new Buffer(content);
}
}
return file;
}
async onFinish(pluginContext: plugins.CommandContext) {
//同步 index.html 配置到 game.js
const gameJSPath = path.join(pluginContext.outputDir, "game.js");
let gameJSContent = fs.readFileSync(gameJSPath, { encoding: "utf8" });
const projectConfig = pluginContext.buildConfig.projectConfig;
const optionStr =
`entryClassName: ${projectConfig.entryClassName},\n\t\t` +
`orientation: ${projectConfig.orientation},\n\t\t` +
`frameRate: ${projectConfig.frameRate},\n\t\t` +
`scaleMode: ${projectConfig.scaleMode},\n\t\t` +
`contentWidth: ${projectConfig.contentWidth},\n\t\t` +
`contentHeight: ${projectConfig.contentHeight},\n\t\t` +
`showFPS: ${projectConfig.showFPS},\n\t\t` +
`fpsStyles: ${projectConfig.fpsStyles},\n\t\t` +
`showLog: ${projectConfig.showLog},\n\t\t` +
`maxTouches: ${projectConfig.maxTouches},`;
const reg = /\/\/----auto option start----[\s\S]*\/\/----auto option end----/;
const replaceStr = '\/\/----auto option start----\n\t\t' + optionStr + '\n\t\t\/\/----auto option end----';
gameJSContent = gameJSContent.replace(reg, replaceStr);
fs.writeFileSync(gameJSPath, gameJSContent);
//修改横竖屏
let orientation;
if (projectConfig.orientation == '"landscape"') {
orientation = "landscape";
}
else {
orientation = "portrait";
}
const gameJSONPath = path.join(pluginContext.outputDir, "game.json");
let gameJSONContent = JSON.parse(fs.readFileSync(gameJSONPath, { encoding: "utf8" }));
gameJSONContent.deviceOrientation = orientation;
fs.writeFileSync(gameJSONPath, JSON.stringify(gameJSONContent, null, "\t"));
}
}
\ No newline at end of file
/**
* 可滚动的底图
*/
class BgMap extends egret.DisplayObjectContainer
{
/**图片引用*/
private bmpArr: egret.Bitmap[];
/**图片数量*/
private rowCount: number;
/**stage宽*/
private stageW: number;
/**stage高*/
private stageH: number;
/**纹理本身的高度*/
private textureHeight: number;
/**控制滚动速度*/
private speed: number = 4;
public constructor()
{
super();
this.addEventListener(egret.Event.ADDED_TO_STAGE,this.onAddToStage,this);
}
/**初始化*/
private onAddToStage(event: egret.Event)
{
this.removeEventListener(egret.Event.ADDED_TO_STAGE,this.onAddToStage,this);
this.stageW = this.stage.stageWidth;
this.stageH = this.stage.stageHeight;
console.log('width:', this.stage.$stageWidth);
var texture: egret.Texture = RES.getRes("background_png");
this.textureHeight = texture.textureHeight;//保留原始纹理的高度,用于后续的计算
this.rowCount = Math.ceil(this.stageH / this.textureHeight) + 1;//计算在当前屏幕中,需要的图片数量
this.bmpArr = [];
//创建这些图片,并设置y坐标,让它们连接起来
for(var i: number = 0; i < this.rowCount; i++)
{
var result: egret.Bitmap = new egret.Bitmap();
var texture: egret.Texture = RES.getRes("background_png");
result.texture = texture;
var bgBmp: egret.Bitmap = result;
bgBmp.y = this.textureHeight * i - (this.textureHeight * this.rowCount - this.stageH);
this.bmpArr.push(bgBmp);
this.addChild(bgBmp);
}
}
/**开始滚动*/
public start(): void
{
this.removeEventListener(egret.Event.ENTER_FRAME,this.enterFrameHandler,this);
this.addEventListener(egret.Event.ENTER_FRAME,this.enterFrameHandler,this);
}
/**逐帧运动*/
private enterFrameHandler(event: egret.Event): void
{
for(var i: number = 0; i < this.rowCount; i++)
{
var bgBmp: egret.Bitmap = this.bmpArr[i];
bgBmp.y += this.speed;
//判断超出屏幕后,回到队首,这样来实现循环反复
if(bgBmp.y > this.stageH)
{
bgBmp.y = this.bmpArr[0].y - this.textureHeight;
this.bmpArr.pop();
this.bmpArr.unshift(bgBmp);
}
}
}
/**暂停滚动*/
public pause(): void
{
this.removeEventListener(egret.Event.ENTER_FRAME,this.enterFrameHandler,this);
}
}
//////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014-2015, Egret Technology Inc.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Egret nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////////////
class LoadingUI extends egret.Sprite
{
public constructor()
{
super();
this.createView();
}
private textField: egret.TextField;
private createView(): void
{
this.textField = new egret.TextField();
this.addChild(this.textField);
this.textField.y = 300;
this.textField.width = 480;
this.textField.height = 100;
this.textField.textAlign = "center";
}
public setProgress(current: number,total: number): void
{
this.textField.text = `Loading...${current}/${total}`;
}
public setCustomProgress(current: number,total: number,message: string): void
{
this.textField.text = `[${message}] 加载中...${current}/${total}`;
}
}
/**
*
* @author
*
*/
class Bullet
{
/*
* 子弹
*/
public constructor()
{
}
//子弹X轴
public X: number;
//子弹Y轴
public Y: number;
//子弹类型
public Type: string;
//谁发出的子弹
public Plane: Plane;
//子弹图片
public Image: egret.Bitmap;
//子弹声音
public bulletSound: egret.Sound;
}
/**
*
* @author
*
*/
class Plane
{
//血量
public blood: number;
//飞机对象
public Image: egret.Bitmap;
//X轴
public X: number;
//Y轴
public Y: number;
//子弹类型
public Type: string;
//子弹声音
public bulletSound: egret.Sound;
//子弹模型
public bulletImage: string;
//开枪
public Shoot(): Bullet
{
var bullet: Bullet = new Bullet();
bullet.Type = this.Type;
bullet.Image = new egret.Bitmap(RES.getRes(this.bulletImage));
bullet.Image.width = 64;
bullet.Image.height = 64;
bullet.Plane = this;
if(this.Type == "Donw")
{
bullet.Image.rotation = 180;
bullet.X = this.X + 31 - (this.Image.width / 2);
bullet.Y = this.Y + 60;
} else
{
if(this.Image!=null){
bullet.bulletSound = this.bulletSound;
bullet.X = this.X + (this.Image.width / 2 - 35);
bullet.Y = this.Y - 45;
}
}
bullet.Image.x = bullet.X;
bullet.Image.y = bullet.Y;
return bullet;
};
//硬币
public lives: number;
}
/**
*
* @author
*
*/
class Resources
{
/**
* 资源
*/
public constructor(name: string,chinese: string)
{
this.name = name;
this.chinese = chinese;
this.isOver = false;
}
//名称
public name: string;
//中文名
public chinese: string;
//是否加载成功
public isOver: boolean;
}
/**
*
* @author
*
*/
class Blueplane extends egret.DisplayObjectContainer
{
public constructor()
{
super();
}
/**
* 创建主角
*/
public init(s: egret.DisplayObjectContainer): Plane
{
var plane: Plane = new Plane();
var planeImage = new egret.Bitmap(RES.getRes("BluePlane_png"));
plane.blood = 100;
plane.bulletImage = "bullet_03_png";
plane.Image = planeImage;
plane.Type = "UP";
plane.lives = 0;
var sound: egret.Sound = RES.getRes("bullet_mp3");
plane.bulletSound = sound;
this.BottomCenter(plane,s);
planeImage.touchEnabled = true;
s.removeEventListener(egret.TouchEvent.TOUCH_MOVE,this.PlaneMoveHandle,[plane,s]);
s.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.PlaneMoveHandle,[plane,s]);
return plane;
}
/**
* 飞机移动处理
*/
private PlaneMoveHandle(e: egret.TouchEvent): void
{
var plane: Plane = this[0];
if(plane.Image == null) return;
var parent = this[1];
var hight = plane.Image.height;
var wight = plane.Image.width;
plane.Image.x = e.stageX - (wight / 2);
plane.Image.y = e.stageY - (hight / 2);
if(plane.Image.x <= 0)
{
plane.Image.x = 0;
}
if(e.stageX + wight / 2 >= parent.stage.stageWidth)
{
plane.Image.x = parent.stage.stageWidth - wight;
}
if(plane.Image.y <= 0)
{
plane.Image.y = 0;
}
if(e.stageY + hight / 2 >= parent.stage.stageHeight)
{
plane.Image.y = parent.stage.stageHeight - hight;
}
plane.X = plane.Image.x;
plane.Y = plane.Image.y;
}
/**
* 初始默认底部居中位子
*/
private BottomCenter(bit: Plane,s: egret.DisplayObject): void
{
var mapHight = s.stage.stageWidth;
var mapwight = s.stage.stageHeight;
var hight = bit.Image.height;
var wight = bit.Image.width;
bit.X = (mapHight / 2) - (bit.Image.width / 2);
bit.Y = mapwight - bit.Image.height;
bit.Image.x = (mapHight / 2) - (bit.Image.width / 2);
bit.Image.y = mapwight - bit.Image.height;
}
}
/**
*
* @author
*
*/
class Enemyplane extends egret.DisplayObjectContainer
{
public constructor()
{
super();
}
/**
* 创建敌军
*/
public init(x: number,y: number): Plane
{
var enmyplanlist = ["GodPlane_png","GreenPlane_png","JitPlane_png"];
var planeIndex = Math.floor(Math.random() * enmyplanlist.length);
var plane: Plane = new Plane();
var planeImage = new egret.Bitmap(RES.getRes(enmyplanlist[planeIndex]));
plane.blood = 100;
plane.bulletImage = "bullet_02_png";
plane.Image = planeImage;
plane.Image.rotation = 180;
plane.Image.x = x + 128;
plane.Image.y = y + 128;
plane.X = plane.Image.x;
plane.Y = plane.Image.y;
plane.Type = "Donw";
plane.lives = 3;
return plane;
}
}
/**
* 平台数据接口。
* 由于每款游戏通常需要发布到多个平台上,所以提取出一个统一的接口用于开发者获取平台数据信息
* 推荐开发者通过这种方式封装平台逻辑,以保证整体结构的稳定
* 由于不同平台的接口形式各有不同,白鹭推荐开发者将所有接口封装为基于 Promise 的异步形式
*/
declare interface Platform {
getUserInfo(): Promise<any>;
login(): Promise<any>
}
class DebugPlatform implements Platform {
async getUserInfo() {
return { nickName: "username" }
}
async login() {
}
}
if (!window.platform) {
window.platform = new DebugPlatform();
}
declare let platform: Platform;
declare interface Window {
platform: Platform
}
require("launcher/native_require.js");
egret_native.egtMain = function () {
egret_native.nativeType = "native";
egret_native.egretInit();
egret_native.egretStart();
};
var manifest = JSON.parse(egret_native.readFileSync("manifest.json"));
var game_file_list = manifest.initial.concat(manifest.game);
var window = this;
egret_native.setSearchPaths([""]);
egret_native.requireFiles = function () {
for (var key in game_file_list) {
var src = game_file_list[key];
require(src);
}
};
egret_native.egretInit = function () {
if(egret_native.featureEnable) {
//控制一些优化方案是否开启
//Control whether some optimization options are open
var result = egret_native.featureEnable({
});
}
egret_native.requireFiles();
egret.dom = {};
egret.dom.drawAsCanvas = function () {
};
};
egret_native.egretStart = function () {
var option = {
//以下为自动修改,请勿修改
//The following is automatically modified, please do not modify
//----auto option start----
//----auto option end----
};
egret.native.NativePlayer.option = option;
egret.runEgret();
egret_native.Label.createLabel("/system/fonts/DroidSansFallback.ttf", 20, "", 0);
egret_native.EGTView.preSetOffScreenBufferEnable(true);
};
\ No newline at end of file
require("launcher/native_require.js");
egret_native.egtMain = function () {
egret_native.nativeType = "runtime";
egret_native.egretInit();
egret_native.egretStart();
};
\ No newline at end of file
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Egret</title>
<meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="true" />
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<style>
html, body {
-ms-touch-action: none;
background: #888888;
padding: 0;
border: 0;
margin: 0;
height: 100%;
}
</style>
</head>
<body>
<div style="margin: auto;width: 100%;height: 100%;" class="egret-player"
data-entry-class="Main"
data-orientation="portrait"
data-scale-mode="showAll"
data-frame-rate="30"
data-content-width="480"
data-content-height="800"
data-show-paint-rect="false"
data-multi-fingered="2"
data-show-fps="false" data-show-log="false"
data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
</div>
<script>
var loadScript = function (list, callback) {
var loaded = 0;
var loadNext = function () {
loadSingleScript(list[loaded], function () {
loaded++;
if (loaded >= list.length) {
callback();
}
else {
loadNext();
}
})
};
loadNext();
};
var loadSingleScript = function (src, callback) {
var s = document.createElement('script');
s.async = false;
s.src = src;
s.addEventListener('load', function () {
s.parentNode.removeChild(s);
s.removeEventListener('load', arguments.callee, false);
callback();
}, false);
document.body.appendChild(s);
};
var xhr = new XMLHttpRequest();
xhr.open('GET', './manifest.json?v=' + Math.random(), true);
xhr.addEventListener("load", function () {
var manifest = JSON.parse(xhr.response);
var list = manifest.initial.concat(manifest.game);
loadScript(list, function () {
/**
* {
* "renderMode":, //Engine rendering mode, "canvas" or "webgl"
* "audioType": 0 //Use the audio type, 0: default, 2: web audio, 3: audio
* "antialias": //Whether the anti-aliasing is enabled in WebGL mode, true: on, false: off, defaults to false
* "calculateCanvasScaleFactor": //a function return canvas scale factor
* }
**/
egret.runEgret({ renderMode: "webgl", audioType: 0, calculateCanvasScaleFactor:function(context) {
var backingStore = context.backingStorePixelRatio ||
context.webkitBackingStorePixelRatio ||
context.mozBackingStorePixelRatio ||
context.msBackingStorePixelRatio ||
context.oBackingStorePixelRatio ||
context.backingStorePixelRatio || 1;
return (window.devicePixelRatio || 1) / backingStore;
}});
});
});
xhr.send(null);
</script>
</body>
</html>
\ No newline at end of file
{
"compilerOptions": {
"target": "es5",
"outDir": "bin-debug",
"experimentalDecorators": true,
"lib": [
"es5",
"dom",
"es2015.promise"
],
"types": []
},
"include": [
"src",
"libs"
]
}
\ No newline at end of file
{
"resourcePlugin":{
"configs":[{
"configPath":"resource/default.res.json",
"relativePath":"resource/"
}]
},
"theme":"resource/default.thm.json"
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
require('./weapp-adapter.js');
require('./platform.js');
require('./manifest.js');
require('./egret.wxgame.js');
console.log('1');
wx.login({
success: function(res) {
console.log(res)
}
})
// wx.getUserInfo({
// success: function(res) {
// console.log(res)
// }
// })
egret.runEgret({
//以下为自动修改,请勿修改
//The following is automatically modified, please do not modify
//----auto option start----
entryClassName: "Main",
orientation: "auto",
frameRate: 30,
scaleMode: "fixedWidth",
contentWidth: 480,
contentHeight: 800,
showFPS: false,
fpsStyles: "x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9",
showLog: false,
maxTouches: 2,
//----auto option end----
renderMode: 'webgl',
audioType: 0,
calculateCanvasScaleFactor: function (context) {
var backingStore = context.backingStorePixelRatio ||
context.webkitBackingStorePixelRatio ||
context.mozBackingStorePixelRatio ||
context.msBackingStorePixelRatio ||
context.oBackingStorePixelRatio ||
context.backingStorePixelRatio || 1;
return (window.devicePixelRatio || 1) / backingStore;
}
});
// require("egret.min.js")
{
"deviceOrientation": "portrait",
"networkTimeout": {
"request": 5000,
"connectSocket": 5000,
"uploadFile": 5000,
"downloadFile": 5000
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment