Browse Source

Renamed Conversation class to ConversationManager. Documented conversation() function in Lua.

master
Christopher 9 years ago
parent
commit
b77fb1dd58
  1. 4
      Assets/Fungus/Narrative/Scripts/ConversationManager.cs
  2. 0
      Assets/Fungus/Narrative/Scripts/ConversationManager.cs.meta
  3. 11
      Assets/Fungus/Narrative/Scripts/Stage.cs
  4. 10
      Assets/Fungus/Thirdparty/FungusLua/Resources/Lua/fungus.txt
  5. 9
      Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaUtils.cs
  6. 4
      Assets/FungusExamples/FungusLua/Narrative/PortaitControlExample.unity

4
Assets/Fungus/Narrative/Scripts/Conversation.cs → Assets/Fungus/Narrative/Scripts/ConversationManager.cs

@ -6,7 +6,7 @@ using UnityEngine;
namespace Fungus
{
public class Conversation
public class ConversationManager
{
protected struct ConversationItem
{
@ -20,7 +20,7 @@ namespace Fungus
protected bool exitSayWait;
public Conversation ()
public void PopulateCharacterCache()
{
// cache characters for faster lookup
characters = UnityEngine.Object.FindObjectsOfType<Character>();

0
Assets/Fungus/Narrative/Scripts/Conversation.cs.meta → Assets/Fungus/Narrative/Scripts/ConversationManager.cs.meta

11
Assets/Fungus/Narrative/Scripts/Stage.cs

@ -82,6 +82,17 @@ namespace Fungus
}
return null;
}
public static Stage GetActiveStage()
{
if (Stage.activeStages == null ||
Stage.activeStages.Count == 0)
{
return null;
}
return Stage.activeStages[0];
}
}
}

10
Assets/Fungus/Thirdparty/FungusLua/Resources/Lua/fungus.txt vendored

@ -197,10 +197,14 @@ function M.say(text, voiceclip)
M.runwait(e)
end
-- Say series of lines
-- conv: A string of conversational lines
-- Say a series of lines, setting speakign character, portrait or stage position on each line.
-- All parameters may be ommitted. The first three parameters can appear in any order.
-- The story text starts with a ':' and runs to the next newline character.
-- conv: A string of conversational lines using the following format.
-- [character] [portrait] [position] <: Story text>
-- e.g. john happy left: Hi, I'm happy.
function M.conversation(conv)
local e = luautils.Conversation(conv)
local e = luautils.DoConversation(conv)
M.runwait(e)
end

9
Assets/Fungus/Thirdparty/FungusLua/Scripts/LuaUtils.cs vendored

@ -72,7 +72,7 @@ namespace Fungus
protected StringSubstituter stringSubstituter;
protected Conversation conversation;
protected ConversationManager conversationManager;
/// <summary>
/// Called by LuaEnvironment when initializing.
@ -285,7 +285,8 @@ namespace Fungus
stringSubstituter = new StringSubstituter();
conversation = new Conversation();
conversationManager = new ConversationManager();
conversationManager.PopulateCharacterCache();
if (fungusModule == FungusModuleOptions.UseGlobalVariables)
{
@ -475,9 +476,9 @@ namespace Fungus
/// Use the conversation manager to play out a conversation
/// </summary>
/// <param name="conv"></param>
public virtual IEnumerator Conversation(string conv)
public virtual IEnumerator DoConversation(string conv)
{
return conversation.DoConversation(conv);
return conversationManager.DoConversation(conv);
}
}

4
Assets/FungusExamples/FungusLua/Narrative/PortaitControlExample.unity

@ -423,7 +423,7 @@ MonoBehaviour:
indentLevel: 0
luaEnvironment: {fileID: 0}
luaFile: {fileID: 0}
luaScript: 'conversation[[
luaScript: 'conversation [[
watson annoyed left: What the deuce!
@ -507,7 +507,7 @@ MonoBehaviour:
indentLevel: 0
luaEnvironment: {fileID: 0}
luaFile: {fileID: 0}
luaScript: "conversation [[\r\nsherlock right: Character+position.\r\nThis is a
luaScript: "conversation [[\r\nsherlock right: Character+position.\r\nThis is a
continuation of the last line.\nS bored left:All three options with name shortened.\nwatson
annoyed right: Adding a new character on the right.\r\nW, confident, offscreen
right: Move Watson offscreen using commas.\r\n]]"

Loading…
Cancel
Save