From 7ffee2a2a8d8e6140c51dc1da983dfc9e840b20d Mon Sep 17 00:00:00 2001 From: desktop-maesty/steve Date: Mon, 25 Jun 2018 19:53:18 +1000 Subject: [PATCH] TextVariation scene demos nested vary sections --- Assets/Fungus/Scripts/Utils/TextVariationHandler.cs | 5 ++--- Assets/FungusExamples/VariationText/TextVariation.unity | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Assets/Fungus/Scripts/Utils/TextVariationHandler.cs b/Assets/Fungus/Scripts/Utils/TextVariationHandler.cs index 6af32241..d6ebabb8 100644 --- a/Assets/Fungus/Scripts/Utils/TextVariationHandler.cs +++ b/Assets/Fungus/Scripts/Utils/TextVariationHandler.cs @@ -16,6 +16,8 @@ namespace Fungus /// /// Empty sections are allowed, such that [a||c], on second showing it will have 0 characters. /// + /// Supports nested sections, that are only evaluated if their parent element is chosen. + /// /// This behaviour can be modified with certain characters at the start of the [], eg. [&a|b|c]; /// - & does not hold the final element it wraps back around to the begining in a looping fashion /// - ! does not hold the final element, it instead returns empty for the varying section @@ -67,9 +69,6 @@ namespace Fungus } static Dictionary hashedSections = new Dictionary(); - //static StringBuilder sb = new StringBuilder(); - //const string pattern = @"\[([^]]+?)\]"; - //static Regex r = new Regex(pattern); /// /// Simple parser to extract depth matched []. diff --git a/Assets/FungusExamples/VariationText/TextVariation.unity b/Assets/FungusExamples/VariationText/TextVariation.unity index 8d58dba4..63141a97 100644 --- a/Assets/FungusExamples/VariationText/TextVariation.unity +++ b/Assets/FungusExamples/VariationText/TextVariation.unity @@ -972,8 +972,8 @@ MonoBehaviour: indentLevel: 0 conversationText: stringRef: {fileID: 0} - stringVal: 'john calling-neutral left: [Good morning, it''s John|Hmm|Yes, still - here]. + stringVal: 'john calling-neutral left: [Good [~morning|day], it''s John|Hmm|[~Yes, + still|I''m|We''re] here]. sherlock explaining right: [!Who are you talking to?||Still at it, I see.] We have a case to [~deal with|work|tend to|solve]. [!I''m right as rain.|Stop fussing