public override void CloseWindow() { base.CloseWindow(); if (IsUIOpen) { return; } CurrentType = DialogueType.Normal; CurrentTalker = null; CurrentQuest = null; currentDialog = null; currentOption = null; currentTalkObj = null; currentSubmitObj = null; wordsOptionInstances.Clear(); ClearOptions(); HideQuestDescription(); if (!BuildingManager.Instance.IsPreviewing) { WindowsManager.Instance.PauseAll(false); } if (WarehouseManager.Instance.IsPausing) { WarehouseManager.Instance.PauseDisplay(false); } if (WarehouseManager.Instance.IsUIOpen) { WarehouseManager.Instance.CloseWindow(); } if (ShopManager.Instance.IsPausing) { ShopManager.Instance.PauseDisplay(false); } if (ShopManager.Instance.IsUIOpen) { ShopManager.Instance.CloseWindow(); } IsTalking = false; UIManager.Instance.EnableJoyStick(true); PlayerManager.Instance.PlayerController.controlAble = true; }
public void StartObjectiveDialogue(SubmitObjective submitObj) { if (submitObj == null) { return; } Quest parentQ = submitObj.runtimeParent; var amount = BackpackManager.Instance.GetItemAmount(submitObj.ItemToSubmit); bool submitAble = true; if (parentQ.CmpltObjctvInOrder) { foreach (var o in parentQ.ObjectiveInstances) { if (o is CollectObjective && (o as CollectObjective).LoseItemAtSbmt && o.InOrder && o.IsComplete) { if (amount - submitObj.Amount < o.Amount) { submitAble = false; MessageManager.Instance.New($"该物品为目标[{o.DisplayName}]所需"); break; } } } } submitAble &= BackpackManager.Instance.TryLoseItem_Boolean(submitObj.ItemToSubmit, submitObj.Amount); if (!submitAble) { return; } currentSubmitObj = submitObj; CurrentType = DialogueType.Objective; ShowButtons(false, false, false); StartOneWords(new DialogueWords(submitObj.TalkerType == TalkerType.NPC ? CurrentTalker.Info : null, submitObj.WordsWhenSubmit, submitObj.TalkerType)); SayNextWords(); }
public void Init(string text, SubmitObjective objective) { titleText.text = text; OptionType = OptionType.Objective; SubmitObjective = objective; }
/// <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(); }