Esempio n. 1
0
        // QUESTS HUD: ----------------------------------------------------------------------------

        public void OpenQuestsHUD()
        {
            if (this.questsHUDInstance == null)
            {
                DatabaseQuests db     = DatabaseQuests.Load();
                GameObject     prefab = db.GetQuestsHUDPrefab();

                if (prefab != null)
                {
                    this.questsHUDInstance = Instantiate(prefab, Vector3.zero, Quaternion.identity);
                }
            }

            StopAllCoroutines();
            StartCoroutine(this.ChangeQuestsHUDState(true));
            this.isQuestsHUDOpen = true;
        }
Esempio n. 2
0
        // JOURNAL: -------------------------------------------------------------------------------

        public void OpenJournal()
        {
            if (this.journalInstance == null)
            {
                DatabaseQuests db     = DatabaseQuests.Load();
                GameObject     prefab = db.GetJournalPrefab();

                if (prefab != null)
                {
                    this.journalInstance = Instantiate(prefab, Vector3.zero, Quaternion.identity);
                }
            }

            StopAllCoroutines();
            StartCoroutine(this.ChangeJournalState(true));
            this.isJournalOpen = true;
        }
        // INITIALIZE: ----------------------------------------------------------------------------

        private void OnEnable()
        {
            if (target == null || serializedObject == null)
            {
                return;
            }

            this.databaseQuests = (DatabaseQuests)this.target;
            this.spQuests       = serializedObject.FindProperty(PROP_QUESTS);
            this.spList         = serializedObject.FindProperty(PROP_LIST);
            this.spSettings     = serializedObject.FindProperty(PROP_SETTINGS);

            if (this.spQuests.objectReferenceValue == null)
            {
                this.spQuests.objectReferenceValue = QuestUtilities.GetQuestsRoot();
                serializedObject.ApplyModifiedPropertiesWithoutUndo();
                serializedObject.Update();
            }

            Quests quests = (Quests)this.spQuests.objectReferenceValue;

            this.questsInstances = new Dictionary <int, IQuest>();
            this.questsInstances.Add(QuestsTreeView.ROOT_ID, quests);

            this.editorRoot    = IQuestEditor.CreateEditor(quests);
            this.questsEditors = new Dictionary <int, IQuestEditor>();
            this.questsEditors.Add(quests.GetInstanceID(), this.editorRoot);

            for (int i = 0; i < this.databaseQuests.list.Count; ++i)
            {
                IQuest item = this.databaseQuests.list[i];
                if (!this.questsInstances.ContainsKey(item.GetInstanceID()))
                {
                    this.questsInstances.Add(item.GetInstanceID(), item);
                }

                IQuestEditor editor = IQuestEditor.CreateEditor(item);
                this.questsEditors.Add(item.GetInstanceID(), editor);
            }

            this.questsTree = new QuestsTreeView(this.databaseQuests.questsTreeState, this);

            this.searchField = new SearchField();
            this.searchField.downOrUpArrowKeyPressed += this.questsTree.SetFocusAndEnsureSelectedItem;
        }
Esempio n. 4
0
        private void LoadQuests()
        {
            DatabaseQuests database = DatabaseQuests.Load();

            this.collection = new Dictionary <string, IQuest>();
            this.quests     = new Dictionary <string, Quest>();

            int questsCount = database.list.Count;

            for (int i = 0; i < questsCount; ++i)
            {
                IQuest reference = database.list[i];
                IQuest instance  = Instantiate(reference);

                this.collection.Add(instance.uniqueID, instance);
                if (instance.IsQuestRoot())
                {
                    this.quests.Add(instance.uniqueID, (Quest)instance);
                }
            }
        }