Ejemplo n.º 1
0
        public void OnAwake()
        {
            var QuestIndicatorData = Data.QuestIndicatorData;
            var CharacterTransform = _context.CharacterModel.CharacterTransform.transform;
            var list = Services.SharedInstance.PhysicsService.GetObjectsInRadiusByTag(CharacterTransform.position, 100f, "NPC");

            for (int i = 0; i < list.Count; i++)
            {
                GameObject          instance       = GameObject.Instantiate(QuestIndicatorData.QuestIndicatorStruct.Prefab);
                QuestIndicatorModel QuestIndicator = new QuestIndicatorModel(instance, QuestIndicatorData, list[i].gameObject, _context);
                _context.QuestIndicatorModelList.Add(QuestIndicator);
                QuestIndicatorData.SetPosition(list[i].transform, instance.transform);
            }
            Services.SharedInstance.EventManager.TriggerEvent(GameEventTypes.QuestUpdated, null);
        }
Ejemplo n.º 2
0
        public void GetQuestInfo(int npcID, QuestIndicatorModel model)
        {
            var questModel = model.Context.QuestModel;
            var questsWithCompletedAllTask             = questModel.AllTaskCompletedInQuests;
            var questsWithCompletedAllTaskWithOptional = questModel.AllTaskCompletedInQuestsWithOptional;
            var activeQuests    = questModel.ActiveQuests;
            var completedQuests = questModel.CompletedQuests;
            var completedTasks  = questModel.CompletedTasks;

            if (DialogueCache.Rows.Count != 0)
            {
                for (int i = 0; i < DialogueCache.Rows.Count; i++)
                {
                    var currentQuestID   = DialogueCache.Rows[i].GetInt(8);
                    var dialogueTargetID = DialogueCache.Rows[i].GetInt(0);

                    if (DialogueCache.Rows[i].GetInt(5) == npcID)
                    {
                        if (DialogueCache.Rows[i].GetInt(6) == 1)
                        {
                            if (!completedQuests.Contains(currentQuestID) & !activeQuests.Contains(currentQuestID))
                            {
                                ExclamationMarkShow(true, model);
                            }
                            else
                            {
                                ExclamationMarkShow(false, model);
                            }
                        }

                        if (DialogueCache.Rows[i].GetInt(9) == 1)
                        {
                            for (int j = 0; j < QuestTasksCache.Rows.Count; j++)
                            {
                                var q = QuestTasksCache.Rows[j].GetInt(1);
                                if (QuestTasksCache.Rows[j].GetInt(1) == currentQuestID)
                                {
                                    var currentTaskID = QuestTasksCache.Rows[j].GetInt(0);
                                    var taskTargetID  = QuestTasksCache.Rows[j].GetInt(2);

                                    if (!completedTasks.Contains(currentTaskID) &
                                        activeQuests.Contains(currentQuestID) &
                                        !questsWithCompletedAllTask.Contains(currentQuestID) &
                                        taskTargetID == dialogueTargetID)
                                    {
                                        TaskQuestionMarkShow(true, model);
                                        break;
                                    }
                                    else
                                    {
                                        var flag = false;
                                        for (int k = 0; k < activeQuests.Count; k++)
                                        {
                                            var tempQuestId = activeQuests[k];

                                            if (activeQuests.Contains(tempQuestId) &
                                                !questsWithCompletedAllTask.Contains(tempQuestId) &
                                                !questsWithCompletedAllTaskWithOptional.Contains(tempQuestId) &
                                                tempQuestId != currentQuestID &
                                                !completedTasks.Contains(currentTaskID) &
                                                !completedQuests.Contains(currentQuestID))
                                            {
                                                flag = true;
                                                break;
                                            }
                                        }

                                        if (!flag)
                                        {
                                            TaskQuestionMarkShow(false, model);
                                        }
                                    }
                                }
                            }
                        }

                        if (DialogueCache.Rows[i].GetInt(7) == 1)
                        {
                            if (questsWithCompletedAllTaskWithOptional.Contains(currentQuestID) || questsWithCompletedAllTask.Contains(currentQuestID))
                            {
                                QuestionMarkShow(true, model);
                            }
                            else
                            {
                                QuestionMarkShow(false, model);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public void ExclamationMarkShow(bool isOn, QuestIndicatorModel model)
 {
     model.QuestIndicatorTransform.GetChild(0).gameObject.SetActive(isOn);
 }