public static void UnloadStaticContent() { if (LoadedContentManagers.Count != 0) { LoadedContentManagers.RemoveAt(0); mRegisteredUnloads.RemoveAt(0); } if (LoadedContentManagers.Count == 0) { if (MazetechFont_1 != null) { MazetechFont_1 = null; } if (MazetechFont != null) { MazetechFont = null; } if (MazetechFont_0 != null) { MazetechFont_0 = null; } if (MessageTexture != null) { MessageTexture = null; } } }
public static void LoadStaticContent(string contentManagerName) { if (string.IsNullOrEmpty(contentManagerName)) { throw new ArgumentException("contentManagerName cannot be empty or null"); } ContentManagerName = contentManagerName; #if DEBUG if (contentManagerName == FlatRedBallServices.GlobalContentManager) { HasBeenLoadedWithGlobalContentManager = true; } else if (HasBeenLoadedWithGlobalContentManager) { throw new 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 bool registerUnload = false; if (LoadedContentManagers.Contains(contentManagerName) == false) { LoadedContentManagers.Add(contentManagerName); lock (mLockObject) { if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBallServices.GlobalContentManager) { FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("LabelStaticUnload", UnloadStaticContent); mRegisteredUnloads.Add(ContentManagerName); } } if (!FlatRedBallServices.IsLoaded <FlatRedBall.Graphics.BitmapFont>(@"content/entities/label/paint100.fnt", ContentManagerName)) { registerUnload = true; } Paint100 = FlatRedBallServices.Load <FlatRedBall.Graphics.BitmapFont>(@"content/entities/label/paint100.fnt", ContentManagerName); if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/label/paint100_0.png", ContentManagerName)) { registerUnload = true; } Paint100_0 = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/label/paint100_0.png", ContentManagerName); } if (registerUnload && ContentManagerName != FlatRedBallServices.GlobalContentManager) { lock (mLockObject) { if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBallServices.GlobalContentManager) { FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("LabelStaticUnload", UnloadStaticContent); mRegisteredUnloads.Add(ContentManagerName); } } } CustomLoadStaticContent(contentManagerName); }
public static void UnloadStaticContent() { if (LoadedContentManagers.Count != 0) { LoadedContentManagers.RemoveAt(0); mRegisteredUnloads.RemoveAt(0); } if (LoadedContentManagers.Count == 0) { if (Paint100 != null) { Paint100 = null; } if (Paint100_0 != null) { Paint100_0 = null; } } }