{"id":126,"date":"2015-04-07T09:45:50","date_gmt":"2015-04-07T01:45:50","guid":{"rendered":"http:\/\/qxu1606620110.my3w.com\/?p=126"},"modified":"2016-10-11T09:34:59","modified_gmt":"2016-10-11T01:34:59","slug":"loading-%e8%bf%9b%e5%ba%a6%e6%9d%a1%e5%8a%a0%e8%bd%bd%e5%8a%a8%e7%94%bb%e6%95%88%e6%9e%9c","status":"publish","type":"post","link":"http:\/\/www.u3d8.com\/?p=126","title":{"rendered":"Loading \u8fdb\u5ea6\u6761\u52a0\u8f7d\u52a8\u753b\u6548\u679c"},"content":{"rendered":"<p>Loading \u8fdb\u5ea6\u6761\u52a0\u8f7d\u52a8\u753b\u6548\u679c <\/p>\n<pre class=\"lang:c# decode:true \" title=\"Loading\u8fdb\u5ea6\u6761\" >public UIProgressBar loadingAnimator;\r\n  AsyncOperation async;\r\n  float displayProgress = 0f;\r\n  float toProgress = 0f;\r\n  \/\/ Use this for initialization\r\n  void Start () {\r\n      \/\/ \u6267\u884c\u534f\u7a0b\u65b9\u6cd5\r\n      StartCoroutine (loadScene());\r\n  }\r\n  IEnumerator loadScene ()\r\n  {\r\n      \/\/ \u5f02\u6b65\u52a0\u8f7d\u7b2c\u4e09\u4e2a\u573a\u666f\r\n      async = Application.LoadLevelAsync (3);\r\n      yield return new WaitForEndOfFrame();\r\n      \/\/ \u52a0\u8f7d\u5b8c\u6210\u4e0d\u81ea\u52a8\u8fdb\u5165\r\n      async.allowSceneActivation = false;\r\n      yield return async;\r\n  }\r\n  void FixedUpdate ()\r\n  {\r\n      \/\/ \u56e0unity\u5f02\u6b65\u52a0\u8f7d\u53ea\u52a0\u8f7d\u523090%  \u6240\u4ee5\u5224\u65ad\u5c0f\u4e8e\u7b49\u4e8e0.9f\r\n      if (async.progress &lt;= 0.9f)\r\n          toProgress = async.progress;\r\n      if (displayProgress &lt; toProgress + 0.1)\r\n          displayProgress += 0.01f;\r\n      loadingAnimator.value = (displayProgress);\r\n      if (displayProgress &gt;= 1)\r\n          async.allowSceneActivation = true;\r\n  }<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Loading \u8fdb\u5ea6\u6761\u52a0\u8f7d\u52a8\u753b\u6548\u679c public UIProgressBar l &hellip; <a href=\"http:\/\/www.u3d8.com\/?p=126\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[23],"tags":[141,142,143],"_links":{"self":[{"href":"http:\/\/www.u3d8.com\/index.php?rest_route=\/wp\/v2\/posts\/126"}],"collection":[{"href":"http:\/\/www.u3d8.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.u3d8.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.u3d8.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.u3d8.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=126"}],"version-history":[{"count":6,"href":"http:\/\/www.u3d8.com\/index.php?rest_route=\/wp\/v2\/posts\/126\/revisions"}],"predecessor-version":[{"id":759,"href":"http:\/\/www.u3d8.com\/index.php?rest_route=\/wp\/v2\/posts\/126\/revisions\/759"}],"wp:attachment":[{"href":"http:\/\/www.u3d8.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.u3d8.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=126"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.u3d8.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}