ConfigHelper.cs 373 B

123456789101112131415161718192021
  1. using System;
  2. using UnityEngine;
  3. namespace Model
  4. {
  5. public static class ConfigHelper
  6. {
  7. public static string GetText(string key)
  8. {
  9. try
  10. {
  11. string configStr = ((GameObject)Resources.Load("Config")).Get<TextAsset>(key).text;
  12. return configStr;
  13. }
  14. catch (Exception)
  15. {
  16. throw new GameException($"load config file fail, key: {key}");
  17. }
  18. }
  19. }
  20. }