先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
190 lines
7.3 KiB
C#
190 lines
7.3 KiB
C#
//using UnityEngine;
|
|
//using UnityEditor;
|
|
////using UnityEngine.Localization.Tables;
|
|
//using System.Collections.Generic;
|
|
//using System.IO;
|
|
//using UnityEditor.Localization;
|
|
//using System.Linq;
|
|
|
|
//public static class AssetTableEditorUtils
|
|
//{
|
|
// // 从 CSV 导入
|
|
// [MenuItem("Tools/Localization/Import AssetTable")]
|
|
// public static void ImportFrom()
|
|
// {
|
|
// // 显示表格选择对话框
|
|
// var tableCollections = LocalizationEditorSettings.GetAssetTableCollections();
|
|
// var assetTableCollections = new List<AssetTableCollection>();
|
|
|
|
// foreach (var collection in tableCollections)
|
|
// {
|
|
// if (collection is AssetTableCollection assetCollection)
|
|
// {
|
|
// assetTableCollections.Add(assetCollection);
|
|
// }
|
|
// }
|
|
|
|
// if (assetTableCollections.Count == 0)
|
|
// {
|
|
// EditorUtility.DisplayDialog("Error", "No Asset Table Collections found.", "OK");
|
|
// return;
|
|
// }
|
|
|
|
// // 创建选择窗口
|
|
// var selectionWindow = EditorWindow.GetWindow<TableSelectionWindow>();
|
|
// selectionWindow.titleContent = new GUIContent("Select Target Table");
|
|
// selectionWindow.SetCollections(assetTableCollections);
|
|
// selectionWindow.OnTableSelected = (collection) =>
|
|
// {
|
|
// ProcessImport(collection);
|
|
// selectionWindow.Close();
|
|
// };
|
|
// selectionWindow.Show();
|
|
// }
|
|
// public static string assetSrcFolderPath = "Assets/ABPackage/pkgFirstPackage/Fonts/Multilingual_General";
|
|
// public static string assetSrcFolderPath1 = "Assets/ABPackage/pkgDownloads/Fonts/";
|
|
// static string LanguageList = "en,de,fr,es,pt,it,tr,ar,zh-Hans,zh-Hant,ja,ko,pl,nl,ms,th,id";
|
|
// static string LanguagePackList = "Multilingual_General,Multilingual_General,Multilingual_General,Multilingual_General,Multilingual_General,Multilingual_General,Multilingual_General,Multilingual_General,Multilingual_Character,Multilingual_Character,Multilingual_Character,Multilingual_Character,Multilingual_General,Multilingual_General,Multilingual_General,Multilingual_General,Multilingual_General";
|
|
|
|
// private static void ProcessImport(AssetTableCollection collection)
|
|
// {
|
|
// SharedTableData sharedTableData = collection.SharedData;
|
|
// // 创建或获取表格
|
|
// var tables = collection.AssetTables;
|
|
// Dictionary<string, List<string>> keyValuePairs = new Dictionary<string, List<string>>();
|
|
// Dictionary<string, string> LanguagePack = new Dictionary<string, string>();
|
|
// List<string> PackName = new List<string>() { "Multilingual_General" };
|
|
// //获取 assetSrcFolderPath 下所有非mate 文件
|
|
// var Multilingual_General = Directory.GetFiles(assetSrcFolderPath, "*.*", SearchOption.AllDirectories)
|
|
// .Where(file => file.EndsWith(".mat") || file.EndsWith(".asset"))
|
|
// .ToList();
|
|
// keyValuePairs["Multilingual_General"] = Multilingual_General;
|
|
// var languages = LanguageList.Split(',');
|
|
// var languagePacks = LanguagePackList.Split(',');
|
|
// for (int i = 0; i < languages.Length; i++)
|
|
// {
|
|
// LanguagePack[languages[i]] = languagePacks[i];
|
|
// if (!PackName.Contains(languagePacks[i]))
|
|
// {
|
|
// PackName.Add(languagePacks[i]);
|
|
// var Multilingual_Character = Directory.GetFiles(assetSrcFolderPath1 + languagePacks[i], "*.*", SearchOption.AllDirectories)
|
|
// .Where(file => file.EndsWith(".mat") || file.EndsWith(".asset"))
|
|
// .ToList();
|
|
// keyValuePairs[languagePacks[i]] = Multilingual_Character;
|
|
// }
|
|
// }
|
|
// for (int i = 0; i < Multilingual_General.Count; i++)
|
|
// {
|
|
// //获取不带后缀的文件名
|
|
// string name = Path.GetFileNameWithoutExtension(Multilingual_General[i]);
|
|
// var entry = sharedTableData.GetEntry(name);
|
|
// if (entry == null)
|
|
// {
|
|
// sharedTableData.AddKey(name);
|
|
// }
|
|
// }
|
|
// var entries = sharedTableData.Entries;
|
|
|
|
// for (int j = 0; j < tables.Count; j++)
|
|
// {
|
|
// AssetTable table = tables[j];
|
|
// //table.Clear();
|
|
// for (int i = 0; i < entries.Count; i++)
|
|
// {
|
|
// var entrie = entries[i];
|
|
// var entry = table.GetEntry(entrie.Key);
|
|
// string code = table.LocaleIdentifier.Code;
|
|
// var assetPath = LanguagePack[code];
|
|
// //匹配文件名
|
|
// assetPath = keyValuePairs[LanguagePack[code]].FirstOrDefault(path => IsValidAssetPath(path, entrie.Key));
|
|
// if (string.IsNullOrEmpty(assetPath))
|
|
// {
|
|
// Debug.LogError($"No valid asset found for key: {entrie.Key} in language: {code}");
|
|
// continue;
|
|
// }
|
|
// string guid = AssetDatabase.AssetPathToGUID(assetPath);
|
|
// if (entry == null)
|
|
// {
|
|
// entry = table.AddEntry(entrie.Key, guid);
|
|
// }
|
|
// else
|
|
// {
|
|
// entry.Address = guid;
|
|
// }
|
|
// }
|
|
// EditorUtility.SetDirty(table);
|
|
// }
|
|
|
|
// // 保存更改
|
|
// EditorUtility.SetDirty(sharedTableData);
|
|
// EditorUtility.SetDirty(collection);
|
|
// AssetDatabase.SaveAssets();
|
|
// AssetDatabase.Refresh();
|
|
|
|
// EditorUtility.DisplayDialog("Success", " import completed!", "OK");
|
|
// }
|
|
// static bool IsValidAssetPath(string path, string Key)
|
|
// {
|
|
// path = Path.GetFileNameWithoutExtension(path);
|
|
// if (path == Key)
|
|
// {
|
|
// return true;
|
|
// }
|
|
// var Keys = Key.Split('_');
|
|
// var paths = path.Split('_');
|
|
// if (Key == "fangzheng SDF")
|
|
// {
|
|
// return paths[^1] == "content SDF";
|
|
// }
|
|
// if (Key == "en_btn_text SDF")
|
|
// {
|
|
// return paths[^1] == "title SDF";
|
|
// }
|
|
// if (Keys.Length < 2)
|
|
// {
|
|
// return false;
|
|
// }
|
|
// return paths[^1] == Keys[^1] && paths[^2] == Keys[^2];
|
|
// }
|
|
//}
|
|
|
|
//// 表格选择窗口
|
|
//public class TableSelectionWindow : EditorWindow
|
|
//{
|
|
// private List<AssetTableCollection> collections;
|
|
// private AssetTableCollection selectedCollection;
|
|
// public System.Action<AssetTableCollection> OnTableSelected;
|
|
|
|
// public void SetCollections(List<AssetTableCollection> collections)
|
|
// {
|
|
// this.collections = collections;
|
|
// }
|
|
|
|
// private void OnGUI()
|
|
// {
|
|
// EditorGUILayout.LabelField("Select AssetTable Collection", EditorStyles.boldLabel);
|
|
|
|
// if (collections == null || collections.Count == 0)
|
|
// {
|
|
// EditorGUILayout.HelpBox("No collections available.", MessageType.Info);
|
|
// return;
|
|
// }
|
|
|
|
// //选择某个文件夹,获取里面的所有材质
|
|
|
|
|
|
|
|
|
|
|
|
// // 显示集合列表
|
|
// foreach (var collection in collections)
|
|
// {
|
|
// if (GUILayout.Button(collection.name))
|
|
// {
|
|
// selectedCollection = collection;
|
|
// OnTableSelected?.Invoke(selectedCollection);
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|