muddesigner/MudEngine/GameObjects/Characters/DialogChat.cs
Scionwest_cp 45931f5fe6 MudEngine:
- Added a new Type called DialogChat which will be used to hold branched dialogs for characters.
 - Added initial support for Dialog chatting in BaseCharacter. This will primarily be for AI, as Users already have the Say command and don't use branched dialog.
 - Added primitive checking during BaseCharacter.Load() to find the correct Room for the character in the event that two Zones with the same name exist.
2011-05-08 11:00:36 -07:00

62 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MudEngine.GameObjects.Characters
{
public enum DialogSlot
{
Entry1,
Entry2,
Entry3,
Entry4,
Entry5,
}
public class DialogChat
{
public Dictionary<DialogSlot, DialogChat> DialogBranch { get; internal set; }
public String Response { get; set; }
public String Question { get; set; }
public DialogChat()
{
DialogBranch = new Dictionary<DialogSlot, DialogChat>();
}
public DialogChat(String response) : this()
{
this.Response = response;
}
public Boolean AddDialog(DialogSlot slot, DialogChat dialog)
{
foreach (DialogSlot s in DialogBranch.Keys)
{
//If an entry is already in use, do not replace it or add a duplicate entry with a different dialog.
//Reject it.
if (s == slot)
{
return false;
}
}
DialogBranch.Add(slot, dialog);
return true;
}
public DialogChat GetDialog(DialogSlot slot)
{
if (DialogBranch.Count == 0)
return null;
if (DialogBranch[slot] == null)
return null;
return DialogBranch[slot];
}
}
}