CodeTemplateFactory.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 InitTemplate { get; private set; }
  11. public static string DisposeTemplate { get; private set; }
  12. public static string FunctionSingleTemplate { get; private set; }
  13. public static string FunctionGroupTemplate { get; private set; }
  14. public static string FunctionAllTemplate { get; private set; }
  15. public static string FunctionAllSingleBlockTemplate { get; private set; }
  16. public static string FunctionAllKeyBlockTemplate { get; private set; }
  17. public static string FunctionAllGroupBlockTemplate { get; private set; }
  18. public static string DisposeAllCfgsCacheTemplate { get; private set; }
  19. public static string FunctionDisposeTemplate { get; private set; }
  20. public static string StrCfgArrayDisposeTemplate { get; private set; }
  21. public static string InitAllCfgsCacheTemplate { get; private set; }
  22. public static string FunctionInitTemplate { get; private set; }
  23. public static string StrCfgArrayInitTemplate { get; private set; }
  24. //public static string ConfigTemplateEditor { get => _configTemplateEditor; }
  25. //public static string ConfigArrayTemplateEditor { get => _configArrayTemplateEditor; }
  26. public static void Init()
  27. {
  28. ConfigTemplate = File.ReadAllText(ExcelConfig.templatePath + "Config.txt");
  29. //using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "Config.txt"))
  30. //{
  31. // ConfigTemplate = sr.ReadToEnd();
  32. //}
  33. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "ConfigArray.txt"))
  34. {
  35. ConfigArrayTemplate = sr.ReadToEnd();
  36. }
  37. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "Init.txt"))
  38. {
  39. InitTemplate = sr.ReadToEnd();
  40. }
  41. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "Dispose.txt"))
  42. {
  43. DisposeTemplate = sr.ReadToEnd();
  44. }
  45. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionSingle.txt"))
  46. {
  47. FunctionSingleTemplate = sr.ReadToEnd();
  48. }
  49. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionGroup.txt"))
  50. {
  51. FunctionGroupTemplate = sr.ReadToEnd();
  52. }
  53. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionAll.txt"))
  54. {
  55. FunctionAllTemplate = sr.ReadToEnd();
  56. }
  57. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionAllSingleBlock.txt"))
  58. {
  59. FunctionAllSingleBlockTemplate = sr.ReadToEnd();
  60. }
  61. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionAllKeyBlock.txt"))
  62. {
  63. FunctionAllKeyBlockTemplate = sr.ReadToEnd();
  64. }
  65. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionAllGroupBlock.txt"))
  66. {
  67. FunctionAllGroupBlockTemplate = sr.ReadToEnd();
  68. }
  69. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "DisposeAllCfgsCache.txt"))
  70. {
  71. DisposeAllCfgsCacheTemplate = sr.ReadToEnd();
  72. }
  73. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionDispose.txt"))
  74. {
  75. FunctionDisposeTemplate = sr.ReadToEnd();
  76. }
  77. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "StrCfgArrayDisposeBlock.txt"))
  78. {
  79. StrCfgArrayDisposeTemplate = sr.ReadToEnd();
  80. }
  81. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "InitAllCfgsCache.txt"))
  82. {
  83. InitAllCfgsCacheTemplate = sr.ReadToEnd();
  84. }
  85. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "FunctionInit.txt"))
  86. {
  87. FunctionInitTemplate = sr.ReadToEnd();
  88. }
  89. using (StreamReader sr = new StreamReader(ExcelConfig.templatePath + "StrCfgArrayInitBlock.txt"))
  90. {
  91. StrCfgArrayInitTemplate = sr.ReadToEnd();
  92. }
  93. }
  94. }
  95. }