ConfigLoader.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using YooAsset;
  4. namespace ET.Client
  5. {
  6. [Invoke]
  7. public class GetAllConfigBytes: AInvokeHandler<ConfigComponent.GetAllConfigBytes, Dictionary<Type, byte[]>>
  8. {
  9. public override Dictionary<Type, byte[]> Handle(ConfigComponent.GetAllConfigBytes args)
  10. {
  11. Dictionary<Type, byte[]> output = new Dictionary<Type, byte[]>();
  12. HashSet<Type> configTypes = EventSystem.Instance.GetTypes(typeof (ConfigAttribute));
  13. foreach (Type configType in configTypes)
  14. {
  15. var op = YooAssets.GetRawFileAsync(configType.Name);
  16. output[configType] = op.GetRawBytes();
  17. Log.Debug($"load config {configType} ok.");
  18. }
  19. return output;
  20. }
  21. }
  22. [Invoke]
  23. public class GetOneConfigBytes: AInvokeHandler<ConfigComponent.GetOneConfigBytes, byte[]>
  24. {
  25. public override byte[] Handle(ConfigComponent.GetOneConfigBytes args)
  26. {
  27. //TextAsset v = ResourcesComponent.Instance.GetAsset("config.unity3d", configName) as TextAsset;
  28. //return v.bytes;
  29. throw new NotImplementedException("client cant use LoadOneConfig");
  30. }
  31. }
  32. }