- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
76 lines
3.1 KiB
C#
76 lines
3.1 KiB
C#
using UnityEngine;
|
|
using System.IO;
|
|
using UnityEditor;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
/// <summary>
|
|
/// 梳理Resources 和StreamingAssets中的资源文件 并生成资源路径文件
|
|
/// 通过AssetsManager获取资源路径
|
|
/// </summary>
|
|
public class GenerateAssetsConfig :Editor
|
|
{
|
|
/// <summary>
|
|
/// 生成配置文件:创建一个文件,文件中写内容,
|
|
/// 遍历Resources资源文件夹得到路径 *.prefab >>IO
|
|
/// </summary>
|
|
[MenuItem("Tools/Generate Config File/Resources")]
|
|
public static void GenerateResourcesMap()
|
|
{ string path = Path.Combine(Application.dataPath,
|
|
"Resources").Replace(@"\", "/");
|
|
string[] resFiles = Directory.GetFiles(path, "*.*",
|
|
SearchOption.AllDirectories).Where(p=>!p.EndsWith(".meta")).ToArray();
|
|
Dictionary<string, string> resDic = new Dictionary<string, string>();
|
|
for (int i = 0; i < resFiles.Length; i++)
|
|
{ //Hit_Ice_Chest=Skill/HitFx/Hit_Ice_Chest 值 键
|
|
string key = Path.GetFileNameWithoutExtension(resFiles[i]);
|
|
string value = resFiles[i].Replace(@"\", "/").Replace(path + "/", "");
|
|
int index = value.LastIndexOf('.');
|
|
value = value.Remove(index);
|
|
//Replace(".prefab", "");//掐头去尾
|
|
resFiles[i] = key + "=" + value;
|
|
if (!resDic.ContainsKey(key))//记录字典便于查重
|
|
{
|
|
resDic.Add(key, value);
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError($"名称重复的资源{resDic[key]}={value}");
|
|
}
|
|
}
|
|
File.WriteAllLines(Path.Combine(path, "ResMap.txt"), resFiles);
|
|
AssetDatabase.Refresh();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 生成配置文件:创建一个文件,文件中写内容,
|
|
/// 遍历StreamingAssets资源文件夹得到路径 排除.meta 和 .manifest
|
|
/// </summary>
|
|
[MenuItem("Tools/Generate Config File/StreamingAssets")]
|
|
public static void GenerateSAMap()
|
|
{
|
|
string path = Path.Combine(Application.dataPath,
|
|
"StreamingAssets").Replace(@"\", "/");
|
|
string[] resFiles = Directory.GetFiles(path, "*.*",
|
|
SearchOption.AllDirectories).Where(p=>!p.EndsWith(".meta")&&!p.EndsWith(".manifest")).ToArray();//排除Unity自动创建的.meta 和 .manifest文件
|
|
Dictionary<string, string> resDic = new Dictionary<string, string>();
|
|
for (int i = 0; i < resFiles.Length; i++)
|
|
{ //Hit_Ice_Chest=Skill/HitFx/Hit_Ice_Chest 值 键
|
|
string key = Path.GetFileNameWithoutExtension(resFiles[i]);
|
|
string value = resFiles[i].Replace(@"\", "/").Replace(path + "/", "");//掐头
|
|
resFiles[i] = key + "=" + value;
|
|
if (!resDic.ContainsKey(key))//记录字典便于查重
|
|
{
|
|
resDic.Add(key, value);
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError($"名称重复的资源{resDic[key]}={value}");
|
|
}
|
|
}
|
|
File.WriteAllLines(Path.Combine(path, "SAMap.txt"), resFiles);
|
|
AssetDatabase.Refresh();
|
|
}
|
|
}
|