ExplainUnzip.cs 729 B

12345678910111213141516171819202122232425262728293031
  1. using UnityEngine;
  2. using System.Collections;
  3. namespace ZenFulcrum.EmbeddedBrowser {
  4. /** Out of the box, our BrowserAssets won't be in place. If they aren't, explain what to do. */
  5. [RequireComponent(typeof(Browser))]
  6. public class ExplainUnzip : MonoBehaviour {
  7. public void Start() {
  8. var browser = GetComponent<Browser>();
  9. browser.onLoad += data => {
  10. if (data["status"] == 404) {
  11. browser.LoadHTML(Resources.Load<TextAsset>("ExplainUnzip").text);
  12. if (HUDManager.Instance) HUDManager.Instance.Pause();
  13. Time.timeScale = 1;
  14. }
  15. };
  16. browser.onFetchError += data => {
  17. //For abysmally slow computers:
  18. if (data["error"] == "ERR_ABORTED") {
  19. browser.QueuePageReplacer(() => {}, 1);
  20. }
  21. };
  22. }
  23. }
  24. }