Files
esengine/demo/libs/fairygui/fairygui.min.js

1 line
350 KiB
JavaScript
Raw Normal View History

2020-08-21 19:21:40 +08:00
window.fgui={},window.fairygui=window.fgui,window.__extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(o,r){function s(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){t.done?o(t.value):new i(function(e){e(t.value)}).then(s,a)}h((n=n.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){var i,n,o,r,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(o=2&r[0]?n.return:r[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,r[1])).done)return o;switch(n=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,n=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){s.label=r[1];break}if(6===r[0]&&s.label<o[1]){s.label=o[1],o=r;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(r);break}o[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],n=0}finally{i=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}};!function(t){var e=function(){function e(){this._itemList=new Array,this._objectPool=new Array}return e.prototype.createObject=function(e,i){var n=t.UIPackage.getByName(e);if(!n)throw new Error("package not found: "+e);var o=n.getItemByName(i);if(!o)throw new Error("resource not found: "+i);this.internalCreateObject(o)},e.prototype.createObjectFromURL=function(e){var i=t.UIPackage.getItemByURL(e);if(!i)throw new Error("resource not found: "+e);this.internalCreateObject(i)},e.prototype.cancel=function(){t.GTimers.inst.remove(this.run,this),this._itemList.length=0;var e=this._objectPool.length;if(e>0){for(var i=0;i<e;i++)this._objectPool[i].dispose();this._objectPool.length=0}},e.prototype.internalCreateObject=function(e){this._itemList.length=0,this._objectPool.length=0;var i={pi:e,type:e.objectType};i.childCount=this.collectComponentChildren(e),this._itemList.push(i),this._index=0,t.GTimers.inst.add(1,0,this.run,this)},e.prototype.collectComponentChildren=function(e){var i,n,o,r,s,a,h=e.rawData;h.seek(0,2);var l=h.readShort();for(o=0;o<l;o++){r=h.readShort(),s=h.position,h.seek(s,0);var c=h.readByte(),u=h.readS(),_=h.readS();h.position=s,null!=u?(i={pi:n=null!=(a=null!=_?t.UIPackage.getById(_):e.owner)?a.getItemById(u):null,type:c},null!=n&&n.type==t.PackageItemType.Component&&(i.childCount=this.collectComponentChildren(n))):(i={type:c},c==t.ObjectType.List&&(i.listItemCount=this.collectListChildren(h))),this._itemList.push(i),h.position=s+r}return l},e.prototype.collectListChildren=function(e){e.seek(e.position,8);var i,n,o,r,s,a=0,h=e.readS(),l=e.readShort();for(i=0;i<l;i++)n=e.readShort(),n+=e.position,null==(o=e.readS())&&(o=h),o&&(r=t.UIPackage.getItemByURL(o))&&(s={pi:r,type:r.objectType},r.type==t.PackageItemType.Component&&(s.childCount=this.collectComponentChildren(r)),this._itemList.push(s),a++),e.position=n;return a},e.prototype.run=function(){for(var e,i,n,o,r=egret.getTimer(),s=t.UIConfig.frameTimeForAsyncUIConstruction,a=this._itemList.length;this._index<a;){if((i=this._itemList[this._index]).pi)e=t.UIObjectFactory.newObject(i.pi),this._objectPool.push(e),t.UIPackage._constructing++,i.pi.type==t.PackageItemType.Component?(n=this._objectPool.length-i.childCount-1,e.constructFromResource2(this._objectPool,n),this._objectPool.splice(n,i.childCount)):e.constructFromResour