浏览代码

Merge

/main
uChema 4 年前
当前提交
2aa92a2d
共有 45 个文件被更改,包括 2615 次插入0 次删除
  1. 1
      UOP1_Project/Assets/AddressableAssetsData/AddressableAssetSettings.asset
  2. 14
      UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Localization-AssetTables.asset
  3. 71
      UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Localization-Assets-Shared.asset
  4. 129
      UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Localization-StringTables.asset
  5. 70
      UOP1_Project/Assets/Scripts/Dialogues/DialogueDataSO.cs
  6. 108
      UOP1_Project/Assets/Dialogue Test Shared Data.asset
  7. 8
      UOP1_Project/Assets/Dialogue Test Shared Data.asset.meta
  8. 103
      UOP1_Project/Assets/Dialogue Test .asset
  9. 8
      UOP1_Project/Assets/Dialogue Test .asset.meta
  10. 102
      UOP1_Project/Assets/Dialogue Test _en.asset
  11. 8
      UOP1_Project/Assets/Dialogue Test _en.asset.meta
  12. 102
      UOP1_Project/Assets/Dialogue Test _fr.asset
  13. 8
      UOP1_Project/Assets/Dialogue Test _fr.asset.meta
  14. 43
      UOP1_Project/Assets/Localization Files/Asset Tables/Font Shared Data.asset
  15. 8
      UOP1_Project/Assets/Localization Files/Asset Tables/Font Shared Data.asset.meta
  16. 22
      UOP1_Project/Assets/Localization Files/Asset Tables/Font.asset
  17. 8
      UOP1_Project/Assets/Localization Files/Asset Tables/Font.asset.meta
  18. 26
      UOP1_Project/Assets/Localization Files/Asset Tables/Font_en.asset
  19. 8
      UOP1_Project/Assets/Localization Files/Asset Tables/Font_en.asset.meta
  20. 26
      UOP1_Project/Assets/Localization Files/Asset Tables/Font_fr.asset
  21. 8
      UOP1_Project/Assets/Localization Files/Asset Tables/Font_fr.asset.meta
  22. 8
      UOP1_Project/Assets/Samples.meta
  23. 1001
      UOP1_Project/Assets/Scenes/TestingGround.unity
  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
  38. 312
      UOP1_Project/Assets/Scripts/Quests/QuestAncorSO.cs
  39. 53
      UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/StepSO.cs

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:

71
UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Localization-Assets-Shared.asset


m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
<<<<<<< Updated upstream
=======
- m_GUID: 0a8caeffc79914eb7ae64a269378d203
m_Address: Inventory Item Action Shared Data
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 41b74adf4121a468e9dbe8958eb2f813
m_Address: Inventory Item Name Shared Data
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 63bf683e4210c4e48a201dfa773125d5
m_Address: Inventory Item Description Shared Data
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 7e97a5d681d6e4480b18b504a66e69b2
m_Address: Buttons Shared Data
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: adb8fcb8e38ea48798752fce4b4ed075
m_Address: Recipes Shared Data
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 5654218660b564ff7a2858b08dfbf571
m_Address: Inventory Item Type Shared Data
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 9db3533f1761145a091a919f210c4e94
m_Address: Inventory Tabs Shared Data
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: aa5b18277a15a4113950a3cc2f1e9909
m_Address: Interactions Shared Data
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: fa861d4d052e86c4182bff8b7cbbe4e2
m_Address: Dialogue Test Shared Data
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 6a8afeec30be61d4bb23618ac27c2736
m_Address: Font Shared Data
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: e3265ab4bf004d28a9537516768c1c75
m_Address: LiberationSans
m_ReadOnly: 1
m_SerializedLabels:
- Locale-fr
- Locale-en
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
>>>>>>> Stashed changes
m_ReadOnly: 1
m_Settings: {fileID: 11400000, guid: bffab80dc16c4464b92b2e97b6a1964c, type: 2}
m_SchemaSet:

129
UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Localization-StringTables.asset


- Locale-fr
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
<<<<<<< Updated upstream
=======
- m_GUID: 0d7c1864963414ff180884d706e87219
m_Address: Inventory Item Action_en
m_ReadOnly: 1
m_SerializedLabels:
- Locale-en
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 7f70e48c12dbc4ce0b2e6b49b6836f2d
m_Address: Inventory Item Action_fr
m_ReadOnly: 1
m_SerializedLabels:
- Locale-fr
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: daf77f07b58ca4d25a0fb9e02ee4e326
m_Address: Inventory Item Name_en
m_ReadOnly: 1
m_SerializedLabels:
- Locale-en
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 4e2db78eee23e479393aedf8e3625b46
m_Address: Inventory Item Name_fr
m_ReadOnly: 1
m_SerializedLabels:
- Locale-fr
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: c13e09b5e02c24fd59f5bb58426fddc2
m_Address: Inventory Item Description_en
m_ReadOnly: 1
m_SerializedLabels:
- Locale-en
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 24884a8e6933a4d0cb837cfb28a6439f
m_Address: Inventory Item Description_fr
m_ReadOnly: 1
m_SerializedLabels:
- Locale-fr
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 7b418d2f8c70a4bffabe178921caf86b
m_Address: Buttons_en
m_ReadOnly: 1
m_SerializedLabels:
- Locale-en
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 5e42d58442b78425db9a6b1aca9a9c43
m_Address: Buttons_fr
m_ReadOnly: 1
m_SerializedLabels:
- Locale-fr
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 3e4629403dfbc4366a0e94df84672bf8
m_Address: Recipes_en
m_ReadOnly: 1
m_SerializedLabels:
- Locale-en
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 3d2b06b3cad94450da7907d8ed0245bb
m_Address: Recipes_fr
m_ReadOnly: 1
m_SerializedLabels:
- Locale-fr
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 4607f3ca389c84e05b75bb7fa5236166
m_Address: Inventory Item Type_en
m_ReadOnly: 1
m_SerializedLabels:
- Locale-en
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 0118320ac3ccc4b72bac90ab1f6660d0
m_Address: Inventory Item Type_fr
m_ReadOnly: 1
m_SerializedLabels:
- Locale-fr
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: c1866b8b88fdb418886123a7f6404094
m_Address: Inventory Tabs_en
m_ReadOnly: 1
m_SerializedLabels:
- Locale-en
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 60bc6035c2adb4c9da79f134bd4cebad
m_Address: Inventory Tabs_fr
m_ReadOnly: 1
m_SerializedLabels:
- Locale-fr
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 8c990337c09944296842b163021829c8
m_Address: Interactions_en
m_ReadOnly: 1
m_SerializedLabels:
- Locale-en
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 75a54b82bfa6f4f9e8239e9940432c0d
m_Address: Interactions_fr
m_ReadOnly: 1
m_SerializedLabels:
- Locale-fr
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 79571eb7079cad446bd934159ccaf7b1
m_Address: Dialogue Test _en
m_ReadOnly: 1
m_SerializedLabels:
- Locale-en
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: 5f70dc3e7ec41734fa501915805982e2
m_Address: Dialogue Test _fr
m_ReadOnly: 1
m_SerializedLabels:
- Locale-fr
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
>>>>>>> Stashed changes
m_ReadOnly: 1
m_Settings: {fileID: 11400000, guid: bffab80dc16c4464b92b2e97b6a1964c, type: 2}
m_SchemaSet:

70
UOP1_Project/Assets/Scripts/Dialogues/DialogueDataSO.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Timeline;
<<<<<<< Updated upstream
=======
using UnityEngine.Localization;
using UnityEditor.Localization;
public enum DialogueType
{
startDialogue,
winDialogue,
loseDialogue,
defaultDialogue,
}
public enum ChoiceActionType
{
doNothing,
continueWithStep
>>>>>>> Stashed changes
/// <summary>
/// A Dialogue is a list of consecutive DialogueLines. They play in sequence using the input of the player to skip forward.

//TODO: Add support for branching conversations
// Maybe add 2 (or more) special line slots which represent a choice in a conversation
// Each line would also have an event associated, or another Dialogue
<<<<<<< Updated upstream
=======
private void OnEnable()
{
FindDialogueLines();
}
void FindDialogueLines()
{
int index = 0;
var collection = LocalizationEditorSettings.GetStringTableCollection("NewQuestlineDialogue");
_dialogueLines.Clear();
if (collection != null)
{
LocalizedString _dialogueLine = null;
do
{
index++;
var key = "L" + index + "-" + this.name;
if (collection.SharedData.Contains(key))
{
Debug.Log("found Key " + key);
_dialogueLine = new LocalizedString() { TableReference = "NewQuestlineDialogue", TableEntryReference = key };
_dialogueLines.Add(_dialogueLine);
}
else
{
Debug.Log("No Key " + key);
_dialogueLine = null;
}
} while (_dialogueLine != null);
}
}
}
[Serializable]
public class Choice
{
[SerializeField] private LocalizedString _response = default;
[SerializeField] private DialogueDataSO _nextDialogue = default;
[SerializeField] private ChoiceActionType _actionType = default;
public LocalizedString Response => _response;
public DialogueDataSO NextDialogue => _nextDialogue;
public ChoiceActionType ActionType => _actionType;
>>>>>>> Stashed changes
}

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:

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.meta


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

1001
UOP1_Project/Assets/Scenes/TestingGround.unity
文件差异内容过多而无法显示
查看文件

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:

312
UOP1_Project/Assets/Scripts/Quests/QuestAncorSO.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
[CreateAssetMenu(fileName = "QuestAnchor", menuName = "Quests/QuestAnchor", order = 51)]
public class QuestAncorSO : ScriptableObject
{
[Header("Data")]
[SerializeField] private List<QuestlineSO> _questlines = default;
[SerializeField] private Inventory _inventory = default;
[Header("Linstening to channels")]
[SerializeField] private VoidEventChannelSO _checkStepValidityEvent = default;
[SerializeField] private DialogueDataChannelSO _endDialogueEvent = default;
[Header("Broadcasting on channels")]
[FormerlySerializedAs("_winDialogueEvent")]
[SerializeField] private VoidEventChannelSO _completeDialogueEvent = default;
[FormerlySerializedAs("_loseDialogueEvent")]
[SerializeField] private VoidEventChannelSO _incompleteDialogueEvent = default;
[SerializeField] private ItemEventChannelSO _giveItemEvent = default;
[SerializeField] private ItemEventChannelSO _rewardItemEvent = default;
private QuestSO _currentQuest=null;
private QuestlineSO _currentQuestline;
private StepSO _currentStep;
private int _currentQuestIndex = 0;
private int _currentQuestlineIndex = 0;
private int _currentStepIndex = 0;
public void StartGame()
{//Add code for saved information
if (_checkStepValidityEvent != null)
{
_checkStepValidityEvent.OnEventRaised += CheckStepValidity;
}
if (_endDialogueEvent != null)
{
_endDialogueEvent.OnEventRaised += EndDialogue;
}
StartQuestline();
}
void StartQuestline()
{
if (_questlines != null)
{
if (_questlines.Exists(o => !o.IsDone))
{
_currentQuestlineIndex = _questlines.FindIndex(o => !o.IsDone);
if (_currentQuestlineIndex >= 0)
_currentQuestline = _questlines.Find(o => !o.IsDone);
}
}
}
bool hasStep(ActorSO actorToCheckWith)
{
if(_currentStep!=null)
{
if(_currentStep.Actor== actorToCheckWith)
{
return true;
}
}
return false;
}
bool CheckQuestlineForQuestWithActor(ActorSO actorToCheckWith)
{
if (_currentQuest == null)//check if there's a current quest
{
if (_currentQuestline != null)
{
return _currentQuestline.Quests.Exists(o => !o.IsDone && o.Steps != null && o.Steps[0].Actor == actorToCheckWith);
}
}
return false;
}
public DialogueDataSO InteractWithCharacter(ActorSO actor, bool isCheckValidity, bool isValid)
{
if (_currentQuest == null)
{
if (CheckQuestlineForQuestWithActor(actor))
{
StartQuest(actor);
}
}
if (hasStep(actor))
{
if (isCheckValidity)
{
if (isValid)
{
return _currentStep.CompleteDialogue;
}
else
{
return _currentStep.IncompleteDialogue;
}
}
else
{
return _currentStep.DialogueBeforeStep;
}
}
return null;
}
//When Interacting with a character, we ask the quest manager if there's a quest that starts with a step with a certain character
void StartQuest(ActorSO actorToCheckWith)
{
if (_currentQuest != null)//check if there's a current quest
{
return;
}
if (_currentQuestline != null)
{
//find quest index
_currentQuestIndex = _currentQuestline.Quests.FindIndex(o => !o.IsDone && o.Steps != null && o.Steps[0].Actor == actorToCheckWith);
if ((_currentQuestline.Quests.Count > _currentQuestIndex) && (_currentQuestIndex >= 0))
{
_currentQuest = _currentQuestline.Quests[_currentQuestIndex];
//start Step
_currentStepIndex = 0;
_currentStepIndex = _currentQuest.Steps.FindIndex(o => o.IsDone == false);
if (_currentStepIndex >= 0)
StartStep();
}
}
}
void StartStep()
{
if (_currentQuest.Steps != null)
if (_currentQuest.Steps.Count > _currentStepIndex)
{
_currentStep = _currentQuest.Steps[_currentStepIndex];
}
}
void CheckStepValidity()
{
if (_currentStep != null)
{
switch (_currentStep.Type)
{
case stepType.checkItem:
if (_inventory.Contains(_currentStep.Item))
{
_inventory.Contains(_currentStep.Item);
//Trigger win dialogue
_completeDialogueEvent.RaiseEvent();
}
else
{
//trigger lose dialogue
_incompleteDialogueEvent.RaiseEvent();
}
break;
case stepType.giveItem:
if (_inventory.Contains(_currentStep.Item))
{
_giveItemEvent.RaiseEvent(_currentStep.Item);
_completeDialogueEvent.RaiseEvent();
}
else
{
//trigger lose dialogue
_incompleteDialogueEvent.RaiseEvent();
}
break;
case stepType.rewardItem:
_rewardItemEvent.RaiseEvent(_currentStep.Item);
//no dialogue is needed after Reward Item
if(_currentStep.CompleteDialogue !=null)
{
_completeDialogueEvent.RaiseEvent();
}
else
{
EndStep();
}
break;
case stepType.dialogue:
//dialogue has already been played
if (_currentStep.CompleteDialogue != null)
{
_completeDialogueEvent.RaiseEvent();
}
else
{
EndStep();
}
break;
}
}
}
void EndDialogue(DialogueDataSO dialogue)
{
//depending on the dialogue that ended, do something
switch (dialogue.DialogueType)
{
case DialogueType.winDialogue:
EndStep();
break;
case DialogueType.startDialogue:
CheckStepValidity();
break;
default:
break;
}
}
void EndStep()
{
_currentStep = null;
if (_currentQuest != null)
if (_currentQuest.Steps.Count > _currentStepIndex)
{
_currentQuest.Steps[_currentStepIndex].FinishStep();
if (_currentQuest.Steps.Count > _currentStepIndex + 1)
{
_currentStepIndex++;
StartStep();
}
else
{
EndQuest();
}
}
}
void EndQuest()
{
if (_currentQuest != null)
_currentQuest.FinishQuest();
_currentQuest = null;
_currentQuestIndex = -1;
if (_currentQuestline != null)
{
if (!_currentQuestline.Quests.Exists(o => !o.IsDone))
{
EndQuestline();
}
}
}
void EndQuestline()
{
if (_questlines != null)
{
if (_currentQuestline != null)
{
_currentQuestline.FinishQuestline();
}
if (_questlines.Exists(o => o.IsDone))
{
StartQuestline();
}
}
}
}

53
UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/StepSO.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
public enum stepType
{
dialogue,
giveItem,
checkItem,
rewardItem
}
[CreateAssetMenu(fileName = "step", menuName = "Quests/step", order = 51)]
public class StepSO : ScriptableObject
{
[Tooltip("The Character this mission will need interaction with")]
[SerializeField]
private ActorSO _actor = default;
[Tooltip("The dialogue that will be diplayed befor an action, if any")]
[SerializeField]
private DialogueDataSO _dialogueBeforeStep = default;
[Tooltip("The dialogue that will be diplayed when the step is achieved")]
[SerializeField]
[FormerlySerializedAs("_winDialogue")]
private DialogueDataSO _completeDialogue = default;
[Tooltip("The dialogue that will be diplayed if the step is not achieved yet")]
[SerializeField]
[FormerlySerializedAs("_loseDialogue")]
private DialogueDataSO _incompleteDialogue = default;
[Tooltip("The item to check/give/reward")]
[SerializeField]
private Item _item = default;
[Tooltip("The type of the step")]
[SerializeField]
private stepType _type = default;
[SerializeField]
bool _isDone = false;
public DialogueDataSO DialogueBeforeStep => _dialogueBeforeStep;
public DialogueDataSO CompleteDialogue => _completeDialogue;
public DialogueDataSO IncompleteDialogue => _incompleteDialogue;
public Item Item => _item;
public stepType Type => _type;
public bool IsDone => _isDone;
public ActorSO Actor => _actor;
public void FinishStep()
{
_isDone = true;
}
}
正在加载...
取消
保存