Esempio n. 1
0
        public void OnLoad(System.Object generic)
        {
            QuestsStorage storage = (QuestsStorage)generic;
            Dictionary <string, QuestData> storeDatas = new Dictionary <string, QuestData>();

            for (int i = 0; i < storage.questsData.Length; ++i)
            {
                storeDatas.Add(storage.questsData[i].questID, storage.questsData[i]);
            }

            foreach (KeyValuePair <string, IQuest> collectionItem in this.collection)
            {
                if (storeDatas.ContainsKey(collectionItem.Key))
                {
                    QuestData storeData = storeDatas[collectionItem.Key];
                    collectionItem.Value.progress = storeData.progress;
                    collectionItem.Value.status   = storeData.status;
                }
            }
        }
Esempio n. 2
0
        public System.Object GetSaveData()
        {
            QuestsStorage storage = new QuestsStorage();

            storage.questsData = new QuestData[this.collection.Count];

            int index = 0;

            foreach (KeyValuePair <string, IQuest> item in this.collection)
            {
                storage.questsData[index] = new QuestData()
                {
                    questID  = item.Key,
                    status   = item.Value.status,
                    progress = item.Value.progress
                };

                index++;
            }

            return(storage);
        }