Commit c833d73d authored by rockyl's avatar rockyl

分流节点修改为负责最后一个出口

数据中心getDataByName增加容错
parent 8bd346c5
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
declare const engine: any; declare const engine: any;
export default class ZoomButton { export default class TouchZoom {
static id = 'zoom-button'; static id = 'touch-zoom';
host; host;
zoomTo = 1.1; zoomTo = 1.1;
...@@ -18,11 +18,11 @@ export default class ZoomButton { ...@@ -18,11 +18,11 @@ export default class ZoomButton {
this.host.addEventListener(engine.MouseEvent.MOUSE_UP, this._onMouseUp, this); this.host.addEventListener(engine.MouseEvent.MOUSE_UP, this._onMouseUp, this);
} }
_onMouseDown(e) { private _onMouseDown(e) {
this.host.scaleX = this.host.scaleY = this.zoomTo; this.host.scaleX = this.host.scaleY = this.zoomTo;
} }
_onMouseUp(e) { private _onMouseUp(e) {
this.host.scaleX = this.host.scaleY = 1; this.host.scaleX = this.host.scaleY = 1;
} }
} }
"use strict";
exports.__esModule = true;
var ZoomButton = (function () {
function ZoomButton() {
this.zoomTo = 1.1;
}
ZoomButton.prototype.mounted = function () {
this.host.anchorX = this.host.width / 2;
this.host.anchorY = this.host.height / 2;
this.host.addEventListener(engine.MouseEvent.MOUSE_DOWN, this._onMouseDown, this);
this.host.addEventListener(engine.MouseEvent.MOUSE_UP, this._onMouseUp, this);
};
ZoomButton.prototype._onMouseDown = function (e) {
this.host.scaleX = this.host.scaleY = this.zoomTo;
};
ZoomButton.prototype._onMouseUp = function (e) {
this.host.scaleX = this.host.scaleY = 1;
};
ZoomButton.id = 'zoom-button';
return ZoomButton;
}());
exports["default"] = ZoomButton;
...@@ -66,7 +66,7 @@ export class Process { ...@@ -66,7 +66,7 @@ export class Process {
for (let i = 0, li = meta.output.length; i < li; i++) { for (let i = 0, li = meta.output.length; i < li; i++) {
const key = meta.output[i]; const key = meta.output[i];
p = this._executeNextProcess(key, args); p = this._executeNextProcess(key, args);
if (i === 0) { if (i === li - 1) {
result = await p; result = await p;
} else { } else {
p.catch(e => { p.catch(e => {
...@@ -91,9 +91,9 @@ export class Process { ...@@ -91,9 +91,9 @@ export class Process {
if (this._meta) { if (this._meta) {
let metaConfig = this._meta; let metaConfig = this._meta;
if (metaConfig) { if (metaConfig) {
this.updateProps(payload);
if (metaConfig.script) { if (metaConfig.script) {
let func = new Function('args', 'props', 'target', 'global', 'vm', warpAsyncScript(metaConfig.script)); let func = new Function('args', 'props', 'target', 'global', 'vm', warpAsyncScript(metaConfig.script));
this.updateProps(payload);
let globalContext = this._vm.globalContext; let globalContext = this._vm.globalContext;
result = await func(payload, this._config.props, this._target, globalContext, this._vm); result = await func(payload, this._config.props, this._target, globalContext, this._vm);
} }
...@@ -204,7 +204,7 @@ export class Process { ...@@ -204,7 +204,7 @@ export class Process {
} }
} }
if(props[key] === undefined && propsConfig[key].hasOwnProperty('default')){ if (props[key] === undefined && propsConfig[key].hasOwnProperty('default')) {
props[key] = propsConfig[key]['default']; props[key] = propsConfig[key]['default'];
} }
} }
......
...@@ -68,13 +68,13 @@ export function registerScriptDef(id, def) { ...@@ -68,13 +68,13 @@ export function registerScriptDef(id, def) {
}); });
} }
export function registerScripts(scripts){ export function registerScripts(scripts) {
for(let id in scripts){ for (let id in scripts) {
let code = scripts[id]; let code = scripts[id];
let create = new Function('exports', code); let create = new Function('exports', code);
let exports = {}; let exports: any = {};
create(exports); create(exports);
registerScriptDef(id, exports['default']); registerScriptDef(id, exports.default);
} }
} }
......
...@@ -59,8 +59,10 @@ export class DataCenter extends EventDispatcher { ...@@ -59,8 +59,10 @@ export class DataCenter extends EventDispatcher {
*/ */
getDataByName(name, throwException?) { getDataByName(name, throwException?) {
let watcher = this.getWatcher(name); let watcher = this.getWatcher(name);
if(watcher){
return getDataByPath(this.store, watcher.path, throwException); return getDataByPath(this.store, watcher.path, throwException);
} }
}
/** /**
* 填充数据 * 填充数据
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
export * from './launcher' export * from './launcher'
export * from './decorators/scripts' export * from './decorators/scripts'
export * from './decorators/events'
import {instantiate} from './game-warpper/view-interpreter' import {instantiate} from './game-warpper/view-interpreter'
export { export {
......
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