protected override void OnApplicationTick(float dt)
 {
     if (Config.QuickloadKey != InputKey.Invalid && Input.IsKeyReleased(Config.QuickloadKey) && QuicksaveManager.CanQuickload)
     {
         QuicksaveManager.Quickload();
     }
     OnApplicationTickEvent?.Invoke();
 }
 protected override void OnSubModuleLoad()
 {
     try
     {
         harmony = new Harmony(harmonyId);
         harmony.PatchAll();
         QuicksaveManager.Init();
         modActive = true;
     }
     catch (Exception exception)
     {
         onSubModuleLoadException = exception;
         harmony?.UnpatchAll(harmonyId);
     }
 }
Exemple #3
0
 protected override void OnApplicationTick(float dt)
 {
     if (lgr != null)
     {
         if (GameStateManager.Current.ActiveState is MapState)
         {
             if (Mission.Current != null)
             {
                 InformationManager.DisplayMessage(new InformationMessage("Mission is not null, failed to quickload!", Colors.Red));
             }
             else
             {
                 QuicksaveManager.loadSave(lgr);
             }
             lgr = null;
         }
     }
     else
     if (Input.IsKeyReleased(Config.QuickloadKey) && QuicksaveManager.CanQuickload)
     {
         lgr = QuicksaveManager.GetLatestQuicksave();
         if (lgr == null)
         {
             InformationManager.DisplayMessage(new InformationMessage("No quicksaves available."));
         }
         else
         {
             if (lgr.LoadResult.Successful)
             {
                 if (Mission.Current != null)
                 {
                     Mission.Current.RetreatMission();
                 }
             }
             else
             {
                 InformationManager.DisplayMessage(new InformationMessage("Unable to load quicksave:",
                                                                          Colors.Yellow));
                 foreach (LoadError loadError in lgr.LoadResult.Errors)
                 {
                     InformationManager.DisplayMessage(new InformationMessage(loadError.Message, Colors.Red));
                 }
                 lgr = null;
             }
         }
     }
 }
Exemple #4
0
 static void Postfix(ref bool __result, string name)
 {
     __result = QuicksaveManager.IsValidName(name) || __result;
 }