2020-06-08 20:11:58 +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 i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Array.prototype.findIndex=function(t){return function(t,e){for(var n=0,i=t.length;n<i;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,i,r){return e.call(arguments[2],i,r,t)&&n.push(i),n},[]);for(var n=[],i=0,r=t.length;i<r;i++){var o=t[i];e.call(arguments[2],o,i,t)&&n.push(o)}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,i=t.length;n<i;n++)if(JSON.stringify(t[n])==JSON.stringify(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,i,r){return n.push(e.call(arguments[2],i,r,t)),n},[]);for(var n=[],i=0,r=t.length;i<r;i++)n.push(e.call(arguments[2],t[i],i,t));return n}(this,t)},Array.prototype.orderBy=function(t,e){return function(t,e,n){return t.sort(function(t,i){var r=e(t),o=e(i);return n?n(r,o):r>o?1:-1}),t}(this,t,e)},Array.prototype.orderByDescending=function(t,e){return function(t,e,n){return t.sort(function(t,i){var r=e(t),o=e(i);return n?-n(r,o):r<o?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(i,r,o){var s=JSON.stringify(e.call(arguments[1],r,o,t)),a=n.findIndex(function(t){return t===s});return a<0&&(a=n.push(s)-1),i[a]||(i[a]=[]),i[a].push(r),i},[])}for(var i=[],r=[],o=function(n,o){var a=JSON.stringify(e.call(s[1],t[n],n,t)),c=r.findIndex(function(t){return t===a});c<0&&(c=r.push(a)-1),i[c]||(i[c]=[]),i[c].push(t[n])},s=arguments,a=0,c=t.length;a<c;a++)o(a);return i}(this,t)},Array.prototype.sum=function(t){return function(t,e){for(var n,i=0,r=t.length;i<r;i++)0==i?n=e?e.call(arguments[2],t[i],i,t):t[i]:n+=e?e.call(arguments[2],t[i],i,t):t[i];return n}(this,t)};var DirtyType,Component=function(){function t(){this._enabled=!0}return 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},t.prototype.update=function(){},t.prototype.bind=function(t){return this.displayRender=t,this},t.prototype.registerComponent=function(){var t=this;this.entity.componentBits.set(ComponentTypeManager.getIndexFor(this)),this.entity.scene.entityProcessors.forEach(function(e){return e.onChanged(t.entity)})},t}(),Entity=function(){function t(t){this._updateOrder=0,this._enabled=!0,this.name=t,this.transform=new Transform(this),this.components=[],this.componentBits=new BitSet}return Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.setEnabled(t)},enumerable:!0,conf
|