Example #1
0
        private static void Bootstrap()
        {
            RedirectionHelper.RedirectCalls(
                typeof(LoadingWrapper).GetMethod("OnLoadingExtensionsCreated", BindingFlags.Instance | BindingFlags.NonPublic),
                typeof(IsolatedFailures).GetMethod("OnLoadingExtensionsCreated", BindingFlags.Instance | BindingFlags.NonPublic));

            if (FindType("ModTools") == null)
            {
                RedirectionHelper.RedirectCalls(
                    typeof(LoadingWrapper).GetMethod("OnLevelLoaded", BindingFlags.Instance | BindingFlags.Public),
                    typeof(IsolatedFailures).GetMethod("OnLevelLoaded", BindingFlags.Instance | BindingFlags.Public));
            }
            else
            {
                UnityEngine.Debug.LogWarning("IsolatedFailures#Bootstrap(): ModTools discovered");
            }

            RedirectionHelper.RedirectCalls(
                typeof(LoadingWrapper).GetMethod("OnLevelUnloading", BindingFlags.Instance | BindingFlags.Public),
                typeof(IsolatedFailures).GetMethod("OnLevelUnloading", BindingFlags.Instance | BindingFlags.Public));
            RedirectionHelper.RedirectCalls(
                typeof(LoadingWrapper).GetMethod("OnLoadingExtensionsReleased", BindingFlags.Instance | BindingFlags.NonPublic),
                typeof(IsolatedFailures).GetMethod("OnLoadingExtensionsReleased", BindingFlags.Instance | BindingFlags.NonPublic));
        }