public Conversation BuildConversation(IConversable forWhom) { if (playerOnlyMessage != null && !(forWhom is IPlayer)) { return(new Conversation(plugin, forWhom, new NotPlayerMessagePrompt())); } Dictionary <object, object> copiedInitialSessionData = new Dictionary <object, object>(); foreach (var initData in initialSessionData) { copiedInitialSessionData.Add(initData.Key, initData.Value); } Conversation conversation = new Conversation(plugin, forWhom, firstPrompt, copiedInitialSessionData); conversation.IsModal = isModal; conversation.IsLocalEchoEnabled = localEchoEnabled; conversation.Prefix = prefix; foreach (IConversationCanceller canceller in cancellers) { conversation.AddConversationCanceller((IConversationCanceller)canceller.Clone()); } return(conversation); }
/// <summary> /// Starts the conversation. /// </summary> public void StartConversation() { // Reference to the class that contains defitions for functions triggered by this conversation // In effect, this is the part of the NPCs behaviour. IConversable npcRef = this.gameObject.GetComponentInParent(typeof(IConversable)) as IConversable; DialogManager.Instance.StartConversation(this.Graph, npcRef); }
public Conversation(IPlugin plugin, IConversable forWhom, IPrompt firstPrompt, Dictionary <Object, Object> initialSessionData) { this.firstPrompt = firstPrompt; this.context = new ConversationContext(plugin, forWhom, initialSessionData); this.modal = true; this.localEchoEnabled = true; this.prefix = new NullConversationPrefix(); this.cancellers = new List <IConversationCanceller>(); }
/// <summary> /// Starts the conversation. /// </summary> /// <param name="Conversation">The dialog graph that will be interpreted.</param> /// <param name="NPC">Reference to the NPC that the player is going to talk with.</param> public void StartConversation(List <DialogNode> Conversation, IConversable NPC) { this.Speaker = NPC; this.DialogGraph = Conversation; UpdateDialog(this.DialogGraph[0]); currentSelection = 0; endOfConversation = false; isWindowHidden = false; DialogBackground.SetActive(true); }
public ConversationContext(IPlugin plugin, IConversable forWhom, Dictionary <object, object> initialSessionData) { this.plugin = plugin; this.forWhom = forWhom; this.sessionData = initialSessionData; }
protected abstract void MessageReceived(IConversable sender, string message);
public Conversation(IPlugin plugin, IConversable forWhom, IPrompt firstPrompt) : this(plugin, forWhom, firstPrompt, new Dictionary <object, object>()) { }
public static void SendNotice(this ClientBase client, IConversable receiver, string message) { client.SendMessage(new RawMessage("NOTICE", receiver.Target, message)); }
public ConversationMessageEventArgs(IConversable sender, string message) { Sender = sender; Message = message; }