示例#1
0
 protected virtual void OnInventoryWeightChanged(Inventory inventory, float oldWeightLimit)
 {
     if (inventory == Inventory)
     {
         NotifyCenter.PostNotify(InventoryMoneyChangedMsgKey, inventory, oldWeightLimit);
     }
 }
示例#2
0
 /// <summary>
 /// 关闭窗口
 /// </summary>
 /// <param name="args">变长参数</param>
 /// <returns>是否成功关闭</returns>
 public bool Close(params object[] args)
 {
     args ??= new object[0];
     if (OnClose(args))
     {
         WindowsManager.Remove(this);
         NotifyCenter.PostNotify(WindowStateChanged, GetType().Name, WindowStates.Closed);
         IsOpen = false;
         onClose?.Invoke();
         onClose = null;
         openBy  = null;
         if (animated)
         {
             content.blocksRaycasts = false;
             IFadeAble <Window> .FadeTo(this, 0, duration);
         }
         else
         {
             content.alpha          = 0;
             content.blocksRaycasts = false;
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#3
0
 protected virtual void OnInventoryMoneyChanged(Inventory inventory, long oldMoney)
 {
     if (inventory == Inventory)
     {
         NotifyCenter.PostNotify(InventoryMoneyChangedMsgKey, inventory, oldMoney);
     }
 }
示例#4
0
 protected virtual void OnInventorySpaceChanged(Inventory inventory, int oldSpaceLimit)
 {
     if (inventory == Inventory)
     {
         NotifyCenter.PostNotify(InventoryMoneyChangedMsgKey, inventory, oldSpaceLimit);
     }
 }
示例#5
0
 public void DestroyStructure(StructureData structure)
 {
     if (!structure)
     {
         return;
     }
     ConfirmWindow.StartConfirm(string.Format("确定拆毁{0}{1}吗?", structure.Name, (Vector2)transform.position),
                                delegate
     {
         if (structure)
         {
             if (this.structures.TryGetValue(structure.Info.ID, out var structures))
             {
                 structures.Remove(structure);
                 if (structures.Count < 1)
                 {
                     this.structures.Remove(structure.Info.ID);
                 }
             }
             if (structure.entity && structure.entity.gameObject)
             {
                 UpdateAStar(structure.entity);
                 structure.entity.Destroy();
             }
             else if (structure.preview && structure.preview.gameObject)
             {
                 UpdateAStar(structure.preview);
                 structure.preview.Destroy();
             }
             NotifyCenter.PostNotify(StructureDestroy, structure, structures);
         }
     });
示例#6
0
 /// <summary>
 /// 打开窗口
 /// </summary>
 /// <param name="args">变长参数</param>
 /// <returns>是否成功打开</returns>
 public bool Open(params object[] args)
 {
     args ??= new object[0];
     if (OnOpen(args))
     {
         WindowsManager.Push(this);
         NotifyCenter.PostNotify(WindowStateChanged, GetType().Name, WindowStates.Open);
         IsOpen  = true;
         closeBy = null;
         if (animated)
         {
             IFadeAble <Window> .FadeTo(this, 1, duration, () => content.blocksRaycasts = true);
         }
         else
         {
             content.alpha          = 1;
             content.blocksRaycasts = true;
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#7
0
    public void UseItem(ItemData item)
    {
        if (!item.Model_old.Usable)
        {
            MessageManager.Instance.New("该物品不可使用");
            return;
        }
        bool used = false;

        if (item.Model_old.IsBox)
        {
            used = UseBox(item);
        }
        else if (item.Model_old.IsEquipment)
        {
            used = UseEuipment(item);
        }
        else if (item.Model_old.IsBook)
        {
            used = UseBook(item);
        }
        else if (item.Model_old.IsBag)
        {
            used = UseBag(item);
        }
        else if (item.Model_old.IsForQuest)
        {
            used = UseQuest(item);
        }
        if (used)
        {
            NotifyCenter.PostNotify(BackpackUseItem, item);
        }
    }
示例#8
0
 private void GatherCancel()
 {
     //PlayerManager.Instance.Controller.Animator.SetInteger(animaNameHash, -1);
     FinishInteraction();
     if (IsGathering)
     {
         NotifyCenter.PostNotify(NotifyCenter.CommonKeys.GatheringStateChanged, false);
     }
     IsGathering = false;
 }
示例#9
0
 private void GatherStart()
 {
     doneAgent = null;
     if (!IsGathering)
     {
         NotifyCenter.PostNotify(NotifyCenter.CommonKeys.GatheringStateChanged, true);
     }
     IsGathering = true;
     ProgressBar.Instance.New(Resource.ResourceInfo.GatherTime, GatherDone, GatherCancel, "采集中");
 }
示例#10
0
 public void SetTrigger(string triggerName, bool value)
 {
     if (!triggers.ContainsKey(triggerName))
     {
         triggers.Add(triggerName, value ? TriggerState.On : TriggerState.Off);
     }
     else
     {
         triggers[triggerName] = value ? TriggerState.On : TriggerState.Off;
     }
     OnTriggerSetEvent?.Invoke(triggerName, value);
     NotifyCenter.PostNotify(NotifyCenter.CommonKeys.TriggerChanged, triggerName, value);
 }
示例#11
0
 public void TimePass(float time)
 {
     if (Info.EmptyAble && Info.RefreshTime > 0)
     {
         leftRefreshTime -= time;
         if (leftRefreshTime <= 0)
         {
             leftRefreshTime = Info.RefreshTime;
             LeftAmount     += Random.Range(Info.MinRefreshAmount, Info.MaxRefreshAmount);
             NotifyCenter.PostNotify(ShopManager.VendorGoodsRefresh, this);
         }
     }
 }
示例#12
0
 private void GatherDone()
 {
     //PlayerManager.Instance.Controller.Animator.SetInteger(animaNameHash, -1);
     if (!Resource)
     {
         return;
     }
     FinishInteraction();
     Resource.GatherSuccess();
     if (IsGathering)
     {
         NotifyCenter.PostNotify(NotifyCenter.CommonKeys.GatheringStateChanged, false);
     }
     IsGathering = false;
     doneAgent   = Resource;
     StartCoroutine(UpdateDistance());
 }
示例#13
0
    /// <summary>
    /// 扩展负重
    /// </summary>
    /// <param name="weightLoad">扩展数量</param>
    /// <returns>是否成功扩展</returns>
    public bool ExpandLoad(float weightLoad)
    {
        if (weightLoad < 0.01f)
        {
            return(false);
        }
        if (maxWeightLimit > 0 && Inventory.WeightLimit >= maxWeightLimit)
        {
            MessageManager.Instance.New(Name + "已经达到最大扩展载重了");
            return(false);
        }
        float finallyExpand = maxWeightLimit > 0 ? (Inventory.WeightLimit + weightLoad > maxWeightLimit ? maxWeightLimit - Inventory.WeightLimit : weightLoad) : weightLoad;

        Inventory.ExpandLoad(weightLoad);
        NotifyCenter.PostNotify(BackpackWeightChanged);
        MessageManager.Instance.New(Name + "载重增加了" + finallyExpand.ToString("F2"));
        return(true);
    }
示例#14
0
    /// <summary>
    /// 扩展容量
    /// </summary>
    /// <param name="space">扩展数量</param>
    /// <returns>是否成功扩展</returns>
    public bool ExpandSpace(int space)
    {
        if (space < 1)
        {
            return(false);
        }
        if (maxSpaceLimit > 0 && Inventory.SpaceLimit >= maxSpaceLimit)
        {
            MessageManager.Instance.New(Name + "已经达到最大容量了");
            return(false);
        }
        int finallyExpand = maxSpaceLimit > 0 ? (Inventory.SpaceLimit + space > maxSpaceLimit ? maxSpaceLimit - Inventory.SpaceLimit : space) : space;

        Inventory.ExpandSpace(finallyExpand);
        NotifyCenter.PostNotify(BackpackSpaceChanged);
        MessageManager.Instance.New(Name + "空间增加了" + finallyExpand);
        return(true);
    }
示例#15
0
    public void PlantCrop(CropInformation crop, Vector3 position)
    {
        if (!crop)
        {
            return;
        }

        if (FData.spaceOccup < crop.Size)
        {
            MessageManager.Instance.New("空间不足");
            return;
        }

        CropData cropData = FData.PlantCrop(crop);

        if (cropData)
        {
            Crop entity = ObjectPool.Get(crop.Prefab, transform);
            entity.Init(cropData, this, position);
            NotifyCenter.PostNotify(FieldManager.FieldCropPlanted, this, cropData);
        }
    }
示例#16
0
 public bool Learn(ItemBase item)
 {
     if (!item)
     {
         return(false);
     }
     if (item.MakingMethod == MakingMethod.None || !item.Formulation || item.Formulation.Materials.Count < 1)
     {
         MessageManager.Instance.New("无法制作的道具");
         return(false);
     }
     if (HadLearned(item))
     {
         ConfirmWindow.StartConfirm("已经学会制作 [" + item.Name + "],无需再学习。");
         return(false);
     }
     LearnedItems.Add(item);
     //MessageManager.Instance.NewMessage(string.Format("学会了 [{0}] 的制作方法!", item.name));
     ConfirmWindow.StartConfirm(string.Format("学会了 [{0}] 的制作方法!", item.Name));
     NotifyCenter.PostNotify(LearnedNewMakingItem, item);
     return(true);
 }
示例#17
0
 protected virtual void OnSlotStateChanged(ItemSlotData slot)
 {
     NotifyCenter.PostNotify(SlotStateChangedMsgKey, slot);
 }
示例#18
0
 protected virtual void OnItemAmountChanged(ItemBase model, int oldAmount, int newAmount)
 {
     NotifyCenter.PostNotify(ItemAmountChangedMsgKey, model, oldAmount, newAmount);
 }
示例#19
0
 protected override void OnStateChange(CharacterStates main, dynamic sub)
 {
     NotifyCenter.PostNotify(NotifyCenter.CommonKeys.PlayerStateChanged, main, sub);
 }
示例#20
0
    private void OnObjectiveStateChange(ObjectiveData objective, bool befCmplt)
    {
        if (!SaveManager.Instance.IsLoading)
        {
            if (objective.CurrentAmount > 0)
            {
                string message = objective.Model.DisplayName + (objective.IsComplete ? "(完成)" : $"[{objective.AmountString}]");
                MessageManager.Instance.New(message);
            }
            if (objective.parent.IsComplete)
            {
                MessageManager.Instance.New($"[任务]{objective.parent.Model.Title}(已完成)");
            }
        }
        if (!befCmplt && objective.IsComplete)
        {
            UpdateNextCollectObjectives(objective);
            //Debug.Log("\"" + objective.DisplayName + "\"" + "从没完成变成完成");
            ObjectiveData        nextToDo    = null;
            QuestData            quest       = objective.parent;
            List <ObjectiveData> parallelObj = new List <ObjectiveData>();
            for (int i = 0; i < quest.Objectives.Count - 1; i++)
            {
                if (quest.Objectives[i] == objective)
                {
                    for (int j = i - 1; j > -1; j--)//往前找可以并行的目标
                    {
                        ObjectiveData prevObj = quest.Objectives[j];
                        if (!prevObj.Parallel)
                        {
                            break;                   //只要碰到一个不能并行的,就中断
                        }
                        else
                        {
                            parallelObj.Add(prevObj);
                        }
                    }
                    for (int j = i + 1; j < quest.Objectives.Count; j++)//往后找可以并行的目标
                    {
                        ObjectiveData nextObj = quest.Objectives[j];
                        if (!nextObj.Parallel)//只要碰到一个不能并行的,就中断
                        {
                            if (nextObj.AllPrevComplete && !nextObj.IsComplete)
                            {
                                nextToDo = nextObj;//同时,若该非并行目标的所有前置目标都完成了,那么它就是下一个要做的目标
                            }
                            break;
                        }
                        else
                        {
                            parallelObj.Add(nextObj);
                        }
                    }
                    break;
                }
            }
            if (!nextToDo)                                //当目标不能并行时此变量才不为空,所以此时表示所有后置目标都是可并行的,或者不存在后置目标
            {
                parallelObj.RemoveAll(x => x.IsComplete); //把所有已完成的可并行目标去掉

                /*if (parallelObj.Count > 0)//剩下未完成的可并行目标,则随机选一个作为下一个要做的目标
                 *  nextToDo = parallelObj[Random.Range(0, parallelObj.Count)];*/
                foreach (var obj in parallelObj)
                {
                    CreateObjectiveMapIcon(obj);
                }
            }
            else
            {
                CreateObjectiveMapIcon(nextToDo);
            }
            RemoveObjectiveMapIcon(objective);
        }
        //else Debug.Log("无操作");
        NotifyCenter.PostNotify(ObjectiveUpdate, objective, befCmplt);
    }
示例#21
0
    /// <summary>
    /// 放弃任务
    /// </summary>
    /// <param name="quest">要放弃的任务</param>
    public bool AbandonQuest(QuestData quest)
    {
        if (!quest.Model.Abandonable)
        {
            ConfirmWindow.StartConfirm("该任务无法放弃。");
        }
        else if (HasOngoingQuest(quest) && quest && quest.Model.Abandonable)
        {
            if (HasQuestNeedAsCondition(quest.Model, out var findQuest))
            {
                //MessageManager.Instance.New($"由于任务[{bindQuest.Title}]正在进行,无法放弃该任务。");
                ConfirmWindow.StartConfirm($"由于任务[{findQuest.Model.Title}]正在进行,无法放弃该任务。");
            }
            else
            {
                bool isCmplt = quest.IsComplete;
                quest.InProgress = false;
                questsInProgress.Remove(quest);
                foreach (ObjectiveData o in quest.Objectives)
                {
                    o.OnStateChangeEvent -= OnObjectiveStateChange;
                    if (o is CollectObjectiveData)
                    {
                        CollectObjectiveData co = o as CollectObjectiveData;
                        co.CurrentAmount   = 0;
                        co.amountWhenStart = 0;
                        BackpackManager.Instance.Inventory.OnItemAmountChanged -= co.UpdateCollectAmount;
                    }
                    if (o is KillObjectiveData ko)
                    {
                        ko.CurrentAmount = 0;
                        switch (ko.Model.KillType)
                        {
                        case KillObjectiveType.Specific:
                            GameManager.Enemies[ko.Model.Enemy.ID].ForEach(e => e.OnDeathEvent -= ko.UpdateKillAmount);
                            break;

                        case KillObjectiveType.Race:
                            foreach (List <Enemy> enemies in GameManager.Enemies.Values.Where(x => x.Count > 0 && x[0].Info.Race && x[0].Info.Race == ko.Model.Race))
                            {
                                enemies.ForEach(e => e.OnDeathEvent -= ko.UpdateKillAmount);
                            }
                            break;

                        case KillObjectiveType.Group:
                            foreach (List <Enemy> enemies in GameManager.Enemies.Values.Where(x => x.Count > 0 && ko.Model.Group.Contains(x[0].Info.ID)))
                            {
                                enemies.ForEach(e => e.OnDeathEvent -= ko.UpdateKillAmount);
                            }
                            break;

                        case KillObjectiveType.Any:
                            foreach (List <Enemy> enemies in GameManager.Enemies.Select(x => x.Value))
                            {
                                enemies.ForEach(e => e.OnDeathEvent -= ko.UpdateKillAmount);
                            }
                            break;
                        }
                    }
                    if (o is TalkObjectiveData to)
                    {
                        to.CurrentAmount = 0;
                        DialogueManager.Instance.Talkers[to.Model.NPCToTalk.ID].objectivesTalkToThis.RemoveAll(x => x == to);
                        DialogueManager.Instance.RemoveDialogueData(to.Model.Dialogue);
                    }
                    if (o is MoveObjectiveData mo)
                    {
                        mo.CurrentAmount = 0;
                        mo.targetPoint   = null;
                        CheckPointManager.Instance.RemoveCheckPointListener(mo.Model.AuxiliaryPos, mo.UpdateMoveState);
                    }
                    if (o is SubmitObjectiveData so)
                    {
                        so.CurrentAmount = 0;
                        DialogueManager.Instance.Talkers[so.Model.NPCToSubmit.ID].objectivesSubmitToThis.RemoveAll(x => x == so);
                    }
                    if (o is TriggerObjectiveData cuo)
                    {
                        cuo.CurrentAmount = 0;
                        TriggerManager.Instance.DeleteTriggerListner(cuo.UpdateTriggerState);
                    }
                    RemoveObjectiveMapIcon(o);
                }
                if (quest.Model.NPCToSubmit)
                {
                    quest.originalQuestHolder.TransferQuestToThis(quest);
                }
                quest.latestHandleDays = TimeManager.Instance.Days;
                NotifyCenter.PostNotify(QuestStateChanged, quest, true);
                return(true);
            }
        }
        MessageManager.Instance.New("该任务未在进行");
        return(false);
    }
示例#22
0
    private readonly List <QuestData> questsFinished = new List <QuestData>();//分开存储完成任务可减少不必要的检索开销

    #region 任务处理相关
    /// <summary>
    /// 接取任务
    /// </summary>
    /// <param name="quest">要接取的任务</param>
    public bool AcceptQuest(QuestData quest)
    {
        if (!quest || !IsQuestValid(quest.Model))
        {
            MessageManager.Instance.New("无效任务");
            return(false);
        }
        if (!MiscFuntion.CheckCondition(quest.Model.AcceptCondition) && !SaveManager.Instance.IsLoading)
        {
            MessageManager.Instance.New("未满足任务接取条件");
            return(false);
        }
        if (HasOngoingQuest(quest))
        {
            MessageManager.Instance.New("已经在执行");
            return(false);
        }
        ObjectiveData currentObjective = quest.Objectives[0];

        for (int i = 0; i < quest.Objectives.Count; i++)
        {
            var o = quest.Objectives[i];
            o.OnStateChangeEvent += OnObjectiveStateChange;
            if (o is CollectObjectiveData co)
            {
                BackpackManager.Instance.Inventory.OnItemAmountChanged += co.UpdateCollectAmount;
                if (o.AllPrevComplete)
                {
                    if (co.Model.CheckBagAtStart && !SaveManager.Instance.IsLoading)
                    {
                        co.CurrentAmount = BackpackManager.Instance.GetAmount(co.Model.ItemToCollect);
                    }
                    else if (!co.Model.CheckBagAtStart && !SaveManager.Instance.IsLoading)
                    {
                        co.amountWhenStart = BackpackManager.Instance.GetAmount(co.Model.ItemToCollect);
                    }
                }
            }
            if (o is KillObjectiveData ko)
            {
                switch (ko.Model.KillType)
                {
                case KillObjectiveType.Specific:
                    GameManager.Enemies[ko.Model.Enemy.ID].ForEach(e => e.OnDeathEvent += ko.UpdateKillAmount);
                    break;

                case KillObjectiveType.Race:
                    foreach (List <Enemy> enemies in GameManager.Enemies.Values.Where(x => x.Count > 0 && x[0].Info.Race && x[0].Info.Race == ko.Model.Race))
                    {
                        enemies.ForEach(e => e.OnDeathEvent += ko.UpdateKillAmount);
                    }
                    break;

                case KillObjectiveType.Group:
                    foreach (List <Enemy> enemies in GameManager.Enemies.Values.Where(x => x.Count > 0 && ko.Model.Group.Contains(x[0].Info.ID)))
                    {
                        enemies.ForEach(e => e.OnDeathEvent += ko.UpdateKillAmount);
                    }
                    break;

                case KillObjectiveType.Any:
                    foreach (List <Enemy> enemies in GameManager.Enemies.Select(x => x.Value))
                    {
                        enemies.ForEach(e => e.OnDeathEvent += ko.UpdateKillAmount);
                    }
                    break;
                }
            }
            if (o is TalkObjectiveData to)
            {
                if (!o.IsComplete)
                {
                    var talker = DialogueManager.Instance.Talkers[to.Model.NPCToTalk.ID];
                    talker.objectivesTalkToThis.Add(to);
                    o.OnStateChangeEvent += talker.TryRemoveObjective;
                }
            }
            if (o is MoveObjectiveData mo)
            {
                mo.targetPoint = CheckPointManager.Instance.CreateCheckPoint(mo.Model.AuxiliaryPos, mo.UpdateMoveState);
            }
            if (o is SubmitObjectiveData so)
            {
                if (!o.IsComplete)
                {
                    var talker = DialogueManager.Instance.Talkers[so.Model.NPCToSubmit.ID];
                    talker.objectivesSubmitToThis.Add(so);
                    o.OnStateChangeEvent += talker.TryRemoveObjective;
                }
            }
            if (o is TriggerObjectiveData cuo)
            {
                TriggerManager.Instance.RegisterTriggerEvent(cuo.UpdateTriggerState);
                var state = TriggerManager.Instance.GetTriggerState(cuo.Model.TriggerName);
                if (cuo.Model.CheckStateAtAcpt && state != TriggerState.NotExist)
                {
                    TriggerManager.Instance.SetTrigger(cuo.Model.TriggerName, state == TriggerState.On);
                }
            }
        }
        quest.InProgress = true;
        questsInProgress.Add(quest);
        if (quest.Model.NPCToSubmit)
        {
            DialogueManager.Instance.Talkers[quest.Model.NPCToSubmit.ID].TransferQuestToThis(quest);
        }
        if (!SaveManager.Instance.IsLoading)
        {
            MessageManager.Instance.New($"接取了任务 [{quest.Model.Title}]");
        }
        quest.latestHandleDays = TimeManager.Instance.Days;
        CreateObjectiveMapIcon(quest.Objectives[0]);
        NotifyCenter.PostNotify(QuestStateChanged, quest, false);
        return(true);
    }
示例#23
0
    /// <summary>
    /// 完成任务
    /// </summary>
    /// <param name="quest">要放弃的任务</param>
    /// <returns>是否成功完成任务</returns>
    public bool CompleteQuest(QuestData quest)
    {
        if (!quest)
        {
            return(false);
        }
        if (HasOngoingQuest(quest) && quest.IsComplete)
        {
            if (!SaveManager.Instance.IsLoading)
            {
                if (!BackpackManager.Instance.CanGet(quest.Model.RewardItems))
                {
                    return(false);
                }
                List <QuestData> questsReqThisItem = new List <QuestData>();
                foreach (ObjectiveData o in quest.Objectives)
                {
                    if (o is CollectObjectiveData co)
                    {
                        questsReqThisItem = FindQuestsRequiredItem(co.Model.ItemToCollect, BackpackManager.Instance.GetAmount(co.Model.ItemToCollect) - o.Model.Amount).ToList();
                    }
                    if (questsReqThisItem.Contains(quest) && questsReqThisItem.Count > 1)
                    //需要道具的任务群包含该任务且数量多于一个,说明有其他任务对该任务需提交的道具存在依赖
                    {
                        MessageManager.Instance.New("提交失败!其他任务对该任务需提交的物品存在依赖");
                        return(false);
                    }
                }
            }
            quest.InProgress = false;
            questsInProgress.Remove(quest);
            quest.currentQuestHolder.questInstances.Remove(quest);
            questsFinished.Add(quest);
            foreach (ObjectiveData o in quest.Objectives)
            {
                o.OnStateChangeEvent -= OnObjectiveStateChange;
                if (o is CollectObjectiveData co)
                {
                    BackpackManager.Instance.Inventory.OnItemAmountChanged -= co.UpdateCollectAmount;
                    if (!SaveManager.Instance.IsLoading && co.Model.LoseItemAtSbmt)
                    {
                        BackpackManager.Instance.LoseItem(co.Model.ItemToCollect, o.Model.Amount);
                    }
                }
                if (o is KillObjectiveData ko)
                {
                    switch (ko.Model.KillType)
                    {
                    case KillObjectiveType.Specific:
                        GameManager.Enemies[ko.Model.Enemy.ID].ForEach(e => e.OnDeathEvent -= ko.UpdateKillAmount);
                        break;

                    case KillObjectiveType.Race:
                        foreach (List <Enemy> enemies in GameManager.Enemies.Values.Where(x => x.Count > 0 && x[0].Info.Race && x[0].Info.Race == ko.Model.Race))
                        {
                            enemies.ForEach(e => e.OnDeathEvent -= ko.UpdateKillAmount);
                        }
                        break;

                    case KillObjectiveType.Group:
                        foreach (List <Enemy> enemies in GameManager.Enemies.Values.Where(x => x.Count > 0 && ko.Model.Group.Contains(x[0].Info.ID)))
                        {
                            enemies.ForEach(e => e.OnDeathEvent -= ko.UpdateKillAmount);
                        }
                        break;

                    case KillObjectiveType.Any:
                        foreach (List <Enemy> enemies in GameManager.Enemies.Values)
                        {
                            enemies.ForEach(e => e.OnDeathEvent -= ko.UpdateKillAmount);
                        }
                        break;
                    }
                }
                if (o is TalkObjectiveData to)
                {
                    var talker = DialogueManager.Instance.Talkers[to.Model.NPCToTalk.ID];
                    talker.objectivesTalkToThis.RemoveAll(x => x == to);
                    o.OnStateChangeEvent -= talker.TryRemoveObjective;
                }
                if (o is MoveObjectiveData mo)
                {
                    mo.targetPoint = null;
                    CheckPointManager.Instance.RemoveCheckPointListener(mo.Model.AuxiliaryPos, mo.UpdateMoveState);
                }
                if (o is SubmitObjectiveData so)
                {
                    var talker = DialogueManager.Instance.Talkers[so.Model.NPCToSubmit.ID];
                    talker.objectivesSubmitToThis.RemoveAll(x => x == so);
                    o.OnStateChangeEvent -= talker.TryRemoveObjective;
                }
                if (o is TriggerObjectiveData cuo)
                {
                    TriggerManager.Instance.DeleteTriggerListner(cuo.UpdateTriggerState);
                }
                RemoveObjectiveMapIcon(o);
            }
            if (!SaveManager.Instance.IsLoading)
            {
                BackpackManager.Instance.GetItem(quest.Model.RewardItems);
                MessageManager.Instance.New($"提交了任务 [{quest.Model.Title}]");
            }
            quest.latestHandleDays = TimeManager.Instance.Days;
            NotifyCenter.PostNotify(QuestStateChanged, quest, true);
            return(true);
        }
        return(false);
    }