From 925c2e27998def41bf2b6d22599469a839c26313 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 3 Jun 2016 21:22:59 +0100 Subject: [PATCH] Embed string substitution keys in substitution text #488 --- .../FungusLua/Scripts/StringSubstituter.cs | 25 +- .../StringSubstitutionTests.unity | 581 +++++++++++++++++- .../Tests/StringSubstitution/stringtable.txt | 11 + .../StringSubstitution/stringtable.txt.meta | 8 + 4 files changed, 618 insertions(+), 7 deletions(-) create mode 100644 Assets/Tests/StringSubstitution/stringtable.txt create mode 100644 Assets/Tests/StringSubstitution/stringtable.txt.meta diff --git a/Assets/Fungus/Thirdparty/FungusLua/Scripts/StringSubstituter.cs b/Assets/Fungus/Thirdparty/FungusLua/Scripts/StringSubstituter.cs index 5d16a89b..47de117d 100644 --- a/Assets/Fungus/Thirdparty/FungusLua/Scripts/StringSubstituter.cs +++ b/Assets/Fungus/Thirdparty/FungusLua/Scripts/StringSubstituter.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Text; namespace Fungus { @@ -63,11 +64,25 @@ namespace Fungus /// public virtual string SubstituteStrings(string input) { - string newString = input; - foreach (ISubstitutionHandler handler in substitutionHandlers) - { - newString = handler.SubstituteStrings(newString); - } + string newString = input; + + // Perform the substitution multiple times to expand nested keys + int lasthash = 0; + int currenthash = -1; + int loopCount = 0; // Avoid infinite recursion loops + + while (lasthash != currenthash && + loopCount < 5) + { + lasthash = newString.GetHashCode(); + foreach (ISubstitutionHandler handler in substitutionHandlers) + { + newString = handler.SubstituteStrings(newString); + } + currenthash = newString.GetHashCode(); + + loopCount++; + } return newString; } diff --git a/Assets/Tests/StringSubstitution/StringSubstitutionTests.unity b/Assets/Tests/StringSubstitution/StringSubstitutionTests.unity index 32a0bcad..b0b275a4 100644 --- a/Assets/Tests/StringSubstitution/StringSubstitutionTests.unity +++ b/Assets/Tests/StringSubstitution/StringSubstitutionTests.unity @@ -174,6 +174,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 1627631718} m_RootOrder: 0 @@ -228,6 +229,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 2 @@ -258,7 +260,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3} m_Name: m_EditorClassIdentifier: - selectedFlowchart: {fileID: 951347112} + selectedFlowchart: {fileID: 2064973748} --- !u!4 &167744855 Transform: m_ObjectHideFlags: 1 @@ -268,9 +270,84 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 +--- !u!1 &270131671 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 270131672} + - 222: {fileID: 270131674} + - 114: {fileID: 270131673} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &270131672 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 270131671} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 709636067} + m_RootOrder: 0 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 5, y: 0} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &270131673 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 270131671} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 20 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 2 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: New Text +--- !u!222 &270131674 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 270131671} --- !u!1 &436484125 GameObject: m_ObjectHideFlags: 0 @@ -297,6 +374,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 1627631718} m_RootOrder: 1 @@ -436,6 +514,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: - {fileID: 2035584479} - {fileID: 875535383} @@ -516,6 +595,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 3 @@ -534,7 +614,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!114 &684307463 MonoBehaviour: m_ObjectHideFlags: 0 @@ -565,6 +645,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: - {fileID: 951347108} - {fileID: 1563984263} @@ -601,6 +682,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 545923889} m_RootOrder: 5 @@ -616,6 +698,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4cc8a659e950044b69d7c62696c36962, type: 3} m_Name: m_EditorClassIdentifier: + allEnvironments: 1 + luaEnvironment: {fileID: 0} tableName: registerTypes: 1 boundTypes: @@ -646,6 +730,99 @@ MonoBehaviour: - key: text obj: {fileID: 1532141878} component: {fileID: 1532141880} +--- !u!1 &709636066 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 709636067} + - 223: {fileID: 709636070} + - 114: {fileID: 709636069} + - 114: {fileID: 709636068} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &709636067 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 709636066} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 270131672} + m_Father: {fileID: 1475498172} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &709636068 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 709636066} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &709636069 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 709636066} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &709636070 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 709636066} + m_Enabled: 1 + serializedVersion: 2 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 --- !u!1 &791892755 GameObject: m_ObjectHideFlags: 0 @@ -713,6 +890,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 982964957} m_RootOrder: 1 @@ -747,6 +925,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 545923889} m_RootOrder: 1 @@ -935,6 +1114,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 684307464} m_RootOrder: 0 @@ -1034,6 +1214,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: - {fileID: 32012240} - {fileID: 791892758} @@ -1066,6 +1247,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: - {fileID: 1532141879} m_Father: {fileID: 545923889} @@ -1131,6 +1313,182 @@ Canvas: m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 +--- !u!1 &1153383139 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 179118, guid: 3ddf9f33ba98e4b31ba4d2b9722bea00, type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1153383140} + - 114: {fileID: 1153383145} + - 114: {fileID: 1153383144} + - 114: {fileID: 1153383143} + - 114: {fileID: 1153383142} + - 114: {fileID: 1153383141} + m_Layer: 0 + m_Name: Lua + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1153383140 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 466848, guid: 3ddf9f33ba98e4b31ba4d2b9722bea00, type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1153383139} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 1475498172} + m_RootOrder: 2 +--- !u!114 &1153383141 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11437776, guid: 3ddf9f33ba98e4b31ba4d2b9722bea00, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1153383139} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c10f0b861365b42b0928858f7b086ff3, type: 3} + m_Name: + m_EditorClassIdentifier: + fungusModule: 0 + activeLanguage: en + stringTables: + - {fileID: 4900000, guid: 47d7f6e35cabd4559bc7b4c260dbf15c, type: 3} + registerTypes: + - {fileID: 4900000, guid: 9c3ab7a98d51241bbb499643399fa761, type: 3} + - {fileID: 4900000, guid: 93fddea8208764a2dbb189cc238aed40, type: 3} +--- !u!114 &1153383142 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11483650, guid: 3ddf9f33ba98e4b31ba4d2b9722bea00, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1153383139} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ba19c26c1ba7243d2b57ebc4329cc7c6, type: 3} + m_Name: + m_EditorClassIdentifier: + remoteDebugger: 0 +--- !u!114 &1153383143 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11499092, guid: 3ddf9f33ba98e4b31ba4d2b9722bea00, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1153383139} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4cc8a659e950044b69d7c62696c36962, type: 3} + m_Name: + m_EditorClassIdentifier: + allEnvironments: 1 + luaEnvironment: {fileID: 1153383142} + tableName: + registerTypes: 1 + boundTypes: + - UnityEngine.GameObject, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - UnityEngine.PrimitiveType, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - UnityEngine.Component, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - System.Type, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + - System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + - System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + - UnityEngine.SendMessageOptions, UnityEngine, Version=0.0.0.0, Culture=neutral, + PublicKeyToken=null + - UnityEngine.SceneManagement.Scene, UnityEngine, Version=0.0.0.0, Culture=neutral, + PublicKeyToken=null + - UnityEngine.Object, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - System.Single, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + - UnityEngine.UI.Text, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + - UnityEngine.TextGenerator, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - UnityEngine.Texture, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - UnityEngine.Font, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - UnityEngine.TextAnchor, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - UnityEngine.HorizontalWrapMode, UnityEngine, Version=0.0.0.0, Culture=neutral, + PublicKeyToken=null + - UnityEngine.VerticalWrapMode, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - UnityEngine.FontStyle, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - UnityEngine.TextGenerationSettings, UnityEngine, Version=0.0.0.0, Culture=neutral, + PublicKeyToken=null + - UnityEngine.Vector2, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - Fungus.Flowchart, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - Fungus.Block, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - System.Action, System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + - Fungus.Variable, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - Fungus.Label, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - Fungus.Command, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + - Fungus.CommandInfoAttribute, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, + PublicKeyToken=null + - UnityEngine.Rect, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + boundObjects: + - key: text + obj: {fileID: 270131671} + component: {fileID: 270131673} + - key: flowchart + obj: {fileID: 2064973741} + component: {fileID: 2064973748} +--- !u!114 &1153383144 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11417560, guid: 3ddf9f33ba98e4b31ba4d2b9722bea00, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1153383139} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 446caeace65234baaacd52095d24f101, type: 3} + m_Name: + m_EditorClassIdentifier: + luaEnvironment: {fileID: 1153383142} + luaFile: {fileID: 0} + luaScript: '-- Test 3 levels of recursivion using string table entries + + local v = sub("{$s1}") + + check(v == "A B C") + + + -- Test 3 levels of recursion using flowchart variables + + -- Also pulls in strings from string table + + runblock(flowchart, "DoTest") + + + check(text.text == "A B C D E F") + + + pass()' + runAsCoroutine: 1 +--- !u!114 &1153383145 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11415008, guid: 3ddf9f33ba98e4b31ba4d2b9722bea00, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1153383139} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6ee79785811ba49399c1b56d7309e3df, type: 3} + m_Name: + m_EditorClassIdentifier: + executeAfterTime: 1 + repeatExecuteTime: 1 + repeatEveryTime: 1 + executeAfterFrames: 1 + repeatExecuteFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + executeMethods: 2 + executeMethodName: OnExecute --- !u!1 &1249712160 GameObject: m_ObjectHideFlags: 0 @@ -1211,6 +1569,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 684307464} m_RootOrder: 3 @@ -1218,6 +1577,59 @@ Transform: Transform: m_PrefabParentObject: {fileID: 495584, guid: 49031c561e16d4fcf91c12153f8e0b25, type: 2} m_PrefabInternal: {fileID: 529362524} +--- !u!1 &1475498170 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1475498172} + - 114: {fileID: 1475498171} + m_Layer: 0 + m_Name: RecursionTest + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1475498171 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1475498170} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3} + m_Name: + m_EditorClassIdentifier: + timeout: 5 + ignored: 0 + succeedAfterAllAssertionsAreExecuted: 0 + expectException: 0 + expectedExceptionList: + succeedWhenExceptionIsThrown: 0 + includedPlatforms: -1 + platformsToIgnore: [] + dynamic: 0 + dynamicTypeName: +--- !u!4 &1475498172 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1475498170} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 2064973742} + - {fileID: 709636067} + - {fileID: 1153383140} + m_Father: {fileID: 0} + m_RootOrder: 8 --- !u!1 &1532141878 GameObject: m_ObjectHideFlags: 0 @@ -1244,6 +1656,7 @@ RectTransform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 1106846133} m_RootOrder: 0 @@ -1317,6 +1730,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 684307464} m_RootOrder: 1 @@ -1416,6 +1830,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: - {fileID: 35396880} - {fileID: 436484126} @@ -1500,6 +1915,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 545923889} m_RootOrder: 2 @@ -1625,6 +2041,7 @@ Transform: 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 545923889} m_RootOrder: 0 @@ -1675,6 +2092,165 @@ MonoBehaviour: hasFailed: 0 executeMethods: 2 executeMethodName: OnExecute +--- !u!1 &2064973741 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 142980, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2064973742} + - 114: {fileID: 2064973748} + - 114: {fileID: 2064973747} + - 114: {fileID: 2064973745} + - 114: {fileID: 2064973744} + - 114: {fileID: 2064973749} + - 114: {fileID: 2064973743} + m_Layer: 0 + m_Name: Flowchart + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2064973742 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 467082, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2064973741} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 1475498172} + m_RootOrder: 0 +--- !u!114 &2064973743 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2064973741} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 78c0367bf08d147bd80b5454de50e9d4, type: 3} + m_Name: + m_EditorClassIdentifier: + itemId: 1 + errorMessage: + indentLevel: 0 + targetTextObject: {fileID: 270131671} + text: + stringRef: {fileID: 0} + stringVal: '{$StringVarA}' + description: + _textObjectObsolete: {fileID: 0} +--- !u!114 &2064973744 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2064973741} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4580f28dd8581476b810b38eea2f1316, type: 3} + m_Name: + m_EditorClassIdentifier: + scope: 1 + key: StringVarB + value: E {$StringVarC} +--- !u!114 &2064973745 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2064973741} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4580f28dd8581476b810b38eea2f1316, type: 3} + m_Name: + m_EditorClassIdentifier: + scope: 1 + key: StringVarA + value: '{$s1} D {$StringVarB}' +--- !u!114 &2064973747 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 11433304, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2064973741} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} + m_Name: + m_EditorClassIdentifier: + nodeRect: + serializedVersion: 2 + x: 68 + y: 70 + width: 120 + height: 40 + itemId: 0 + blockName: DoTest + description: + eventHandler: {fileID: 0} + commandList: + - {fileID: 2064973743} +--- !u!114 &2064973748 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11430050, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2064973741} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 1 + scrollPos: {x: 0, y: 0} + variablesScrollPos: {x: 0, y: 0} + variablesExpanded: 1 + blockViewHeight: 400 + zoom: 1 + scrollViewRect: + serializedVersion: 2 + x: -343 + y: -340 + width: 1114 + height: 859 + selectedBlock: {fileID: 0} + selectedCommands: [] + variables: + - {fileID: 2064973745} + - {fileID: 2064973744} + - {fileID: 2064973749} + description: "Tests embedding a string key inside the replacement \nstring. This + can be done in Flowchart string variables \nand in Lua string table entries. " + stepPause: 0 + colorCommands: 1 + hideComponents: 1 + saveSelection: 1 + localizationId: + showLineNumbers: 0 + hideCommands: [] +--- !u!114 &2064973749 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2064973741} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4580f28dd8581476b810b38eea2f1316, type: 3} + m_Name: + m_EditorClassIdentifier: + scope: 1 + key: StringVarC + value: F --- !u!1 &2135590527 GameObject: m_ObjectHideFlags: 0 @@ -1758,6 +2334,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 1 diff --git a/Assets/Tests/StringSubstitution/stringtable.txt b/Assets/Tests/StringSubstitution/stringtable.txt new file mode 100644 index 00000000..11ed39bc --- /dev/null +++ b/Assets/Tests/StringSubstitution/stringtable.txt @@ -0,0 +1,11 @@ +{ + "s1" : { + "en" : "A {$s2}", + }, + "s2" : { + "en" : "B {$s3}", + }, + "s3" : { + "en" : "C", + } +} \ No newline at end of file diff --git a/Assets/Tests/StringSubstitution/stringtable.txt.meta b/Assets/Tests/StringSubstitution/stringtable.txt.meta new file mode 100644 index 00000000..c5bdd21a --- /dev/null +++ b/Assets/Tests/StringSubstitution/stringtable.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 47d7f6e35cabd4559bc7b4c260dbf15c +timeCreated: 1464973113 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: