CodeTemplateFactory.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Collections;
  2. using System.IO;
  3. using UnityEngine;
  4. namespace GFGEditor
  5. {
  6. public class CodeTemplateFactory
  7. {
  8. public static string ConfigTemplate { get; private set; }
  9. public static string ConfigArrayTemplate { get; private set; }
  10. public static string FunctionGroupTemplate { get; private set; }
  11. public static string FunctionGroupOnlyTemplate { get; private set; }
  12. public static string FunctionSingleTemplate { get; private set; }
  13. //public static string ConfigTemplateEditor { get => _configTemplateEditor; }
  14. //public static string ConfigArrayTemplateEditor { get => _configArrayTemplateEditor; }
  15. public static void Init()
  16. {
  17. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "Config.txt"))
  18. {
  19. ConfigTemplate = sr.ReadToEnd();
  20. }
  21. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "ConfigArray.txt"))
  22. {
  23. ConfigArrayTemplate = sr.ReadToEnd();
  24. }
  25. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionGroup.txt"))
  26. {
  27. FunctionGroupTemplate = sr.ReadToEnd();
  28. }
  29. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionGroupOnly.txt"))
  30. {
  31. FunctionGroupOnlyTemplate = sr.ReadToEnd();
  32. }
  33. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionSingle.txt"))
  34. {
  35. FunctionSingleTemplate = sr.ReadToEnd();
  36. }
  37. }
  38. }
  39. }