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 (GameScreenGum == null) { GameScreenGum = (Slotmachine.GumRuntimes.GameScreenGumRuntime)GumRuntime.ElementSaveExtensions.CreateGueForElement(Gum.Managers.ObjectFinder.Self.GetScreen("GameScreenGum"), true); } Slotmachine.Entities.Slot1.LoadStaticContent(contentManagerName); Slotmachine.Entities.Slot2.LoadStaticContent(contentManagerName); Slotmachine.Entities.Slot3.LoadStaticContent(contentManagerName); CustomLoadStaticContent(contentManagerName); }
public override void Destroy() { base.Destroy(); GameScreenGum.RemoveFromManagers(); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= RefreshLayoutInternal; GameScreenGum = null; if (Slot1Instance != null) { Slot1Instance.Destroy(); Slot1Instance.Detach(); } if (Slot2Instance != null) { Slot2Instance.Destroy(); Slot2Instance.Detach(); } if (Slot3Instance != null) { Slot3Instance.Destroy(); Slot3Instance.Detach(); } FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear(); CustomDestroy(); }