Exemple #1
0
        public void AssignNewDialogue(DialogueInfo info)
        {
            DialogueOption dialogue = DialogueService.GetInstance().GetDialogue(info);
            IChattable     npc      = EntityService.GetInstance().GetNpcById(info.NpcId);

            npc.AddDialogue(dialogue);
            hasChanged = true;
        }
        public object Clone()
        {
            DialogueInfo clone = new DialogueInfo();

            clone.npcId      = npcId;
            clone.dialogueId = dialogueId;

            return(clone);
        }
Exemple #3
0
        public void OnSelected(object sender, EventArgs args)
        {
            if (!(sender is DialogueInfo))
            {
                return;
            }

            DialogueInfo dialogueInfo = (DialogueInfo)sender;

            selectedDialogues.Enqueue(dialogueInfo);
        }
Exemple #4
0
 public DialogueOption GetDialogue(DialogueInfo dialogueInfo)
 {
     foreach (KeyValuePair <DialogueInfo, DialogueOption> item in allDialogues)
     {
         if (dialogueInfo.Equals(item.Key))
         {
             return(item.Value);
         }
     }
     return(null);
 }
        public override bool Equals(object obj)
        {
            if (!(obj is DialogueInfo))
            {
                return(false);
            }

            DialogueInfo info = (DialogueInfo)obj;

            return(info.dialogueId == dialogueId &&
                   info.npcId == npcId);
        }
Exemple #6
0
        public void Update(GameTime gameTime)
        {
            while (selectedDialogues.Count > 0)
            {
                DialogueInfo   info     = selectedDialogues.Dequeue();
                DialogueOption dialogue = DialogueService.GetInstance().GetDialogue(info);
                dialogue.Update(gameTime);
                hasChanged = true;

                if (DialogueSelected != null)
                {
                    DialogueSelected(info, null);
                }
            }
        }