Browse Source

TextVariation scene demos nested vary sections

master
desktop-maesty/steve 7 years ago
parent
commit
7ffee2a2a8
  1. 5
      Assets/Fungus/Scripts/Utils/TextVariationHandler.cs
  2. 4
      Assets/FungusExamples/VariationText/TextVariation.unity

5
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. /// 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]; /// 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 wraps back around to the begining in a looping fashion
/// - ! does not hold the final element, it instead returns empty for the varying section /// - ! does not hold the final element, it instead returns empty for the varying section
@ -67,9 +69,6 @@ namespace Fungus
} }
static Dictionary<int, int> hashedSections = new Dictionary<int, int>(); static Dictionary<int, int> hashedSections = new Dictionary<int, int>();
//static StringBuilder sb = new StringBuilder();
//const string pattern = @"\[([^]]+?)\]";
//static Regex r = new Regex(pattern);
/// <summary> /// <summary>
/// Simple parser to extract depth matched []. /// Simple parser to extract depth matched [].

4
Assets/FungusExamples/VariationText/TextVariation.unity

@ -972,8 +972,8 @@ MonoBehaviour:
indentLevel: 0 indentLevel: 0
conversationText: conversationText:
stringRef: {fileID: 0} stringRef: {fileID: 0}
stringVal: 'john calling-neutral left: [Good morning, it''s John|Hmm|Yes, still stringVal: 'john calling-neutral left: [Good [~morning|day], it''s John|Hmm|[~Yes,
here]. still|I''m|We''re] here].
sherlock explaining right: [!Who are you talking to?||Still at it, I see.] We 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 have a case to [~deal with|work|tend to|solve]. [!I''m right as rain.|Stop fussing

Loading…
Cancel
Save