private static bool LoadMovieHarmony(GauntletMovie __instance, Widget ____movieRootNode)
        {
            var movie = Instance.MovieRequested(__instance.MovieName);

            if (movie == null)
            {
                return(true);
            }

            var widgetCreationData = new WidgetCreationData(__instance.Context, __instance.WidgetFactory);

            widgetCreationData.AddExtensionData(__instance);
            RootViewProperty.SetValue(__instance, WidgetInstantiationResultDatabindingExtension.GetGauntletView(movie.Instantiate(widgetCreationData)));
            ____movieRootNode.AddChild(__instance.RootView.Target);
            __instance.RootView.RefreshBindingWithChildren();
            return(false);
        }
예제 #2
0
        /// <summary>
        /// Intercept LoadMovie("ModOptionsScreen_v1")
        /// </summary>
        public static bool Prefix(GauntletMovie __instance)
        {
            if (__instance.MovieName == "ModOptionsScreen_v1")
            {
                var customType         = PrefabsLoader.LoadModOptionsScreen_v1Prefab();
                var widgetCreationData = new WidgetCreationData(__instance.Context, __instance.WidgetFactory);
                widgetCreationData.AddExtensionData(__instance);
                var widgetInstantiationResult = customType.Instantiate(widgetCreationData);
                RootViewProperty.SetValue(__instance, widgetInstantiationResult.GetGauntletView());
                var target        = __instance.RootView.Target;
                var movieRootNode = (Widget)MovieRootNodeField.GetValue(__instance);
                movieRootNode.AddChild(target);
                __instance.RootView.RefreshBindingWithChildren();

                return(false);
            }

            return(true);
        }