当前位置: 首页 > news >正文

一键替换工程文件和场景中的UI对象字体

具体流程:

  1. 找到工程中使用到的所有字体
  2. 找到工程和场景中包含Text的所有对象
  3. 展示要替换的字体名字让用户选择
  4. 通过用户选择的字体,展示响应的物体对象
  5. 一键替换

通过AssetDatabase.FindAssets找到工程中包含的所有字体:

 private List<string> FindAllFonts(){List<string> list = new List<string>();// 获取所有字体文件string[] fontGUIDs = AssetDatabase.FindAssets("t:Font");foreach (string fontGUID in fontGUIDs){string fontPath = AssetDatabase.GUIDToAssetPath(fontGUID);Font font = AssetDatabase.LoadAssetAtPath<Font>(fontPath);list.Add(font.name);}list.Add("Arial");//默认字体添加进去return list;}

 通过AssetDatabase.FindAssets找到工程中的所有预制体

  private List<GameObject> GetAllPrefabByAssetDatabase(params string[] path){List<GameObject> _prefabList = new List<GameObject>();string[] _guids = AssetDatabase.FindAssets("t:Prefab", path);string _prefabPath = "";GameObject _prefab;foreach (var _guid in _guids){_prefabPath = AssetDatabase.GUIDToAssetPath(_guid);_prefab = AssetDatabase.LoadAssetAtPath(_prefabPath, typeof(GameObject)) as GameObject;_prefabList.Add(_prefab);}
#if UNITY_2020_1_OR_NEWERText[] texts = GameObject.FindObjectsOfType<Text>(true);foreach (var text in texts){_prefabList.Add(text.gameObject);}
#elseScene activeScene = EditorSceneManager.GetActiveScene();GameObject[] allObjectsInScene = activeScene.GetRootGameObjects();foreach (var obj in allObjectsInScene){Text[] texts = obj.GetComponentsInChildren<Text>(true);foreach (var text in texts){_prefabList.Add(text.gameObject);}}
#endifreturn _prefabList;}

过滤没有含Text组件的对象

 private List<GameObject> FilterNoTextPrefabs(){List<GameObject> templist = new List<GameObject>();Dic_Font_Prefabs.Clear();foreach (var prefab in prefabs){Text[] texts = prefab.GetComponentsInChildren<Text>(true);if (texts.Length != 0){foreach (var text in texts){if (text.font != null){if (!Dic_Font_Prefabs.ContainsKey(text.font.name)){Dic_Font_Prefabs.Add(text.font.name, new List<GameObject>());//根据Font类型,添加一个Text集合到字典中}if (!Dic_Font_Prefabs[text.font.name].Contains(prefab)){Dic_Font_Prefabs[text.font.name].Add(prefab);}if (!templist.Contains(prefab)){templist.Add(prefab);//包含该Text的预制体添加到集合中}}}}}return templist;}

最后,用户选择完要替换的字体,选择开始替换即可。

TextMeshPro跟Text是一个道理,只需要把代码中响应的Text和Font改为TextMeshProGUI和FontAssets即可。

最后附上完整代码:

using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine.UI;
using System.Linq;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
/// <summary>
/// 查找替换工程场景中Text的Font
/// </summary>
public class ChangePrefabFont : EditorWindow
{[MenuItem("Tools/替换字体/Text")]//入口static void GetWindow()//静态函数{//创建窗口ChangePrefabFont window = EditorWindow.GetWindow<ChangePrefabFont>("Text字体替换窗口");//生成一个unity窗口弹窗window.Show();//展示OnGUI中的界面显示}#region 属性/// <summary>/// 工程中包含的字体的名字/// </summary>List<string> fontsOnAssets = new List<string>();/// <summary>/// 对应字体是否需要替换/// </summary>List<bool> textPaidFontRelpace = new List<bool>();/// <summary>/// 代替要替换的字体的字体/// </summary>List<Font> textReplaceFonts = new List<Font>();/// <summary>/// 预制体集合/// </summary>List<GameObject> prefabs = new List<GameObject>();/// <summary>/// 根据字体类型分类的预制体对象/// </summary>Dictionary<string, List<GameObject>> Dic_Font_Prefabs = new Dictionary<string, List<GameObject>>();#endregionprivate void OnEnable(){InitFont();}private void OnGUI(){InitPrefabs();#region 显示替换选项EditorGUILayout.LabelField("下面是工程中包含的字体,和工程中&场景中的对象使用的字体情况。请选择要替换的字体:");for (int i = 0; i < fontsOnAssets.Count; i++){EditorGUILayout.BeginHorizontal();EditorGUILayout.LabelField($"更换[{fontsOnAssets[i]}]字体");textPaidFontRelpace[i] = EditorGUILayout.Toggle(textPaidFontRelpace[i], GUILayout.Width(position.width));//是否要替换当前字体的复选框EditorGUILayout.EndHorizontal();EditorGUILayout.BeginHorizontal();EditorGUILayout.LabelField($"    预制体数量:{GetGetUseFontPrefabCount(fontsOnAssets[i])}");if (!textPaidFontRelpace[i]){if (Dic_Font_Prefabs.ContainsKey(fontsOnAssets[i])){foreach (var item in Dic_Font_Prefabs[fontsOnAssets[i]]){if (prefabs.Contains(item)){prefabs.Remove(item);}}}}else{EditorGUILayout.LabelField($"代替【{fontsOnAssets[i]}】的字体:");textReplaceFonts[i] = (Font)EditorGUILayout.ObjectField(textReplaceFonts[i], typeof(Font), true);//代替的字体复选框if (Dic_Font_Prefabs.ContainsKey(fontsOnAssets[i])){foreach (var item in Dic_Font_Prefabs[fontsOnAssets[i]]){if (!prefabs.Contains(item)){prefabs.Add(item);}}}}EditorGUILayout.EndHorizontal();}EditorGUILayout.Space();#endregion#region 开始替换操作if (GUILayout.Button("开始替换")){if (textReplaceFonts == null || textReplaceFonts.Count == 0){EditorUtility.DisplayDialog("提示", "没有字体!", "确定");return;}if (prefabs == null || prefabs.Count == 0){EditorUtility.DisplayDialog("提示", "没有需要替换的对象!", "确定");return;}List<GameObject> ReplaceGo = new List<GameObject>();Dictionary<string, Font> Dic_Font_ReplaceFont = new Dictionary<string, Font>();for (int i = 0; i < textPaidFontRelpace.Count; i++){if (textPaidFontRelpace[i] == true){if (textReplaceFonts[i] != null){if (Dic_Font_Prefabs.ContainsKey(fontsOnAssets[i])){ReplaceGo.AddRange(Dic_Font_Prefabs[fontsOnAssets[i]]);Dic_Font_ReplaceFont.Add(fontsOnAssets[i], textReplaceFonts[i]);}else{EditorUtility.DisplayDialog("提示", $"使用了【{fontsOnAssets[i]}】字体的预制体数量为0!", "确定");}}else{EditorUtility.DisplayDialog("提示", $"【{fontsOnAssets[i]}】的替代字体为空!", "确定");}}}if (ReplaceGo.Count == 0){EditorUtility.DisplayDialog("提示", "没有需要替换的对象!", "确定");}else{string hintInfo = "";foreach (var font in Dic_Font_ReplaceFont){hintInfo += $"{font.Key} >> {font.Value.name}\n";}if (EditorUtility.DisplayDialog("确认进行下面的替换?", hintInfo, "确定", "取消")){foreach (var font in Dic_Font_ReplaceFont){ReplaceFont(Dic_Font_Prefabs[font.Key], font.Key, font.Value);}SaveChangedToAsset(prefabs);}}}#endregion#region 预制体列表InitReorderableList();if (reorderableList != null && reorderableList.count != 0){scrollPos = EditorGUILayout.BeginScrollView(scrollPos);reorderableList.DoLayoutList();EditorGUILayout.EndScrollView();}else{EditorGUILayout.LabelField("提示:没有需要替换字体的预制体");}#endregion}#region 列表和滚动窗口ReorderableList reorderableList;//列表显示Vector2 scrollPos;//滚动窗口需要private void DrawHeader(Rect rect){EditorGUI.LabelField(rect, "对象列表数量:" + prefabs.Count);}private void DrawElement(Rect rect, int index, bool isActive, bool isFocused){rect.height -= 4;rect.y += 2;prefabs[index] = (GameObject)EditorGUI.ObjectField(rect, "包含Text的对象", prefabs[index], typeof(GameObject), true);}private void AddItem(ReorderableList list){prefabs.Add(null);}#endregion#region 逻辑方法/// <summary>/// 字体相关初始化/// </summary>private void InitFont(){textPaidFontRelpace.Clear();textReplaceFonts.Clear();fontsOnAssets = FindAllFonts();foreach (var item in fontsOnAssets){textPaidFontRelpace.Add(false);textReplaceFonts.Add(null);}}/// <summary>/// 预制体相关初始化/// </summary>private void InitPrefabs(){prefabs = GetAllPrefabByAssetDatabase();prefabs = FilterNoTextPrefabs();prefabs.Clear();foreach (var item in Dic_Font_Prefabs){prefabs.AddRange(item.Value);}}/// <summary>/// 初始化链表操作对象/// </summary>private void InitReorderableList(){prefabs = prefabs.Distinct().ToList();reorderableList = new ReorderableList(prefabs, typeof(GameObject), true, true, true, true);reorderableList.drawHeaderCallback = DrawHeader;reorderableList.drawElementCallback = DrawElement;reorderableList.onAddCallback = AddItem;}#endregion#region 功能方法#region 查找和过滤/// <summary>/// 找到工程和场景中的含有Text组件的对象/// </summary>/// <param name="path"></param>/// <returns></returns>private List<GameObject> GetAllPrefabByAssetDatabase(params string[] path){List<GameObject> _prefabList = new List<GameObject>();string[] _guids = AssetDatabase.FindAssets("t:Prefab", path);string _prefabPath = "";GameObject _prefab;foreach (var _guid in _guids){_prefabPath = AssetDatabase.GUIDToAssetPath(_guid);_prefab = AssetDatabase.LoadAssetAtPath(_prefabPath, typeof(GameObject)) as GameObject;_prefabList.Add(_prefab);}
#if UNITY_2020_1_OR_NEWERText[] texts = GameObject.FindObjectsOfType<Text>(true);foreach (var text in texts){_prefabList.Add(text.gameObject);}
#elseScene activeScene = EditorSceneManager.GetActiveScene();GameObject[] allObjectsInScene = activeScene.GetRootGameObjects();foreach (var obj in allObjectsInScene){Text[] texts = obj.GetComponentsInChildren<Text>(true);foreach (var text in texts){_prefabList.Add(text.gameObject);}}
#endifreturn _prefabList;}/// <summary>/// 过滤没有包含Text的预制体/// 过滤没有包含付费字体的预制体/// 根据Text类型分类/// </summary>/// <param name="gameObjects"></param>/// <returns></returns>private List<GameObject> FilterNoTextPrefabs(){List<GameObject> templist = new List<GameObject>();Dic_Font_Prefabs.Clear();foreach (var prefab in prefabs){Text[] texts = prefab.GetComponentsInChildren<Text>(true);if (texts.Length != 0){foreach (var text in texts){if (text.font != null){if (!Dic_Font_Prefabs.ContainsKey(text.font.name)){Dic_Font_Prefabs.Add(text.font.name, new List<GameObject>());//根据Font类型,添加一个Text集合到字典中}if (!Dic_Font_Prefabs[text.font.name].Contains(prefab)){Dic_Font_Prefabs[text.font.name].Add(prefab);}if (!templist.Contains(prefab)){templist.Add(prefab);//包含该Text的预制体添加到集合中}}}}}return templist;}/// <summary>/// 找到工程中的所有字体文件/// </summary>/// <returns>返回字体名称列表</returns>private List<string> FindAllFonts(){List<string> list = new List<string>();// 获取所有字体文件string[] fontGUIDs = AssetDatabase.FindAssets("t:Font");foreach (string fontGUID in fontGUIDs){string fontPath = AssetDatabase.GUIDToAssetPath(fontGUID);Font font = AssetDatabase.LoadAssetAtPath<Font>(fontPath);list.Add(font.name);}list.Add("Arial");//默认字体添加进去return list;}#endregion#region 替换字体方法/// <summary>/// 替换Text的字体/// </summary>/// <param name="texts">要替换的Text集合</param>/// <param name="fontName">要替换的字体的名字</param>/// <param name="font">用来替换的字体</param>private void ReplaceFont(List<GameObject> gameObjects, string fontName, Font font){foreach (var go in gameObjects){Text[] texts = go.GetComponentsInChildren<Text>(true);foreach (var text in texts){if (text.font != null){if (text.font.name == fontName){text.font = font;}}//else//{//    text.font = Resources.GetBuiltinResource<Font>("Arial.ttf");//}}}}/// <summary>/// 保存更改/// </summary>/// <param name="gameObjects"></param>private void SaveChangedToAsset(List<GameObject> gameObjects){foreach (var gameObject in gameObjects){EditorUtility.SetDirty(gameObject);}AssetDatabase.SaveAssets();AssetDatabase.Refresh();EditorUtility.DisplayDialog("提示", "替换完毕!", "确定");}#endregionprivate List<GameObject> GetUseFontPrefabs(string font){if (Dic_Font_Prefabs.ContainsKey(font))return Dic_Font_Prefabs[font];elsereturn null;}private int GetGetUseFontPrefabCount(string font){List<GameObject> temp = GetUseFontPrefabs(font);return temp == null ? 0 : temp.Count;}#endregion
}

相关文章:

一键替换工程文件和场景中的UI对象字体

具体流程&#xff1a; 找到工程中使用到的所有字体找到工程和场景中包含Text的所有对象展示要替换的字体名字让用户选择通过用户选择的字体&#xff0c;展示响应的物体对象一键替换 通过AssetDatabase.FindAssets找到工程中包含的所有字体&#xff1a; private List<strin…...

微信小程序编辑器代码格式缩进设置

第一步点击这个编辑器设置&#xff1a; 然后设置tab为空格&#xff0c;并且设置占几个空格&#xff0c;这里是4个空格。 这样就好了&#xff0c;文件保存就会自动设置好缩进格式了。...

Android Aidl跨进程通讯(二)--异常捕获处理

学更好的别人&#xff0c; 做更好的自己。 ——《微卡智享》 本文长度为1623字&#xff0c;预计阅读5分钟 前言 上一篇《Android Aidl跨进程通讯的简单使用》中介绍了跨进程的通讯处理&#xff0c;在进程间的数据通过Aidl实现了交互&#xff0c;项目中经常会遇到Bug&#xff0c…...

Android中OkHttp源码阅读二(责任链模式)

博主前些天发现了一个巨牛的人工智能学习网站&#xff0c;通俗易懂&#xff0c;风趣幽默&#xff0c;忍不住也分享一下给大家 &#x1f449;点击跳转到教程 Android OkHttp源码阅读详解一 看OkHttp源码&#xff0c;发现OkHttp里面使用了责任链设计模式&#xff0c;所以才要学习…...

2023年03月 C/C++(六级)真题解析#中国电子学会#全国青少年软件编程等级考试

C/C++编程(1~8级)全部真题・点这里 第1题:波兰表达式 波兰表达式是一种把运算符前置的算术表达式,例如普通的表达式2 + 3的波兰表示法为+ 2 3。波兰表达式的优点是运算符之间不必有优先级关系,也不必用括号改变运算次序,例如(2 + 3) * 4的波兰表示法为* + 2 3 4。本题求解…...

顺序表链表OJ题(1)——【LeetCode】

W...Y的主页 &#x1f60a; 代码仓库分享 &#x1f495; 前言&#xff1a; 今天我们来回顾一下顺序表与链表&#xff0c;针对这一块我们也有许多OJ题目供大家参考。当我们学习完顺序表链表后避免不了一些习题的练习&#xff0c;这样才能巩固我们学习的内容。 话不多说&#xf…...

flex:1

问题1&#xff1a;“flex: 1” 与其他 “flex” 值有何区别&#xff1f; 答案&#xff1a; “flex: 1” 是 “flex” 属性的一种简写形式&#xff0c;它将 “flex-grow”、“flex-shrink” 和 “flex-basis” 设置为特定的值。与其他 “flex” 值相比&#xff0c;“flex: 1” …...

iOS练手项目知识点汇总

基础理解篇 Objective-C是一种面向对象的编程语言&#xff0c;它支持元编程。元编程是指编写程序来生成或操纵其他程序的技术。 Objective-C中&#xff0c;元编程可以使用Objective-C的动态特性来实现。例如可以使用Objective-C的运行时函数来动态地创建类、添加属性和方法等等…...

【Linux】Libevent相关小知识总结

Libevent是基于事件的&#xff0c;也就是说&#xff0c;相当于去注册一个事件&#xff0c;当这个事件发生的话&#xff0c;那么就会调用回调函数。...

【Spring Security】UserDetailsService 接口介绍

文章目录 UserDetailsService 介绍UserDetailsService 具体操作UserDetailsService 方法介绍 UserDetailsService 介绍 UserDetailsService 在 Spring Security 中主要承担查询系统内用户、验证密码、封装用户信息和角色权限。大白话就是你写一个实现类实现 UserDetailsServic…...

Mybatis学习|日志工厂、分页

1.日志工厂 如果一个数据库操作&#xff0c;出现了异常&#xff0c;我们需要排错。日志就是最好的助手! 曾经: sout、debug 现在:日志工厂! 我们主要掌握STDOUT_LOGGING 和LOG4j 在Mybatis中具体使用哪个一日志实现&#xff0c;在设置中设定! 在mybatis核心配置文件中&#…...

Vivado 添加FPGA开发板的Boards file的添加

1 digilent board file 下载地址 下载地址 &#xff1a; https://github.com/Digilent/vivado-boards 2 下载后 3 添加文件到 vivado 安装路径 把文件复制到 Vivado\2019.1\data\boards\board_files4 创建工程查看是否安装成功...

vmstat

vmstat VirtualMeomoryStatistics&#xff0c;虚拟内存统计&#xff0c;是Linux中监控内存的常用工具&#xff0c;可对操作系统的虚拟内存、进程、CPU等的整体情况进行监视。 [rootwenzi wenzi]# vmstat procs -----------memory---------- ---swap-- -----io---- -system--…...

LinuxShell变量

变量&#xff1a; 命名规则&#xff1a; 在Shell中&#xff0c;变量名可以由字母、数字或者下划线组成&#xff0c;并且只能以字母或者下划线开头。对于变量名的长度&#xff0c;Shell并没有做出明确的规定。因此&#xff0c;用户可以使用任意长度的字符串来作为变量名。但是…...

如何实现的手机实景自动直播,都有哪些功能呢?

手机实景自动直播最近真的太火了&#xff0c;全程只需要一部手机&#xff0c;就能完成24小时直播带货&#xff0c;不需要真人出镜&#xff0c;不需要场地&#xff0c;不需要搭建直播间&#xff0c;只需要一部手机就可以了。真人语音讲解&#xff0c;真人智能回复&#xff0c;实…...

如何让qt tableView每个item中个别字用不同颜色显示?

如何让qt tableView每个item中个别字用不同颜色显示&#xff1f; 从上面图片可以看到&#xff0c;Item为红色&#xff0c;数字5为黑色。 要实现在一个控件实现不同颜色&#xff0c;目前想到的只有QTextEdit 、QLabel。有两种方法&#xff0c;第一种是代理&#xff0c;第二种是…...

Aspose导出word使用记录

背景&#xff1a;Aspose系列的控件&#xff0c;功能实现都比较强大&#xff0c;可以实现多样化的报表设计及输出。 通过这次业务机会&#xff0c;锂宝碳审核中业务功需要实现Word文档表格的动态导出功能&#xff0c;因此学习了相关内容&#xff0c;在学习和参考了官方API文档的…...

[Java]_[初级]_[使用SAX流的方式写入XML文件]

场景 文件的写入目前没有发现可以增量写入的&#xff0c;只能是完全重新写入。对于大量数据需要写入XML文件&#xff0c;还是和读XML文件一样&#xff0c;不需要生成DOM模型能节省不少的内存和指令。 说明 在java标准库里&#xff0c;也是有相关的SAX类来写入数据流&#xf…...

java里面封装https请求工具类

1.工具类如下 Component Slf4j public class RestClientUtil<T> {private final RestTemplate restTemplate;public RestClientUtil() {this.restTemplate new RestTemplate();}public JSONObject uploadFile(String url, String fileUrl) throws IOException {List<…...

uniApp常见面试题-附详细答案

uniApp中如何进行页面跳转&#xff1f; 答案&#xff1a;可以使用uni.navigateTo、uni.redirectTo和uni.reLaunch等方法进行页面跳转。其中&#xff0c;uni.navigateTo可以实现页面的普通跳转&#xff0c;uni.redirectTo可以实现页面的重定向跳转&#xff0c;uni.reLaunch可以实…...

论文解读:交大港大上海AI Lab开源论文 | 宇树机器人多姿态起立控制强化学习框架(二)

HoST框架核心实现方法详解 - 论文深度解读(第二部分) 《Learning Humanoid Standing-up Control across Diverse Postures》 系列文章: 论文深度解读 + 算法与代码分析(二) 作者机构: 上海AI Lab, 上海交通大学, 香港大学, 浙江大学, 香港中文大学 论文主题: 人形机器人…...

【JavaEE】-- HTTP

1. HTTP是什么&#xff1f; HTTP&#xff08;全称为"超文本传输协议"&#xff09;是一种应用非常广泛的应用层协议&#xff0c;HTTP是基于TCP协议的一种应用层协议。 应用层协议&#xff1a;是计算机网络协议栈中最高层的协议&#xff0c;它定义了运行在不同主机上…...

Linux简单的操作

ls ls 查看当前目录 ll 查看详细内容 ls -a 查看所有的内容 ls --help 查看方法文档 pwd pwd 查看当前路径 cd cd 转路径 cd .. 转上一级路径 cd 名 转换路径 …...

Matlab | matlab常用命令总结

常用命令 一、 基础操作与环境二、 矩阵与数组操作(核心)三、 绘图与可视化四、 编程与控制流五、 符号计算 (Symbolic Math Toolbox)六、 文件与数据 I/O七、 常用函数类别重要提示这是一份 MATLAB 常用命令和功能的总结,涵盖了基础操作、矩阵运算、绘图、编程和文件处理等…...

汇编常见指令

汇编常见指令 一、数据传送指令 指令功能示例说明MOV数据传送MOV EAX, 10将立即数 10 送入 EAXMOV [EBX], EAX将 EAX 值存入 EBX 指向的内存LEA加载有效地址LEA EAX, [EBX4]将 EBX4 的地址存入 EAX&#xff08;不访问内存&#xff09;XCHG交换数据XCHG EAX, EBX交换 EAX 和 EB…...

【碎碎念】宝可梦 Mesh GO : 基于MESH网络的口袋妖怪 宝可梦GO游戏自组网系统

目录 游戏说明《宝可梦 Mesh GO》 —— 局域宝可梦探索Pokmon GO 类游戏核心理念应用场景Mesh 特性 宝可梦玩法融合设计游戏构想要素1. 地图探索&#xff08;基于物理空间 广播范围&#xff09;2. 野生宝可梦生成与广播3. 对战系统4. 道具与通信5. 延伸玩法 安全性设计 技术选…...

微软PowerBI考试 PL300-在 Power BI 中清理、转换和加载数据

微软PowerBI考试 PL300-在 Power BI 中清理、转换和加载数据 Power Query 具有大量专门帮助您清理和准备数据以供分析的功能。 您将了解如何简化复杂模型、更改数据类型、重命名对象和透视数据。 您还将了解如何分析列&#xff0c;以便知晓哪些列包含有价值的数据&#xff0c;…...

基于Java+MySQL实现(GUI)客户管理系统

客户资料管理系统的设计与实现 第一章 需求分析 1.1 需求总体介绍 本项目为了方便维护客户信息为了方便维护客户信息&#xff0c;对客户进行统一管理&#xff0c;可以把所有客户信息录入系统&#xff0c;进行维护和统计功能。可通过文件的方式保存相关录入数据&#xff0c;对…...

4. TypeScript 类型推断与类型组合

一、类型推断 (一) 什么是类型推断 TypeScript 的类型推断会根据变量、函数返回值、对象和数组的赋值和使用方式&#xff0c;自动确定它们的类型。 这一特性减少了显式类型注解的需要&#xff0c;在保持类型安全的同时简化了代码。通过分析上下文和初始值&#xff0c;TypeSc…...

Spring Security 认证流程——补充

一、认证流程概述 Spring Security 的认证流程基于 过滤器链&#xff08;Filter Chain&#xff09;&#xff0c;核心组件包括 UsernamePasswordAuthenticationFilter、AuthenticationManager、UserDetailsService 等。整个流程可分为以下步骤&#xff1a; 用户提交登录请求拦…...