2020-06-09 11:09:26 +08:00
|
|
|
window.framework={},window.__extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Array.prototype.findIndex=function(t){return function(t,e){for(var n=0,o=t.length;n<o;n++)if(e.call(arguments[2],t[n],n,t))return n;return-1}(this,t)},Array.prototype.any=function(t){return function(t,e){return t.findIndex(e)>-1}(this,t)},Array.prototype.firstOrDefault=function(t){return function(t,e){var n=t.findIndex(e);return-1==n?null:t[n]}(this,t)},Array.prototype.find=function(t){return function(t,e){return t.firstOrDefault(e)}(this,t)},Array.prototype.where=function(t){return function(t,e){if("function"==typeof t.reduce)return t.reduce(function(n,o,i){return e.call(arguments[2],o,i,t)&&n.push(o),n},[]);for(var n=[],o=0,i=t.length;o<i;o++){var r=t[o];e.call(arguments[2],r,o,t)&&n.push(r)}return n}(this,t)},Array.prototype.count=function(t){return function(t,e){return t.where(e).length}(this,t)},Array.prototype.findAll=function(t){return function(t,e){return t.where(e)}(this,t)},Array.prototype.contains=function(t){return function(t,e){for(var n=0,o=t.length;n<o;n++)if(t[n]==e)return!0;return!1}(this,t)},Array.prototype.removeAll=function(t){!function(t,e){var n;do{(n=t.findIndex(e))>=0&&t.splice(n,1)}while(n>=0)}(this,t)},Array.prototype.remove=function(t){return function(t,e){var n=t.findIndex(function(t){return t===e});return n>=0&&(t.splice(n,1),!0)}(this,t)},Array.prototype.removeAt=function(t){return function(t,e){t.splice(e,1)}(this,t)},Array.prototype.removeRange=function(t,e){return function(t,e,n){t.splice(e,n)}(this,t,e)},Array.prototype.select=function(t){return function(t,e){if("function"==typeof t.reduce)return t.reduce(function(n,o,i){return n.push(e.call(arguments[2],o,i,t)),n},[]);for(var n=[],o=0,i=t.length;o<i;o++)n.push(e.call(arguments[2],t[o],o,t));return n}(this,t)},Array.prototype.orderBy=function(t,e){return function(t,e,n){return t.sort(function(t,o){var i=e(t),r=e(o);return n?n(i,r):i>r?1:-1}),t}(this,t,e)},Array.prototype.orderByDescending=function(t,e){return function(t,e,n){return t.sort(function(t,o){var i=e(t),r=e(o);return n?-n(i,r):i<r?1:-1}),t}(this,t,e)},Array.prototype.groupBy=function(t){return function(t,e){if("function"==typeof t.reduce){var n=[];return t.reduce(function(o,i,r){var s=JSON.stringify(e.call(arguments[1],i,r,t)),a=n.findIndex(function(t){return t===s});return a<0&&(a=n.push(s)-1),o[a]||(o[a]=[]),o[a].push(i),o},[])}for(var o=[],i=[],r=function(n,r){var a=JSON.stringify(e.call(s[1],t[n],n,t)),c=i.findIndex(function(t){return t===a});c<0&&(c=i.push(a)-1),o[c]||(o[c]=[]),o[c].push(t[n])},s=arguments,a=0,c=t.length;a<c;a++)r(a);return o}(this,t)},Array.prototype.sum=function(t){return function(t,e){for(var n,o=0,i=t.length;o<i;o++)0==o?n=e?e.call(arguments[2],t[o],o,t):t[o]:n+=e?e.call(arguments[2],t[o],o,t):t[o];return n}(this,t)};var DirtyType,ComponentTransform,Component=function(){function t(){this._enabled=!0,this.updateInterval=1}return Object.defineProperty(t.prototype,"transform",{get:function(){return this.entity.transform},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.entity?this.entity.enabled&&this._enabled:this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,configurable:!0}),t.prototype.setEnabled=function(t){return this._enabled!=t&&(this._enabled=t,this._enabled?this.onEnabled():this.onDisabled()),this},t.prototype.onAddedToEntity=function(){},t.prototype.onRemovedFromEntity=function(){},t.prototype.onEnabled=function(){},t.prototype.onDisabled=function(){},t.prototype.onEntityTransformChanged=function(t){},t.prototype.update=function(){},t.prototype.bind=function(t){return this.displayRender=t,this},t.prototype.registerComponent=function(){this.entity.componentBits.set(ComponentTypeManager.getIndexFor(this),!1),this.entity.scene.
|