phantasmal-world/13.f72a484ce85172f5cfee.js

1 line
2.4 KiB
JavaScript
Raw Normal View History

2020-01-17 05:50:19 +08:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{QRTb:function(e,t,s){"use strict";s.r(t),s.d(t,"TextureController",(function(){return f}));var r=s("mKaR"),l=s("wtpc"),i=s("iPoI"),u=s("yub1"),n=s("NRxM"),o=s("bcBH"),a=s("/UnV"),c=s("rwco"),_=s("ouMO"),b=s("IMNf"),h=s("BAAx"),d=s("5cb6"),v=function(e,t,s,r){return new(s||(s=Promise))((function(l,i){function u(e){try{o(r.next(e))}catch(e){i(e)}}function n(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var t;e.done?l(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(u,n)}o((r=r.apply(e,t||[])).next())}))};const m=c.a.get("viewer/controllers/TextureController");class f extends r.a{constructor(){super(...arguments),this._textures=Object(_.c)(),this._result_dialog_visible=Object(_.e)(!1),this._result=Object(_.e)(void 0),this._result_problems_message=Object(_.e)(""),this._result_error_message=Object(_.e)(""),this.textures=this._textures,this.result_dialog_visible=this._result_dialog_visible,this.result=this._result,this.result_problems_message=this._result_problems_message,this.result_error_message=this._result_error_message,this.load_file=e=>v(this,void 0,void 0,(function*(){this._result_problems_message.val=`Encountered some problems while opening "${e.name}".`,this._result_error_message.val=`Couldn't open "${e.name}".`;try{const t=Object(l.g)(e.name).toLowerCase(),s=yield Object(i.b)(e),r=new n.a(s,o.a.Little);if("xvm"===t){const e=Object(u.b)(r);this.set_result(e),e.success&&(this._textures.val=e.value.textures)}else if("afs"===t){const e=Object(h.b)(m),t=Object(a.a)(r);if(e.add_result(t),t.success){const s=t.value.flatMap(t=>{var s,r,l,i;const a=new n.a(t,o.a.Little);if(Object(u.a)(a)){const t=Object(u.b)(a);return e.add_result(t),null!=(r=null===(s=t.value)||void 0===s?void 0:s.textures)?r:[]}{const t=Object(u.b)(Object(b.a)(a.seek_start(0)));return e.add_result(t),null!=(i=null===(l=t.value)||void 0===l?void 0:l.textures)?i:[]}});s.length?this.set_result(e.success(s)):this.set_result(e.failure()),this._textures.val=s}else this.set_result(e.failure())}else m.debug(`Unsupported file extension in filename "${e.name}".`),this.set_result(Object(h.a)([{severity:d.b.Error,ui_message:"Unsupported file type."}]))}catch(e){m.error("Couldn't read file.",e),this.set_result(Object(h.a)())}})),this.dismiss_result_dialog=()=>{this._result_dialog_visible.val=!1}}set_result(e){this._result.val=e,e.problems.length&&(this._result_dialog_visible.val=!0)}}}}]);