Browse Source

Added {m} tag to broadcast a message to all FungusScripts

This allows you to broadcast a message to all FungusScripts in the
middle of Say story text.
master
chrisgregan 10 years ago
parent
commit
bba07f3ddb
  1. 3
      Assets/Fungus/Dialog/Editor/SayEditor.cs
  2. 4
      Assets/Fungus/Dialog/Scripts/Dialog.cs
  3. 8
      Assets/Fungus/Dialog/Scripts/DialogParser.cs

3
Assets/Fungus/Dialog/Editor/SayEditor.cs

@ -24,7 +24,8 @@ namespace Fungus
"\t{wp}, {wp=0.5} Wait on punctuation\n" +
"\t{c} Clear\n" +
"\t{s}, {s=60} Writing speed (chars per sec)\n" +
"\t{x} Exit";
"\t{x} Exit" +
"\t{m} Broadcast message";
float pixelHeight = EditorStyles.miniLabel.CalcHeight(new GUIContent(tagsText), EditorGUIUtility.currentViewWidth);
EditorGUILayout.SelectableLabel(tagsText, EditorStyles.miniLabel, GUILayout.MinHeight(pixelHeight));

4
Assets/Fungus/Dialog/Scripts/Dialog.cs

@ -243,6 +243,10 @@ namespace Fungus
}
yield break;
case TokenType.Message:
FungusScript.BroadcastFungusMessage(token.param);
break;
}
// Update text writing

8
Assets/Fungus/Dialog/Scripts/DialogParser.cs

@ -20,7 +20,8 @@ namespace Fungus
WaitOnPunctuation, // wp, wp=0.5
Clear, // c
Speed, // s, s=60
Exit // x
Exit, // x
Message // m=MessageName
}
public class Token
@ -153,6 +154,11 @@ namespace Fungus
{
type = TokenType.Exit;
}
else if (tag.StartsWith("m="))
{
type = TokenType.Message;
paramText = tag.Substring(2, tag.Length - 2);
}
Token token = new Token();
token.type = type;

Loading…
Cancel
Save