public static void LoadStaticContent(string contentManagerName) { if (string.IsNullOrEmpty(contentManagerName)) { throw new System.ArgumentException("contentManagerName cannot be empty or null"); } // Set the content manager for Gum var contentManagerWrapper = new FlatRedBall.Gum.ContentManagerWrapper(); contentManagerWrapper.ContentManagerName = contentManagerName; RenderingLibrary.Content.LoaderManager.Self.ContentLoader = contentManagerWrapper; // Access the GumProject just in case it's async loaded var throwaway = GlobalContent.GumProject; #if DEBUG if (contentManagerName == FlatRedBall.FlatRedBallServices.GlobalContentManager) { HasBeenLoadedWithGlobalContentManager = true; } else if (HasBeenLoadedWithGlobalContentManager) { throw new System.Exception("This type has been loaded with a Global content manager, then loaded with a non-global. This can lead to a lot of bugs"); } #endif if (Mario_Main_GUI == null) { Mario_Main_GUI = (Super_Marios_Bros.GumRuntimes.Mario_Main_GUIRuntime)GumRuntime.ElementSaveExtensions.CreateGueForElement(Gum.Managers.ObjectFinder.Self.GetScreen("Mario_Main_GUI"), true); } Super_Marios_Bros.Entities.Mario.LoadStaticContent(contentManagerName); Super_Marios_Bros.Entities.DeadMario.LoadStaticContent(contentManagerName); CustomLoadStaticContent(contentManagerName); }
public override void Destroy() { base.Destroy(); Factories.A_BrickFactory.Destroy(); Factories.Lucky_blockFactory.Destroy(); Factories.GumbaFactory.Destroy(); Factories.A_Brick_being_destroyedFactory.Destroy(); Factories.MushroomFactory.Destroy(); Factories.TurtleFactory.Destroy(); Factories.CoinFactory.Destroy(); Mario_Main_GUI.RemoveFromManagers(); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= RefreshLayoutInternal; Mario_Main_GUI = null; A_BrickList.MakeOneWay(); Lucky_blockList.MakeOneWay(); GumbaList.MakeOneWay(); A_Brick_being_destroyedList.MakeOneWay(); MushroomList.MakeOneWay(); TurtleList.MakeOneWay(); CoinList.MakeOneWay(); for (int i = A_BrickList.Count - 1; i > -1; i--) { A_BrickList[i].Destroy(); } if (MarioInstance != null) { MarioInstance.Destroy(); MarioInstance.Detach(); } for (int i = Lucky_blockList.Count - 1; i > -1; i--) { Lucky_blockList[i].Destroy(); } for (int i = GumbaList.Count - 1; i > -1; i--) { GumbaList[i].Destroy(); } for (int i = A_Brick_being_destroyedList.Count - 1; i > -1; i--) { A_Brick_being_destroyedList[i].Destroy(); } if (CombinedShapeCollection != null) { CombinedShapeCollection.Visible = false; } for (int i = MushroomList.Count - 1; i > -1; i--) { MushroomList[i].Destroy(); } for (int i = TurtleList.Count - 1; i > -1; i--) { TurtleList[i].Destroy(); } if (DeadMarioInstance != null) { DeadMarioInstance.Destroy(); DeadMarioInstance.Detach(); } for (int i = CoinList.Count - 1; i > -1; i--) { CoinList[i].Destroy(); } A_BrickList.MakeTwoWay(); Lucky_blockList.MakeTwoWay(); GumbaList.MakeTwoWay(); A_Brick_being_destroyedList.MakeTwoWay(); MushroomList.MakeTwoWay(); TurtleList.MakeTwoWay(); CoinList.MakeTwoWay(); FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear(); CustomDestroy(); }