public static void LoadStaticContent(string contentManagerName)
 {
     if (string.IsNullOrEmpty(contentManagerName))
     {
         throw new ArgumentException("contentManagerName cannot be empty or null");
     }
                 #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
     if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/screens/testscreen/gold.png", contentManagerName))
     {
     }
     Gold = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/screens/testscreen/gold.png", contentManagerName);
     if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/parallaxbackground/parallaxtexture.png", contentManagerName))
     {
     }
     ParallaxTexture = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/parallaxbackground/parallaxtexture.png", contentManagerName);
     ParalaxEntity.Entities.ParallaxBackground.LoadStaticContent(contentManagerName);
     CustomLoadStaticContent(contentManagerName);
 }
Beispiel #2
0
        public static void LoadStaticContent(string contentManagerName)
        {
            if (string.IsNullOrEmpty(contentManagerName))
            {
                throw new 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 == 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
            if (!FlatRedBallServices.IsLoaded <FlatRedBall.Gum.GumIdb>(@"content/gumproject/screens/gamescreengum.gusx", contentManagerName))
            {
            }
            GameScreenGum = new GumIdb();  GameScreenGum.LoadFromFile("content/gumproject/screens/gamescreengum.gusx");  GameScreenGum.AssignReferences();
            Pokamen.Entities.Enemy.LoadStaticContent(contentManagerName);
            Pokamen.Entities.Player.LoadStaticContent(contentManagerName);
            Pokamen.Entities.CursorEntity.LoadStaticContent(contentManagerName);
            CustomLoadStaticContent(contentManagerName);
        }
 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("BoardTileStaticUnload", UnloadStaticContent);
                 mRegisteredUnloads.Add(ContentManagerName);
             }
         }
         if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/boardtile/tilenone.png", ContentManagerName))
         {
             registerUnload = true;
         }
         TileNone = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/boardtile/tilenone.png", ContentManagerName);
         if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/boardtile/tileotexture.png", ContentManagerName))
         {
             registerUnload = true;
         }
         TileOTexture = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/boardtile/tileotexture.png", ContentManagerName);
         if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/boardtile/tilextexture.png", ContentManagerName))
         {
             registerUnload = true;
         }
         TileXTexture = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/boardtile/tilextexture.png", ContentManagerName);
     }
     if (registerUnload && ContentManagerName != FlatRedBallServices.GlobalContentManager)
     {
         lock (mLockObject)
         {
             if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBallServices.GlobalContentManager)
             {
                 FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("BoardTileStaticUnload", UnloadStaticContent);
                 mRegisteredUnloads.Add(ContentManagerName);
             }
         }
     }
     CustomLoadStaticContent(contentManagerName);
 }
 public static new void LoadStaticContent(string contentManagerName)
 {
     if (string.IsNullOrEmpty(contentManagerName))
     {
         throw new ArgumentException("contentManagerName cannot be empty or null");
     }
     ContentManagerName = contentManagerName;
     PlatformerCharacterBase.LoadStaticContent(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("PlayerStaticUnload", UnloadStaticContent);
                 mRegisteredUnloads.Add(ContentManagerName);
             }
         }
         if (!FlatRedBallServices.IsLoaded <FlatRedBall.Graphics.Animation.AnimationChainList>(@"content/entities/player/animationchainlistfile.achx", ContentManagerName))
         {
             registerUnload = true;
         }
         AnimationChainListFile = FlatRedBallServices.Load <FlatRedBall.Graphics.Animation.AnimationChainList>(@"content/entities/player/animationchainlistfile.achx", ContentManagerName);
         if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/player/playertexture.png", ContentManagerName))
         {
             registerUnload = true;
         }
         PlayerTexture = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/player/playertexture.png", ContentManagerName);
     }
     if (registerUnload && ContentManagerName != FlatRedBallServices.GlobalContentManager)
     {
         lock (mLockObject)
         {
             if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBallServices.GlobalContentManager)
             {
                 FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("PlayerStaticUnload", UnloadStaticContent);
                 mRegisteredUnloads.Add(ContentManagerName);
             }
         }
     }
     CustomLoadStaticContent(contentManagerName);
 }
        public static AnimationChain FromGif(string fileName, string contentManagerName)
        {
            if (FileManager.IsRelative(fileName))
            {
                fileName = FileManager.RelativeDirectory + fileName;
            }

            if (FlatRedBallServices.IsLoaded <AnimationChain>(fileName, contentManagerName))
            {
                return(FlatRedBallServices.GetNonDisposable <AnimationChain>(fileName, contentManagerName).Clone());
            }

            ImageDataList imageDataList = GifLoader.GetImageDataList(fileName);

            int numberOfFrames = imageDataList.Count;

            AnimationChain animationChain = new AnimationChain(numberOfFrames);

            for (int i = 0; i < numberOfFrames; i++)
            {
                // We assume GIFs are for 2D games that don't need mipmaps.  Could change this later
                // if needed
                const bool generateMipmaps = false;

                Texture2D texture2D = imageDataList[i].ToTexture2D(generateMipmaps, FlatRedBallServices.GraphicsDevice);
                texture2D.Name =
                    fileName + i.ToString();

                if (i >= imageDataList.FrameTimes.Count)
                {
                    const double defaultFrameTime = .1;

                    animationChain.Add(
                        new AnimationFrame(
                            texture2D, (float)defaultFrameTime));
                }
                else
                {
                    animationChain.Add(
                        new AnimationFrame(
                            texture2D, (float)imageDataList.FrameTimes[i]));
                }
                FlatRedBallServices.AddDisposable(texture2D.Name, texture2D, contentManagerName);
            }

            // Don't dispose the anything because it's part of the
            // content manager.

            animationChain.ParentGifFileName = fileName;
            animationChain.Name = FileManager.RemovePath(fileName);

            return(animationChain);
        }
Beispiel #6
0
 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("ParallaxBackgroundStaticUnload", UnloadStaticContent);
                 mRegisteredUnloads.Add(ContentManagerName);
             }
         }
         if (!FlatRedBallServices.IsLoaded <System.String>(@"content/entities/parallaxbackground/license.txt", ContentManagerName))
         {
             registerUnload = true;
         }
         License = FlatRedBallServices.Load <System.String>(@"content/entities/parallaxbackground/license.txt", ContentManagerName);
     }
     if (registerUnload && ContentManagerName != FlatRedBallServices.GlobalContentManager)
     {
         lock (mLockObject)
         {
             if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBallServices.GlobalContentManager)
             {
                 FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("ParallaxBackgroundStaticUnload", UnloadStaticContent);
                 mRegisteredUnloads.Add(ContentManagerName);
             }
         }
     }
     CustomLoadStaticContent(contentManagerName);
 }
        public override void Initialize(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            if (!FlatRedBallServices.IsLoaded <FlatRedBall.Scene>(@"content/screens/splashscreen/scenefile.scnx", ContentManagerName))
            {
            }
            SceneFile    = FlatRedBallServices.Load <FlatRedBall.Scene>(@"content/screens/splashscreen/scenefile.scnx", ContentManagerName);
            SpriteObject = SceneFile.Sprites.FindByName("frblogo5121");

            this.NextScreen = typeof(LudumDare29.Screens.MenuScreen).FullName;

            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
 public static void LoadStaticContent(string contentManagerName)
 {
     if (string.IsNullOrEmpty(contentManagerName))
     {
         throw new ArgumentException("contentManagerName cannot be empty or null");
     }
                 #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
     if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/screens/ccgsplashscreen/ccgsplash.png", contentManagerName))
     {
     }
     CcgSplash = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/screens/ccgsplashscreen/ccgsplash.png", contentManagerName);
     FrbTicTacToe.Entities.Label.LoadStaticContent(contentManagerName);
     CustomLoadStaticContent(contentManagerName);
 }