From d6f057c98c86cf4eebb1476bf4bd66e63024c29e Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Wed, 19 Aug 2015 14:56:44 +0100 Subject: [PATCH] Refactored localisation system to use ILocalizable interface You can now add custom commands that work with the localisation system by implementing the ILocalizable interface. --- Assets/Fungus/Flowchart/Scripts/Command.cs | 22 + Assets/Fungus/Narrative/Scripts/Character.cs | 27 +- .../Fungus/Narrative/Scripts/Commands/Menu.cs | 27 +- .../Fungus/Narrative/Scripts/Commands/Say.cs | 33 +- .../Fungus/Narrative/Scripts/Localization.cs | 362 +++---------- Assets/Fungus/UI/Scripts/Commands/SetText.cs | 27 +- Assets/Fungus/UI/Scripts/Commands/Write.cs | 27 +- .../CSV/localization_Commands.csv | 4 +- .../CSV/localization_Narrative.csv | 4 + .../CSV/localization_Narrative.csv.meta | 8 + .../Localisation/LocalisationTests.unity | 484 +++++++++++++++++- 11 files changed, 711 insertions(+), 314 deletions(-) create mode 100644 Assets/Tests/Localisation/CSV/localization_Narrative.csv create mode 100644 Assets/Tests/Localisation/CSV/localization_Narrative.csv.meta diff --git a/Assets/Fungus/Flowchart/Scripts/Command.cs b/Assets/Fungus/Flowchart/Scripts/Command.cs index 666cfee2..12f910ed 100644 --- a/Assets/Fungus/Flowchart/Scripts/Command.cs +++ b/Assets/Fungus/Flowchart/Scripts/Command.cs @@ -184,6 +184,28 @@ namespace Fungus { return false; } + + /** + * Returns the localization id for the Flowchart that contains this command. + */ + public virtual string GetFlowchartLocalizationId() + { + // If no localization id has been set then use the Flowchart name + Flowchart flowchart = GetFlowchart(); + if (flowchart == null) + { + return ""; + } + + string localizationId = GetFlowchart().localizationId; + if (localizationId.Length == 0) + { + localizationId = flowchart.name; + } + + return localizationId; + } + } } \ No newline at end of file diff --git a/Assets/Fungus/Narrative/Scripts/Character.cs b/Assets/Fungus/Narrative/Scripts/Character.cs index 82d9e319..4d644f0e 100644 --- a/Assets/Fungus/Narrative/Scripts/Character.cs +++ b/Assets/Fungus/Narrative/Scripts/Character.cs @@ -8,7 +8,7 @@ namespace Fungus { [ExecuteInEditMode] - public class Character : MonoBehaviour + public class Character : MonoBehaviour, ILocalizable { public string nameText; // We need a separate name as the object name is used for character variations (e.g. "Smurf Happy", "Smurf Sad") public Color nameColor = Color.white; @@ -36,6 +36,31 @@ namespace Fungus { activeCharacters.Remove(this); } + + // + // ILocalizable implementation + // + + public virtual string GetStandardText() + { + return nameText; + } + + public virtual void SetStandardText(string standardText) + { + nameText = standardText; + } + + public virtual string GetDescription() + { + return description; + } + + public virtual string GetStringId() + { + // String id for character names is CHARACTER. + return "CHARACTER." + nameText; + } } } \ No newline at end of file diff --git a/Assets/Fungus/Narrative/Scripts/Commands/Menu.cs b/Assets/Fungus/Narrative/Scripts/Commands/Menu.cs index ef62caff..6d0f2f36 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/Menu.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/Menu.cs @@ -11,7 +11,7 @@ namespace Fungus "Menu", "Displays a button in a multiple choice menu")] [AddComponentMenu("")] - public class Menu : Command + public class Menu : Command, ILocalizable { [Tooltip("Text to display on the menu button")] public string text = "Option Text"; @@ -118,6 +118,31 @@ namespace Fungus { return new Color32(184, 210, 235, 255); } + + // + // ILocalizable implementation + // + + public virtual string GetStandardText() + { + return text; + } + + public virtual void SetStandardText(string standardText) + { + text = standardText; + } + + public virtual string GetDescription() + { + return description; + } + + public virtual string GetStringId() + { + // String id for Menu commands is MENU.. + return "MENU." + GetFlowchartLocalizationId() + "." + itemId; + } } } \ No newline at end of file diff --git a/Assets/Fungus/Narrative/Scripts/Commands/Say.cs b/Assets/Fungus/Narrative/Scripts/Commands/Say.cs index 0ec621a2..5f06909d 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/Say.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/Say.cs @@ -9,7 +9,7 @@ namespace Fungus "Say", "Writes text in a dialog box.")] [AddComponentMenu("")] - public class Say : Command + public class Say : Command, ILocalizable { // Removed this tooltip as users's reported it obscures the text box [TextArea(5,10)] @@ -160,6 +160,37 @@ namespace Fungus { executionCount = 0; } + + // + // ILocalizable implementation + // + + public virtual string GetStandardText() + { + return storyText; + } + + public virtual void SetStandardText(string standardText) + { + storyText = standardText; + } + + public virtual string GetDescription() + { + return description; + } + + public virtual string GetStringId() + { + // String id for Say commands is SAY...[Character Name] + string stringId = "SAY." + GetFlowchartLocalizationId() + "." + itemId + "."; + if (character != null) + { + stringId += character.nameText; + } + + return stringId; + } } } \ No newline at end of file diff --git a/Assets/Fungus/Narrative/Scripts/Localization.cs b/Assets/Fungus/Narrative/Scripts/Localization.cs index 4b23b951..1854c271 100644 --- a/Assets/Fungus/Narrative/Scripts/Localization.cs +++ b/Assets/Fungus/Narrative/Scripts/Localization.cs @@ -11,6 +11,14 @@ using Ideafixxxer.CsvParser; namespace Fungus { + public interface ILocalizable + { + string GetStandardText(); + void SetStandardText(string standardText); + string GetDescription(); + string GetStringId(); + } + /** * Multi-language localization support. */ @@ -24,6 +32,8 @@ namespace Fungus protected static Dictionary localizedStrings = new Dictionary(); + protected Dictionary localizeableObjects = new Dictionary(); + /** * Temp storage for a single item of standard text and its localizations */ @@ -48,6 +58,17 @@ namespace Fungus public virtual void Start() { + // Build cache of localizeable objects in the scene + Component[] components = GameObject.FindObjectsOfType(); + foreach (Component component in components) + { + ILocalizable localizable = component as ILocalizable; + if (localizable != null) + { + localizeableObjects[localizable.GetStringId()] = localizable; + } + } + if (localizationFile != null && localizationFile.text.Length > 0) { @@ -144,98 +165,49 @@ namespace Fungus { Dictionary textItems = new Dictionary(); - // Export all character names - foreach (Character character in GameObject.FindObjectsOfType()) - { - // String id for character names is CHARACTER. - TextItem textItem = new TextItem(); - textItem.standardText = character.nameText; - textItem.description = character.description; - string stringId = "CHARACTER." + character.nameText; - textItems[stringId] = textItem; - } - - // Export all Say and Menu commands in the scene - // To make it easier to localize, we preserve the command order in each exported block. + // Add localizable commands in same order as command list to make it + // easier to localise / edit standard text. Flowchart[] flowcharts = GameObject.FindObjectsOfType(); foreach (Flowchart flowchart in flowcharts) { - // If no localization id has been set then use the Flowchart name - string localizationId = flowchart.localizationId; - if (localizationId.Length == 0) - { - localizationId = flowchart.name; - } - Block[] blocks = flowchart.GetComponentsInChildren(); foreach (Block block in blocks) { foreach (Command command in block.commandList) { - string stringId = ""; - string standardText = ""; - string description = ""; - - System.Type type = command.GetType(); - if (type == typeof(Say)) + ILocalizable localizable = command as ILocalizable; + if (localizable != null) { - // String id for Say commands is SAY... - Say sayCommand = command as Say; - standardText = sayCommand.storyText; - description = sayCommand.description; - stringId = "SAY." + localizationId + "." + sayCommand.itemId + "."; - if (sayCommand.character != null) - { - stringId += sayCommand.character.nameText; - } - } - else if (type == typeof(Menu)) - { - // String id for Menu commands is MENU.. - Menu menuCommand = command as Menu; - standardText = menuCommand.text; - description = menuCommand.description; - stringId = "MENU." + localizationId + "." + menuCommand.itemId; + TextItem textItem = new TextItem(); + textItem.standardText = localizable.GetStandardText(); + textItem.description = localizable.GetDescription(); + textItems[localizable.GetStringId()] = textItem; } - else if (type == typeof(Write)) - { - // String id for Write commands is WRITE.. - Write writeCommand = command as Write; - standardText = writeCommand.text; - description = writeCommand.description; - stringId = "WRITE." + localizationId + "." + writeCommand.itemId; - } - else if (type == typeof(SetText)) - { - // String id for Set Text commands is SETTEXT.. - SetText setTextCommand = command as SetText; - standardText = setTextCommand.text; - description = setTextCommand.description; - stringId = "SETTEXT." + localizationId + "." + setTextCommand.itemId; - } - else - { - continue; - } - - TextItem textItem = null; - if (textItems.ContainsKey(stringId)) - { - textItem = textItems[stringId]; - } - else - { - textItem = new TextItem(); - textItems[stringId] = textItem; - } - - // Update basic properties,leaving localised strings intact - textItem.standardText = standardText; - textItem.description = description; } } } - + + // Add everything else that's localizable + Component[] components = GameObject.FindObjectsOfType(); + foreach (Component component in components) + { + ILocalizable localizable = component as ILocalizable; + if (localizable != null) + { + string stringId = localizable.GetStringId(); + if (textItems.ContainsKey(stringId)) + { + // Already added + continue; + } + + TextItem textItem = new TextItem(); + textItem.standardText = localizable.GetStandardText(); + textItem.description = localizable.GetDescription(); + textItems[stringId] = textItem; + } + } + return textItems; } @@ -271,7 +243,9 @@ namespace Fungus { if (stringId.StartsWith("CHARACTER.") || stringId.StartsWith("SAY.") || - stringId.StartsWith("MENU.")) + stringId.StartsWith("MENU.") || + stringId.StartsWith("WRITE.") || + stringId.StartsWith("SETTEXT.")) { // If it's a 'built-in' type this probably means that item has been deleted from its flowchart, // so there's no need to add a text item for it. @@ -380,28 +354,6 @@ namespace Fungus // Using a localized language text column // 1. Add all localized text to the localized strings dict // 2. Update all scene text properties with localized versions - - // Cache a lookup table of characters in the scene - Dictionary characterDict = new Dictionary(); - foreach (Character character in GameObject.FindObjectsOfType()) - { - characterDict[character.nameText] = character; - } - - // Cache a lookup table of flowcharts in the scene - Dictionary flowchartDict = new Dictionary(); - foreach (Flowchart flowchart in GameObject.FindObjectsOfType()) - { - // If no localization id has been set then use the Flowchart name - string localizationId = flowchart.localizationId; - if (localizationId.Length == 0) - { - localizationId = flowchart.name; - } - - flowchartDict[localizationId] = flowchart; - } - for (int i = 1; i < csvTable.Length; ++i) { string[] fields = csvTable[i]; @@ -417,7 +369,7 @@ namespace Fungus if (languageEntry.Length > 0) { localizedStrings[stringId] = languageEntry; - PopulateTextProperty(stringId, languageEntry, flowchartDict, characterDict); + PopulateTextProperty(stringId, languageEntry); } } } @@ -425,181 +377,21 @@ namespace Fungus /** * Populates the text property of a single scene object with a new text value. */ - public virtual bool PopulateTextProperty(string stringId, - string newText, - Dictionary flowchartDict, - Dictionary characterDict) + public virtual bool PopulateTextProperty(string stringId, string newText) { - string[] idParts = stringId.Split('.'); - if (idParts.Length == 0) - { - return false; - } - - string stringType = idParts[0]; - if (stringType == "SAY") - { - if (idParts.Length != 4) - { - return false; - } - - string flowchartId = idParts[1]; - if (!flowchartDict.ContainsKey(flowchartId)) - { - return false; - } - Flowchart flowchart = flowchartDict[flowchartId]; - - int itemId = int.Parse(idParts[2]); - - if (flowchart != null) - { - foreach (Say say in flowchart.GetComponentsInChildren()) - { - if (say.itemId == itemId && - say.storyText != newText) - { - #if UNITY_EDITOR - Undo.RecordObject(say, "Set Text"); - #endif - - say.storyText = newText; - return true; - } - } - } - } - else if (stringType == "MENU") - { - if (idParts.Length != 3) - { - return false; - } - - string flowchartId = idParts[1]; - if (!flowchartDict.ContainsKey(flowchartId)) - { - return false; - } - Flowchart flowchart = flowchartDict[flowchartId]; - - int itemId = int.Parse(idParts[2]); - - if (flowchart != null) - { - foreach (Menu menu in flowchart.GetComponentsInChildren()) - { - if (menu.itemId == itemId && - menu.text != newText) - { - #if UNITY_EDITOR - Undo.RecordObject(menu, "Set Text"); - #endif - - menu.text = newText; - return true; - } - } - } - } - else if (stringType == "CHARACTER") - { - if (idParts.Length != 2) - { - return false; - } - - string characterName = idParts[1]; - if (!characterDict.ContainsKey(characterName)) - { - return false; - } - - Character character = characterDict[characterName]; - if (character != null && - character.nameText != newText) - { - #if UNITY_EDITOR - Undo.RecordObject(character, "Set Text"); - #endif - - character.nameText = newText; - return true; - } - } - else if (stringType == "WRITE") - { - if (idParts.Length != 3) - { - return false; - } - - string flowchartId = idParts[1]; - if (!flowchartDict.ContainsKey(flowchartId)) - { - return false; - } - Flowchart flowchart = flowchartDict[flowchartId]; - - int itemId = int.Parse(idParts[2]); - - if (flowchart != null) - { - foreach (Write write in flowchart.GetComponentsInChildren()) - { - if (write.itemId == itemId && - write.text != newText) - { - #if UNITY_EDITOR - Undo.RecordObject(write, "Write"); - #endif - - write.text.Value = newText; - return true; - } - } - } - } - else if (stringType == "SETTEXT") + ILocalizable localizable = null; + localizeableObjects.TryGetValue(stringId, out localizable); + if (localizable != null) { - if (idParts.Length != 3) - { - return false; - } - - string flowchartId = idParts[1]; - if (!flowchartDict.ContainsKey(flowchartId)) - { - return false; - } - Flowchart flowchart = flowchartDict[flowchartId]; - - int itemId = int.Parse(idParts[2]); - - if (flowchart != null) - { - foreach (SetText setText in flowchart.GetComponentsInChildren()) - { - if (setText.itemId == itemId && - setText.text != newText) - { - #if UNITY_EDITOR - Undo.RecordObject(setText, "Set Text"); - #endif - - setText.text.Value = newText; - return true; - } - } - } + localizable.SetStandardText(newText); + return true; } return false; } /** - * Returns all standard text for SAY & MENU commands in the scene using an + * Returns all standard text for localizeable text in the scene using an * easy to edit custom text format. */ public virtual string GetStandardText() @@ -611,11 +403,6 @@ namespace Fungus int rowCount = 0; foreach (string stringId in textItems.Keys) { - if (!stringId.StartsWith("SAY.") && !(stringId.StartsWith("MENU."))) - { - continue; - } - TextItem languageItem = textItems[stringId]; textData += "#" + stringId + "\n"; @@ -633,27 +420,6 @@ namespace Fungus */ public virtual void SetStandardText(string textData) { - // Cache a lookup table of characters in the scene - Dictionary characterDict = new Dictionary(); - foreach (Character character in GameObject.FindObjectsOfType()) - { - characterDict[character.nameText] = character; - } - - // Cache a lookup table of flowcharts in the scene - Dictionary flowchartDict = new Dictionary(); - foreach (Flowchart flowchart in GameObject.FindObjectsOfType()) - { - // If no localization id has been set then use the Flowchart name - string localizationId = flowchart.localizationId; - if (localizationId.Length == 0) - { - localizationId = flowchart.name; - } - - flowchartDict[localizationId] = flowchart; - } - string[] lines = textData.Split('\n'); int updatedCount = 0; @@ -668,7 +434,7 @@ namespace Fungus if (stringId.Length > 0) { // Write buffered text to the appropriate text property - if (PopulateTextProperty(stringId, buffer.Trim(), flowchartDict, characterDict)) + if (PopulateTextProperty(stringId, buffer.Trim())) { updatedCount++; } @@ -687,7 +453,7 @@ namespace Fungus // Handle last buffered entry if (stringId.Length > 0) { - if (PopulateTextProperty(stringId, buffer.Trim(), flowchartDict, characterDict)) + if (PopulateTextProperty(stringId, buffer.Trim())) { updatedCount++; } diff --git a/Assets/Fungus/UI/Scripts/Commands/SetText.cs b/Assets/Fungus/UI/Scripts/Commands/SetText.cs index b2f09e3c..df6db972 100644 --- a/Assets/Fungus/UI/Scripts/Commands/SetText.cs +++ b/Assets/Fungus/UI/Scripts/Commands/SetText.cs @@ -11,7 +11,7 @@ namespace Fungus "Sets the text property on a UI Text object and/or an Input Field object.")] [AddComponentMenu("")] - public class SetText : Command + public class SetText : Command, ILocalizable { [Tooltip("Text object to set text on. Can be a UI Text, Text Field or Text Mesh object.")] public GameObject targetTextObject; @@ -86,6 +86,31 @@ namespace Fungus targetTextObject = _textObjectObsolete.gameObject; } } + + // + // ILocalizable implementation + // + + public virtual string GetStandardText() + { + return text; + } + + public virtual void SetStandardText(string standardText) + { + text.Value = standardText; + } + + public virtual string GetDescription() + { + return description; + } + + public virtual string GetStringId() + { + // String id for Set Text commands is SETTEXT.. + return "SETTEXT." + GetFlowchartLocalizationId() + "." + itemId; + } } } \ No newline at end of file diff --git a/Assets/Fungus/UI/Scripts/Commands/Write.cs b/Assets/Fungus/UI/Scripts/Commands/Write.cs index 6bac3083..122d45e3 100644 --- a/Assets/Fungus/UI/Scripts/Commands/Write.cs +++ b/Assets/Fungus/UI/Scripts/Commands/Write.cs @@ -11,7 +11,7 @@ namespace Fungus "Writes content to a UI Text or Text Mesh object.")] [AddComponentMenu("")] - public class Write : Command + public class Write : Command, ILocalizable { [Tooltip("Text object to set text on. Text, Input Field and Text Mesh objects are supported.")] public GameObject textObject; @@ -107,6 +107,31 @@ namespace Fungus return writer; } + + // + // ILocalizable implementation + // + + public virtual string GetStandardText() + { + return text; + } + + public virtual void SetStandardText(string standardText) + { + text.Value = standardText; + } + + public virtual string GetDescription() + { + return description; + } + + public virtual string GetStringId() + { + // String id for Write commands is WRITE.. + return "WRITE." + GetFlowchartLocalizationId() + "." + itemId; + } } } \ No newline at end of file diff --git a/Assets/Tests/Localisation/CSV/localization_Commands.csv b/Assets/Tests/Localisation/CSV/localization_Commands.csv index a4094ab4..bcf9c5da 100644 --- a/Assets/Tests/Localisation/CSV/localization_Commands.csv +++ b/Assets/Tests/Localisation/CSV/localization_Commands.csv @@ -1,5 +1,5 @@ Key,Description,Standard,FR -WRITE.Flowchart.1,,English text,texte français +SETTEXT.Flowchart.6,,English text,texte français SETTEXT.Flowchart.5,,English text,texte français WRITE.Flowchart.3,,English text,texte français -SETTEXT.Flowchart.6,,English text,texte français +WRITE.Flowchart.1,,English text,texte français diff --git a/Assets/Tests/Localisation/CSV/localization_Narrative.csv b/Assets/Tests/Localisation/CSV/localization_Narrative.csv new file mode 100644 index 00000000..3dd4e3a5 --- /dev/null +++ b/Assets/Tests/Localisation/CSV/localization_Narrative.csv @@ -0,0 +1,4 @@ +Key,Description,Standard,FR +SAY.Flowchart.1.Character Name,,Say text,Dites texte +MENU.Flowchart.2,,Option text,Texte Option +CHARACTER.Character Name,,Character Name,Le nom du personnage diff --git a/Assets/Tests/Localisation/CSV/localization_Narrative.csv.meta b/Assets/Tests/Localisation/CSV/localization_Narrative.csv.meta new file mode 100644 index 00000000..e9a02032 --- /dev/null +++ b/Assets/Tests/Localisation/CSV/localization_Narrative.csv.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5d25dc3ca14874409ad738ecbe1f7627 +timeCreated: 1439990493 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/Localisation/LocalisationTests.unity b/Assets/Tests/Localisation/LocalisationTests.unity index 83d62c09..f8ca7aa7 100644 --- a/Assets/Tests/Localisation/LocalisationTests.unity +++ b/Assets/Tests/Localisation/LocalisationTests.unity @@ -261,7 +261,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 5 --- !u!1 &263238434 GameObject: m_ObjectHideFlags: 0 @@ -302,6 +302,101 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_RootOrder: 2 +--- !u!1 &292727465 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 292727466} + - 114: {fileID: 292727467} + m_Layer: 0 + m_Name: NarrativeLocalizationTest + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &292727466 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 292727465} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 331926889} + - {fileID: 679750563} + - {fileID: 1141038908} + - {fileID: 622392413} + m_Father: {fileID: 0} + m_RootOrder: 4 +--- !u!114 &292727467 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 292727465} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3} + m_Name: + m_EditorClassIdentifier: + timeout: 5 + ignored: 0 + succeedAfterAllAssertionsAreExecuted: 1 + expectException: 0 + expectedExceptionList: + succeedWhenExceptionIsThrown: 0 + includedPlatforms: -1 + platformsToIgnore: [] + dynamic: 0 + dynamicTypeName: +--- !u!1 &331926888 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 149266, guid: ffbd0831d997545eab75c364da082c1b, type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 331926889} + - 114: {fileID: 331926890} + m_Layer: 0 + m_Name: Localization + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &331926889 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 480768, guid: ffbd0831d997545eab75c364da082c1b, type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 331926888} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 292727466} + m_RootOrder: 0 +--- !u!114 &331926890 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11438504, guid: ffbd0831d997545eab75c364da082c1b, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 331926888} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e5724422a635e425bae0af9ffe2615d6, type: 3} + m_Name: + m_EditorClassIdentifier: + activeLanguage: + localizationFile: {fileID: 4900000, guid: 5d25dc3ca14874409ad738ecbe1f7627, type: 3} --- !u!1 &365459144 GameObject: m_ObjectHideFlags: 1 @@ -329,7 +424,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3} m_Name: m_EditorClassIdentifier: - selectedFlowchart: {fileID: 587159255} + selectedFlowchart: {fileID: 679750556} --- !u!4 &365459146 Transform: m_ObjectHideFlags: 1 @@ -357,7 +452,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &453921374 Transform: m_ObjectHideFlags: 0 @@ -486,7 +581,8 @@ MonoBehaviour: width: 1114 height: 859 selectedBlock: {fileID: 587159257} - selectedCommands: [] + selectedCommands: + - {fileID: 587159256} variables: [] description: stepPause: 0 @@ -565,7 +661,7 @@ MonoBehaviour: parentBlock: {fileID: 587159257} --- !u!114 &587159259 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 587159254} @@ -605,7 +701,7 @@ Transform: m_RootOrder: 0 --- !u!114 &587159261 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 587159254} @@ -620,7 +716,7 @@ MonoBehaviour: languageCode: FR --- !u!114 &587159262 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 587159254} @@ -635,7 +731,7 @@ MonoBehaviour: duration: 1 --- !u!114 &587159263 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 587159254} @@ -655,7 +751,7 @@ MonoBehaviour: _textObjectObsolete: {fileID: 0} --- !u!114 &587159264 MonoBehaviour: - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 587159254} @@ -693,6 +789,309 @@ MonoBehaviour: compareType: 0 comparisonType: 4 ignoreCase: 0 +--- !u!1 &622392412 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 622392413} + - 114: {fileID: 622392414} + m_Layer: 0 + m_Name: TestAssertions + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &622392413 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 622392412} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 292727466} + m_RootOrder: 3 +--- !u!114 &622392414 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 622392412} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8bafa54482a87ac4cbd7ff1bfd1ac93a, type: 3} + m_Name: + m_EditorClassIdentifier: + checkAfterTime: 0 + repeatCheckTime: 0 + repeatEveryTime: 1 + checkAfterFrames: 1 + repeatCheckFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + checkMethods: 2 + m_ActionBase: {fileID: 2000112801} + checksPerformed: 0 +--- !u!1 &679750555 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 142980, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 679750563} + - 114: {fileID: 679750556} + - 114: {fileID: 679750558} + - 114: {fileID: 679750557} + - 114: {fileID: 679750559} + - 114: {fileID: 679750560} + - 114: {fileID: 679750564} + - 114: {fileID: 679750562} + - 114: {fileID: 679750561} + - 114: {fileID: 679750566} + - 114: {fileID: 679750565} + m_Layer: 0 + m_Name: Flowchart + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &679750556 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11430050, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 679750555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 1.0 + scrollPos: {x: 0, y: 0} + variablesScrollPos: {x: 0, y: 0} + variablesExpanded: 1 + blockViewHeight: 400 + zoom: 1 + scrollViewRect: + serializedVersion: 2 + x: -380 + y: -363 + width: 1151 + height: 1014 + selectedBlock: {fileID: 679750558} + selectedCommands: + - {fileID: 679750557} + variables: [] + description: 'This is a manual test to check that localization + + works with the Say and Menu commands' + stepPause: 0 + colorCommands: 1 + hideComponents: 1 + saveSelection: 1 + localizationId: +--- !u!114 &679750557 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 679750555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ec422cd568a9c4a31ad7c36d0572b9da, type: 3} + m_Name: + m_EditorClassIdentifier: + itemId: 1 + errorMessage: + indentLevel: 0 + storyText: Say text + description: + character: {fileID: 1141038909} + portrait: {fileID: 0} + voiceOverClip: {fileID: 0} + showAlways: 1 + showCount: 1 + extendPrevious: 0 + fadeIn: 0 + fadeOut: 0 + waitForClick: 1 + setSayDialog: {fileID: 0} +--- !u!114 &679750558 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 11433304, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 679750555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} + m_Name: + m_EditorClassIdentifier: + nodeRect: + serializedVersion: 2 + x: 198 + y: 128 + width: 120 + height: 40 + itemId: 0 + blockName: Say + description: + eventHandler: {fileID: 0} + commandList: + - {fileID: 679750557} + - {fileID: 679750559} +--- !u!114 &679750559 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 679750555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 841589fc622bc494aa5405f416fa1301, type: 3} + m_Name: + m_EditorClassIdentifier: + itemId: 2 + errorMessage: + indentLevel: 0 + text: Option text + description: + targetBlock: {fileID: 679750560} + hideIfVisited: 0 + interactable: + booleanRef: {fileID: 0} + booleanVal: 1 + setMenuDialog: {fileID: 0} +--- !u!114 &679750560 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 679750555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} + m_Name: + m_EditorClassIdentifier: + nodeRect: + serializedVersion: 2 + x: 197 + y: 210 + width: 120 + height: 40 + itemId: 3 + blockName: Menu Option + description: + eventHandler: {fileID: 0} + commandList: + - {fileID: 679750566} + - {fileID: 679750565} +--- !u!114 &679750561 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 679750555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d2f6487d21a03404cb21b245f0242e79, type: 3} + m_Name: + m_EditorClassIdentifier: + parentBlock: {fileID: 679750564} +--- !u!114 &679750562 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 679750555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 050fb9e6e72f442b3b883da8a965bdeb, type: 3} + m_Name: + m_EditorClassIdentifier: + itemId: 5 + errorMessage: + indentLevel: 0 + targetFlowchart: {fileID: 0} + targetBlock: {fileID: 679750558} + callMode: 2 +--- !u!4 &679750563 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 467082, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 679750555} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 292727466} + m_RootOrder: 1 +--- !u!114 &679750564 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 679750555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} + m_Name: + m_EditorClassIdentifier: + nodeRect: + serializedVersion: 2 + x: 196 + y: 42 + width: 120 + height: 40 + itemId: 4 + blockName: Start + description: + eventHandler: {fileID: 679750561} + commandList: + - {fileID: 679750562} +--- !u!114 &679750565 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 679750555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 050fb9e6e72f442b3b883da8a965bdeb, type: 3} + m_Name: + m_EditorClassIdentifier: + itemId: 9 + errorMessage: + indentLevel: 0 + targetFlowchart: {fileID: 0} + targetBlock: {fileID: 679750558} + callMode: 0 +--- !u!114 &679750566 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 679750555} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3fc625e237d6048bf86f34835d8266d9, type: 3} + m_Name: + m_EditorClassIdentifier: + itemId: 8 + errorMessage: + indentLevel: 0 + languageCode: FR --- !u!1 &881473892 GameObject: m_ObjectHideFlags: 0 @@ -844,6 +1243,53 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1134558494} +--- !u!1 &1141038907 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 100000, guid: b20518d45890e4be59ba82946f88026c, type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1141038908} + - 114: {fileID: 1141038909} + m_Layer: 0 + m_Name: Character + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1141038908 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 400000, guid: b20518d45890e4be59ba82946f88026c, type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1141038907} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 292727466} + m_RootOrder: 2 +--- !u!114 &1141038909 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11400000, guid: b20518d45890e4be59ba82946f88026c, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1141038907} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 25fb867d2049d41f597aefdd6b19f598, type: 3} + m_Name: + m_EditorClassIdentifier: + nameText: Character Name + nameColor: {r: 1, g: 1, b: 1, a: 1} + soundEffect: {fileID: 0} + profileSprite: {fileID: 0} + portraits: [] + portraitsFace: 0 + description: --- !u!1 &1242222009 GameObject: m_ObjectHideFlags: 0 @@ -1051,6 +1497,26 @@ RectTransform: m_AnchoredPosition: {x: 33, y: 89} m_SizeDelta: {x: 550, y: 50} m_Pivot: {x: .5, y: .5} +--- !u!114 &2000112801 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 58783f051e477fd4e93b42ec7a43bb64, type: 3} + m_Name: + m_EditorClassIdentifier: + go: {fileID: 331926888} + thisPropertyPath: Localization.activeLanguage + compareToType: 1 + other: {fileID: 0} + otherPropertyPath: + constantValueGeneric: + compareType: 0 + comparisonType: 4 + ignoreCase: 0 --- !u!1 &2104226803 GameObject: m_ObjectHideFlags: 0