/// <summary>
    /// 生成分支对话选项
    /// </summary>
    private void MakeNormalOption()
    {
        if (wordsToSay.Count < 1 || wordsToSay.Peek().Options.Count < 1)
        {
            return;
        }
        DialogueWords currentWords = wordsToSay.Peek();

        dialogueDatas.TryGetValue(currentDialog.ID, out DialogueData dialogDataFound);
        if (CurrentType == DialogueType.Normal)
        {
            ClearOptions(OptionType.Quest, OptionType.Objective);
        }
        else
        {
            ClearOptions();
        }
        bool isLastWords = currentDialog.IndexOfWords(wordsToSay.Peek()) == currentDialog.Words.Count - 1;

        foreach (WordsOption option in currentWords.Options)
        {
            if (option.OptionType == WordsOptionType.Choice && dialogDataFound != null)
            {
                DialogueWordsData wordsDataFound = dialogDataFound.wordsDatas.Find(x => x.wordsIndex == currentDialog.IndexOfWords(currentWords));
                //这个选择型分支是否完成了
                if (isLastWords || wordsDataFound != null && wordsDataFound.IsOptionCmplt(currentWords.IndexOfOption(option)))
                {
                    continue;//是最后一句话或者选项完成则跳过创建
                }
            }
            if (option.IsValid)
            {
                if (option.OptionType == WordsOptionType.OnlyGet && (option.ShowOnlyWhenNotHave && BackpackManager.Instance.HasItemWithID(option.ItemCanGet.ItemID) ||
                                                                     option.OnlyForQuest && option.BindedQuest && !QuestManager.Instance.HasOngoingQuestWithID(option.BindedQuest.ID)))
                {
                    continue;//若已持有当前选项给的道具,或者需任务驱动但任务未接取,则跳过创建
                }
                else if (option.OptionType == WordsOptionType.SubmitAndGet && option.OnlyForQuest && option.BindedQuest &&
                         !QuestManager.Instance.HasOngoingQuestWithID(option.BindedQuest.ID))
                {
                    continue;//若需当前选项需任务驱动但任务未接取,则跳过创建
                }
                OptionAgent oa = ObjectPool.Get(UI.optionPrefab, UI.optionsParent, false).GetComponent <OptionAgent>();
                oa.Init(option.Title, option);
                optionAgents.Add(oa);
            }
        }
        //把第一页以外的选项隐藏
        for (int i = UI.lineAmount - (int)(UI.wordsText.preferredHeight / UI.textLineHeight); i < optionAgents.Count; i++)
        {
            ZetanUtility.SetActive(optionAgents[i].gameObject, false);
        }
        if (optionAgents.Count < 1)
        {
            MakeContinueOption();//如果所有选择型分支都完成了,则可以进行下一句对话
        }
        CheckPages();
        //Debug.Log("make");
        //Debug.Log(optionAgents.Count);
    }
 /// <summary>
 /// 生成任务列表的选项
 /// </summary>
 private void MakeTalkerQuestOption()
 {
     if (CurrentTalker.QuestInstances.Count < 1)
     {
         return;
     }
     ClearOptions();
     foreach (Quest quest in CurrentTalker.QuestInstances)
     {
         if (!QuestManager.Instance.HasCompleteQuest(quest) && QuestManager.Instance.IsQuestAcceptable(quest) && QuestManager.IsQuestValid(quest))
         {
             OptionAgent oa = ObjectPool.Get(UI.optionPrefab, UI.optionsParent, false).GetComponent <OptionAgent>();
             oa.Init(quest.Title + (quest.IsComplete ? "(完成)" : quest.InProgress ? "(进行中)" : string.Empty), quest);
             if (quest.IsComplete)
             {
                 //保证完成的任务优先显示,方便玩家提交完成的任务
                 oa.transform.SetAsFirstSibling();
                 optionAgents.Insert(0, oa);
             }
             else
             {
                 optionAgents.Add(oa);
             }
         }
     }
     //保证进行中的任务最后显示,方便玩家接取未接取的任务
     for (int i = optionAgents.Count - 1; i >= 0; i--)
     {
         OptionAgent oa = optionAgents[i];
         //若当前选项关联的任务在进行中
         if (oa.MQuest.InProgress && !oa.MQuest.IsComplete)
         {
             //则从后向前找一个新位置以放置该选项
             for (int j = optionAgents.Count - 1; j > i; j--)
             {
                 //若找到了合适的位置
                 if (!optionAgents[j].MQuest.InProgress && !optionAgents[j].MQuest.IsComplete)
                 {
                     //则从该位置开始到选项的原位置,逐个前移一位,填充(覆盖)选项的原位置并空出新位置
                     for (int k = i; k < j; k++)
                     {
                         //在k指向目标位置之前,逐个前移
                         optionAgents[k] = optionAgents[k + 1];
                     }
                     //把选项放入新位置,此时选项的原位置即OptionAgents[i]已被填充(覆盖)
                     optionAgents[j] = oa;
                     oa.transform.SetSiblingIndex(j);
                     break;
                 }
             }
         }
     }
     //把第一页以外的选项隐藏
     for (int i = UI.lineAmount - (int)(UI.wordsText.preferredHeight / UI.textLineHeight); i < optionAgents.Count; i++)
     {
         ZetanUtility.SetActive(optionAgents[i].gameObject, false);
     }
     CheckPages();
 }
 /// <summary>
 /// 生成已完成任务选项
 /// </summary>
 private void MakeTalkerCmpltQuestOption()
 {
     if (CurrentTalker.QuestInstances.Count < 1)
     {
         return;
     }
     ClearOptions(OptionType.Option);
     foreach (Quest quest in CurrentTalker.QuestInstances)
     {
         if (!QuestManager.Instance.HasCompleteQuest(quest) && quest.IsComplete)
         {
             OptionAgent oa = ObjectPool.Get(UI.optionPrefab, UI.optionsParent, false).GetComponent <OptionAgent>();
             oa.Init(quest.Title + "(完成)", quest);
             optionAgents.Add(oa);
         }
     }
     //把第一页以外的选项隐藏
     for (int i = UI.lineAmount - (int)(UI.wordsText.preferredHeight / UI.textLineHeight); i < optionAgents.Count; i++)
     {
         ZetanUtility.SetActive(optionAgents[i].gameObject, false);
     }
     CheckPages();
 }
    /// <summary>
    /// 生成对话目标列表的选项
    /// </summary>
    private void MakeTalkerObjectiveOption()
    {
        int index = 1;

        ClearOptions(OptionType.Quest, OptionType.Option);
        foreach (TalkObjective to in CurrentTalker.Data.objectivesTalkToThis.Where(o => !o.IsComplete))
        {
            if (to.AllPrevObjCmplt && !to.HasNextObjOngoing)
            {
                OptionAgent oa = ObjectPool.Get(UI.optionPrefab, UI.optionsParent, false).GetComponent <OptionAgent>();
                oa.Init(to.runtimeParent.Title, to);
                optionAgents.Add(oa);
                if (index > UI.lineAmount - (int)(UI.wordsText.preferredHeight / UI.textLineHeight))
                {
                    ZetanUtility.SetActive(oa.gameObject, false);                                                                                 //第一页以外隐藏
                }
                index++;
            }
        }
        index = 1;
        foreach (SubmitObjective so in CurrentTalker.Data.objectivesSubmitToThis.Where(o => !o.IsComplete))
        {
            if (so.AllPrevObjCmplt && !so.HasNextObjOngoing)
            {
                OptionAgent oa = ObjectPool.Get(UI.optionPrefab, UI.optionsParent, false).GetComponent <OptionAgent>();
                oa.Init(so.DisplayName, so);
                optionAgents.Add(oa);
                if (index > UI.lineAmount - (int)(UI.wordsText.preferredHeight / UI.textLineHeight))
                {
                    ZetanUtility.SetActive(oa.gameObject, false);                                                                                 //第一页以外隐藏
                }
                index++;
            }
        }
        CheckPages();
    }
 /// <summary>
 /// 处理最后一句对话型目标的对话
 /// </summary>
 private void HandlingLastObjectiveWords()
 {
     if (currentSubmitObj)
     {
         //双重确认,以防出错
         Quest qParent    = currentSubmitObj.runtimeParent;
         var   amount     = BackpackManager.Instance.GetItemAmount(currentSubmitObj.ItemToSubmit);
         bool  submitAble = true;
         if (qParent.CmpltObjctvInOrder)
         {
             foreach (var o in qParent.ObjectiveInstances)
             {
                 if (o is CollectObjective && (o as CollectObjective).LoseItemAtSbmt && o.InOrder && o.IsComplete)
                 {
                     if (amount - currentSubmitObj.Amount < o.Amount)
                     {
                         submitAble = false;
                         MessageManager.Instance.New($"该物品为目标[{o.DisplayName}]所需");
                         break;
                     }
                 }
             }
         }
         submitAble &= BackpackManager.Instance.TryLoseItem_Boolean(currentSubmitObj.ItemToSubmit, currentSubmitObj.Amount);
         if (submitAble)
         {
             BackpackManager.Instance.LoseItem(currentSubmitObj.ItemToSubmit, currentSubmitObj.Amount);
             currentSubmitObj.UpdateSubmitState(currentSubmitObj.Amount);
         }
         if (currentSubmitObj.IsComplete)
         {
             OptionAgent oa = optionAgents.Find(x => x.TalkObjective == currentSubmitObj);
             if (oa && oa.gameObject)
             {
                 //去掉该对话目标自身的提交型目标选项
                 optionAgents.Remove(oa);
                 oa.Recycle();
             }
             //若该目标是任务的最后一个目标,则可以直接提交任务
             if (qParent.currentQuestHolder == CurrentTalker.Data && qParent.IsComplete && qParent.ObjectiveInstances.IndexOf(currentSubmitObj) == qParent.ObjectiveInstances.Count - 1)
             {
                 oa = ObjectPool.Get(UI.optionPrefab, UI.optionsParent).GetComponent <OptionAgent>();
                 oa.Init("继续", qParent);
                 optionAgents.Add(oa);
             }
         }
         currentSubmitObj = null;//重置管理器的提交目标以防出错
     }
     else if (currentTalkObj)
     {
         if (!AllOptionComplete())
         {
             return;
         }
         currentTalkObj.UpdateTalkState();
         if (currentTalkObj.IsComplete)
         {
             OptionAgent oa = optionAgents.Find(x => x.TalkObjective == currentTalkObj);
             if (oa && oa.gameObject)
             {
                 //去掉该对话目标自身的对话型目标选项
                 optionAgents.Remove(oa);
                 oa.Recycle();
             }
             //该目标是任务的最后一个目标,则可以直接提交任务
             Quest qParent = currentTalkObj.runtimeParent;
             if (qParent.currentQuestHolder == CurrentTalker.Data && qParent.IsComplete && qParent.ObjectiveInstances.IndexOf(currentTalkObj) == qParent.ObjectiveInstances.Count - 1)
             {
                 oa = ObjectPool.Get(UI.optionPrefab, UI.optionsParent).GetComponent <OptionAgent>();
                 oa.Init("继续", qParent);
                 optionAgents.Add(oa);
             }
         }
         currentTalkObj = null;//重置管理器的对话目标以防出错
     }
     QuestManager.Instance.UpdateUI();
 }