From d02af591007287933cc677df1f898e9c4d37b734 Mon Sep 17 00:00:00 2001 From: NTG_Lenovo Date: Mon, 21 Jul 2025 16:56:58 +0900 Subject: [PATCH] =?UTF-8?q?Message=20Ui=EC=97=90=EC=84=9C=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=EB=90=A0=20=ED=98=84=EC=A7=80=ED=99=94=20=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20Importer?= =?UTF-8?q?=20=EC=A0=80=EC=9E=A5=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Localization/LocalizationImporter.cs | 31 ++++++++++++++----- .../Localization/LocalizationManager.cs | 1 + 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationImporter.cs b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationImporter.cs index 9d8a212da..5432f7c85 100644 --- a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationImporter.cs +++ b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationImporter.cs @@ -13,9 +13,19 @@ public static class LocalizationImporter public static async void ImportAllFromSheet(string webAppUrl) { string json = await GoogleSheetWebClient.Get(webAppUrl); - if (string.IsNullOrEmpty(json)) return; + if (string.IsNullOrEmpty(json)) + { + Debug.LogError("[Localization Import] Google Sheet로부터 데이터를 가져오지 못했습니다."); + return; + } var payload = JsonConvert.DeserializeObject(json); + if (payload == null || payload.Tables == null || payload.Tables.Count == 0) + { + Debug.LogWarning("[Localization Import] 불러온 데이터가 비어있습니다."); + return; + } + foreach (var kv in payload.Tables) { string tableName = kv.Key; @@ -29,27 +39,34 @@ public static async void ImportAllFromSheet(string webAppUrl) } var shared = collection.SharedData; + EditorUtility.SetDirty(shared); // ✅ SharedData 저장 대상 표시 foreach (var row in rows) { - if (!row.TryGetValue("Key", out var key)) continue; + if (!row.TryGetValue("Key", out var key) || string.IsNullOrEmpty(key)) continue; + var sharedEntry = shared.GetEntry(key) ?? shared.AddKey(key); foreach (var localeCode in row.Keys) { if (localeCode == "Key") continue; + var table = collection.GetTable(localeCode) as StringTable; - if (table == null) continue; + if (table == null) + { + Debug.LogWarning($"[Localization] Table '{tableName}'의 로케일 '{localeCode}' 테이블이 존재하지 않습니다."); + continue; + } table.AddEntry(sharedEntry.Id, row[localeCode]); - EditorUtility.SetDirty(table); + EditorUtility.SetDirty(table); // ✅ StringTable 저장 대상 표시 } } - - AssetDatabase.SaveAssets(); } - Debug.Log("[Localization Import] 완료"); + AssetDatabase.SaveAssets(); // ✅ 변경사항 저장 + + Debug.Log("[Localization Import] 완료: Google Sheet → Unity"); } } } diff --git a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs index eccd25c8d..4ada9b995 100644 --- a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs +++ b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs @@ -8,6 +8,7 @@ public enum TableName None = 0, Item_Name, Item_Description, + Global_Message, } public static class LocalizationManager