Пример #1
0
        /// <summary>
        /// Open a dialogue window with a question for the player to answer
        /// </summary>
        /// <param name="question">Information about the question that the dialogue window will be opened with</param>
        public static void OpenQuestion(DialogueQuestionInformation question)
        {
            // Check to make sure the question has been registered
            if (injectedQuestions.ContainsKey(question.ModUniqueKey()))
            {
                Response[] responses = GetResponseArray(question.Choices);

                if (responses.Length == 0)
                {
                    // I'm really not sure what this would do, so I'm leaving it as a warning for now. If it causes some kind of crash or problem, this might have to get upgraded to an exception
                    Farmhand.Logging.Log.Warning($"Question {question.Key} in mod {question.Owner.ModSettings.Name} is attempting to open a question with no possible answers!");
                }

                Game1.currentLocation.createQuestionDialogue(question.Question, responses, question.ModUniqueKey());
            }
            else
            {
                // This question was never registered, but since we have all the information, we can do it for the mod real fast, then re-call OpenQuestion
                RegisterQuestion(question);
                OpenQuestion(question);
            }
        }
Пример #2
0
 /// <summary>
 /// Register a new question which can be posed to the player through a dialogue
 /// </summary>
 /// <param name="question">Information about the question</param>
 public static void RegisterQuestion(DialogueQuestionInformation question)
 {
     injectedQuestions.Add(question.ModUniqueKey(), question);
 }