Exemple #1
0
 public void HideIcon()
 {
     if (iconInstance)
     {
         iconInstance.Hide();
     }
 }
Exemple #2
0
 public void Init(Talker questHolder)
 {
     this.questHolder = questHolder;
     if (MapManager.Instance)
     {
         if (mapIcon)
         {
             MapManager.Instance.RemoveMapIcon(mapIcon, true);
         }
         mapIcon = MapManager.Instance.CreateMapIcon(notAccepted, Vector2.one * 48, questHolder.GetData <TalkerData>().currentPosition, false, MapIconType.Quest, false);
         mapIcon.iconImage.raycastTarget = false;
         mapIcon.Hide();
     }
     triggerNames.Clear();
     foreach (var quest in questHolder.QuestInstances)
     {
         Condition find = quest.Model.AcceptCondition.Conditions.Find(x => x.Type == ConditionType.TriggerSet || x.Type == ConditionType.TriggerReset);
         if (find)
         {
             triggerNames.Add(find.TriggerName);
         }
     }
     UpdateUI();
     Update();
     NotifyCenter.RemoveListener(this);
     NotifyCenter.AddListener(QuestManager.QuestStateChanged, _ => UpdateUI(), this);
     NotifyCenter.AddListener(QuestManager.ObjectiveUpdate, _ => UpdateUI(), this);
     NotifyCenter.AddListener(NotifyCenter.CommonKeys.TriggerChanged, OnTriggerChange, this);
 }
Exemple #3
0
    public void UpdateUI()
    {
        //Debug.Log(questHolder.TalkerName);
        bool hasObjective = questHolder.GetData <TalkerData>().objectivesTalkToThis.FindAll(x => x.AllPrevComplete && !x.IsComplete).Count > 0 ||
                            questHolder.GetData <TalkerData>().objectivesSubmitToThis.FindAll(x => x.AllPrevComplete && !x.IsComplete).Count > 0;

        if (questHolder.QuestInstances.Count < 1 && !hasObjective)
        {
            if (icon.enabled)
            {
                icon.enabled = false;
            }
            mapIcon.Hide();
            conditionShow = false;
            return;
        }
        //Debug.Log("enter");
        if (hasObjective)//该NPC身上有未完成的任务目标
        {
            icon.overrideSprite = accepted;
            mapIcon.iconImage.overrideSprite = accepted;
            conditionShow = true;
            return;
        }
        foreach (var quest in questHolder.QuestInstances)
        {
            if (!quest.IsComplete && !quest.InProgress && MiscFuntion.CheckCondition(quest.Model.AcceptCondition))//只要有一个没接取
            {
                icon.overrideSprite = notAccepted;
                mapIcon.iconImage.overrideSprite = notAccepted;
                conditionShow = true;
                return;
            }
            else if (quest.IsComplete && quest.InProgress)//只要有一个完成
            {
                icon.overrideSprite = complete;
                mapIcon.iconImage.overrideSprite = complete;
                conditionShow = true;
                return;
            }
        }
        conditionShow = false;
    }
Exemple #4
0
 public void UpdateUI()
 {
     //Debug.Log(questHolder.TalkerName);
     hasObjective = questHolder.Data.objectivesTalkToThis.FindAll(x => x.AllPrevObjCmplt && !x.IsComplete).Count > 0 ||
                    questHolder.Data.objectivesSubmitToThis.FindAll(x => x.AllPrevObjCmplt && !x.IsComplete).Count > 0;
     if (questHolder.QuestInstances.Count < 1 && !hasObjective)
     {
         if (icon.enabled)
         {
             icon.enabled = false;
         }
         mapIcon.Hide();
         return;
     }
     //Debug.Log("enter");
     if (hasObjective)//该NPC有未完成的谈话任务
     {
         icon.overrideSprite = accepted;
         mapIcon.iconImage.overrideSprite = accepted;
         return;
     }
     foreach (var quest in questHolder.QuestInstances)
     {
         if (!quest.IsComplete && !quest.InProgress && QuestManager.Instance.IsQuestAcceptable(quest))//只要有一个没接取
         {
             icon.overrideSprite = notAccepted;
             mapIcon.iconImage.overrideSprite = notAccepted;
             return;
         }
         else if (quest.IsComplete && quest.InProgress)//只要有一个完成
         {
             icon.overrideSprite = complete;
             mapIcon.iconImage.overrideSprite = complete;
             return;
         }
     }
     icon.overrideSprite = accepted;
     mapIcon.iconImage.overrideSprite = accepted;
 }
Exemple #5
0
 public void Init(Talker questHolder)
 {
     this.questHolder = questHolder;
     if (MapManager.Instance)
     {
         if (mapIcon)
         {
             MapManager.Instance.RemoveMapIcon(mapIcon, true);
         }
         mapIcon = MapManager.Instance.CreateMapIcon(notAccepted, Vector2.one * 48, questHolder.Data.currentPosition, false, MapIconType.Quest, false);
         mapIcon.iconImage.raycastTarget = false;
         mapIcon.Hide();
     }
     UpdateUI();
     Update();
     if (QuestManager.Instance)
     {
         QuestManager.Instance.OnQuestStatusChange += UpdateUI;
     }
 }