Пример #1
0
 protected override void OnSceneSave()
 {
     if (!Autosave.Autosaving)
     {
         Autosave.ResetStudioCoroutine();
     }
 }
Пример #2
0
 protected override void OnSceneLoad(SceneOperationKind operation, ReadOnlyDictionary <int, ObjectCtrlInfo> loadedItems)
 {
     if (!Autosave.Autosaving)
     {
         Autosave.ResetStudioCoroutine();
     }
 }
Пример #3
0
 protected override void OnCardBeingSaved(GameMode currentGameMode)
 {
     if (MakerAPI.InsideAndLoaded && !Autosave.Autosaving)
     {
         Autosave.ResetMakerCoroutine();
     }
 }
Пример #4
0
        private void Start()
        {
#if !EC && !PC && !SBPR
            InStudio = Application.productName == Constants.StudioProcessName.Replace("64bit", "").Replace("_64", "");
#endif
            Logger   = base.Logger;
            Instance = this;

            AutosaveEnabled = Config.Bind("Config", "Autosave Enabled", true, new ConfigDescription("Whether to do autosaves", null, new ConfigurationManagerAttributes {
                Order = 11
            }));
            AutosaveInterval = Config.Bind("Config", "Autosave Interval", 15, new ConfigDescription("Minutes between autosaves", new AcceptableValueRange <int>(1, 60), new ConfigurationManagerAttributes {
                Order = 10
            }));
            AutosaveCountdown = Config.Bind("Config", "Autosave Countdown", 10, new ConfigDescription("Seconds of countdown before autosaving", new AcceptableValueRange <int>(0, 60), new ConfigurationManagerAttributes {
                Order = 9
            }));
            AutosaveFileLimit = Config.Bind("Config", "Autosave File Limit", 10, new ConfigDescription("Number of autosaves to keep, older ones will be deleted", new AcceptableValueRange <int>(0, 100), new ConfigurationManagerAttributes {
                Order = 8, ShowRangeAsPercent = false
            }));

            Harmony.CreateAndPatchAll(typeof(Hooks));

            if (InStudio)
            {
#if !EC && !PC && !SBPR
                StudioCoroutine = StartCoroutine(AutosaveStudio());
#endif
            }
            else
            {
#if !HS && !PC && !SBPR
                KKAPI.Maker.MakerAPI.MakerFinishedLoading += (a, b) => MakerCoroutine = StartCoroutine(AutosaveMaker());
                KKAPI.Maker.MakerAPI.MakerExiting         += (a, b) => StopMakerCoroutine();
#endif
            }

            //Delete any leftover autosaves
            if (AutosaveFileLimit.Value == 0)
            {
#if PC
                DeleteAutosaves(AutosavePath);
#else
                DeleteAutosaves(AutosavePathMale);
                DeleteAutosaves(AutosavePathFemale);
#endif
            }

#if KK || EC || AI || HS2 || PH
            KKAPI.Chara.CharacterApi.RegisterExtraBehaviour <CharaController>(PluginGUID);
#endif
#if KK || AI || HS2 || PH
            KKAPI.Studio.SaveLoad.StudioSaveLoadApi.RegisterExtraBehaviour <StudioController>(PluginGUID);
#endif
        }
Пример #5
0
        private void Start()
        {
#if !EC && !PC && !SBPR
            InStudio = Application.productName == Constants.StudioProcessName.Replace("64bit", "").Replace("_64", "");
#endif
            Logger   = base.Logger;
            Instance = this;

            AutosaveIntervalStudio = Config.Bind("Config", "Autosave Interval Studio", 10, new ConfigDescription("Minutes between autosaves in Studio", new AcceptableValueRange <int>(1, 60), new ConfigurationManagerAttributes {
                Order = 10
            }));
            AutosaveIntervalMaker = Config.Bind("Config", "Autosave Interval Maker", 5, new ConfigDescription("Minutes between autosaves in the character maker", new AcceptableValueRange <int>(1, 60), new ConfigurationManagerAttributes {
                Order = 10
            }));
            AutosaveCountdown = Config.Bind("Config", "Autosave Countdown", 10, new ConfigDescription("Seconds of countdown before autosaving", new AcceptableValueRange <int>(0, 60), new ConfigurationManagerAttributes {
                Order = 9
            }));
            AutosaveFileLimit = Config.Bind("Config", "Autosave File Limit", 10, new ConfigDescription("Number of autosaves to keep, older ones will be deleted", new AcceptableValueRange <int>(0, 100), new ConfigurationManagerAttributes {
                Order = 8, ShowRangeAsPercent = false
            }));

            Harmony.CreateAndPatchAll(typeof(Hooks));

            if (InStudio)
            {
#if !EC && !PC && !SBPR
                StartCoroutine(AutosaveStudio());
#endif
            }
            else
            {
#if !HS && !PC && !SBPR
                KKAPI.Maker.MakerAPI.MakerFinishedLoading += (a, b) => MakerCoroutine = StartCoroutine(AutosaveMaker());
                KKAPI.Maker.MakerAPI.MakerExiting         += (a, b) => StopMakerCoroutine();
#endif
            }

            //Delete any leftover autosaves
            if (AutosaveFileLimit.Value == 0)
            {
#if PC
                DeleteAutosaves(AutosavePath);
#else
                DeleteAutosaves(AutosavePathMale);
                DeleteAutosaves(AutosavePathFemale);
#endif
            }
        }