protected override void RenderExtensionButton(CodeGen item) { string errorInfo = string.Empty; if (string.IsNullOrEmpty(item.EditorName)) { errorInfo = "Editor Name Is Empty"; } else if (string.IsNullOrEmpty(item.SubType)) { errorInfo = "SubType Is Empty"; } if (string.IsNullOrEmpty(errorInfo)) { //设置导出路径 string export_folder = string.Format(@"{0}/Editor/Export/", Application.dataPath); if (!Directory.Exists(export_folder)) { Directory.CreateDirectory(export_folder); } //检测代码是否已存在 string path = string.Format("{0}{1}.cs", export_folder, item.EditorName); string disPlay = Language.Build; if (File.Exists(path)) { GUI.color = Color.green; disPlay = Language.ReBuild; } if (GUILayout.Button(disPlay, new GUILayoutOption[] { GUILayout.Width(currentEditorSetting.ExtensionHeadTagWith) })) { WriteFile(item, path); } GUI.color = Color.white; } else { if (GUILayout.Button(EditorGUIStyle.LoadEditorResource <Texture2D>("warning.png"), new GUILayoutOption[] { GUILayout.Width(currentEditorSetting.ExtensionHeadTagWith), GUILayout.Height(18) })) { ShowNotification(new GUIContent(errorInfo)); } } }
protected override void RenderExtensionButton(CodeGen item) { string error = VerfiyLineData(item, false); if (string.IsNullOrEmpty(error)) { string export_path = PathMapping.GetInstance().DecodePath(item.CodeExportPath); if (!Directory.Exists(export_path)) { Directory.CreateDirectory(export_path); } //检测代码是否已存在 string path = Path.Combine(export_path, string.Format("{0}Export.cs", item.ClassType)); string disPlay = Language.Build; if (File.Exists(path)) { GUI.color = Color.green; disPlay = Language.ReBuild; } if (GUILayout.Button(disPlay, new GUILayoutOption[] { GUILayout.Width(currentEditorSetting.ExtensionHeadTagWith) })) { WriteFile(item, path); } GUI.color = Color.white; } else { if (GUILayout.Button(EditorGUIStyle.LoadEditorResource <Texture2D>("warning.png"), new GUILayoutOption[] { GUILayout.Width(currentEditorSetting.ExtensionHeadTagWith), GUILayout.Height(18) })) { ShowNotification(new GUIContent(error)); } } }