예제 #1
0
            public void Load(int backup = -1)
            {
                string targetFile = fullName(backup);
                var    copyFrom   = new SaveData(-1);

                if (File.Exists(targetFile))
                {
                    using (var sr = new StreamReader(targetFile))
                        using (JsonReader reader = new JsonTextReader(sr)) {
                            var serializer = new JsonSerializer {
                                DefaultValueHandling = DefaultValueHandling.Populate
                            };
                            copyFrom = serializer.Deserialize <SaveData>(reader);
                        }
                }
                TreesActivated = new HashSet <AbilityType>(copyFrom.TreesActivated);
                OpherSold      = new HashSet <AbilityType>(copyFrom.OpherSold);
                OpherUpgraded  = new Dictionary <AbilityType, int>(copyFrom.OpherUpgraded);
                TwillenSold    = new HashSet <ShardType>(copyFrom.TwillenSold);
                WorldEvents    = new HashSet <QuestEventType>(copyFrom.WorldEvents);
                SkillsFound    = new HashSet <AbilityType>(copyFrom?.SkillsFound ?? new HashSet <AbilityType>());
                FoundCount     = copyFrom.FoundCount;
                KSBought       = copyFrom.KSBought;
                TrackFileController.Write();
            }
예제 #2
0
 public static void SetEvent(QuestEventType ev, bool setTo = true)
 {
     if (setTo)
     {
         Data.WorldEvents.Add(ev);
     }
     else
     {
         Data.WorldEvents.Remove(ev);
     }
     TrackFileController.Write();
 }
예제 #3
0
            public void Save(int backup = -1)
            {
                string targetFile = fullName(backup);

                if (File.Exists(targetFile))
                {
                    File.Delete(targetFile);
                }

                using (var sw = new StreamWriter(targetFile))
                    using (JsonWriter writer = new JsonTextWriter(sw)) {
                        var serializer = new JsonSerializer();
                        serializer.Serialize(writer, this);
                    }
                TrackFileController.Write();
            }
예제 #4
0
        public static void SetAbility(AbilityType ability, bool setTo = true)
        {
            if (setTo)
            {
                Data.SkillsFound.Add(ability);
            }
            else
            {
                Data.SkillsFound.Remove(ability);
            }

            InterOp.set_ability(ability, setTo);
            if (ability.Equip().HasValue)
            {
                InterOp.set_equipment(ability.Equip().Value, setTo);
            }

            TrackFileController.Write();
        }