Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        protected override void Load(FilePath referencedFilePath, out object runtimeObjects, out object dataModel)
        {
            var extension = referencedFilePath.Extension;

            if (extension == "gusx")
            {
                var gumReferencedFile = GlueViewState.Self
                                        .GetAllReferencedFiles()
                                        .FirstOrDefault(item => item.Name.ToLowerInvariant().EndsWith(".gumx"));
                var absoluteGumxFileName = GlueViewCommands.Self.FileCommands.GetAbsoluteFileName(gumReferencedFile);

                GumIdb.StaticInitialize(absoluteGumxFileName.FullPath);

                var contentManagerWrapper = new FlatRedBall.Gum.ContentManagerWrapper();
                contentManagerWrapper.ContentManagerName = "test";
                RenderingLibrary.Content.LoaderManager.Self.ContentLoader = contentManagerWrapper;

                gumIdb = new GumIdb();

                string elementFileName = referencedFilePath.Standardized;
                gumIdb.LoadFromFile(elementFileName);
                gumIdb.AssignReferences();
                gumIdb.Element.UpdateLayout();

                // Handled in StaticInit
                //SpriteManager.AddDrawableBatch(gumIdb);

                runtimeObjects = gumIdb;
                dataModel      = gumIdb.Element;
            }
            else
            {
                runtimeObjects = null;
                dataModel      = null;
            }
        }