Skip to content

Commit

Permalink
added some common tags to the built in dialogue system prefab.
Browse files Browse the repository at this point in the history
  • Loading branch information
McJones committed Jan 30, 2025
1 parent 32fd6ac commit 861aa39
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
> ```
- Added a sample (CustomSaliency) showing off making a custom saliency selection strategy.
- Added a sample (InlineEvents) showing off using `ActionMarkupHandler`'s to perform in line events.
- The Dialogue System prefab now has support for some common rich text tags
- `[i]` will italicise text
- `[b]` will embolden text
- `[u]` will underline text
- `[s]` will strike through text

### Changed

Expand Down
13 changes: 5 additions & 8 deletions Prefabs/Dialogue System.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ MonoBehaviour:
autoAdvanceDelay: 1
useTypewriterEffect: 1
typewriterEffectSpeed: 60
onCharacterTyped:
m_PersistentCalls:
m_Calls: []
temporalProcessors: []
--- !u!1 &2958262986393358530
GameObject:
Expand Down Expand Up @@ -532,7 +529,7 @@ MonoBehaviour:
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_ActiveFontFeatures: 00000000
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
Expand Down Expand Up @@ -743,7 +740,7 @@ MonoBehaviour:
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_ActiveFontFeatures: 00000000
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
Expand Down Expand Up @@ -879,7 +876,7 @@ MonoBehaviour:
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_ActiveFontFeatures: 00000000
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
Expand Down Expand Up @@ -1049,7 +1046,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a968ef973edc54520b248fa3113ae925, type: 3}
m_Name:
m_EditorClassIdentifier:
palette: {fileID: 0}
palette: {fileID: 11400000, guid: 6df01bf68e01943908f9e625c3b0bbc6, type: 2}
lineProvider: {fileID: 0}
--- !u!114 &3859336322602399707
MonoBehaviour:
Expand Down Expand Up @@ -1533,7 +1530,7 @@ MonoBehaviour:
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_ActiveFontFeatures: 00000000
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
Expand Down
17 changes: 11 additions & 6 deletions Runtime/Async/PaletteMarkerProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class PaletteMarkerProcessor : Yarn.Unity.ReplacementMarkupHandler
/// <returns>A list of markup diagnostics if there are any errors, otherwise an empty list.</returns>
public override List<LineParser.MarkupDiagnostic> ProcessReplacementMarker(MarkupAttribute marker, StringBuilder childBuilder, List<MarkupAttribute> childAttributes, string localeCode)
{
// get the colour for this marker
// get the palette for this marker
if (!palette.FormatForMarker(marker.Name, out var style))
{
var error = new List<LineParser.MarkupDiagnostic>
Expand Down Expand Up @@ -95,19 +95,24 @@ public class PaletteMarkerProcessor : Yarn.Unity.ReplacementMarkupHandler
/// </summary>
protected void Start()
{
if (lineProvider == null)
if (palette == null)
{
lineProvider = (LineProviderBehaviour)GameObject.FindAnyObjectByType<DialogueRunner>().LineProvider;
return;
}

if (palette == null)
if (palette.FormatMarkers.Count == 0)
{
return;
}

foreach (var colour in palette.FormatMarkers)
if (lineProvider == null)
{
lineProvider = (LineProviderBehaviour)GameObject.FindAnyObjectByType<DialogueRunner>().LineProvider;
}

foreach (var marker in palette.FormatMarkers)
{
lineProvider.RegisterMarkerProcessor(colour.Marker, this);
lineProvider.RegisterMarkerProcessor(marker.Marker, this);
}
}
}
57 changes: 57 additions & 0 deletions Runtime/Common Tags.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 992e2b513670a4d089c2e58d4c48e8c8, type: 3}
m_Name: Common Tags
m_EditorClassIdentifier:
FormatMarkers:
- Marker: b
CustomColor: 0
Color: {r: 0, g: 0, b: 0, a: 1}
Boldened: 1
Italicised: 0
Underlined: 0
Strikedthrough: 0
- Marker: i
CustomColor: 0
Color: {r: 0, g: 0, b: 0, a: 1}
Boldened: 0
Italicised: 1
Underlined: 0
Strikedthrough: 0
- Marker: u
CustomColor: 0
Color: {r: 0, g: 0, b: 0, a: 1}
Boldened: 0
Italicised: 0
Underlined: 1
Strikedthrough: 0
- Marker: underline
CustomColor: 0
Color: {r: 0, g: 0, b: 0, a: 1}
Boldened: 0
Italicised: 0
Underlined: 1
Strikedthrough: 0
- Marker: s
CustomColor: 0
Color: {r: 0, g: 0, b: 0, a: 1}
Boldened: 0
Italicised: 0
Underlined: 0
Strikedthrough: 1
- Marker: strikethrough
CustomColor: 0
Color: {r: 0, g: 0, b: 0, a: 1}
Boldened: 0
Italicised: 0
Underlined: 1
Strikedthrough: 0
8 changes: 8 additions & 0 deletions Runtime/Common Tags.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 861aa39

Please sign in to comment.