diff --git a/Assets/Fungus/UI/Scripts/TextTagParser.cs b/Assets/Fungus/UI/Scripts/TextTagParser.cs index d5204505..fe6f898d 100644 --- a/Assets/Fungus/UI/Scripts/TextTagParser.cs +++ b/Assets/Fungus/UI/Scripts/TextTagParser.cs @@ -17,6 +17,8 @@ namespace Fungus ItalicEnd, // /i ColorStart, // color=red ColorEnd, // /color + SizeStart, // size=20 + SizeEnd, // /size Wait, // w, w=0.5 WaitForInputNoClear, // wi WaitForInputAndClear, // wc @@ -49,6 +51,7 @@ namespace Fungus "\t{b} Bold Text {/b}\n" + "\t{i} Italic Text {/i}\n" + "\t{color=red} Color Text (color){/color}\n" + + "\t{size=30} Text size {/size}\n" + "\n" + "\t{s}, {s=60} Writing speed (chars per sec){/s}\n" + "\t{w}, {w=0.5} Wait (seconds)\n" + @@ -180,6 +183,14 @@ namespace Fungus { type = TokenType.ColorEnd; } + else if (tag.StartsWith("size=")) + { + type = TokenType.SizeStart; + } + else if (tag == "/size") + { + type = TokenType.SizeEnd; + } else if (tag == "wi") { type = TokenType.WaitForInputNoClear; diff --git a/Assets/Fungus/UI/Scripts/Writer.cs b/Assets/Fungus/UI/Scripts/Writer.cs index 7a9dfcd0..ffeb722e 100644 --- a/Assets/Fungus/UI/Scripts/Writer.cs +++ b/Assets/Fungus/UI/Scripts/Writer.cs @@ -79,6 +79,8 @@ namespace Fungus protected bool italicActive = false; protected bool colorActive = false; protected string colorText = ""; + protected bool sizeActive = false; + protected float sizeValue = 16f; protected bool inputFlag; protected bool exitFlag; @@ -212,6 +214,10 @@ namespace Fungus if (SupportsRichText()) { + if (sizeActive) + { + tagText += ""; + } if (colorActive) { tagText += ""; @@ -247,6 +253,10 @@ namespace Fungus { closeText += ""; } + if (sizeActive) + { + closeText += ""; + } } return closeText; @@ -364,7 +374,9 @@ namespace Fungus boldActive = false; italicActive = false; colorActive = false; + sizeActive = false; colorText = ""; + sizeValue = 16f; currentPunctuationPause = punctuationPause; currentWritingSpeed = writingSpeed; @@ -409,7 +421,18 @@ namespace Fungus case TextTagParser.TokenType.ColorEnd: colorActive = false; break; - + + case TextTagParser.TokenType.SizeStart: + if (TryGetSingleParam(token.paramList, 0, 16f, out sizeValue)) + { + sizeActive = true; + } + break; + + case TextTagParser.TokenType.SizeEnd: + sizeActive = false; + break; + case TextTagParser.TokenType.Wait: yield return StartCoroutine(DoWait(token.paramList)); break; diff --git a/Assets/Tests/Narrative/NarrativeTests.unity b/Assets/Tests/Narrative/NarrativeTests.unity index c78af67c..f8da9a04 100644 --- a/Assets/Tests/Narrative/NarrativeTests.unity +++ b/Assets/Tests/Narrative/NarrativeTests.unity @@ -112,7 +112,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3} m_Name: m_EditorClassIdentifier: - selectedFlowchart: {fileID: 670062727} + selectedFlowchart: {fileID: 1985406185} --- !u!4 &11556238 Transform: m_ObjectHideFlags: 1 @@ -511,7 +511,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - version: 1.0 + version: 1 scrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 @@ -559,7 +559,10 @@ MonoBehaviour: itemId: 5 errorMessage: indentLevel: 0 - duration: 2 + _duration: + floatRef: {fileID: 0} + floatVal: 2 + durationOLD: 0 --- !u!114 &24983361 MonoBehaviour: m_ObjectHideFlags: 2 @@ -668,7 +671,10 @@ MonoBehaviour: itemId: 6 errorMessage: indentLevel: 0 - duration: 2 + _duration: + floatRef: {fileID: 0} + floatVal: 2 + durationOLD: 0 --- !u!114 &24983366 MonoBehaviour: m_ObjectHideFlags: 2 @@ -710,7 +716,10 @@ MonoBehaviour: itemId: 8 errorMessage: indentLevel: 0 - duration: 2 + _duration: + floatRef: {fileID: 0} + floatVal: 2 + durationOLD: 0 --- !u!114 &24983368 MonoBehaviour: m_ObjectHideFlags: 2 @@ -1525,6 +1534,7 @@ Canvas: m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 @@ -2487,6 +2497,7 @@ Canvas: m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 m_SortingLayerID: 0 m_SortingOrder: 1 m_TargetDisplay: 0 @@ -2685,7 +2696,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - version: 1.0 + version: 1 scrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 @@ -2832,6 +2843,7 @@ MonoBehaviour: - {fileID: 21300000, guid: c779e34c6eb8e45da98c70cf2802a54c, type: 3} - {fileID: 21300000, guid: c009fd0bc42254e3b8b5ebe324dfeb3f, type: 3} portraitsFace: 1 + setSayDialog: {fileID: 0} description: --- !u!4 &290123701 Transform: @@ -3380,6 +3392,7 @@ MonoBehaviour: - {fileID: 21300000, guid: daa5ae3d727b143f0b42aaa4e6b1e2a5, type: 3} - {fileID: 21300000, guid: b498a62f179e149be9515ba5614ccfa3, type: 3} portraitsFace: 2 + setSayDialog: {fileID: 0} description: --- !u!1 &364445737 GameObject: @@ -3535,6 +3548,58 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: passCount: 0 +--- !u!1 &458201897 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 458201899} + - 114: {fileID: 458201898} + m_Layer: 0 + m_Name: SizeTagTest + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!114 &458201898 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 458201897} + 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!4 &458201899 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 458201897} + 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: 1626834557} + - {fileID: 1985406181} + - {fileID: 1096381122} + m_Father: {fileID: 0} + m_RootOrder: 16 --- !u!1 &462273689 GameObject: m_ObjectHideFlags: 0 @@ -3685,6 +3750,7 @@ MonoBehaviour: shiftKeyEnabled: 1 nextClickDelay: 0 keyList: 0900000020000000 + ignoreMenuClicks: 1 --- !u!82 &538232717 AudioSource: m_ObjectHideFlags: 0 @@ -3795,6 +3861,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: targetTextObject: {fileID: 620765065} + punchObject: {fileID: 0} writingSpeed: 60 punctuationPause: 0.25 hiddenTextColor: {r: 1, g: 1, b: 1, a: 0} @@ -3887,6 +3954,7 @@ Canvas: m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 m_SortingLayerID: 0 m_SortingOrder: 1 m_TargetDisplay: 0 @@ -4082,7 +4150,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - version: 1.0 + version: 1 scrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 @@ -4119,7 +4187,10 @@ MonoBehaviour: itemId: 6 errorMessage: indentLevel: 0 - duration: 1 + _duration: + floatRef: {fileID: 0} + floatVal: 1 + durationOLD: 0 --- !u!114 &562609156 MonoBehaviour: m_ObjectHideFlags: 0 @@ -4283,6 +4354,79 @@ Transform: m_Children: [] m_Father: {fileID: 956321189} m_RootOrder: 2 +--- !u!1 &588326334 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 588326337} + - 222: {fileID: 588326336} + - 114: {fileID: 588326335} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &588326335 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 588326334} + 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 &588326336 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 588326334} +--- !u!224 &588326337 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 588326334} + 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: 1626834557} + m_RootOrder: 0 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -140, y: -42} + m_SizeDelta: {x: 280, y: 84} + m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &594837298 GameObject: m_ObjectHideFlags: 0 @@ -5126,7 +5270,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - version: 1.0 + version: 1 scrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 @@ -5163,7 +5307,10 @@ MonoBehaviour: itemId: 4 errorMessage: indentLevel: 0 - duration: 0.5 + _duration: + floatRef: {fileID: 0} + floatVal: 0.5 + durationOLD: 0 --- !u!114 &670062729 MonoBehaviour: m_ObjectHideFlags: 2 @@ -5499,7 +5646,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - version: 1.0 + version: 1 scrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 @@ -5611,7 +5758,10 @@ MonoBehaviour: itemId: 5 errorMessage: indentLevel: 0 - duration: 1 + _duration: + floatRef: {fileID: 0} + floatVal: 1 + durationOLD: 0 --- !u!1 &724348927 GameObject: m_ObjectHideFlags: 0 @@ -5807,7 +5957,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - version: 1.0 + version: 1 scrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 @@ -5909,7 +6059,10 @@ MonoBehaviour: itemId: 6 errorMessage: indentLevel: 0 - duration: 2 + _duration: + floatRef: {fileID: 0} + floatVal: 2 + durationOLD: 0 --- !u!114 &736071355 MonoBehaviour: m_ObjectHideFlags: 2 @@ -5983,7 +6136,10 @@ MonoBehaviour: itemId: 7 errorMessage: indentLevel: 0 - duration: 4 + _duration: + floatRef: {fileID: 0} + floatVal: 4 + durationOLD: 0 --- !u!114 &736071358 MonoBehaviour: m_ObjectHideFlags: 2 @@ -6077,7 +6233,10 @@ MonoBehaviour: itemId: 10 errorMessage: indentLevel: 0 - duration: 2 + _duration: + floatRef: {fileID: 0} + floatVal: 2 + durationOLD: 0 --- !u!114 &736071363 MonoBehaviour: m_ObjectHideFlags: 2 @@ -6119,7 +6278,10 @@ MonoBehaviour: itemId: 12 errorMessage: indentLevel: 0 - duration: 2 + _duration: + floatRef: {fileID: 0} + floatVal: 2 + durationOLD: 0 --- !u!114 &736071365 MonoBehaviour: m_ObjectHideFlags: 2 @@ -6230,7 +6392,10 @@ MonoBehaviour: itemId: 16 errorMessage: indentLevel: 0 - duration: 2 + _duration: + floatRef: {fileID: 0} + floatVal: 2 + durationOLD: 0 --- !u!1 &754457508 GameObject: m_ObjectHideFlags: 0 @@ -7149,7 +7314,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - version: 1.0 + version: 1 scrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 @@ -7314,7 +7479,10 @@ MonoBehaviour: itemId: 6 errorMessage: indentLevel: 0 - duration: 0.5 + _duration: + floatRef: {fileID: 0} + floatVal: 0.5 + durationOLD: 0 --- !u!114 &861253881 MonoBehaviour: m_ObjectHideFlags: 0 @@ -7530,7 +7698,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - version: 1.0 + version: 1 scrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 @@ -8345,6 +8513,7 @@ MonoBehaviour: shiftKeyEnabled: 1 nextClickDelay: 0 keyList: 0900000020000000 + ignoreMenuClicks: 1 --- !u!114 &927439919 MonoBehaviour: m_ObjectHideFlags: 0 @@ -8380,6 +8549,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: targetTextObject: {fileID: 157771017} + punchObject: {fileID: 0} writingSpeed: 60 punctuationPause: 0.25 hiddenTextColor: {r: 1, g: 1, b: 1, a: 0} @@ -8472,9 +8642,30 @@ Canvas: m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 m_SortingLayerID: 0 m_SortingOrder: 1 m_TargetDisplay: 0 +--- !u!114 &935477942 +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: 588326334} + thisPropertyPath: Text.text + compareToType: 1 + other: {fileID: 0} + otherPropertyPath: + constantValueGeneric: Set size text + compareType: 0 + comparisonType: 4 + ignoreCase: 0 --- !u!1 &956321188 GameObject: m_ObjectHideFlags: 0 @@ -8656,6 +8847,7 @@ Canvas: m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 @@ -9457,6 +9649,7 @@ MonoBehaviour: portraits: - {fileID: 21300000, guid: 10cc2fec4b8aa4db983981588b06b591, type: 3} portraitsFace: 0 + setSayDialog: {fileID: 0} description: --- !u!1 &1049860612 GameObject: @@ -9576,6 +9769,7 @@ MonoBehaviour: - {fileID: 21300000, guid: 5b776e5296df54952a07a367943f5c7c, type: 3} - {fileID: 21300000, guid: 820bab66bb5a044ec961ba8ee3b045cc, type: 3} portraitsFace: 0 + setSayDialog: {fileID: 0} description: --- !u!1 &1066357890 stripped GameObject: @@ -9856,6 +10050,7 @@ MonoBehaviour: shiftKeyEnabled: 1 nextClickDelay: 0 keyList: 0900000020000000 + ignoreMenuClicks: 1 --- !u!114 &1090798155 MonoBehaviour: m_ObjectHideFlags: 0 @@ -9869,6 +10064,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: targetTextObject: {fileID: 658513471} + punchObject: {fileID: 0} writingSpeed: 60 punctuationPause: 0.25 hiddenTextColor: {r: 1, g: 1, b: 1, a: 0} @@ -9961,9 +10157,59 @@ Canvas: m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 m_SortingLayerID: 0 m_SortingOrder: 1 m_TargetDisplay: 0 +--- !u!1 &1096381121 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1096381122} + - 114: {fileID: 1096381123} + m_Layer: 0 + m_Name: TestAssertions + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1096381122 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1096381121} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 178.0346, y: 66.80416, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 458201899} + m_RootOrder: 2 +--- !u!114 &1096381123 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1096381121} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8bafa54482a87ac4cbd7ff1bfd1ac93a, type: 3} + m_Name: + m_EditorClassIdentifier: + checkAfterTime: 3 + repeatCheckTime: 0 + repeatEveryTime: 1 + checkAfterFrames: 1 + repeatCheckFrame: 1 + repeatEveryFrame: 1 + hasFailed: 0 + checkMethods: 1 + m_ActionBase: {fileID: 935477942} + checksPerformed: 0 --- !u!1 &1112648893 GameObject: m_ObjectHideFlags: 0 @@ -10094,6 +10340,7 @@ MonoBehaviour: shiftKeyEnabled: 1 nextClickDelay: 0 keyList: 0900000020000000 + ignoreMenuClicks: 1 --- !u!224 &1125936941 RectTransform: m_ObjectHideFlags: 0 @@ -10201,6 +10448,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: targetTextObject: {fileID: 319877265} + punchObject: {fileID: 0} writingSpeed: 60 punctuationPause: 0.25 hiddenTextColor: {r: 1, g: 1, b: 1, a: 0} @@ -10293,6 +10541,7 @@ Canvas: m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 m_SortingLayerID: 0 m_SortingOrder: 1 m_TargetDisplay: 0 @@ -10674,7 +10923,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - version: 1.0 + version: 1 scrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 @@ -10736,7 +10985,10 @@ MonoBehaviour: itemId: 4 errorMessage: indentLevel: 0 - duration: 1 + _duration: + floatRef: {fileID: 0} + floatVal: 1 + durationOLD: 0 --- !u!114 &1196429432 MonoBehaviour: m_ObjectHideFlags: 0 @@ -10871,6 +11123,7 @@ MonoBehaviour: shiftKeyEnabled: 1 nextClickDelay: 0 keyList: 0900000020000000 + ignoreMenuClicks: 1 --- !u!114 &1242507978 MonoBehaviour: m_ObjectHideFlags: 0 @@ -10906,6 +11159,7 @@ Canvas: m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 m_SortingLayerID: 0 m_SortingOrder: 1 m_TargetDisplay: 0 @@ -11019,6 +11273,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: targetTextObject: {fileID: 572306878} + punchObject: {fileID: 0} writingSpeed: 60 punctuationPause: 0.25 hiddenTextColor: {r: 1, g: 1, b: 1, a: 0} @@ -11443,6 +11698,7 @@ Canvas: m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 m_SortingLayerID: 0 m_SortingOrder: 1 m_TargetDisplay: 0 @@ -11794,6 +12050,98 @@ MonoBehaviour: type: 2} m_PrefabInternal: {fileID: 141635719} m_Script: {fileID: 11500000, guid: 3a0bbe22c246e4c78ad8e9816cbae9d5, type: 3} +--- !u!1 &1626834556 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1626834557} + - 223: {fileID: 1626834560} + - 114: {fileID: 1626834559} + - 114: {fileID: 1626834558} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1626834557 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1626834556} + 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_Children: + - {fileID: 588326337} + m_Father: {fileID: 458201899} + m_RootOrder: 0 + 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 &1626834558 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1626834556} + 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 &1626834559 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1626834556} + 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 &1626834560 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1626834556} + 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 &1633375113 GameObject: m_ObjectHideFlags: 0 @@ -11918,6 +12266,7 @@ MonoBehaviour: - {fileID: 21300000, guid: 450277e404c2d4d1e87c5bd4012283bb, type: 3} - {fileID: 21300000, guid: c779e34c6eb8e45da98c70cf2802a54c, type: 3} portraitsFace: 1 + setSayDialog: {fileID: 0} description: --- !u!1 &1645730417 GameObject: @@ -13168,6 +13517,7 @@ MonoBehaviour: shiftKeyEnabled: 1 nextClickDelay: 0 keyList: 0900000020000000 + ignoreMenuClicks: 1 --- !u!82 &1714427705 AudioSource: m_ObjectHideFlags: 0 @@ -13276,6 +13626,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: targetTextObject: {fileID: 93721126} + punchObject: {fileID: 0} writingSpeed: 60 punctuationPause: 0.25 hiddenTextColor: {r: 1, g: 1, b: 1, a: 0} @@ -13368,6 +13719,7 @@ Canvas: m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 m_SortingLayerID: 0 m_SortingOrder: 1 m_TargetDisplay: 0 @@ -13553,6 +13905,7 @@ MonoBehaviour: shiftKeyEnabled: 1 nextClickDelay: 0 keyList: 0900000020000000 + ignoreMenuClicks: 1 --- !u!82 &1764227329 AudioSource: m_ObjectHideFlags: 0 @@ -13663,6 +14016,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: targetTextObject: {fileID: 995680046} + punchObject: {fileID: 0} writingSpeed: 60 punctuationPause: 0.25 hiddenTextColor: {r: 1, g: 1, b: 1, a: 0} @@ -13755,6 +14109,7 @@ Canvas: m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 m_SortingLayerID: 0 m_SortingOrder: 1 m_TargetDisplay: 0 @@ -14301,7 +14656,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - version: 1.0 + version: 1 scrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 @@ -14536,7 +14891,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - version: 1.0 + version: 1 scrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 @@ -15128,6 +15483,136 @@ CanvasRenderer: type: 2} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1982302732} +--- !u!1 &1985406180 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 142980, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1985406181} + - 114: {fileID: 1985406185} + - 114: {fileID: 1985406184} + - 114: {fileID: 1985406183} + - 114: {fileID: 1985406182} + m_Layer: 0 + m_Name: Flowchart + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1985406181 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 467082, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1985406180} + 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: 458201899} + m_RootOrder: 1 +--- !u!114 &1985406182 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1985406180} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ad2261dbe44de43a980e6f7c77c88f7f, type: 3} + m_Name: + m_EditorClassIdentifier: + itemId: 1 + errorMessage: + indentLevel: 0 + textObject: {fileID: 588326334} + text: + stringRef: {fileID: 0} + stringVal: Set {size=30}size{/size} text + description: + clearText: 1 + waitUntilFinished: 1 + textColor: 0 + setAlpha: + floatRef: {fileID: 0} + floatVal: 1 + setColor: + colorRef: {fileID: 0} + colorVal: {r: 1, g: 1, b: 1, a: 1} +--- !u!114 &1985406183 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 11462346, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1985406180} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d2f6487d21a03404cb21b245f0242e79, type: 3} + m_Name: + m_EditorClassIdentifier: + parentBlock: {fileID: 1985406184} +--- !u!114 &1985406184 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 11433304, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1985406180} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} + m_Name: + m_EditorClassIdentifier: + nodeRect: + serializedVersion: 2 + x: 67 + y: 70 + width: 120 + height: 40 + itemId: 0 + blockName: Start + description: + eventHandler: {fileID: 1985406183} + commandList: + - {fileID: 1985406182} +--- !u!114 &1985406185 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11430050, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1985406180} + 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: 1985406184} + selectedCommands: [] + variables: [] + description: + stepPause: 0 + colorCommands: 1 + hideComponents: 1 + saveSelection: 1 + localizationId: + hideCommands: [] --- !u!1 &1992903419 GameObject: m_ObjectHideFlags: 0 @@ -15469,6 +15954,7 @@ MonoBehaviour: profileSprite: {fileID: 0} portraits: [] portraitsFace: 0 + setSayDialog: {fileID: 0} description: --- !u!1 &2011349147 GameObject: @@ -15671,7 +16157,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Name: m_EditorClassIdentifier: - version: 1.0 + version: 1 scrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0} variablesExpanded: 1 @@ -15810,7 +16296,10 @@ MonoBehaviour: itemId: 3 errorMessage: indentLevel: 0 - duration: 1 + _duration: + floatRef: {fileID: 0} + floatVal: 1 + durationOLD: 0 --- !u!114 &2043226677 MonoBehaviour: m_ObjectHideFlags: 2 @@ -15855,7 +16344,10 @@ MonoBehaviour: itemId: 4 errorMessage: indentLevel: 0 - duration: 1 + _duration: + floatRef: {fileID: 0} + floatVal: 1 + durationOLD: 0 --- !u!114 &2043226679 MonoBehaviour: m_ObjectHideFlags: 2 @@ -15884,7 +16376,10 @@ MonoBehaviour: itemId: 7 errorMessage: indentLevel: 0 - duration: 1 + _duration: + floatRef: {fileID: 0} + floatVal: 1 + durationOLD: 0 --- !u!1 &2046151992 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Tests/UI/Editor/TextTagParserTests.cs b/Assets/Tests/UI/Editor/TextTagParserTests.cs index 244f593e..cdcd13b6 100644 --- a/Assets/Tests/UI/Editor/TextTagParserTests.cs +++ b/Assets/Tests/UI/Editor/TextTagParserTests.cs @@ -18,6 +18,7 @@ public class TextTagParserTests "{b}bold test{/b}" + "{i}italic test{/i}" + "{color=red}color test{/color}" + + "{size=30}size test{/size}" + "{w}{w=0.5}" + "{wi}{wc}" + "{wp}{wp=0.5}{/wp}" + @@ -73,6 +74,18 @@ public class TextTagParserTests Assert.That(tokens[i].type == TextTagParser.TokenType.ColorEnd); Assert.That(tokens[i].paramList.Count == 0); + i++; + Assert.That(tokens[i].type == TextTagParser.TokenType.SizeStart); + Assert.That(tokens[i].paramList[0] == "30"); + + i++; + Assert.That(tokens[i].type == TextTagParser.TokenType.Words); + Assert.That(tokens[i].paramList[0] == "size test"); + + i++; + Assert.That(tokens[i].type == TextTagParser.TokenType.SizeEnd); + Assert.That(tokens[i].paramList.Count == 0); + i++; Assert.That(tokens[i].type == TextTagParser.TokenType.Wait); Assert.That(tokens[i].paramList.Count == 0); @@ -157,7 +170,7 @@ public class TextTagParserTests Assert.That(tokens[i].type == TextTagParser.TokenType.AudioStop); Assert.That(tokens[i].paramList[0] == "Sound"); - Assert.That(tokens.Count == 31); + Assert.That(tokens.Count == 34); } [Test]