Commit d6398ae8 authored by rockyl's avatar rockyl

兼容混淆版本的引擎

parent 6e583a84
This diff is collapsed.
This diff is collapsed.
{"id":"engine","url":"engine.cba09e24bd26909e1a67685a889d4799f4c2597a.js"}
\ No newline at end of file
...@@ -25,10 +25,13 @@ ...@@ -25,10 +25,13 @@
"declare": "node scripts/declare.js src/index.ts", "declare": "node scripts/declare.js src/index.ts",
"dev": "rollup -c -m -w", "dev": "rollup -c -m -w",
"build": "rollup -c -o dist/engine.js", "build": "rollup -c -o dist/engine.js",
"build:prod": "rollup -c -o dist/engine.js --environment BUILD:production", "build:prod": "rollup -c -o dist/engine.min.js --environment BUILD:production",
"preprocess": "node scripts/pre-process.js engine dist/engine.js", "preprocess:prod": "node scripts/pre-process.js engine dist/engine.min.js prod",
"build:upload": "rm -rf dist&&yarn build:prod && yarn preprocess && ali-oss-publish -c oss.config.js -e dist", "preprocess:debug": "node scripts/pre-process.js engine dist/engine.js",
"build:debug": "rm -rf dist&&yarn build && yarn preprocess && ali-oss-publish -c oss.config.js -e dist", "pack:prod": "yarn build:prod && yarn preprocess:prod",
"pack:debug": "yarn build && yarn preprocess:debug",
"upload": "ali-oss-publish -c oss.config.js -e dist",
"publish": "rm -rf dist && yarn pack:debug && yarn pack:prod && yarn upload",
"ts": "dts-bundle --name engine --main types/src/index.d.ts --out ../../dist/index.d.ts", "ts": "dts-bundle --name engine --main types/src/index.d.ts --out ../../dist/index.d.ts",
"token": "uglifyjs -m -c -o px-token.min.js px-token.js", "token": "uglifyjs -m -c -o px-token.min.js px-token.js",
"dts": "dts-bundle-generator -o types.d.ts src/index.ts" "dts": "dts-bundle-generator -o types.d.ts src/index.ts"
......
...@@ -6,7 +6,7 @@ const crypto = require('crypto'); ...@@ -6,7 +6,7 @@ const crypto = require('crypto');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const [_, __, id, fileName] = process.argv; const [_, __, id, fileName, isProd] = process.argv;
const stream = fs.createReadStream(fileName); const stream = fs.createReadStream(fileName);
const fsHash = crypto.createHash('sha1'); const fsHash = crypto.createHash('sha1');
...@@ -26,10 +26,16 @@ function loadComplete(md5) { ...@@ -26,10 +26,16 @@ function loadComplete(md5) {
const newFileName = fileName.substr(0, extIndex + 1) + md5 + fileName.substr(extIndex); const newFileName = fileName.substr(0, extIndex + 1) + md5 + fileName.substr(extIndex);
fs.renameSync(fileName, newFileName); fs.renameSync(fileName, newFileName);
let manifest = { let manifest;
if (fs.existsSync('manifest.json')) {
manifest = JSON.parse(fs.readFileSync('manifest.json', 'utf-8'));
} else {
manifest = {
id, id,
url: path.basename(newFileName),
}; };
}
manifest[isProd ? 'url' : 'url_dbg'] = path.basename(newFileName);
fs.writeFileSync('manifest.json', JSON.stringify(manifest)); fs.writeFileSync('manifest.json', JSON.stringify(manifest));
} }
import { ObservablePoint, Point, Rectangle } from '../math'; import {ObservablePoint, Point, Rectangle} from '../math';
import { sign, TextureCache } from '../utils'; import {sign, TextureCache} from '../utils';
// import { BLEND_MODES } from '../const'; // import { BLEND_MODES } from '../const';
import Texture from '../texture/Texture'; import Texture from '../texture/Texture';
import { Event } from '../events/Event'; import {Event} from '../events/Event';
import Container from './Container'; import Container from './Container';
import { DisplayObject } from "./DisplayObject"; import {DisplayObject} from "./DisplayObject";
import CanvasRenderer from '../renderers/CanvasRenderer'; import CanvasRenderer from '../renderers/CanvasRenderer';
import { SCALE_MODES } from '../const'; import {SCALE_MODES} from '../const';
import { WebglRenderer } from '../renderers/WebglRenderer'; import {WebglRenderer} from '../renderers/WebglRenderer';
import { abs } from "../utils/twiddle"; import {abs} from "../utils/twiddle";
const indices = new Uint16Array([0, 1, 2, 0, 2, 3]); const indices = new Uint16Array([0, 1, 2, 0, 2, 3]);
/** /**
...@@ -475,6 +475,12 @@ export default class Sprite extends Container { ...@@ -475,6 +475,12 @@ export default class Sprite extends Container {
} }
this._texture = value || Texture.EMPTY; this._texture = value || Texture.EMPTY;
if (this._texture != Texture.EMPTY &&
this._texture != null &&
!this._texture.baseTexture.hasLoaded) {
this._texture.removeEventListener('update', this._onTextureUpdate, this);
}
this._textureID = -1; this._textureID = -1;
this._textureTrimmedID = -1; this._textureTrimmedID = -1;
this._cachedTint = 0xFFFFFF; this._cachedTint = 0xFFFFFF;
......
...@@ -136,7 +136,8 @@ export class StackContainer extends Node { ...@@ -136,7 +136,8 @@ export class StackContainer extends Node {
let len = this.childNum; let len = this.childNum;
if (len <= 0) { if (len <= 0) {
return false; resolve(true);
return;
} }
let lastView = this.getChildAt(this.children.length - 1); let lastView = this.getChildAt(this.children.length - 1);
let view; let view;
...@@ -166,7 +167,8 @@ export class StackContainer extends Node { ...@@ -166,7 +167,8 @@ export class StackContainer extends Node {
let len = this.childNum; let len = this.childNum;
if (len <= 0) { if (len <= 0) {
return false; resolve(true);
return;
} }
let lastView = this.getChildAt(len - 1); let lastView = this.getChildAt(len - 1);
......
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