Commit b4a38642 authored by SherryChaos's avatar SherryChaos

change all cs encode to UTF-8 without BOM

parent fdef8452
root = true
[*.cs]
charset = utf-8
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -537,8 +537,8 @@ MonoBehaviour: ...@@ -537,8 +537,8 @@ MonoBehaviour:
text: {fileID: 1398959084} text: {fileID: 1398959084}
input: {fileID: 1775272994} input: {fileID: 1775272994}
mode_Window: 0 mode_Window: 0
mode_Android: 1 mode_Android: 0
mode_IOS: 0 mode_IOS: 1
fullCopy: 0 fullCopy: 0
--- !u!114 &916768208 --- !u!114 &916768208
MonoBehaviour: MonoBehaviour:
......
...@@ -7960,7 +7960,7 @@ RectTransform: ...@@ -7960,7 +7960,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0} m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 599.99994, y: 0} m_AnchoredPosition: {x: 600, y: 0}
m_SizeDelta: {x: 600, y: 0} m_SizeDelta: {x: 600, y: 0}
m_Pivot: {x: 1, y: 0.5} m_Pivot: {x: 1, y: 0.5}
--- !u!114 &1850716665 --- !u!114 &1850716665
......
...@@ -3,9 +3,9 @@ using UnityEditor; ...@@ -3,9 +3,9 @@ using UnityEditor;
public class AssetFinderWindow : EditorWindow public class AssetFinderWindow : EditorWindow
{ {
private string searchGUID = ""; private string searchGUID = string.Empty;
private UnityEngine.Object foundAsset; private UnityEngine.Object foundAsset;
private string searchMessage = ""; private string searchMessage = string.Empty;
private MessageType messageType; private MessageType messageType;
[MenuItem("Tools/Asset Finder by GUID")] [MenuItem("Tools/Asset Finder by GUID")]
...@@ -20,51 +20,51 @@ public class AssetFinderWindow : EditorWindow ...@@ -20,51 +20,51 @@ public class AssetFinderWindow : EditorWindow
EditorGUILayout.LabelField("Asset Finder by GUID", EditorStyles.boldLabel); EditorGUILayout.LabelField("Asset Finder by GUID", EditorStyles.boldLabel);
GUILayout.Space(10); GUILayout.Space(10);
// 显示当前选中资源的GUID // 显示当前选中资源的GUID
DrawSelectedAssetInfo(); DrawSelectedAssetInfo();
GUILayout.Space(20); GUILayout.Space(20);
EditorGUILayout.LabelField("查找资源", EditorStyles.boldLabel); EditorGUILayout.LabelField("查找资源", EditorStyles.boldLabel);
// 输入GUID // 输入GUID
EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("输入GUID:", GUILayout.Width(80)); EditorGUILayout.LabelField("输入GUID:", GUILayout.Width(80));
searchGUID = EditorGUILayout.TextField(searchGUID); searchGUID = EditorGUILayout.TextField(searchGUID);
EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal();
GUILayout.Space(10); GUILayout.Space(10);
// 查找按钮 // 查找按钮
if (GUILayout.Button("通过GUID查找资源", GUILayout.Height(30))) if (GUILayout.Button("通过GUID查找资源", GUILayout.Height(30)))
{ {
FindAssetByGUID(); FindAssetByGUID();
} }
// 显示查找消息 // 显示查找消息
if (!string.IsNullOrEmpty(searchMessage)) if (!string.IsNullOrEmpty(searchMessage))
{ {
EditorGUILayout.HelpBox(searchMessage, messageType); EditorGUILayout.HelpBox(searchMessage, messageType);
} }
// 显示找到的资源 // 显示找到的资源
if (foundAsset != null) if (foundAsset != null)
{ {
GUILayout.Space(10); GUILayout.Space(10);
EditorGUILayout.LabelField("找到的资源:"); EditorGUILayout.LabelField("找到的资源:");
EditorGUILayout.ObjectField(foundAsset, foundAsset.GetType(), false); EditorGUILayout.ObjectField(foundAsset, foundAsset.GetType(), false);
EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("在Project窗口中定位")) if (GUILayout.Button("在Project窗口中定位"))
{ {
Selection.activeObject = foundAsset; Selection.activeObject = foundAsset;
EditorGUIUtility.PingObject(foundAsset); EditorGUIUtility.PingObject(foundAsset);
} }
if (GUILayout.Button("复制资源路径")) if (GUILayout.Button("复制资源路径"))
{ {
string path = AssetDatabase.GetAssetPath(foundAsset); string path = AssetDatabase.GetAssetPath(foundAsset);
EditorGUIUtility.systemCopyBuffer = path; EditorGUIUtility.systemCopyBuffer = path;
ShowNotification(new GUIContent("路径已复制到剪贴板")); ShowNotification(new GUIContent("路径已复制到剪贴板"));
} }
EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal();
} }
...@@ -77,28 +77,28 @@ public class AssetFinderWindow : EditorWindow ...@@ -77,28 +77,28 @@ public class AssetFinderWindow : EditorWindow
string path = AssetDatabase.GetAssetPath(Selection.activeObject); string path = AssetDatabase.GetAssetPath(Selection.activeObject);
string guid = AssetDatabase.AssetPathToGUID(path); string guid = AssetDatabase.AssetPathToGUID(path);
EditorGUILayout.LabelField("当前选中资源:"); EditorGUILayout.LabelField("当前选中资源:");
EditorGUILayout.ObjectField(Selection.activeObject, Selection.activeObject.GetType(), false); EditorGUILayout.ObjectField(Selection.activeObject, Selection.activeObject.GetType(), false);
EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("GUID:", GUILayout.Width(40)); EditorGUILayout.LabelField("GUID:", GUILayout.Width(40));
EditorGUILayout.TextField(guid); EditorGUILayout.TextField(guid);
if (GUILayout.Button("复制", GUILayout.Width(40))) if (GUILayout.Button("复制", GUILayout.Width(40)))
{ {
EditorGUIUtility.systemCopyBuffer = guid; EditorGUIUtility.systemCopyBuffer = guid;
ShowNotification(new GUIContent("GUID已复制到剪贴板")); ShowNotification(new GUIContent("GUID已复制到剪贴板"));
} }
EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("路径:", GUILayout.Width(40)); EditorGUILayout.LabelField("路径:", GUILayout.Width(40));
EditorGUILayout.TextField(path); EditorGUILayout.TextField(path);
if (GUILayout.Button("复制", GUILayout.Width(40))) if (GUILayout.Button("复制", GUILayout.Width(40)))
{ {
EditorGUIUtility.systemCopyBuffer = path; EditorGUIUtility.systemCopyBuffer = path;
ShowNotification(new GUIContent("路径已复制到剪贴板")); ShowNotification(new GUIContent("路径已复制到剪贴板"));
} }
EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal();
} }
...@@ -108,18 +108,18 @@ public class AssetFinderWindow : EditorWindow ...@@ -108,18 +108,18 @@ public class AssetFinderWindow : EditorWindow
{ {
if (string.IsNullOrEmpty(searchGUID)) if (string.IsNullOrEmpty(searchGUID))
{ {
searchMessage = "请输入GUID"; searchMessage = "请输入GUID";
messageType = MessageType.Error; messageType = MessageType.Error;
return; return;
} }
// 移除可能的前后空格 // 移除可能的前后空格
searchGUID = searchGUID.Trim(); searchGUID = searchGUID.Trim();
// 验证GUID格式 // 验证GUID格式
if (searchGUID.Length != 32) if (searchGUID.Length != 32)
{ {
searchMessage = "GUID格式不正确,应为32个字符"; searchMessage = "GUID格式不正确,应为32个字符";
messageType = MessageType.Error; messageType = MessageType.Error;
foundAsset = null; foundAsset = null;
return; return;
...@@ -129,7 +129,7 @@ public class AssetFinderWindow : EditorWindow ...@@ -129,7 +129,7 @@ public class AssetFinderWindow : EditorWindow
if (string.IsNullOrEmpty(assetPath)) if (string.IsNullOrEmpty(assetPath))
{ {
searchMessage = "未找到对应GUID的资源"; searchMessage = "未找到对应GUID的资源";
messageType = MessageType.Error; messageType = MessageType.Error;
foundAsset = null; foundAsset = null;
return; return;
...@@ -139,12 +139,12 @@ public class AssetFinderWindow : EditorWindow ...@@ -139,12 +139,12 @@ public class AssetFinderWindow : EditorWindow
if (foundAsset != null) if (foundAsset != null)
{ {
searchMessage = "资源查找成功!"; searchMessage = "资源查找成功!";
messageType = MessageType.Info; messageType = MessageType.Info;
} }
else else
{ {
searchMessage = "找到路径但无法加载资源"; searchMessage = "找到路径但无法加载资源";
messageType = MessageType.Error; messageType = MessageType.Error;
} }
} }
......
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.IO;
public class CheckFolderAssetReferences : EditorWindow public class CheckFolderAssetReferences : EditorWindow
{ {
...@@ -11,22 +9,22 @@ public class CheckFolderAssetReferences : EditorWindow ...@@ -11,22 +9,22 @@ public class CheckFolderAssetReferences : EditorWindow
private List<string> zeroReferenceAssets = new List<string>(); private List<string> zeroReferenceAssets = new List<string>();
private Vector2 scrollPosition; private Vector2 scrollPosition;
[MenuItem("Assets/检查文件夹引用情况", false, 106)] [MenuItem("Assets/检查文件夹引用情况", false, 106)]
private static void CheckFolderReferences() private static void CheckFolderReferences()
{ {
string folderPath = AssetDatabase.GetAssetPath(Selection.activeObject); string folderPath = AssetDatabase.GetAssetPath(Selection.activeObject);
if (!AssetDatabase.IsValidFolder(folderPath)) if (!AssetDatabase.IsValidFolder(folderPath))
{ {
EditorUtility.DisplayDialog("错误", "请选择一个有效的文件夹", "确定"); EditorUtility.DisplayDialog("错误", "请选择一个有效的文件夹", "确定");
return; return;
} }
CheckFolderAssetReferences window = GetWindow<CheckFolderAssetReferences>("资产引用检查器"); CheckFolderAssetReferences window = GetWindow<CheckFolderAssetReferences>("资产引用检查器");
window.targetFolderPath = folderPath; window.targetFolderPath = folderPath;
window.AnalyzeReferences(); window.AnalyzeReferences();
} }
[MenuItem("Assets/检查文件夹引用情况", true, 106)] [MenuItem("Assets/检查文件夹引用情况", true, 106)]
private static bool ValidateCheckFolderReferences() private static bool ValidateCheckFolderReferences()
{ {
return Selection.activeObject != null && return Selection.activeObject != null &&
...@@ -38,11 +36,11 @@ public class CheckFolderAssetReferences : EditorWindow ...@@ -38,11 +36,11 @@ public class CheckFolderAssetReferences : EditorWindow
referenceCounts.Clear(); referenceCounts.Clear();
zeroReferenceAssets.Clear(); zeroReferenceAssets.Clear();
// 获取文件夹内所有资产 // 获取文件夹内所有资产
string[] allAssetGUIDs = AssetDatabase.FindAssets("", new[] { targetFolderPath }); string[] allAssetGUIDs = AssetDatabase.FindAssets("", new[] { targetFolderPath });
Dictionary<string, List<string>> referenceCache = new Dictionary<string, List<string>>(); Dictionary<string, List<string>> referenceCache = new Dictionary<string, List<string>>();
// 构建全局引用缓存 // 构建全局引用缓存
string[] allProjectGUIDs = AssetDatabase.FindAssets(""); string[] allProjectGUIDs = AssetDatabase.FindAssets("");
int total = allProjectGUIDs.Length; int total = allProjectGUIDs.Length;
int current = 0; int current = 0;
...@@ -52,17 +50,17 @@ public class CheckFolderAssetReferences : EditorWindow ...@@ -52,17 +50,17 @@ public class CheckFolderAssetReferences : EditorWindow
current++; current++;
string assetPath = AssetDatabase.GUIDToAssetPath(guid); string assetPath = AssetDatabase.GUIDToAssetPath(guid);
// 跳过非Assets文件和非目标文件夹内的文件 // 跳过非Assets文件和非目标文件夹内的文件
if (!assetPath.StartsWith("Assets/")) continue; if (!assetPath.StartsWith("Assets/")) continue;
EditorUtility.DisplayProgressBar("分析引用关系", EditorUtility.DisplayProgressBar("分析引用关系",
$"扫描中... ({current}/{total})", (float)current / total); $"扫描中... ({current}/{total})", (float)current / total);
string[] dependencies = AssetDatabase.GetDependencies(assetPath, false); string[] dependencies = AssetDatabase.GetDependencies(assetPath, false);
foreach (string dependency in dependencies) foreach (string dependency in dependencies)
{ {
if (dependency == assetPath) continue; // 跳过自身引用 if (dependency == assetPath) continue; // 跳过自身引用
if (!referenceCache.ContainsKey(dependency)) if (!referenceCache.ContainsKey(dependency))
referenceCache[dependency] = new List<string>(); referenceCache[dependency] = new List<string>();
...@@ -71,7 +69,7 @@ public class CheckFolderAssetReferences : EditorWindow ...@@ -71,7 +69,7 @@ public class CheckFolderAssetReferences : EditorWindow
} }
} }
// 计算目标文件夹内资产的引用次数 // 计算目标文件夹内资产的引用次数
foreach (string guid in allAssetGUIDs) foreach (string guid in allAssetGUIDs)
{ {
string assetPath = AssetDatabase.GUIDToAssetPath(guid); string assetPath = AssetDatabase.GUIDToAssetPath(guid);
...@@ -88,13 +86,13 @@ public class CheckFolderAssetReferences : EditorWindow ...@@ -88,13 +86,13 @@ public class CheckFolderAssetReferences : EditorWindow
private void OnGUI() private void OnGUI()
{ {
EditorGUILayout.LabelField($"目标文件夹: {targetFolderPath}", EditorStyles.boldLabel); EditorGUILayout.LabelField($"目标文件夹: {targetFolderPath}", EditorStyles.boldLabel);
if (GUILayout.Button("重新分析")) if (GUILayout.Button("重新分析"))
AnalyzeReferences(); AnalyzeReferences();
EditorGUILayout.Space(); EditorGUILayout.Space();
EditorGUILayout.LabelField($"零引用资产 ({zeroReferenceAssets.Count}):", EditorStyles.boldLabel); EditorGUILayout.LabelField($"零引用资产 ({zeroReferenceAssets.Count}个):", EditorStyles.boldLabel);
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
...@@ -102,18 +100,18 @@ public class CheckFolderAssetReferences : EditorWindow ...@@ -102,18 +100,18 @@ public class CheckFolderAssetReferences : EditorWindow
{ {
EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal();
// 显示资产对象字段 // 显示资产对象字段
Object asset = AssetDatabase.LoadAssetAtPath<Object>(assetPath); Object asset = AssetDatabase.LoadAssetAtPath<Object>(assetPath);
EditorGUILayout.ObjectField(asset, typeof(Object), false, GUILayout.Width(300)); EditorGUILayout.ObjectField(asset, typeof(Object), false, GUILayout.Width(300));
// 显示路径标签 // 显示路径标签
EditorGUILayout.LabelField(assetPath, GUILayout.Width(400)); EditorGUILayout.LabelField(assetPath, GUILayout.Width(400));
// 删除按钮 // 删除按钮
if (GUILayout.Button("删除", GUILayout.Width(60))) if (GUILayout.Button("删除", GUILayout.Width(60)))
{ {
if (EditorUtility.DisplayDialog("确认删除", if (EditorUtility.DisplayDialog("确认删除",
$"确定要删除 {assetPath} 吗?", "删除", "取消")) $"确定要删除 {assetPath} 吗?", "删除", "取消"))
{ {
AssetDatabase.DeleteAsset(assetPath); AssetDatabase.DeleteAsset(assetPath);
zeroReferenceAssets.Remove(assetPath); zeroReferenceAssets.Remove(assetPath);
......
using UnityEditor;
using UnityEngine;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
public class EncodingChecker : EditorWindow
{
private List<string> nonUTF8Files = new List<string>();
private Vector2 scrollPos;
[MenuItem("Tools/编码检测/检查非UTF-8脚本")]
private static void ShowWindow() => GetWindow<EncodingChecker>("脚本编码检测器");
private void OnGUI()
{
if (GUILayout.Button("扫描.cs文件(排除Packages)", GUILayout.Height(30)))
ScanScripts();
if (nonUTF8Files.Count > 0)
{
GUILayout.Space(10);
GUILayout.Label($"发现 {nonUTF8Files.Count} 个非UTF-8文件:");
scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
foreach (var file in nonUTF8Files)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(file);
if (GUILayout.Button("用VS打开", GUILayout.Width(80)))
OpenInVS(file);
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndScrollView();
if (GUILayout.Button("一键转换为UTF-8 without BOM", GUILayout.Height(30)))
ConvertAllToUTF8();
}
else
{
GUILayout.Label("✅ 所有脚本均为UTF-8 without BOM格式");
}
}
// 扫描并排除Packages目录
private void ScanScripts()
{
nonUTF8Files.Clear();
string[] allScripts = AssetDatabase.FindAssets("t:Script");
int total = allScripts.Length;
for (int i = 0; i < total; i++)
{
string guid = allScripts[i];
string path = AssetDatabase.GUIDToAssetPath(guid);
// 排除Packages目录
if (path.StartsWith("Packages/") || path.EndsWith(".dll"))
continue;
if (path.Contains("/Demigiant/"))
continue;
if (path.Contains("/Windbot/"))
continue;
if (path.StartsWith("Assets/Tools/"))
continue;
if (path.StartsWith("Assets/Scripts/YGOSharp"))
continue;
if (EditorUtility.DisplayCancelableProgressBar(
"扫描中...",
$"检测: {Path.GetFileName(path)} ({i + 1}/{total})",
(float)i / total))
break;
if (!IsUTF8WithoutBOM(path))
nonUTF8Files.Add(path);
}
EditorUtility.ClearProgressBar();
}
// 检测UTF-8 without BOM
private bool IsUTF8WithoutBOM(string path)
{
try
{
byte[] bytes = File.ReadAllBytes(path);
// 排除带BOM的文件
if (bytes.Length >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF)
return false;
// 验证是否为合法UTF-8
return IsValidUTF8(bytes);
}
catch { return false; }
}
// UTF-8字节流验证算法
private bool IsValidUTF8(byte[] bytes)
{
int i = 0;
while (i < bytes.Length)
{
if ((bytes[i] & 0x80) == 0x00) i++; // 单字节
else if ((bytes[i] & 0xE0) == 0xC0) // 双字节
{
if (i + 1 >= bytes.Length || (bytes[i + 1] & 0xC0) != 0x80)
return false;
i += 2;
}
else if ((bytes[i] & 0xF0) == 0xE0) // 三字节
{
if (i + 2 >= bytes.Length ||
(bytes[i + 1] & 0xC0) != 0x80 ||
(bytes[i + 2] & 0xC0) != 0x80)
return false;
i += 3;
}
else if ((bytes[i] & 0xF8) == 0xF0) // 四字节
{
if (i + 3 >= bytes.Length ||
(bytes[i + 1] & 0xC0) != 0x80 ||
(bytes[i + 2] & 0xC0) != 0x80 ||
(bytes[i + 3] & 0xC0) != 0x80)
return false;
i += 4;
}
else return false;
}
return true;
}
// 用VS打开文件(支持VS Code)
private void OpenInVS(string filePath)
{
string fullPath = Path.GetFullPath(filePath);
// 优先尝试Visual Studio
if (File.Exists(@"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe"))
Process.Start("devenv.exe", $"/Edit \"{fullPath}\"");
// 备用方案:用VS Code打开
else
Process.Start("code", $"\"{fullPath}\"");
}
// 安全转换编码(保留原内容)
private void ConvertAllToUTF8()
{
foreach (string path in nonUTF8Files)
{
// 使用系统编码读取(兼容中文)
string content = File.ReadAllText(path, Encoding.Default);
// 写入为无BOM的UTF-8
File.WriteAllText(path, content, new UTF8Encoding(false));
}
AssetDatabase.Refresh();
UnityEngine.Debug.Log($"已转换 {nonUTF8Files.Count} 个文件");
nonUTF8Files.Clear();
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 7df65366de38df645adfc351a23dc7b7
\ No newline at end of file
...@@ -7,37 +7,37 @@ public class MissingShaderFinder : EditorWindow ...@@ -7,37 +7,37 @@ public class MissingShaderFinder : EditorWindow
{ {
private List<Material> _materialsWithMissingShader = new List<Material>(); private List<Material> _materialsWithMissingShader = new List<Material>();
[MenuItem("Tools/检查丢失Shader的材质")] [MenuItem("Tools/检查丢失Shader的材质")]
public static void ShowWindow() public static void ShowWindow()
{ {
GetWindow<MissingShaderFinder>("丢失Shader的材质列表"); GetWindow<MissingShaderFinder>("丢失Shader的材质列表");
} }
void OnGUI() void OnGUI()
{ {
if (GUILayout.Button("扫描项目", GUILayout.Height(40))) if (GUILayout.Button("扫描项目", GUILayout.Height(40)))
{ {
FindMaterialsWithMissingShader(); FindMaterialsWithMissingShader();
} }
GUILayout.Label($"发现 {_materialsWithMissingShader.Count} 个材质丢失Shader:"); GUILayout.Label($"发现 {_materialsWithMissingShader.Count} 个材质丢失Shader:");
scrollPos = EditorGUILayout.BeginScrollView(scrollPos); scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
foreach (Material mat in _materialsWithMissingShader) foreach (Material mat in _materialsWithMissingShader)
{ {
EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal();
// 显示材质名称和路径 // 显示材质名称和路径
EditorGUILayout.ObjectField(mat, typeof(Material), false); EditorGUILayout.ObjectField(mat, typeof(Material), false);
// 定位按钮 // 定位按钮
if (GUILayout.Button("定位", GUILayout.Width(60))) if (GUILayout.Button("定位", GUILayout.Width(60)))
{ {
Selection.activeObject = mat; Selection.activeObject = mat;
EditorGUIUtility.PingObject(mat); EditorGUIUtility.PingObject(mat);
} }
// 修复按钮 // 修复按钮
if (GUILayout.Button("修复(Standard)", GUILayout.Width(80))) if (GUILayout.Button("修复(Standard)", GUILayout.Width(80)))
{ {
FixShader(mat, Shader.Find("Standard")); FixShader(mat, Shader.Find("Standard"));
} }
...@@ -71,7 +71,7 @@ public class MissingShaderFinder : EditorWindow ...@@ -71,7 +71,7 @@ public class MissingShaderFinder : EditorWindow
Undo.RecordObject(mat, "Fix Missing Shader"); Undo.RecordObject(mat, "Fix Missing Shader");
mat.shader = replacementShader; mat.shader = replacementShader;
EditorUtility.SetDirty(mat); EditorUtility.SetDirty(mat);
Debug.Log($"已修复材质: {mat.name}", mat); Debug.Log($"已修复材质: {mat.name}", mat);
} }
} }
} }
......
...@@ -20,7 +20,7 @@ public class ScriptReferenceEditor : EditorWindow ...@@ -20,7 +20,7 @@ public class ScriptReferenceEditor : EditorWindow
private string searchFilter = ""; private string searchFilter = "";
private bool caseSensitiveSearch = false; private bool caseSensitiveSearch = false;
[MenuItem("Assets/编辑脚本引用", false, 101)] [MenuItem("Assets/编辑脚本引用", false, 101)]
public static void InspectScriptReferences() public static void InspectScriptReferences()
{ {
var selected = Selection.activeObject; var selected = Selection.activeObject;
...@@ -34,7 +34,7 @@ public class ScriptReferenceEditor : EditorWindow ...@@ -34,7 +34,7 @@ public class ScriptReferenceEditor : EditorWindow
} }
} }
[MenuItem("Assets/编辑脚本引用", true)] [MenuItem("Assets/编辑脚本引用", true)]
private static bool ValidateReplaceStringsInAsset() private static bool ValidateReplaceStringsInAsset()
{ {
return Selection.activeObject != null && return Selection.activeObject != null &&
......
// ScriptReferenceReplacerEditor.cs
using System.IO; using System.IO;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
...@@ -8,25 +7,25 @@ public class ScriptReferenceReplacerEditor : EditorWindow ...@@ -8,25 +7,25 @@ public class ScriptReferenceReplacerEditor : EditorWindow
private ScriptReplacementConfig replacementConfig; private ScriptReplacementConfig replacementConfig;
private Vector2 scrollPosition; private Vector2 scrollPosition;
[MenuItem("Assets/替换脚本引用", false, 102)] [MenuItem("Assets/替换脚本引用", false, 102)]
private static void ReplaceScriptReferences() private static void ReplaceScriptReferences()
{ {
// 首先显示确认弹窗 // 首先显示确认弹窗
bool userConfirmed = EditorUtility.DisplayDialog( bool userConfirmed = EditorUtility.DisplayDialog(
"危险操作确认", // 标题 "危险操作确认", // 标题
$"你确定要进行【替换脚本引用】' 吗?此操作不可逆!\n\n建议提前备份项目。", // 消息 $"你确定要进行【替换脚本引用】' 吗?此操作不可逆!\n\n建议提前备份项目。", // 消息
"继续", // 确定按钮 "继续", // 确定按钮
"取消" // 取消按钮 "取消" // 取消按钮
); );
// 如果用户点击了“取消”,则终止操作 // 如果用户点击了“取消”,则终止操作
if (!userConfirmed) if (!userConfirmed)
{ {
Debug.Log("用户取消了操作。"); Debug.Log("用户取消了操作。");
return; return;
} }
// 尝试查找现有的配置 // 尝试查找现有的配置
string[] configGUIDs = AssetDatabase.FindAssets("t:ScriptReplacementConfig"); string[] configGUIDs = AssetDatabase.FindAssets("t:ScriptReplacementConfig");
ScriptReplacementConfig config = null; ScriptReplacementConfig config = null;
if (configGUIDs.Length > 0) if (configGUIDs.Length > 0)
...@@ -41,12 +40,12 @@ public class ScriptReferenceReplacerEditor : EditorWindow ...@@ -41,12 +40,12 @@ public class ScriptReferenceReplacerEditor : EditorWindow
return; return;
} }
// 处理资产 // 处理资产
var assetPath = AssetDatabase.GetAssetPath(Selection.activeObject); var assetPath = AssetDatabase.GetAssetPath(Selection.activeObject);
ProcessAsset(assetPath, config); ProcessAsset(assetPath, config);
} }
[MenuItem("Assets/替换脚本引用", true)] [MenuItem("Assets/替换脚本引用", true)]
private static bool ValidateReplaceStringsInAsset() private static bool ValidateReplaceStringsInAsset()
{ {
return Selection.activeObject != null && return Selection.activeObject != null &&
...@@ -55,19 +54,19 @@ public class ScriptReferenceReplacerEditor : EditorWindow ...@@ -55,19 +54,19 @@ public class ScriptReferenceReplacerEditor : EditorWindow
private static void ProcessAsset(string assetPath, ScriptReplacementConfig config) private static void ProcessAsset(string assetPath, ScriptReplacementConfig config)
{ {
// 读取资产的文本内容 // 读取资产的文本内容
string assetContent = File.ReadAllText(assetPath); string assetContent = File.ReadAllText(assetPath);
bool modified = false; bool modified = false;
// 遍历所有需要替换的配置 // 遍历所有需要替换的配置
foreach (var pair in config.replacementPairs) foreach (var pair in config.replacementPairs)
{ {
// 构造旧的m_Script行内容 // 构造旧的m_Script行内容
string oldScriptLine = $"m_Script: {{fileID: {pair.oldFileId}, guid: {pair.oldGuid}, type: 3}}"; string oldScriptLine = $"m_Script: {{fileID: {pair.oldFileId}, guid: {pair.oldGuid}, type: 3}}";
// 构造新的m_Script行内容 // 构造新的m_Script行内容
string newScriptLine = $"m_Script: {{fileID: {pair.newFileId}, guid: {pair.newGuid}, type: 3}}"; string newScriptLine = $"m_Script: {{fileID: {pair.newFileId}, guid: {pair.newGuid}, type: 3}}";
// 检查并替换 // 检查并替换
if (assetContent.Contains(oldScriptLine)) if (assetContent.Contains(oldScriptLine))
{ {
assetContent = assetContent.Replace(oldScriptLine, newScriptLine); assetContent = assetContent.Replace(oldScriptLine, newScriptLine);
...@@ -76,7 +75,7 @@ public class ScriptReferenceReplacerEditor : EditorWindow ...@@ -76,7 +75,7 @@ public class ScriptReferenceReplacerEditor : EditorWindow
} }
} }
// 如果内容被修改,写回文件并重新导入资产 // 如果内容被修改,写回文件并重新导入资产
if (modified) if (modified)
{ {
File.WriteAllText(assetPath, assetContent); File.WriteAllText(assetPath, assetContent);
...@@ -89,7 +88,7 @@ public class ScriptReferenceReplacerEditor : EditorWindow ...@@ -89,7 +88,7 @@ public class ScriptReferenceReplacerEditor : EditorWindow
} }
} }
// 提供一个编辑器窗口以便于操作和查看配置(可选) // 提供一个编辑器窗口以便于操作和查看配置(可选)
[MenuItem("Tools/Script Reference Replacer")] [MenuItem("Tools/Script Reference Replacer")]
public static void ShowWindow() public static void ShowWindow()
{ {
...@@ -101,7 +100,7 @@ public class ScriptReferenceReplacerEditor : EditorWindow ...@@ -101,7 +100,7 @@ public class ScriptReferenceReplacerEditor : EditorWindow
GUILayout.Label("Script Reference Replacer Tool", EditorStyles.boldLabel); GUILayout.Label("Script Reference Replacer Tool", EditorStyles.boldLabel);
EditorGUILayout.Space(); EditorGUILayout.Space();
// 允许拖拽赋值 // 允许拖拽赋值
replacementConfig = (ScriptReplacementConfig)EditorGUILayout.ObjectField("Replacement Config", replacementConfig, typeof(ScriptReplacementConfig), false); replacementConfig = (ScriptReplacementConfig)EditorGUILayout.ObjectField("Replacement Config", replacementConfig, typeof(ScriptReplacementConfig), false);
if (replacementConfig == null) if (replacementConfig == null)
......
...@@ -12,28 +12,28 @@ public class StringReplacerEditor : EditorWindow ...@@ -12,28 +12,28 @@ public class StringReplacerEditor : EditorWindow
private bool processTextFiles = true; private bool processTextFiles = true;
private bool processSerializedAssets = true; private bool processSerializedAssets = true;
[MenuItem("Assets/替换字符串", false, 103)] [MenuItem("Assets/替换字符串", false, 103)]
private static void ReplaceStringsInAsset() private static void ReplaceStringsInAsset()
{ {
// 首先显示确认弹窗 // 首先显示确认弹窗
bool userConfirmed = EditorUtility.DisplayDialog( bool userConfirmed = EditorUtility.DisplayDialog(
"危险操作确认", // 标题 "危险操作确认", // 标题
$"你确定要进行【替换字符串】' 吗?此操作不可逆!\n\n建议提前备份项目。", // 消息 $"你确定要进行【替换字符串】' 吗?此操作不可逆!\n\n建议提前备份项目。", // 消息
"继续", // 确定按钮 "继续", // 确定按钮
"取消" // 取消按钮 "取消" // 取消按钮
); );
// 如果用户点击了“取消”,则终止操作 // 如果用户点击了“取消”,则终止操作
if (!userConfirmed) if (!userConfirmed)
{ {
Debug.Log("用户取消了操作。"); Debug.Log("用户取消了操作。");
return; return;
} }
ProcessSelectedAsset(AssetDatabase.GetAssetPath(Selection.activeObject)); ProcessSelectedAsset(AssetDatabase.GetAssetPath(Selection.activeObject));
} }
[MenuItem("Assets/替换字符串", true)] [MenuItem("Assets/替换字符串", true)]
private static bool ValidateReplaceStringsInAsset() private static bool ValidateReplaceStringsInAsset()
{ {
return Selection.activeObject != null && return Selection.activeObject != null &&
...@@ -48,15 +48,15 @@ public class StringReplacerEditor : EditorWindow ...@@ -48,15 +48,15 @@ public class StringReplacerEditor : EditorWindow
private static void ProcessSelectedAsset(string assetPath) private static void ProcessSelectedAsset(string assetPath)
{ {
// 查找配置文件 // 查找配置文件
StringReplacementConfig config = FindConfig(); StringReplacementConfig config = FindConfig();
if (config == null || !config.HasRules()) if (config == null || !config.HasRules())
{ {
Debug.LogError("请先创建StringReplacementConfig并配置替换规则"); Debug.LogError("请先创建StringReplacementConfig并配置替换规则");
return; return;
} }
// 根据文件类型选择处理方法 // 根据文件类型选择处理方法
string extension = Path.GetExtension(assetPath).ToLower(); string extension = Path.GetExtension(assetPath).ToLower();
bool isTextFile = IsTextFileExtension(extension); bool isTextFile = IsTextFileExtension(extension);
bool isSerializedAsset = IsSerializedAssetExtension(extension); bool isSerializedAsset = IsSerializedAssetExtension(extension);
...@@ -73,18 +73,18 @@ public class StringReplacerEditor : EditorWindow ...@@ -73,18 +73,18 @@ public class StringReplacerEditor : EditorWindow
} }
else else
{ {
Debug.LogWarning($"不支持的文件类型: {extension}"); Debug.LogWarning($"不支持的文件类型: {extension}");
return; return;
} }
if (processed) if (processed)
{ {
Debug.Log($"成功处理: {assetPath}"); Debug.Log($"成功处理: {assetPath}");
AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate); AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate);
} }
else else
{ {
Debug.Log($"未找到匹配的字符串: {assetPath}"); Debug.Log($"未找到匹配的字符串: {assetPath}");
} }
} }
...@@ -102,7 +102,7 @@ public class StringReplacerEditor : EditorWindow ...@@ -102,7 +102,7 @@ public class StringReplacerEditor : EditorWindow
{ {
content = content.Replace(rule.findString, rule.replaceString); content = content.Replace(rule.findString, rule.replaceString);
modified = true; modified = true;
Debug.Log($"替换文本: {rule.findString} -> {rule.replaceString}"); Debug.Log($"替换文本: {rule.findString} -> {rule.replaceString}");
} }
} }
...@@ -117,8 +117,8 @@ public class StringReplacerEditor : EditorWindow ...@@ -117,8 +117,8 @@ public class StringReplacerEditor : EditorWindow
private static bool ProcessSerializedAsset(string assetPath, StringReplacementConfig config) private static bool ProcessSerializedAsset(string assetPath, StringReplacementConfig config)
{ {
// 对于序列化资产,我们需要更谨慎的处理 // 对于序列化资产,我们需要更谨慎的处理
// 这里使用Unity的序列化API来安全地修改资产 // 这里使用Unity的序列化API来安全地修改资产
bool modified = false; bool modified = false;
SerializedObject serializedObject = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath(assetPath)[0]); SerializedObject serializedObject = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath(assetPath)[0]);
...@@ -143,7 +143,7 @@ public class StringReplacerEditor : EditorWindow ...@@ -143,7 +143,7 @@ public class StringReplacerEditor : EditorWindow
{ {
property.stringValue = newValue; property.stringValue = newValue;
modified = true; modified = true;
Debug.Log($"替换属性 {property.name}: {originalValue} -> {newValue}"); Debug.Log($"替换属性 {property.name}: {originalValue} -> {newValue}");
} }
} }
} }
...@@ -198,31 +198,31 @@ public class StringReplacerEditor : EditorWindow ...@@ -198,31 +198,31 @@ public class StringReplacerEditor : EditorWindow
private void OnGUI() private void OnGUI()
{ {
GUILayout.Label("字符串批量替换工具", EditorStyles.boldLabel); GUILayout.Label("字符串批量替换工具", EditorStyles.boldLabel);
EditorGUILayout.Space(); EditorGUILayout.Space();
// 配置选择 // 配置选择
config = (StringReplacementConfig)EditorGUILayout.ObjectField("替换配置", config, typeof(StringReplacementConfig), false); config = (StringReplacementConfig)EditorGUILayout.ObjectField("替换配置", config, typeof(StringReplacementConfig), false);
if (config == null) if (config == null)
{ {
EditorGUILayout.HelpBox("请先创建或指定一个StringReplacementConfig资产", MessageType.Warning); EditorGUILayout.HelpBox("请先创建或指定一个StringReplacementConfig资产", MessageType.Warning);
if (GUILayout.Button("创建新配置")) if (GUILayout.Button("创建新配置"))
{ {
CreateNewConfig(); CreateNewConfig();
} }
return; return;
} }
// 处理选项 // 处理选项
EditorGUILayout.Space(); EditorGUILayout.Space();
GUILayout.Label("处理选项", EditorStyles.boldLabel); GUILayout.Label("处理选项", EditorStyles.boldLabel);
processTextFiles = EditorGUILayout.Toggle("处理文本文件", processTextFiles); processTextFiles = EditorGUILayout.Toggle("处理文本文件", processTextFiles);
processSerializedAssets = EditorGUILayout.Toggle("处理序列化资产", processSerializedAssets); processSerializedAssets = EditorGUILayout.Toggle("处理序列化资产", processSerializedAssets);
// 显示和编辑配置 // 显示和编辑配置
EditorGUILayout.Space(); EditorGUILayout.Space();
GUILayout.Label("替换规则配置", EditorStyles.boldLabel); GUILayout.Label("替换规则配置", EditorStyles.boldLabel);
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
SerializedObject serializedConfig = new SerializedObject(config); SerializedObject serializedConfig = new SerializedObject(config);
...@@ -231,9 +231,9 @@ public class StringReplacerEditor : EditorWindow ...@@ -231,9 +231,9 @@ public class StringReplacerEditor : EditorWindow
serializedConfig.ApplyModifiedProperties(); serializedConfig.ApplyModifiedProperties();
EditorGUILayout.EndScrollView(); EditorGUILayout.EndScrollView();
// 操作按钮 // 操作按钮
EditorGUILayout.Space(); EditorGUILayout.Space();
if (GUILayout.Button("处理选中资产")) if (GUILayout.Button("处理选中资产"))
{ {
if (Selection.activeObject != null) if (Selection.activeObject != null)
{ {
...@@ -242,11 +242,11 @@ public class StringReplacerEditor : EditorWindow ...@@ -242,11 +242,11 @@ public class StringReplacerEditor : EditorWindow
} }
else else
{ {
Debug.LogWarning("请先选择一个资产"); Debug.LogWarning("请先选择一个资产");
} }
} }
if (GUILayout.Button("处理文件夹中所有资产")) if (GUILayout.Button("处理文件夹中所有资产"))
{ {
if (Selection.activeObject != null) if (Selection.activeObject != null)
{ {
...@@ -257,7 +257,7 @@ public class StringReplacerEditor : EditorWindow ...@@ -257,7 +257,7 @@ public class StringReplacerEditor : EditorWindow
} }
else else
{ {
Debug.LogWarning("请选择一个文件夹"); Debug.LogWarning("请选择一个文件夹");
} }
} }
} }
...@@ -266,10 +266,10 @@ public class StringReplacerEditor : EditorWindow ...@@ -266,10 +266,10 @@ public class StringReplacerEditor : EditorWindow
private void CreateNewConfig() private void CreateNewConfig()
{ {
string path = EditorUtility.SaveFilePanelInProject( string path = EditorUtility.SaveFilePanelInProject(
"创建替换配置", "创建替换配置",
"StringReplacementConfig", "StringReplacementConfig",
"asset", "asset",
"请输入配置文件名"); "请输入配置文件名");
if (!string.IsNullOrEmpty(path)) if (!string.IsNullOrEmpty(path))
{ {
...@@ -286,11 +286,11 @@ public class StringReplacerEditor : EditorWindow ...@@ -286,11 +286,11 @@ public class StringReplacerEditor : EditorWindow
StringReplacementConfig config = FindConfig(); StringReplacementConfig config = FindConfig();
if (config == null || !config.HasRules()) if (config == null || !config.HasRules())
{ {
Debug.LogError("请先配置替换规则"); Debug.LogError("请先配置替换规则");
return; return;
} }
// 获取文件夹中的所有资产 // 获取文件夹中的所有资产
string[] allFiles = Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories); string[] allFiles = Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories);
int processedCount = 0; int processedCount = 0;
...@@ -314,6 +314,6 @@ public class StringReplacerEditor : EditorWindow ...@@ -314,6 +314,6 @@ public class StringReplacerEditor : EditorWindow
} }
AssetDatabase.Refresh(); AssetDatabase.Refresh();
Debug.Log($"处理完成!共处理了 {processedCount} 个文件"); Debug.Log($"处理完成!共处理了 {processedCount} 个文件");
} }
} }
\ No newline at end of file
This diff is collapsed.
...@@ -336,7 +336,7 @@ namespace MDPro3.Duel ...@@ -336,7 +336,7 @@ namespace MDPro3.Duel
var nextPack = OcgCore.GetNextPackage(); var nextPack = OcgCore.GetNextPackage();
if(nextPack == null) if(nextPack == null)
return UniTask.CompletedTask; return UniTask.CompletedTask;
//ǿ //仅检测盖卡打开
if ((GameMessage)nextPack.Function != GameMessage.Chaining) if ((GameMessage)nextPack.Function != GameMessage.Chaining)
return UniTask.CompletedTask; return UniTask.CompletedTask;
......
...@@ -105,7 +105,7 @@ namespace MDPro3 ...@@ -105,7 +105,7 @@ namespace MDPro3
else else
unitCards = ABLoader.LoadFromFolder<PlayableDirector> unitCards = ABLoader.LoadFromFolder<PlayableDirector>
("MasterDuel/Timeline/Summon/SummonFusion/SummonFusion07445ShowUnitCard0" + materials.Count, true, true); ("MasterDuel/Timeline/Summon/SummonFusion/SummonFusion07445ShowUnitCard0" + materials.Count, true, true);
//TODO: 如果在await之前触发跳过TL,unitCards无法被立即删除 //TODO: 如果在await之前触发跳过TL,unitCards无法被立即删除
} }
// Invocation // Invocation
else if (data.HasType(CardType.Fusion) else if (data.HasType(CardType.Fusion)
......
...@@ -276,9 +276,9 @@ namespace MDPro3.Duel ...@@ -276,9 +276,9 @@ namespace MDPro3.Duel
public static int GetCidDefaultAltCard(int card) public static int GetCidDefaultAltCard(int card)
{ {
var data = CardsManager.Get(card); var data = CardsManager.Get(card);
if (card == 89631139 || data.Alias == 89631139)//۰ if (card == 89631139 || data.Alias == 89631139)//青眼白龙
return 89631141; return 89631141;
if (card == 46986414 || data.Alias == 46986414)//ħʦ if (card == 46986414 || data.Alias == 46986414)//黑魔术师
return 46986417; return 46986417;
return card; return card;
} }
......
...@@ -9,11 +9,11 @@ public class ScriptReplacementConfig : ScriptableObject ...@@ -9,11 +9,11 @@ public class ScriptReplacementConfig : ScriptableObject
[Serializable] [Serializable]
public class ScriptReplacementPair public class ScriptReplacementPair
{ {
public string scriptName; // 脚本名称 public string scriptName; // 脚本名称
public string oldGuid; // 旧的GUID public string oldGuid; // 旧的GUID
public string newGuid; // 新的GUID public string newGuid; // 新的GUID
public long oldFileId; // 旧的FileID public long oldFileId; // 旧的FileID
public long newFileId; // 新的FileID public long newFileId; // 新的FileID
} }
public List<ScriptReplacementPair> replacementPairs = new List<ScriptReplacementPair>(); public List<ScriptReplacementPair> replacementPairs = new List<ScriptReplacementPair>();
......
...@@ -9,15 +9,15 @@ public class StringReplacementConfig : ScriptableObject ...@@ -9,15 +9,15 @@ public class StringReplacementConfig : ScriptableObject
[Serializable] [Serializable]
public class ReplacementRule public class ReplacementRule
{ {
public string findString; // 要查找的字符串 public string findString; // 要查找的字符串
public string replaceString; // 替换成的字符串 public string replaceString; // 替换成的字符串
[Tooltip("是否区分大小写")] [Tooltip("是否区分大小写")]
public bool caseSensitive = true; public bool caseSensitive = true;
} }
public List<ReplacementRule> replacementRules = new List<ReplacementRule>(); public List<ReplacementRule> replacementRules = new List<ReplacementRule>();
// 可选:添加一些实用方法 // 可选:添加一些实用方法
public bool HasRules() public bool HasRules()
{ {
return replacementRules != null && replacementRules.Count > 0; return replacementRules != null && replacementRules.Count > 0;
......
...@@ -59,7 +59,7 @@ namespace MDPro3.Servant ...@@ -59,7 +59,7 @@ namespace MDPro3.Servant
public void StartCurrentPuzzle() public void StartCurrentPuzzle()
{ {
//ֹε //防止多次点击
if (Program.instance.currentServant != Program.instance.puzzle) if (Program.instance.currentServant != Program.instance.puzzle)
return; return;
......
...@@ -11,7 +11,7 @@ namespace MDPro3.UI ...@@ -11,7 +11,7 @@ namespace MDPro3.UI
[RequireComponent(typeof(RawImage))] [RequireComponent(typeof(RawImage))]
public class ArtRawImageHandler : MonoBehaviour public class ArtRawImageHandler : MonoBehaviour
{ {
#region ֶκ #region 字段和属性
public bool cache = true; public bool cache = true;
......
...@@ -12,7 +12,7 @@ namespace MDPro3.UI ...@@ -12,7 +12,7 @@ namespace MDPro3.UI
[RequireComponent(typeof(RawImage))] [RequireComponent(typeof(RawImage))]
public class CardRawImageHandler : MonoBehaviour public class CardRawImageHandler : MonoBehaviour
{ {
#region 字段和属性 #region 字段和属性
public bool cache; public bool cache;
public Card card; public Card card;
...@@ -35,7 +35,7 @@ namespace MDPro3.UI ...@@ -35,7 +35,7 @@ namespace MDPro3.UI
#endregion #endregion
#region Unity生命周期 #region Unity生命周期
protected void OnDestroy() protected void OnDestroy()
{ {
...@@ -47,7 +47,7 @@ namespace MDPro3.UI ...@@ -47,7 +47,7 @@ namespace MDPro3.UI
#endregion #endregion
#region 公共API #region 公共API
public void SetCard(int code) public void SetCard(int code)
{ {
...@@ -127,7 +127,7 @@ namespace MDPro3.UI ...@@ -127,7 +127,7 @@ namespace MDPro3.UI
#endregion #endregion
#region 私有实现 #region 私有实现
private void ReleaseCard() private void ReleaseCard()
{ {
...@@ -186,7 +186,7 @@ namespace MDPro3.UI ...@@ -186,7 +186,7 @@ namespace MDPro3.UI
token); token);
if (card == null || card.Id != targetCardId || loadId != currentLoadId) if (card == null || card.Id != targetCardId || loadId != currentLoadId)
{ {
// 如果卡片已更改,释放刚加载的纹理 // 如果卡片已更改,释放刚加载的纹理
if (cardTex != null) if (cardTex != null)
CardImageLoader.ReleaseCard(card.Id); CardImageLoader.ReleaseCard(card.Id);
...@@ -244,7 +244,7 @@ namespace MDPro3.UI ...@@ -244,7 +244,7 @@ namespace MDPro3.UI
} }
catch (System.OperationCanceledException) catch (System.OperationCanceledException)
{ {
// 任务被取消,不做处理 // 任务被取消,不做处理
} }
} }
......
...@@ -76,7 +76,7 @@ namespace MDPro3.UI.Popup ...@@ -76,7 +76,7 @@ namespace MDPro3.UI.Popup
} }
Manager.GetElement<SelectionButton>("ButtonPack") Manager.GetElement<SelectionButton>("ButtonPack")
.SetButtonText(CardCollectionView.packName == string.Empty .SetButtonText(CardCollectionView.packName == string.Empty
? InterString.Get("有卡包") : CardCollectionView.packName); ? InterString.Get("所有卡包") : CardCollectionView.packName);
} }
public override void Show() public override void Show()
...@@ -221,7 +221,7 @@ namespace MDPro3.UI.Popup ...@@ -221,7 +221,7 @@ namespace MDPro3.UI.Popup
filters.Add(-233); filters.Add(-233);
var btnPack = Manager.GetElement<SelectionButton>("ButtonPack"); var btnPack = Manager.GetElement<SelectionButton>("ButtonPack");
if(btnPack.GetButtonText() != InterString.Get("有卡包")) if(btnPack.GetButtonText() != InterString.Get("所有卡包"))
{ {
dirty = true; dirty = true;
CardCollectionView.packName = btnPack.GetButtonText(); CardCollectionView.packName = btnPack.GetButtonText();
...@@ -254,14 +254,14 @@ namespace MDPro3.UI.Popup ...@@ -254,14 +254,14 @@ namespace MDPro3.UI.Popup
inputScaleTo.text = string.Empty; inputScaleTo.text = string.Empty;
inputYearFrom.text = string.Empty; inputYearFrom.text = string.Empty;
inputYearTo.text = string.Empty; inputYearTo.text = string.Empty;
Manager.GetElement<SelectionButton>("ButtonPack").SetButtonText(InterString.Get("有卡包")); Manager.GetElement<SelectionButton>("ButtonPack").SetButtonText(InterString.Get("所有卡包"));
} }
public void OnPack() public void OnPack()
{ {
var selections = new List<string>() var selections = new List<string>()
{ {
InterString.Get("卡包"), InterString.Get("卡包"),
string.Empty string.Empty
}; };
foreach (var pack in PacksManager.packs) foreach (var pack in PacksManager.packs)
......
...@@ -4,9 +4,9 @@ using System.Collections.Generic; ...@@ -4,9 +4,9 @@ using System.Collections.Generic;
namespace MDPro3.Utility namespace MDPro3.Utility
{ {
/// <summary> /// <summary>
/// 自定义优先级队列实现 /// 自定义优先级队列实现
/// </summary> /// </summary>
/// <typeparam name="T">队列元素类型</typeparam> /// <typeparam name="T">队列元素类型</typeparam>
public class PriorityQueue<T> public class PriorityQueue<T>
{ {
private readonly List<T> data; private readonly List<T> data;
......
...@@ -169,7 +169,7 @@ namespace YgomSystem.UI ...@@ -169,7 +169,7 @@ namespace YgomSystem.UI
crntTime = Mathf.Clamp(time, 0, duration); crntTime = Mathf.Clamp(time, 0, duration);
float t = duration > 0 ? crntTime / duration : 1f; float t = duration > 0 ? crntTime / duration : 1f;
// 处理循环类型 // 处理循环类型
switch (style) switch (style)
{ {
case Style.Loop: case Style.Loop:
...@@ -178,7 +178,7 @@ namespace YgomSystem.UI ...@@ -178,7 +178,7 @@ namespace YgomSystem.UI
case Style.PingPong: case Style.PingPong:
t = Mathf.PingPong(t, 1f); t = Mathf.PingPong(t, 1f);
break; break;
// 其他样式处理... // 其他样式处理...
} }
OnSetValue(GetEasing(t)); OnSetValue(GetEasing(t));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment