RuntimeTest.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using UnityEngine;
  2. using System.Collections;
  3. using System;
  4. public class RuntimeTest : MonoBehaviour
  5. {
  6. // Use this for initialization
  7. void Start ()
  8. {
  9. }
  10. // Update is called once per frame
  11. void Update ()
  12. {
  13. if(Input.GetKey(KeyCode.A))
  14. {
  15. GameObject testTmp = (GameObject)ResourceManager.Load("GameObject");
  16. Instantiate(testTmp);
  17. }
  18. if(Input.GetKey(KeyCode.B))
  19. {
  20. GameObject testTmp = (GameObject)ResourceManager.Load("UItest");
  21. Instantiate(testTmp);
  22. }
  23. if (Input.GetKey(KeyCode.U))
  24. {
  25. UIManager.OpenUIWindow("MianMenu");
  26. }
  27. if (Input.GetKey(KeyCode.I))
  28. {
  29. UIManager.CloseUIWindow("MianMenu");
  30. }
  31. if (Input.GetKey(KeyCode.C))
  32. {
  33. AssetsBundleManager.UnLoadBundle("UItest");
  34. }
  35. if (Input.GetKey(KeyCode.D))
  36. {
  37. loadCount++;
  38. ResourceManager.LoadAsync("UItest", (LoadState state, object obj) =>
  39. {
  40. if (state.isDone)
  41. {
  42. callbackCount++;
  43. Debug.Log(state.progress);
  44. GameObject go = (GameObject)obj;
  45. Instantiate(go);
  46. Debug.Log(loadCount+" " + callbackCount);
  47. }
  48. else
  49. {
  50. Debug.Log(state.progress);
  51. }
  52. });
  53. }
  54. }
  55. int loadCount = 0;
  56. int callbackCount = 0;
  57. }