ReferencesLoadHandler.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Newtonsoft.Json;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. namespace ShadowStudio.Model
  6. {
  7. /// <summary>
  8. /// 引用类型的资源管理
  9. /// </summary>
  10. public class ReferencesLoadHandler : ArtInstanceHandler
  11. {
  12. public override Object LoadArt()
  13. {
  14. if (!LoadCache && ArtInfoMgr.Instance != null)
  15. {
  16. var conf = ArtInfoMgr.Instance.GetResConf(Info.Url);
  17. if (conf && conf.resModelList != null)
  18. {
  19. for (int i = 0; i < conf.resModelList.Count; i++)
  20. {
  21. if (conf.resModelList[i] && conf.resModelList[i].name == Info.ArtName)
  22. {
  23. LoadCache = conf.resModelList[i];
  24. break;
  25. }
  26. }
  27. }
  28. }
  29. return LoadCache;
  30. }
  31. public override void LoadArtAsyn(string path, System.Action<float> process, System.Action<Object> loaded)
  32. {
  33. process?.Invoke(1);
  34. loaded?.Invoke(LoadArt());
  35. }
  36. }
  37. }