浏览代码

Merge branch 'pr/290' into QuestSystem

/main
uChema 4 年前
当前提交
4995dad7
共有 43 个文件被更改,包括 1092 次插入0 次删除
  1. 1
      UOP1_Project/Assets/AddressableAssetsData/AddressableAssetSettings.asset
  2. 14
      UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Localization-AssetTables.asset
  3. 108
      UOP1_Project/Assets/Dialogue Test Shared Data.asset
  4. 8
      UOP1_Project/Assets/Dialogue Test Shared Data.asset.meta
  5. 103
      UOP1_Project/Assets/Dialogue Test .asset
  6. 8
      UOP1_Project/Assets/Dialogue Test .asset.meta
  7. 102
      UOP1_Project/Assets/Dialogue Test _en.asset
  8. 8
      UOP1_Project/Assets/Dialogue Test _en.asset.meta
  9. 102
      UOP1_Project/Assets/Dialogue Test _fr.asset
  10. 8
      UOP1_Project/Assets/Dialogue Test _fr.asset.meta
  11. 8
      UOP1_Project/Assets/Samples.meta
  12. 69
      UOP1_Project/Assets/Scripts/Localization/LocalizeComponent_TMProFont.cs
  13. 11
      UOP1_Project/Assets/Scripts/Localization/LocalizeComponent_TMProFont.cs.meta
  14. 22
      UOP1_Project/Assets/Scripts/Localization/LocalizeTMProFontEvent.cs
  15. 11
      UOP1_Project/Assets/Scripts/Localization/LocalizeTMProFontEvent.cs.meta
  16. 43
      UOP1_Project/Assets/Localization Files/Asset Tables/Font Shared Data.asset
  17. 8
      UOP1_Project/Assets/Localization Files/Asset Tables/Font Shared Data.asset.meta
  18. 22
      UOP1_Project/Assets/Localization Files/Asset Tables/Font.asset
  19. 8
      UOP1_Project/Assets/Localization Files/Asset Tables/Font.asset.meta
  20. 26
      UOP1_Project/Assets/Localization Files/Asset Tables/Font_en.asset
  21. 8
      UOP1_Project/Assets/Localization Files/Asset Tables/Font_en.asset.meta
  22. 26
      UOP1_Project/Assets/Localization Files/Asset Tables/Font_fr.asset
  23. 8
      UOP1_Project/Assets/Localization Files/Asset Tables/Font_fr.asset.meta
  24. 8
      UOP1_Project/Assets/Samples/Localization.meta
  25. 8
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview.meta
  26. 8
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings.meta
  27. 5
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/.sample.json
  28. 82
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LoadingMultipleStringsExample.cs
  29. 11
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LoadingMultipleStringsExample.cs.meta
  30. 30
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LocalizedStringGetLocalizedStringExample.cs
  31. 11
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LocalizedStringGetLocalizedStringExample.cs.meta
  32. 60
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LocalizedStringTableExample.cs
  33. 11
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LocalizedStringTableExample.cs.meta
  34. 39
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LocalizedStringWithChangeHandlerExample.cs
  35. 11
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LocalizedStringWithChangeHandlerExample.cs.meta
  36. 65
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/StringDatabaseGetLocalizedStringExample.cs
  37. 11
      UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/StringDatabaseGetLocalizedStringExample.cs.meta

1
UOP1_Project/Assets/AddressableAssetsData/AddressableAssetSettings.asset


- Locale
- Locale-en
- Locale-fr
- Locale-fr-CA
m_SchemaTemplates: []
m_GroupTemplateObjects:
- {fileID: 11400000, guid: fe9282c98cc504273a9fba4fb229bdb0, type: 2}

14
UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Localization-AssetTables.asset


- Locale-fr
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: a62ba054b698fc24090a707e8e9048e8
m_Address: Font_en
m_ReadOnly: 1
m_SerializedLabels:
- Locale-en
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 3d877e937ae7de543af7762f2d26c871
m_Address: Font_fr
m_ReadOnly: 1
m_SerializedLabels:
- Locale-fr
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
m_ReadOnly: 1
m_Settings: {fileID: 11400000, guid: bffab80dc16c4464b92b2e97b6a1964c, type: 2}
m_SchemaSet:

108
UOP1_Project/Assets/Dialogue Test Shared Data.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5b11a58205ec3474ca216360e9fa74a8, type: 3}
m_Name: Dialogue Test Shared Data
m_EditorClassIdentifier:
m_TableCollectionName: 'Dialogue Test '
m_TableCollectionNameGuidString: fa861d4d052e86c4182bff8b7cbbe4e2
m_Entries:
- m_Id: 238002416508928
m_Key: SD-L1-S1-Q1-QL1
m_Metadata:
m_Items: []
- m_Id: 238002471034880
m_Key: SD-L2-S1-Q1-QL1
m_Metadata:
m_Items: []
- m_Id: 238002471034881
m_Key: SD-L1-S2-Q1-QL1
m_Metadata:
m_Items: []
- m_Id: 238002471034882
m_Key: SD-L1-S1-Q2-QL1
m_Metadata:
m_Items: []
- m_Id: 238002471034883
m_Key: SD-L2-S1-Q2-QL1
m_Metadata:
m_Items: []
- m_Id: 238002471034884
m_Key: SD-L1-S2-Q2-QL1
m_Metadata:
m_Items: []
- m_Id: 238002471034885
m_Key: SD-L1-S3-Q2-QL1
m_Metadata:
m_Items: []
- m_Id: 238002475229184
m_Key: SD-L1-S1-Q3-QL1
m_Metadata:
m_Items: []
- m_Id: 238002475229185
m_Key: SD-L1-S2-Q3-QL1
m_Metadata:
m_Items: []
- m_Id: 238002475229186
m_Key: SD-L1-S1-Q1-QL2
m_Metadata:
m_Items: []
- m_Id: 238002475229187
m_Key: SD-L1-S2-Q1-QL2
m_Metadata:
m_Items: []
- m_Id: 238002475229188
m_Key: SD-L1-S3-Q1-QL2
m_Metadata:
m_Items: []
- m_Id: 238002475229189
m_Key: CD-L1-S2-Q2-QL1
m_Metadata:
m_Items: []
- m_Id: 238002475229190
m_Key: ID-L1-S2-Q2-QL1
m_Metadata:
m_Items: []
- m_Id: 238002475229191
m_Key: CD-L1-S2-Q3-QL1
m_Metadata:
m_Items: []
- m_Id: 238002475229192
m_Key: ID-L1-S2-Q3-QL1
m_Metadata:
m_Items: []
- m_Id: 238002475229193
m_Key: CD-L1-S2-Q1-QL2
m_Metadata:
m_Items: []
- m_Id: 238002475229194
m_Key: ID-L1-S2-Q1-QL2
m_Metadata:
m_Items: []
- m_Id: 238002475229195
m_Key: CD-L1-S3-Q1-QL2
m_Metadata:
m_Items: []
- m_Id: 238002475229196
m_Key: ID-L1-S3-Q1-QL2
m_Metadata:
m_Items: []
m_Metadata:
m_Items: []
m_KeyGenerator:
id: 0
references:
version: 1
00000000:
type: {class: DistributedUIDGenerator, ns: UnityEngine.Localization.Tables,
asm: Unity.Localization}
data:
m_CustomEpoch: 1611657466880

8
UOP1_Project/Assets/Dialogue Test Shared Data.asset.meta


fileFormatVersion: 2
guid: fa861d4d052e86c4182bff8b7cbbe4e2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

103
UOP1_Project/Assets/Dialogue Test .asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5be51871efa6c3e4eae1703925c8f5ac, type: 3}
m_Name: 'Dialogue Test '
m_EditorClassIdentifier:
m_SharedTableData: {fileID: 11400000, guid: fa861d4d052e86c4182bff8b7cbbe4e2, type: 2}
m_Tables:
- {fileID: 11400000, guid: 79571eb7079cad446bd934159ccaf7b1, type: 2}
- {fileID: 11400000, guid: 5f70dc3e7ec41734fa501915805982e2, type: 2}
m_Extensions:
- id: 0
- id: 1
- id: 2
m_Group: String Table
references:
version: 1
00000000:
type: {class: GoogleSheetsExtension, ns: UnityEditor.Localization.Plugins.Google,
asm: Unity.Localization.Editor}
data:
m_Collection: {fileID: 11400000}
m_SheetsServiceProvider: {fileID: 11400000, guid: 048784966300e0f418f4fb2c6af7efb3,
type: 2}
m_SpreadsheetId: 1luF1JYM54a-2ijKBRV8cuqDki0C7qENoCGYJurP2YcY
m_SheetId: 1626946536
m_Columns:
- id: 3
- id: 4
m_RemoveMissingPulledKeys: 0
00000001:
type: {class: GoogleSheetsExtension, ns: UnityEditor.Localization.Plugins.Google,
asm: Unity.Localization.Editor}
data:
m_Collection: {fileID: 11400000}
m_SheetsServiceProvider: {fileID: 11400000, guid: 048784966300e0f418f4fb2c6af7efb3,
type: 2}
m_SpreadsheetId: 1luF1JYM54a-2ijKBRV8cuqDki0C7qENoCGYJurP2YcY
m_SheetId: 1626946536
m_Columns:
- id: 5
- id: 6
m_RemoveMissingPulledKeys: 0
00000002:
type: {class: GoogleSheetsExtension, ns: UnityEditor.Localization.Plugins.Google,
asm: Unity.Localization.Editor}
data:
m_Collection: {fileID: 11400000}
m_SheetsServiceProvider: {fileID: 11400000, guid: 048784966300e0f418f4fb2c6af7efb3,
type: 2}
m_SpreadsheetId: 1luF1JYM54a-2ijKBRV8cuqDki0C7qENoCGYJurP2YcY
m_SheetId: 1626946536
m_Columns:
- id: 7
- id: 8
m_RemoveMissingPulledKeys: 1
00000003:
type: {class: KeyColumn, ns: UnityEditor.Localization.Plugins.Google.Columns,
asm: Unity.Localization.Editor}
data:
m_Column: A
00000004:
type: {class: LocaleColumn, ns: UnityEditor.Localization.Plugins.Google.Columns,
asm: Unity.Localization.Editor}
data:
m_Column: B
m_LocaleIdentifier:
m_Code: en
m_IncludeComments: 0
00000005:
type: {class: KeyColumn, ns: UnityEditor.Localization.Plugins.Google.Columns,
asm: Unity.Localization.Editor}
data:
m_Column: A
00000006:
type: {class: LocaleColumn, ns: UnityEditor.Localization.Plugins.Google.Columns,
asm: Unity.Localization.Editor}
data:
m_Column: C
m_LocaleIdentifier:
m_Code: fr
m_IncludeComments: 0
00000007:
type: {class: KeyColumn, ns: UnityEditor.Localization.Plugins.Google.Columns,
asm: Unity.Localization.Editor}
data:
m_Column: A
00000008:
type: {class: LocaleColumn, ns: UnityEditor.Localization.Plugins.Google.Columns,
asm: Unity.Localization.Editor}
data:
m_Column: D
m_LocaleIdentifier:
m_Code:
m_IncludeComments: 0

8
UOP1_Project/Assets/Dialogue Test .asset.meta


fileFormatVersion: 2
guid: 26c4e2c8019ac074b957c74bc18cf52e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

102
UOP1_Project/Assets/Dialogue Test _en.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e9620f8c34305754d8cc9a7e49e852d9, type: 3}
m_Name: Dialogue Test _en
m_EditorClassIdentifier:
m_LocaleId:
m_Code: en
m_SharedData: {fileID: 11400000, guid: fa861d4d052e86c4182bff8b7cbbe4e2, type: 2}
m_Metadata:
m_Items: []
m_TableData:
- m_Id: 238002416508928
m_Localized: Hello
m_Metadata:
m_Items: []
- m_Id: 238002471034880
m_Localized: Welcome to the beach
m_Metadata:
m_Items: []
- m_Id: 238002471034881
m_Localized: Here's a knife for you!
m_Metadata:
m_Items: []
- m_Id: 238002471034882
m_Localized: Hello there
m_Metadata:
m_Items: []
- m_Id: 238002471034883
m_Localized: 'Can you look for some tomatoes please? '
m_Metadata:
m_Items: []
- m_Id: 238002471034884
m_Localized: Did you find the tomatoes?
m_Metadata:
m_Items: []
- m_Id: 238002471034885
m_Localized: 'Here''s a Tomato soup recipe for you '
m_Metadata:
m_Items: []
- m_Id: 238002475229184
m_Localized: Hello, My name is Earl
m_Metadata:
m_Items: []
- m_Id: 238002475229185
m_Localized: 'Do you want a mixer? '
m_Metadata:
m_Items: []
- m_Id: 238002475229186
m_Localized: Hello Welcome to town
m_Metadata:
m_Items: []
- m_Id: 238002475229187
m_Localized: 'Do you know how to cook a tomato soup ? '
m_Metadata:
m_Items: []
- m_Id: 238002475229188
m_Localized: 'Do you have the tomato soup ? '
m_Metadata:
m_Items: []
- m_Id: 238002475229189
m_Localized: Perfect!
m_Metadata:
m_Items: []
- m_Id: 238002475229190
m_Localized: No problem, come back when you find some !
m_Metadata:
m_Items: []
- m_Id: 238002475229191
m_Localized: Here you go
m_Metadata:
m_Items: []
- m_Id: 238002475229192
m_Localized: Okey come back when you want it
m_Metadata:
m_Items: []
- m_Id: 238002475229193
m_Localized: Can you bring me some?
m_Metadata:
m_Items: []
- m_Id: 238002475229194
m_Localized: Okey come back when you know how to do it.
m_Metadata:
m_Items: []
- m_Id: 238002475229195
m_Localized: Awesome ! It tastes so good !
m_Metadata:
m_Items: []
- m_Id: 238002475229196
m_Localized: No problem, come back when you have it.
m_Metadata:
m_Items: []
references:
version: 1

8
UOP1_Project/Assets/Dialogue Test _en.asset.meta


fileFormatVersion: 2
guid: 79571eb7079cad446bd934159ccaf7b1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

102
UOP1_Project/Assets/Dialogue Test _fr.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e9620f8c34305754d8cc9a7e49e852d9, type: 3}
m_Name: Dialogue Test _fr
m_EditorClassIdentifier:
m_LocaleId:
m_Code: fr
m_SharedData: {fileID: 11400000, guid: fa861d4d052e86c4182bff8b7cbbe4e2, type: 2}
m_Metadata:
m_Items: []
m_TableData:
- m_Id: 238002416508928
m_Localized: Bonjour
m_Metadata:
m_Items: []
- m_Id: 238002471034880
m_Localized: "Bienvenue \xE0 la plage"
m_Metadata:
m_Items: []
- m_Id: 238002471034881
m_Localized: Voici un couteau pour vous
m_Metadata:
m_Items: []
- m_Id: 238002471034882
m_Localized: Bonjour toi !
m_Metadata:
m_Items: []
- m_Id: 238002471034883
m_Localized: Est ce que tu peux me trouver quelques tomates?
m_Metadata:
m_Items: []
- m_Id: 238002471034884
m_Localized: "As tu trouv\xE9 les tomates?"
m_Metadata:
m_Items: []
- m_Id: 238002471034885
m_Localized: Voici une recette pour de la soupe de tomates
m_Metadata:
m_Items: []
- m_Id: 238002475229184
m_Localized: Salut, Moi c'est Earl
m_Metadata:
m_Items: []
- m_Id: 238002475229185
m_Localized: 'Est ce que tu as un mixeur? '
m_Metadata:
m_Items: []
- m_Id: 238002475229186
m_Localized: Bienvenue au village
m_Metadata:
m_Items: []
- m_Id: 238002475229187
m_Localized: "Est ce que tu sais pr\xE9parer de la soupe de tomate"
m_Metadata:
m_Items: []
- m_Id: 238002475229188
m_Localized: Est ce que tu as la soupe de tomate?
m_Metadata:
m_Items: []
- m_Id: 238002475229189
m_Localized: Parfait !
m_Metadata:
m_Items: []
- m_Id: 238002475229190
m_Localized: "Pas de probl\xE8me revenez quand vous en aurez ! "
m_Metadata:
m_Items: []
- m_Id: 238002475229191
m_Localized: Voila pour vous!
m_Metadata:
m_Items: []
- m_Id: 238002475229192
m_Localized: Ok, revenez quand vous voudrez en avoir
m_Metadata:
m_Items: []
- m_Id: 238002475229193
m_Localized: 'Est ce que tu peux m''en ramener? '
m_Metadata:
m_Items: []
- m_Id: 238002475229194
m_Localized: D'accord, revenez quand vous saurez!
m_Metadata:
m_Items: []
- m_Id: 238002475229195
m_Localized: Parfait! C'est trop bon!
m_Metadata:
m_Items: []
- m_Id: 238002475229196
m_Localized: "Pas de probl\xE8me revenez quand vous en aurez ! "
m_Metadata:
m_Items: []
references:
version: 1

8
UOP1_Project/Assets/Dialogue Test _fr.asset.meta


fileFormatVersion: 2
guid: 5f70dc3e7ec41734fa501915805982e2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

8
UOP1_Project/Assets/Samples.meta


fileFormatVersion: 2
guid: 3a69d685627722244924a5d565f0e34f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

69
UOP1_Project/Assets/Scripts/Localization/LocalizeComponent_TMProFont.cs


using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Localization.Components;
namespace UnityEditor.Localization.Plugins.TMPro
{
internal static class LocalizeComponent_TMProFont
{
[MenuItem("CONTEXT/TextMeshProUGUI/Localize String And Font")]
static void LocalizeTMProText(MenuCommand command)
{
var target = command.context as TextMeshProUGUI;
SetupForStringLocalization(target);
SetupForFontLocalization(target);
}
public static MonoBehaviour SetupForStringLocalization(TextMeshProUGUI target)
{
//Avoid adding the component multiple times
if (target.GetComponent<LocalizeStringEvent>() != null)
return null;
var comp = Undo.AddComponent(target.gameObject, typeof(LocalizeStringEvent)) as LocalizeStringEvent;
var setStringMethod = target.GetType().GetProperty("text").GetSetMethod();
var methodDelegate = System.Delegate.CreateDelegate(typeof(UnityAction<string>), target, setStringMethod) as UnityAction<string>;
Events.UnityEventTools.AddPersistentListener(comp.OnUpdateString, methodDelegate);
const int kMatchThreshold = 5;
var foundKey = LocalizationEditorSettings.FindSimilarKey(target.text);
if (foundKey.collection != null && foundKey.matchDistance < kMatchThreshold)
{
comp.StringReference.TableEntryReference = foundKey.entry.Id;
comp.StringReference.TableReference = foundKey.collection.TableCollectionNameReference;
}
return null;
}
public static MonoBehaviour SetupForFontLocalization(TextMeshProUGUI target)
{
//Avoid adding the component multiple times
if (target.GetComponent<LocalizeTMProFontEvent>() != null)
return null;
var comp = Undo.AddComponent(target.gameObject, typeof(LocalizeTMProFontEvent)) as LocalizeTMProFontEvent;
var setFontMethod = target.GetType().GetProperty("font").GetSetMethod();
var methodDelegate = System.Delegate.CreateDelegate(typeof(UnityAction<TMP_FontAsset>), target, setFontMethod) as UnityAction<TMP_FontAsset>;
Events.UnityEventTools.AddPersistentListener(comp.OnUpdateAsset, methodDelegate);
//Find font table and set it up automatically
var collections = LocalizationEditorSettings.GetAssetTableCollections();
foreach (var tableCollection in collections)
{
if (tableCollection.name == "Fonts")
{
comp.AssetReference.TableReference = tableCollection.TableCollectionNameReference;
foreach (var entry in tableCollection.SharedData.Entries)
{
if (entry.Key == "font")
comp.AssetReference.TableEntryReference = entry.Id;
}
}
}
return null;
}
}
}

11
UOP1_Project/Assets/Scripts/Localization/LocalizeComponent_TMProFont.cs.meta


fileFormatVersion: 2
guid: a568b6cd30782a04d891cb0bca6a64a1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
UOP1_Project/Assets/Scripts/Localization/LocalizeTMProFontEvent.cs


using System;
using TMPro;
using UnityEngine.Events;
namespace UnityEngine.Localization.Components
{
/// <summary>
/// Component that can be used to Localize a TMP_FontAsset asset.
/// </summary>
[AddComponentMenu("Localization/Asset/Localize TMPro Font Event")]
public class LocalizeTMProFontEvent : LocalizedAssetEvent<TMP_FontAsset, LocalizedTMProFont, UnityEventFont>
{
}
[Serializable]
public class LocalizedTMProFont : LocalizedAsset<TMP_FontAsset>{ }
[Serializable]
public class UnityEventFont : UnityEvent<TMP_FontAsset> { }
}

11
UOP1_Project/Assets/Scripts/Localization/LocalizeTMProFontEvent.cs.meta


fileFormatVersion: 2
guid: d4e8edcf3197e7e409c5a72a3a934676
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

43
UOP1_Project/Assets/Localization Files/Asset Tables/Font Shared Data.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5b11a58205ec3474ca216360e9fa74a8, type: 3}
m_Name: Font Shared Data
m_EditorClassIdentifier:
m_TableCollectionName: Font
m_TableCollectionNameGuidString: 6a8afeec30be61d4bb23618ac27c2736
m_Entries:
- m_Id: 7520247808
m_Key: Font
m_Metadata:
m_Items: []
m_Metadata:
m_Items:
- id: 0
m_KeyGenerator:
id: 1
references:
version: 1
00000000:
type: {class: AssetTypeMetadata, ns: UnityEngine.Localization.Metadata, asm: Unity.Localization}
data:
m_Entries:
- m_KeyId: 7520247808
m_TableCodes:
- en
- fr
m_TypeString: UnityEngine.Font, UnityEngine.TextRenderingModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
00000001:
type: {class: DistributedUIDGenerator, ns: UnityEngine.Localization.Tables,
asm: Unity.Localization}
data:
m_CustomEpoch: 1611670537164

8
UOP1_Project/Assets/Localization Files/Asset Tables/Font Shared Data.asset.meta


fileFormatVersion: 2
guid: 6a8afeec30be61d4bb23618ac27c2736
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

22
UOP1_Project/Assets/Localization Files/Asset Tables/Font.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4db626ad063b13545924a9839ac5fa83, type: 3}
m_Name: Font
m_EditorClassIdentifier:
m_SharedTableData: {fileID: 11400000, guid: 6a8afeec30be61d4bb23618ac27c2736, type: 2}
m_Tables:
- {fileID: 11400000, guid: a62ba054b698fc24090a707e8e9048e8, type: 2}
- {fileID: 11400000, guid: 3d877e937ae7de543af7762f2d26c871, type: 2}
m_Extensions: []
m_Group: Asset Table
references:
version: 1

8
UOP1_Project/Assets/Localization Files/Asset Tables/Font.asset.meta


fileFormatVersion: 2
guid: 4a7b303049746814fbdd5ea8fcb242c8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

26
UOP1_Project/Assets/Localization Files/Asset Tables/Font_en.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 97269afb30aa84742ae3f3342603618a, type: 3}
m_Name: Font_en
m_EditorClassIdentifier:
m_LocaleId:
m_Code: en
m_SharedData: {fileID: 11400000, guid: 6a8afeec30be61d4bb23618ac27c2736, type: 2}
m_Metadata:
m_Items: []
m_TableData:
- m_Id: 7520247808
m_Localized: e3265ab4bf004d28a9537516768c1c75
m_Metadata:
m_Items: []
references:
version: 1

8
UOP1_Project/Assets/Localization Files/Asset Tables/Font_en.asset.meta


fileFormatVersion: 2
guid: a62ba054b698fc24090a707e8e9048e8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

26
UOP1_Project/Assets/Localization Files/Asset Tables/Font_fr.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 97269afb30aa84742ae3f3342603618a, type: 3}
m_Name: Font_fr
m_EditorClassIdentifier:
m_LocaleId:
m_Code: fr
m_SharedData: {fileID: 11400000, guid: 6a8afeec30be61d4bb23618ac27c2736, type: 2}
m_Metadata:
m_Items: []
m_TableData:
- m_Id: 7520247808
m_Localized: e3265ab4bf004d28a9537516768c1c75
m_Metadata:
m_Items: []
references:
version: 1

8
UOP1_Project/Assets/Localization Files/Asset Tables/Font_fr.asset.meta


fileFormatVersion: 2
guid: 3d877e937ae7de543af7762f2d26c871
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

8
UOP1_Project/Assets/Samples/Localization.meta


fileFormatVersion: 2
guid: 3a0ffe2c62aecbf40b759a45bfc73991
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
UOP1_Project/Assets/Samples/Localization/0.9.0-preview.meta


fileFormatVersion: 2
guid: dc939dfef0b373946ba98f3d963cada9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings.meta


fileFormatVersion: 2
guid: 0bdd9cfc436714c4984e234306db1245
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

5
UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/.sample.json


{
"displayName": "Loading Strings",
"description": "This sample shows multiple ways to fetch localized strings from the Localization system.",
"createSeparatePackage": false
}

82
UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LoadingMultipleStringsExample.cs


using System.Collections;
using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
using UnityEngine.Localization.Tables;
using UnityEngine.ResourceManagement.AsyncOperations;
namespace UnityEditor.Localization.Samples
{
/// <summary>
/// This example shows how a <see cref="StringTable"/> can be used directly in order to get translated strings for multiple entries.
/// <seealso cref="LocalizedStringTableExample"/>
/// </summary>
public class LoadingMultipleStringsExample : MonoBehaviour
{
// A LocalizedStringReference provides a simple interface to retrieving translated strings and their tables.
public string stringTableCollectionName = "My Strings";
// We will cache our translated strings
string m_TranslatedStringHello;
string m_TranslatedStringGoodbye;
string m_TranslatedStringThisIsATest;
void OnEnable()
{
// During initialization we start a request for the string and subscribe to any locale change events so that we can update the strings in the future.
StartCoroutine(LoadStrings());
LocalizationSettings.SelectedLocaleChanged += OnSelectedLocaleChanged;
}
void OnDisable()
{
LocalizationSettings.SelectedLocaleChanged -= OnSelectedLocaleChanged;
}
void OnSelectedLocaleChanged(Locale obj)
{
StartCoroutine(LoadStrings());
}
IEnumerator LoadStrings()
{
// A string table may not be immediately available such as during initialization of the localization system or when a table has not been loaded yet.
var loadingOperation = LocalizationSettings.StringDatabase.GetTableAsync(stringTableCollectionName);
yield return loadingOperation;
if (loadingOperation.Status == AsyncOperationStatus.Succeeded)
{
var stringTable = loadingOperation.Result;
m_TranslatedStringThisIsATest = GetLocalizedString(stringTable, "This is a test");
m_TranslatedStringHello = GetLocalizedString(stringTable, "Hello");
m_TranslatedStringGoodbye = GetLocalizedString(stringTable, "Goodbye");
}
else
{
Debug.LogError("Could not load String Table\n" + loadingOperation.OperationException.ToString());
}
}
string GetLocalizedString(StringTable table, string entryName)
{
// Get the table entry. The entry contains the localized string and Metadata
var entry = table.GetEntry(entryName);
return entry.GetLocalizedString(); // We can pass in optional arguments for Smart Format or String.Format here
}
void OnGUI()
{
// We can check if the localization system is ready using the InitializationOperation.
// Initialization involves loading locales and optionally preloading localized data for the current locale.
if (!LocalizationSettings.InitializationOperation.IsDone)
{
GUILayout.Label("Initializing Localization");
return;
}
GUILayout.Label(m_TranslatedStringThisIsATest);
GUILayout.Label(m_TranslatedStringHello);
GUILayout.Label(m_TranslatedStringGoodbye);
}
}
}

11
UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LoadingMultipleStringsExample.cs.meta


fileFormatVersion: 2
guid: 77ab5f1c88b311f468572c9131f8c04e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

30
UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LocalizedStringGetLocalizedStringExample.cs


using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.ResourceManagement.AsyncOperations;
namespace UnityEditor.Localization.Samples
{
/// <summary>
/// This example shows how to use GetLocalizedString to retrieve a localized string.
/// </summary>
public class LocalizedStringGetLocalizedStringExample : MonoBehaviour
{
// A LocalizedString provides an interface to retrieving translated strings.
// This example assumes a String Table Collection with the name "My String Table" and an entry with the Key "Hello World" exists.
// You can change the Table Collection and Entry target in the inspector.
public LocalizedString stringRef;
void OnGUI()
{
// This will make a request to the StringDatabase each time using the LocalizedString properties.
var stringOperation = stringRef.GetLocalizedString();
if (stringOperation.IsDone && stringOperation.Status == AsyncOperationStatus.Succeeded)
GUILayout.Label(stringOperation.Result);
}
private void Start()
{
stringRef = new LocalizedString() { TableReference = "QuestlineDialogue", TableEntryReference = "SD-L1-S1-Q1-QL1" };
}
}
}

11
UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LocalizedStringGetLocalizedStringExample.cs.meta


fileFormatVersion: 2
guid: a8a93043a9567c444af4dd0d7fa44993
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

60
UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LocalizedStringTableExample.cs


using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
using UnityEngine.Localization.Tables;
namespace UnityEditor.Localization.Samples
{
/// <summary>
/// This example shows how a <see cref="StringTable"> can be used directly in order to get translated
/// strings for multiple entries using a <see cref="LocalizedStringTable>"/>.
/// </summary>
public class LocalizedStringTableExample : MonoBehaviour
{
public LocalizedStringTable stringTable = new LocalizedStringTable { TableReference = "My Strings" };
// We will cache our translated strings
string m_TranslatedStringHello;
string m_TranslatedStringGoodbye;
string m_TranslatedStringThisIsATest;
void OnEnable()
{
stringTable.TableChanged += LoadStrings;
}
void OnDisable()
{
stringTable.TableChanged -= LoadStrings;
}
void LoadStrings(StringTable stringTable)
{
m_TranslatedStringHello = GetLocalizedString(stringTable, "Hello");
m_TranslatedStringGoodbye = GetLocalizedString(stringTable, "Goodbye");
m_TranslatedStringThisIsATest = GetLocalizedString(stringTable, "This is a test");
}
static string GetLocalizedString(StringTable table, string entryName)
{
// Get the table entry. The entry contains the localized string and Metadata
var entry = table.GetEntry(entryName);
return entry.GetLocalizedString(); // We can pass in optional arguments for Smart Format or String.Format here.
}
void OnGUI()
{
// We can check if the localization system is ready using the InitializationOperation.
// Initialization involves loading locales and optionally preloading localized data for the current locale.
if (!LocalizationSettings.InitializationOperation.IsDone)
{
GUILayout.Label("Initializing Localization");
return;
}
GUILayout.Label(m_TranslatedStringThisIsATest);
GUILayout.Label(m_TranslatedStringHello);
GUILayout.Label(m_TranslatedStringGoodbye);
}
}
}

11
UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LocalizedStringTableExample.cs.meta


fileFormatVersion: 2
guid: f14bcb214c6b8ac47b373e6dff94fd2c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

39
UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LocalizedStringWithChangeHandlerExample.cs


using UnityEngine;
using UnityEngine.Localization;
namespace UnityEditor.Localization.Samples
{
/// <summary>
/// This sample shows how to use the LocalizedString ChangeHandler to get a notification whenever a new translated string is available.
/// This method is suited to dealing with static strings that will not change during game play for the selected Locale.
/// </summary>
public class LocalizedStringWithChangeHandlerExample : MonoBehaviour
{
// A LocalizedString provides an interface to retrieving translated strings.
// This example assumes a String Table Collection with the name "My String Table" and an entry with the Key "Hello World" exists.
// You can change the Table Collection and Entry target in the inspector.
public LocalizedString stringRef = new LocalizedString() { TableReference = "My String Table", TableEntryReference = "Hello World" };
string m_TranslatedString;
void OnEnable()
{
stringRef.StringChanged += UpdateString;
}
void OnDisable()
{
stringRef.StringChanged -= UpdateString;
}
void UpdateString(string translatedValue)
{
m_TranslatedString = translatedValue;
Debug.Log("Translated Value Updated: " + translatedValue);
}
void OnGUI()
{
GUILayout.Label(m_TranslatedString);
}
}
}

11
UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/LocalizedStringWithChangeHandlerExample.cs.meta


fileFormatVersion: 2
guid: c817f651d855b4242945e9291e2c8347
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

65
UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/StringDatabaseGetLocalizedStringExample.cs


using System.Collections;
using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
using UnityEngine.ResourceManagement.AsyncOperations;
namespace UnityEditor.Localization.Samples
{
/// <summary>
/// This example shows how to get a localized string using the StringDatabase.
/// This example also shows some of the ways to wait for an AsyncOperationHandle to complete.
/// </summary>
public class StringDatabaseGetLocalizedStringExample : MonoBehaviour
{
public bool useCoroutine;
void OnEnable()
{
LocalizationSettings.SelectedLocaleChanged += SelectedLocaleChanged;
UpdateString();
}
void OnDisable()
{
LocalizationSettings.SelectedLocaleChanged -= SelectedLocaleChanged;
}
void SelectedLocaleChanged(Locale locale)
{
UpdateString();
}
void UpdateString()
{
// Sometimes the localized value may not be immediately available.
// The Localization system may not have been initialized yet or the String Table may need loading.
// The AsyncOperation wraps this loading operation. We can yield on it in a coroutine,
// use its various Completed Events or await its Task if using async and await.
var stringOperation = LocalizationSettings.StringDatabase.GetLocalizedStringAsync("UI", "Start Game");
if (stringOperation.IsDone)
SetString(stringOperation);
if (useCoroutine)
StartCoroutine(LoadStringWithCoroutine(stringOperation));
else
stringOperation.Completed += SetString;
}
IEnumerator LoadStringWithCoroutine(AsyncOperationHandle<string> stringOperation)
{
yield return stringOperation;
SetString(stringOperation);
}
void SetString(AsyncOperationHandle<string> stringOperation)
{
// Its possible that something may have gone wrong during loading. We can handle this locally
// or ignore all errors as they will still be captured and reported by the Localization system.
if (stringOperation.Status == AsyncOperationStatus.Failed)
Debug.LogError("Failed to load string");
else
Debug.Log("Loaded String: " + stringOperation.Result);
}
}
}

11
UOP1_Project/Assets/Samples/Localization/0.9.0-preview/Loading Strings/StringDatabaseGetLocalizedStringExample.cs.meta


fileFormatVersion: 2
guid: e7be19f5637c7e746bab0a3fdd67788c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存