Exemplo n.º 1
0
 /// <summary>
 /// Finishes up scene transitions, spawning the selected <see cref="CustomPlatform"/> if needed
 /// </summary>
 private static void TransitionFinalize()
 {
     Log("Transition Finalize");
     try {
         Scene currentEvironment = GetCurrentEnvironment();
         if (!currentEvironment.name.StartsWith("Menu", STR_INV))
         {
             try {
                 if (!Settings.PlayerData.overrideEnvironmentSettings.overrideEnvironments)
                 {
                     TubeLightUtilities.CreateAdditionalLightSwitchControllers(FindLightWithIdManager(currentEvironment));
                     if (!platformSpawned)
                     {
                         PlatformLifeCycleManagement.InternalChangeToPlatform();
                     }
                 }
             } catch (ManagerNotFoundException e) {
                 Log(e);
             }
         }
         else
         {
             platformSpawned = false;
             Heart.SetActive(Settings.ShowHeart);
             Heart.GetComponent <LightWithId>().ColorWasSet(Color.magenta);
         }
     } catch (EnvironmentSceneNotFoundException) { }
     Log("Transition Finalize finished");
 }
Exemplo n.º 2
0
 /// <summary>
 /// Finishes up scene transitions, spawning the selected <see cref="CustomPlatform"/> if needed
 /// </summary>
 private static void TransitionFinalize()
 {
     try {
         Scene currentEvironment = GetCurrentEnvironment();
         if (!currentEvironment.name.StartsWith("Menu", STR_INV) && MultiplayerCheck() && D360Check() && currentEvironment.name != "TutorialEnvironment")   //Excluding TutorialEnvironment for Counters+ to work properly
         {
             try {
                 Settings.UpdatePlayerData();
                 if (EnvironmentSceneOverrider.didOverrideEnvironment || (PlatformsListView.EnvOr == EnvOverrideMode.Song && !Settings.PlayerData.overrideEnvironmentSettings.overrideEnvironments) || currentEvironment.name.StartsWith("Multiplayer", STR_INV))
                 {
                     if (!platformSpawned)
                     {
                         PlatformLifeCycleManagement.InternalChangeToPlatform();
                         EnvironmentSceneOverrider.Revert();
                     }
                 }
             }
             catch (ManagerNotFoundException e) {
                 Log(e);
             }
         }
         else if (currentEvironment.name.StartsWith("Menu", STR_INV))
         {
             platformSpawned = false;
             Heart.SetActive(Settings.ShowHeart);
             Heart.GetComponent <LightWithIdMonoBehaviour>().ColorWasSet(Color.magenta);
         }
     }
     catch (EnvironmentSceneNotFoundException) { }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Changes to a platform in <see cref="AllPlatforms"/>, based on <paramref name="index"/><br/>
 /// Leave <paramref name="index"/> at <see langword="null"/> to change to the currently selected platform instead<br/>
 /// Acts as an interface between <see cref="PlatformLifeCycleManagement"/> and the rest of the plugin
 /// </summary>
 /// <param name="index">The index of the <see cref="CustomPlatform"/> in the list <see cref="AllPlatforms"/></param>
 internal static void ChangeToPlatform(int?index = null)
 {
     if (index == null)
     {
         PlatformLifeCycleManagement.InternalChangeToPlatform();
     }
     else
     {
         PlatformLifeCycleManagement.InternalChangeToPlatform(index.Value);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Prepares for a scene transition, removes all custom elements
 /// </summary>
 private static void TransitionPrep()
 {
     try {
         Scene currentEvironment = GetCurrentEnvironment();
         if (!currentEvironment.name.StartsWith("Menu", STR_INV))
         {
             PlatformLifeCycleManagement.InternalChangeToPlatform(0);
         }
         else
         {
             Heart.SetActive(false);
         }
     }
     catch (EnvironmentSceneNotFoundException) { }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Overrides the previous request, if there was one<br/>
 /// May trigger a platform change if called in-song (Primarily to catch late scene change callbacks)
 /// </summary>
 internal static void OverridePreviousRequest()
 {
     if (errBuffer != null)
     {
         kyleBuffer = errBuffer;
         errBuffer  = null;
         try {
             if (!GetCurrentEnvironment().name.StartsWith("Menu", STR_INV))
             {
                 PlatformLifeCycleManagement.InternalChangeToPlatform();
             }
         } catch (EnvironmentSceneNotFoundException e) {
             IPA.Logging.Logger.Level L = IPA.Logging.Logger.Level.Warning;
             Log("OverridePreviousRequest was called out of place. Please send me a bug report.", L);
             Log(e, L);
         }
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// This function handles outside requests to temporarily change to a specific platform.<br/>
 /// It caches the request and will consume it when a level is played.<br/>
 /// This can be called both before, and after loading.<br/>
 /// Has to be called BEFORE the level is loaded in order for the right vanilla environment to load.<br/>
 /// It does not require you to reset the platform back to the last known state after the level.
 /// </summary>
 /// <param name="index">Index of the desired platform</param>
 /// <exception cref="StackedRequestsException"></exception>
 public static void TempChangeToPlatform(int index)
 {
     if (kyleBuffer != null)
     {
         errBuffer = index;
         throw new StackedRequestsException();
     }
     else
     {
         kyleBuffer = index;
     }
     try {
         if (!GetCurrentEnvironment().name.StartsWith("Menu", STR_INV) && platformSpawned)
         {
             PlatformLifeCycleManagement.InternalChangeToPlatform();
         }
     } catch (EnvironmentSceneNotFoundException e) {
         IPA.Logging.Logger.Level L = IPA.Logging.Logger.Level.Warning;
         Log("TempChangeToPlatform was called out of place. Please send me a bug report.", L);
         Log(e, L);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Changes to a specific <see cref="CustomPlatform"/> and saves the choice
 /// </summary>
 /// <param name="index">The index of the new platform in <see cref="AllPlatforms"/></param>
 internal static void SetPlatformAndShow(int index)
 {
     CurrentPlatform = AllPlatforms[index % AllPlatforms.Count];
     CONFIG.SetString("Data", "CustomPlatformPath", CurrentPlatform.platName + CurrentPlatform.platAuthor);
     PlatformLifeCycleManagement.InternalChangeToPlatform(index);
 }