Esempio n. 1
0
 public void MakeCall(MobileAccount recipient)
 {
     if (ConversationStarted != null)
     {
         ConversationStarted.Invoke(this, recipient);
     }
     Console.WriteLine("Conversation");
 }
        // Start the conversation if possible
        public void StartConversation(Conversation conversation)
        {
            if (_inConversation)
            {
                DialogueLogger.LogWarning($"Trying to start a conversation while already in a conversation");
                return;
            }

            if (_uiController == null)
            {
                DialogueLogger.LogError("Trying to start a conversation, but there's not DialogueUIController assigned");
                return;
            }

            // Find starting point
            _currentConversation = null;
            _currentDialogue     = null;
            _currentSentence     = 0;
            foreach (var diag in conversation.Dialogues)
            {
                if ((_currentDialogue == null || diag.Id > _currentDialogue.Id) && diag.CanBeUsedAsStartingPoint)
                {
                    if (diag.StartConditions.Count > 0)
                    {
                        if (diag.EvaluateStartingConditions())
                        {
                            _currentDialogue = diag;
                        }
                    }
                    else
                    {
                        _currentDialogue = diag;
                    }
                }
            }

            if (_currentDialogue == null)
            {
                DialogueLogger.LogError($"Couldn't find starting point for conversation");
                return;
            }

            // Start the conversation
            _inConversation      = true;
            _currentConversation = conversation;

            if (needToChangeTheme())
            {
                ChangeTheme(_currentDialogue.Theme);
            }

            _uiController.ShowSentence(_currentDialogue.SpeakersName,
                                       parseSentenceForCustomTags(_currentDialogue.Sentences[_currentSentence]),
                                       SpriteRepo.Instance.RetrieveSprite(_currentDialogue.CharacterSpritesName, string.IsNullOrEmpty(_currentDialogue.StartingSprite) ? "Default" : _currentDialogue.StartingSprite),
                                       _currentDialogue.AutoProceed);
            ConversationStarted?.Invoke();
        }
Esempio n. 3
0
 /// <summary>
 /// This will set the <see cref="Name"/>.
 /// </summary>
 protected virtual void Apply(ConversationStarted @event)
 {
     Name = @event.Name;
 }