Exemplo n.º 1
0
        private List <DialogueNode> ContinueMessengerDialog(string charId, FormatDialogue mode, DialogueNode dialogueNode = null)
        {
            var dialogs = mode == FormatDialogue.sms ? activeMessageDialogs : activeEmailDialogs;
            int nodeId  = -1;

            if (!dialogs.ContainsKey(charId) || dialogs[charId].Count == 0)
            {
                return(new List <DialogueNode>());
            }
            Dialog curDialog = dialogs[charId].Last();

            if (dialogueNode != null)
            {
                //SetResultsForNode(dialogueNode);
                nodeId = dialogueNode.Id;

                var player = ConnectingAppManager.CharacterManager.GetPlayer();
                player.AddMessage(charId, dialogueNode, mode == FormatDialogue.sms ? Characters.Player.MessageType.Sms : Characters.Player.MessageType.Email, curDialog.Id);
            }

            var nextNodes = curDialog.TakeNextNodes(nodeId);

            if (nextNodes.Count == 0)
            {
                TriangleManager.InvokeResultFuncs(ResultFuncsEnum.EndOfDialog, new List <string> {
                    curDialog.Id, curDialog.Format.ToString()
                });
                dialogs[charId].Remove(curDialog);
            }
            return(nextNodes);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Для продолжения уже начатого диалога.
        /// </summary>
        /// <param name="mode">Тип диалога.</param>
        /// <param name="dialogueNode">Последняя выработанная нода диалога.</param>
        /// <param name="charId">Id персонажа с которым идет переписка.</param>
        /// <returns></returns>
        public List <DialogueNode> ContinueDialog(FormatDialogue mode, DialogueNode dialogueNode, string charId = "")
        {
            switch (mode)
            {
            case FormatDialogue.call:
                return(ContinueDialog(dialogueNode));

            case FormatDialogue.email:
            case FormatDialogue.sms:
                if (charId != "")
                {
                    return(ContinueMessengerDialog(charId, mode, dialogueNode));
                }
                else
                {
                    Debug.LogError("При попытке продолжить диалог не указан charId.");
                    return(null);
                }

            case FormatDialogue.videocall:
            case FormatDialogue.meet:
            case FormatDialogue.dialogueInterface:
            default:
                return(ContinueDialog(dialogueNode));
            }
        }
Exemplo n.º 3
0
        public List <DialogueNode> StartDialog(string charId, FormatDialogue dialogueMode, string dialogId)
        {
            Dialog newOne = ConnectingAppManager.CharacterManager.GetDialog(charId, dialogueMode, dialogId);

            if (newOne != null)
            {
                if (dialogueMode == FormatDialogue.sms || dialogueMode == FormatDialogue.email)
                {
                    newOne.currentBlock = Core.Dialogues.DialogueBlock.BlockType.hi;
                    var dialogs = dialogueMode == FormatDialogue.sms ? activeMessageDialogs : activeEmailDialogs;
                    if (!dialogs.ContainsKey(charId))
                    {
                        dialogs.Add(charId, new List <Dialog>());
                    }
                    dialogs[charId].Add(newOne);
                    return(ContinueMessengerDialog(charId, dialogueMode));
                }
                activeDialogs.Add(newOne);
                newOne.currentBlock = !IsLonelyDialog(newOne) ? Core.Dialogues.DialogueBlock.BlockType.body : Core.Dialogues.DialogueBlock.BlockType.hi;
                return(ContinueDialog());
            }
            else
            {
                return(new List <DialogueNode>());
            }
        }
Exemplo n.º 4
0
 private static void TryToStartDialogue(List<string> input)
 {
     FormatDialogue mode = (FormatDialogue)Int32.Parse(input[2]);
     var dialogue = ConnectingAppManager.CharacterManager.GetNPC(input[0]).GetDialog(mode, input[1]);
     if (dialogue != null && !ConnectingAppManager.DialogManager.ActiveDialogs.Contains(dialogue))
         TriangleManager.InvokeResultFuncs(ResultFuncsEnum.TryToStartDialogue, input);
 }
Exemplo n.º 5
0
        public void BreakingDialog(string character, string dialogId, FormatDialogue dialogueMode, EBreakingResultType breakingType)
        {
            var npc    = ConnectingAppManager.CharacterManager.GetNPC(character);
            var dialog = npc.GetAvailableDialogs(dialogueMode).ToList().Find(s => s.Id.Equals(dialogId));

            if (dialog != null)
            {
                ActivateResultsForDialogBreak(dialog, breakingType);
            }
        }
Exemplo n.º 6
0
 public Dialog GetDialog(FormatDialogue dialogueMode, string dialogId)
 {
     if (availableDialogs.ContainsKey(dialogueMode) && availableDialogs[dialogueMode].Count > 0)
     {
         if (dialogId.Equals(""))
         {
             var notRepeatableDialog = availableDialogs[dialogueMode].Find(s => !s.Reusable);
             return notRepeatableDialog == null ? availableDialogs[dialogueMode].First() : notRepeatableDialog;
         }
         else return availableDialogs[dialogueMode].Find(s => s.Id.Equals(dialogId));
     }
     else return null;
 }
Exemplo n.º 7
0
 private void ActivateObject(bool activate, FormatDialogue format)
 {
     //TriangleManager.InvokeResultFuncs(ResultFuncsEnum.ActivateCharacter, new List<string>() { Id, activate ? "1" : "0", ((int)format).ToString() });
     Availability[format] = activate;
 }
Exemplo n.º 8
0
 public IList<Dialog> GetAvailableDialogs(FormatDialogue dialogueMode)
 {
     if (availableDialogs.ContainsKey(dialogueMode))
         return availableDialogs[dialogueMode].AsReadOnly();
     else return new List<Dialog>();
 }
Exemplo n.º 9
0
 public Dialog GetDialog(string characterId, FormatDialogue mode, string dialogId = "")
 {
     CreateCharacter(characterId);
     return(((NPC)Characters[characterId]).GetDialog(mode, dialogId));
 }