ConfigLoader.cs 928 B

12345678910111213141516171819202122232425262728293031
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. namespace ET.Client
  4. {
  5. [Callback(CallbackType.GetAllConfigBytes)]
  6. public class GetAllConfigBytes: IAction<Dictionary<string, byte[]>>
  7. {
  8. public void Handle(Dictionary<string, byte[]> output)
  9. {
  10. Dictionary<string, UnityEngine.Object> keys = ResourcesComponent.Instance.GetBundleAll("config.unity3d");
  11. foreach (var kv in keys)
  12. {
  13. TextAsset v = kv.Value as TextAsset;
  14. string key = kv.Key;
  15. output[key] = v.bytes;
  16. }
  17. }
  18. }
  19. [Callback(CallbackType.GetOneConfigBytes)]
  20. public class GetOneConfigBytes: IFunc<string, byte[]>
  21. {
  22. public byte[] Handle(string configName)
  23. {
  24. TextAsset v = ResourcesComponent.Instance.GetAsset("config.unity3d", configName) as TextAsset;
  25. return v.bytes;
  26. }
  27. }
  28. }