示例#1
0
        public Scene LoadScene(string fileName, Layer layer)
        {
            Scene scene = null;

            if (
#if XBOX360
                FlatRedBallServices.IgnoreExtensionsWhenLoadingContent == false &&
#endif
                FlatRedBall.IO.FileManager.GetExtension(fileName) == "scnx")
            {
#if XBOX360
                throw new NotImplementedException("Cannot currently load .scnx files on the 360.  Use content manager");
#else
                scene = FlatRedBall.Content.SpriteEditorScene.FromFile(fileName).ToScene(mContentManagerName);
#endif
            }
            else
            {
                // There is either no extension on the fileName or the extensions are being ignored
                // by the engine.
                scene = FlatRedBallServices.Load <Scene>(fileName, mContentManagerName);
            }

            if (scene != null)
            {
                scene.AddToManagers(layer);

                mSprites.AddRange(scene.Sprites);
                mSpriteGrids.AddRange(scene.SpriteGrids);
                mSpriteFrames.AddRange(scene.SpriteFrames);
                mPositionedModels.AddRange(scene.PositionedModels);

                SpriteManager.SortTexturesSecondary();
            }

            mLastLoadedScene = scene;

            return(scene);
        }