{"id":705,"date":"2020-05-22T19:19:54","date_gmt":"2020-05-22T11:19:54","guid":{"rendered":"http:\/\/blog.xrhoujie.com\/?p=705"},"modified":"2020-06-22T19:21:50","modified_gmt":"2020-06-22T11:21:50","slug":"%e8%87%aa%e5%ae%9a%e4%b9%89loading","status":"publish","type":"post","link":"http:\/\/blog.xrhoujie.com\/?p=705","title":{"rendered":"\u81ea\u5b9a\u4e49loading"},"content":{"rendered":"<div>\n<div>class LoadingUI extends egret.Sprite implements RES.PromiseTaskReporter {<\/div>\n<div>publicconstructor() {<\/div>\n<div>super();<\/div>\n<div>this.addEventListener(egret.Event.ADDED_TO_STAGE, this.createView, this);<\/div>\n<div>}<\/div>\n<div>privateasynccreateView() {<\/div>\n<div>letmy_bg: eui.Rect = neweui.Rect;<\/div>\n<div>my_bg.fillColor = 0xffffff;<\/div>\n<div>my_bg.width = this.stage.stageWidth;<\/div>\n<div>my_bg.height = this.stage.stageHeight;<\/div>\n<div>this.addChild(my_bg);<\/div>\n<div>awaitthis.addDBArmature();<\/div>\n<div>this.initLoading();<\/div>\n<div>}<\/div>\n<div>\/**\u767e\u5206\u6bd4\u4f4d\u56fe *\/<\/div>\n<div>\/\/ private loadingContainer: egret.DisplayObjectContainer;<\/div>\n<div>private text: egret.BitmapText;<\/div>\n<div>publicbar_top: any = neweui.Image();<\/div>\n<div>publicbar_move: any = neweui.Image();<\/div>\n<div>publicbar_mask: any = neweui.Image();<\/div>\n<div>publicbar_bot: any = neweui.Image();<\/div>\n<div>publiclocal_x = 650;<\/div>\n<div>publiclocal_y = 697;<\/div>\n<div>privateinitLoading() {<\/div>\n<div>this.text = newegret.BitmapText();<\/div>\n<div>letfnt = RES.getRes(&#8220;black_fnt_fnt&#8221;); \/\/\u52a0\u8f7d\u5b57\u4f53\u4f4d\u56fe<\/div>\n<div>this.text.font = fnt;<\/div>\n<div>this.text.text = &#8220;0%&#8221;;<\/div>\n<div>this.text.textAlign = &#8220;center&#8221;;<\/div>\n<div>\/\/ this.text.y = 33;<\/div>\n<div>this.text.width = this.stage.stageWidth;<\/div>\n<div>this.text.height = 30;<\/div>\n<div>this.text.y = 850;<\/div>\n<div>this.addChild(this.text);<\/div>\n<div>}<\/div>\n<div>publiconProgress(current: number, total: number): void {<\/div>\n<div>this.text.text = Math.floor((current \/ total) * 100).toString() + &#8220;%&#8221;;<\/div>\n<div>}<\/div>\n<div>\/\/\u52a8\u753b<\/div>\n<div>publicasync\u00a0addDBArmature() {<\/div>\n<div>awaitdbFactory.createArmature(&#8220;Loading&#8221;).then((armature) =&gt; {<\/div>\n<div>this.addChild(armature.display);<\/div>\n<div>armature.display.x = this.stage.stageWidth \/ 2;<\/div>\n<div>armature.display.y = this.local_y &#8211; 120;<\/div>\n<div>armature.play(&#8220;Loading001&#8221;, 0)<\/div>\n<div>})<\/div>\n<div>}<\/div>\n<div>}<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>class LoadingUI extends egret.Sprite implements RES.Pro [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":143,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[15],"_links":{"self":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts\/705"}],"collection":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=705"}],"version-history":[{"count":1,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts\/705\/revisions"}],"predecessor-version":[{"id":706,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts\/705\/revisions\/706"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/media\/143"}],"wp:attachment":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=705"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}