Пример #1
0
        public static void LoadMod()
        {
            if (!Game1.IsMasterGame)
            {
                return;
            }


            try
            {
                ModState state = ModEntry.GetHelper().Data.ReadSaveData <ModState>(SAVE_KEY);

                if (state == null)
                {
                    //need to find folks who have the old data model and convert them to the new one.
                    //since the save key used doesn't match the current save key, lets try the old method.
                    String data = ModEntry.GetHelper().Data.ReadSaveData <String>("data");
                    ModEntry.GetMonitor().Log("Attempting to load mod data");
                    state = JsonConvert.DeserializeObject <ModState>(data);

                    if (state != null)
                    {
                        //this user has the old save format.  Save in new format real quick and blank out the old key.
                        ModEntry.GetHelper().Data.WriteSaveData(SAVE_KEY, ModState.getModState());
                        ModEntry.GetHelper().Data.WriteSaveData("data", "");
                    }
                }
            } catch (Exception e)
            {
                ModEntry.GetMonitor().Log(e.Message);
            }
        }
Пример #2
0
        //private static bool savingInProgress = false;

        private void OnSave(object sender, SavingEventArgs e)
        {
            VoidshroomTree.RemovalAll();
            //CaveCarrot.RemoveAll();
            ModState.visitedMineshafts.Clear();
            ModState.SaveMod();
        }
Пример #3
0
        public static ModState getModState()
        {
            if (thisModState == null)
            {
                thisModState = new ModState();
            }

            return(thisModState);
        }
Пример #4
0
 private void OnSave(object sender, SavingEventArgs e)
 {
     if (!savingInProgress)
     {
         savingInProgress = true;
         VoidshroomTree.RemovalAll();
         ModState.visitedMineshafts.Clear();
         ModState.SaveMod();
         savingInProgress = false;
     }
 }
Пример #5
0
        public static void SaveMod()
        {
            if (!Game1.IsMasterGame)
            {
                return;
            }

            // save data
            ModEntry.GetMonitor().Log("Attempting to save mod data");
            ModEntry.GetHelper().Data.WriteSaveData(SAVE_KEY, ModState.getModState());
        }
Пример #6
0
        public static void SaveMod()
        {
            if (!Game1.IsMasterGame)
            {
                return;
            }

            // save data
            string json = JsonConvert.SerializeObject(ModState.getModState());

            ModEntry.GetMonitor().Log("Attempting to save mod data");

            ModEntry.GetHelper().Data.WriteSaveData("data", json);
        }
Пример #7
0
        public static void LoadMod()
        {
            if (!Game1.IsMasterGame)
            {
                return;
            }


            try
            {
                String data = ModEntry.GetHelper().Data.ReadSaveData <String>("data");
                ModEntry.GetMonitor().Log("Attempting to load mod data");
                ModState state = JsonConvert.DeserializeObject <ModState>(data);
            } catch (Exception e)
            {
                ModEntry.GetMonitor().Log(e.Message);
            }
        }
Пример #8
0
 private void AfterSaveLoad(object sender, SaveLoadedEventArgs e)
 {
     ModState.LoadMod();
     VoidshroomTree.ReplaceAll();
 }