/// <summary> /// 自动添加System系统部分初始化代码 /// </summary> /// <param name="contentName"></param> /// <param name="className"></param> /// <param name="systemName"></param> public static void InitSystem(string contentName, string className, params string[] systemName) { string path = ""; switch (contentName) { case "Game": path = ToolData.gameFeaturePath; break; case "Input": path = ToolData.inputFeaturePath; break; } if (string.IsNullOrEmpty(path)) { return; } foreach (string name in systemName) { SetSystem(path, name, className); } GenerateEntitasCodeWindow.Close(); }
/// <summary> /// 自动添加Services初始化代码 /// </summary> /// <param name="path"></param> public static void InitServices(string path) { if (File.Exists(path)) { string content = File.ReadAllText(path); int index = content.IndexOf("IInitService[] services ="); int newIndex = content.IndexOf("new", index); content = content.Insert(newIndex, "new" + " " + ToolData.serviceName + ToolData.servicePostfix + "(), \r "); File.WriteAllText(path, content, Encoding.UTF8); GenerateEntitasCodeWindow.Close(); } else { Debug.LogError("ServiceManager 脚本不存在!"); } }