示例#1
0
        public static void TempChangeToPlatform(int index)
        {
            Plugin.Log();
            Plugin.Log(index);

            if (kyleBuffer != null)
            {
                errBuffer = index;
                throw new StackedRequestsException();
            }
            else
            {
                kyleBuffer = index;
            }
            try {
                if (!GetCurrentEnvironment().name.StartsWith("Menu") && platformSpawned)
                {
                    DestroyCustomLights();
                    InternalTempChangeToPlatform();
                    PlatformLoader.AddManagers();
                    SpawnCustomLights();
                    Instance.StartCoroutine(ReplaceAllMaterialsAfterOneFrame());
                    EnvironmentArranger.RearrangeEnvironment();
                }
            } catch (EnvironmentSceneNotFoundException e) {
                IPA.Logging.Logger.Level L = IPA.Logging.Logger.Level.Warning;
                Plugin.Log("TempChangeToPlatform was called out of place. Please send me a bug report.", L);
                Plugin.Log(e, L);
            }
        }
示例#2
0
 internal static void Log(object message, Level level = Level.Info)
 {
     try {
         Log(message.ToString(), level);
     } catch (Exception e) {
         Log(e, Level.Error);
     }
 }
示例#3
0
 internal static void Log(GameObject message, Level level = Level.Info)
 {
     try {
         Log(message.GetFullPath(), level);
     } catch (Exception e) {
         Log(e, Level.Error);
     }
 }
示例#4
0
 internal static void Log(Exception e, Level level = Level.Notice)
 {
     Log("An error has been caught:\n" + e.GetType().Name + "\nAt:\n" + e.StackTrace + "\nWith message:\n" + e.Message, level);
     if (e.InnerException != null)
     {
         Log("---Inner Exception:---", level);
         Log(e, level);
     }
 }
示例#5
0
 internal static void InternalOverridePreviousRequest()
 {
     kyleBuffer = errBuffer;
     errBuffer  = null;
     try {
         if (!GetCurrentEnvironment().name.StartsWith("Menu"))
         {
             InternalTempChangeToPlatform();
         }
     } catch (EnvironmentSceneNotFoundException e) {
         IPA.Logging.Logger.Level L = IPA.Logging.Logger.Level.Warning;
         Plugin.Log("OverridePreviousRequest was called out of place. Please send me a bug report.", L);
         Plugin.Log(e, L);
     }
 }
 /// <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);
         }
     }
 }
示例#7
0
        public static void Log(string m, LogLevel l, string suggestedAction)
        {
            IPA.Logging.Logger.Level level = IPA.Logging.Logger.Level.Debug;
            switch (l)
            {
            case LogLevel.Debug: level = IPA.Logging.Logger.Level.Debug; break;

            case LogLevel.Notice: level = IPA.Logging.Logger.Level.Notice; break;

            case LogLevel.Warning: level = IPA.Logging.Logger.Level.Warning; break;

            case LogLevel.Error: level = IPA.Logging.Logger.Level.Error; break;

            case LogLevel.Critical: level = IPA.Logging.Logger.Level.Critical; break;
            }
            logger.Log(level, m);
            if (suggestedAction != null)
            {
                logger.Log(level, $"Suggested Action: {suggestedAction}");
            }
        }
 /// <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);
     }
 }
示例#9
0
 internal static void Log <T>(List <T> messages, Level level = Level.Info)
 {
     foreach (T message in messages)
     {
         try {
             if (message is GameObject)
             {
                 Log(message as GameObject, level);
             }
             else if (message is Component)
             {
                 Log(message as Component, level);
             }
             else
             {
                 Log(message, level);
             }
         } catch (Exception e) {
             Log(e, Level.Error);
         }
     }
 }
示例#10
0
 /// <summary>
 /// Please use <see cref="TempChangeToPlatform(int)"/> instead.
 /// </summary>
 //[Obsolete("Please use TempChangeToPlatform instead", false)]
 //public void ChangeToPlatform(int index, bool ignored = true) {
 //    try {
 //        TempChangeToPlatform(index);
 //    } catch(StackedRequestsException e) {
 //        e.OverridePreviousRequest();
 //    } finally {
 //        InternalTempChangeToPlatform();
 //    }
 //}
 /// <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/>
 /// 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.HasValue)
     {
         errBuffer = index;
         throw new StackedRequestsException();
     }
     else
     {
         kyleBuffer = index;
     }
     try {
         if (!GetCurrentEnvironment().name.StartsWith("Menu"))
         {
             InternalTempChangeToPlatform();
         }
     } catch (EnvironmentSceneNotFoundException e) {
         IPA.Logging.Logger.Level L = IPA.Logging.Logger.Level.Warning;
         Plugin.Log("TempChangeToPlatform was called out of place. Please send me a bug report.", L);
         Plugin.Log(e, L);
     }
 }
示例#11
0
 /// <summary>
 /// Standard string logging, exactly what it says on the tin.
 /// </summary>
 /// <param name="message">The string to print</param>
 /// <param name="level">At what level the message will be printed</param>
 internal static void Log(string message = "<3", Level level = Level.Info)
 {
     Logger.logger.Log(level, message);
 }