当前位置: 首页>>代码示例>>C#>>正文


C# ContentManager.Unload方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Content.ContentManager.Unload方法的典型用法代码示例。如果您正苦于以下问题:C# ContentManager.Unload方法的具体用法?C# ContentManager.Unload怎么用?C# ContentManager.Unload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Content.ContentManager的用法示例。


在下文中一共展示了ContentManager.Unload方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Scene7

 public Scene7(Game game, ContentManager content, GameComponentCollection components)
     : base(game, content, components)
 {
     Components = components;
     Content = content;
     colorList = GameTools.elementColors(colorList);
     gameStorage = new GameData("lobby");
     Content.Unload();
 }
开发者ID:stantheman112,项目名称:ToyRoomGame,代码行数:9,代码来源:Scene7.cs

示例2: clearMap

 /// <summary>
 /// Method to reset map to a new map
 /// <param name="contentMgr">Content manager</param>
 /// </summary>
 public static void clearMap(ContentManager contentMgr)
 {
     content.Clear();
     contentMgr.Unload();
     skyBoxTexture = null;
     mapRadius = 200000;
     skyBoxRepeat = 10;
     skyBoxDrawer = null;
 }
开发者ID:nthfloor,项目名称:Nebulon12,代码行数:13,代码来源:BBNMap.cs

示例3: CreateXML

 public static async Task CreateXML(Mainmap _map, Camera _camera, ContentManager _content)
 {
     CreateMix(_content);
     CreateWalls(_content, "wall1");
     CreateWalls(_content, "wall2");
     CreateWalls(_content, "wall3");
     CreateFloor(_content, "floor1");
     CreateFloor(_content, "floor2");
     CreateFloor(_content, "floor3");
     CreateWalls(_content, "wall4");
     _content.Unload();
     CreateActor(_map, _content, _camera, "bat");
     CreateActor(_map, _content, _camera, "bow");
     CreateActor(_map, _content, _camera, "croc");
     CreateActor(_map, _content, _camera, "Cyclops");
     CreateActor(_map, _content, _camera, "dead");
     CreateActor(_map, _content, _camera, "devil");
     CreateActor(_map, _content, _camera, "dragon");
     CreateActor(_map, _content, _camera, "fairy");
     CreateActor(_map, _content, _camera, "Ghost");
     CreateActor(_map, _content, _camera, "gnome");
     CreateActor(_map, _content, _camera, "guard");
     CreateActor(_map, _content, _camera, "Luigi");
     CreateActor(_map, _content, _camera, "mage");
     CreateActor(_map, _content, _camera, "monk");
     CreateActor(_map, _content, _camera, "mouse");
     CreateActor(_map, _content, _camera, "Mummy");
     CreateActor(_map, _content, _camera, "Necro");
     CreateActor(_map, _content, _camera, "NPC1");
     CreateActor(_map, _content, _camera, "player");
     CreateActor(_map, _content, _camera, "princess");
     CreateActor(_map, _content, _camera, "rat");
     CreateActor(_map, _content, _camera, "skeleton");
     CreateActor(_map, _content, _camera, "skull");
     CreateActor(_map, _content, _camera, "spider");
     CreateActor(_map, _content, _camera, "thief");
     CreateActor(_map, _content, _camera, "vamp");
     CreateActor(_map, _content, _camera, "wolf");
     CreateActor(_map, _content, _camera, "xmas");
     CreateActor(_map, _content, _camera, "Zombie");
     _content.Unload();
     return;
 }
开发者ID:propra13-orga,项目名称:gruppe22,代码行数:43,代码来源:CreateXMLFiles.cs

示例4: instance

        public void instance(string[] args)
        {
            try
            {

                Form form = new Form();
                GraphicsDeviceService gds = GraphicsDeviceService.AddRef(form.Handle, form.ClientSize.Width, form.ClientSize.Height);
                ServiceContainer services = new ServiceContainer();
                services.AddService<IGraphicsDeviceService>(gds);
                var content = new ContentManager(services);

                foreach (string p in args)
                {
                    Console.WriteLine(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + " " + p);
                    if (File.Exists(p))
                    {
                        if (Path.GetExtension(p).Equals(".xnb"))
                        {
                            ConvertToPng(content, p);
                        }
                    }
                    else
                    {
                        Console.WriteLine("Invalid file path or file");
                    }
                }

                foreach (string f in filesToDelete)
                {
                    File.Delete(f);
                }
                content.Unload();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
开发者ID:Silentspy,项目名称:terrariaxnb2png,代码行数:38,代码来源:Program.cs

示例5: UnloadContent

 private void UnloadContent(ContentManager Content)
 {
     Content.Unload();
 }
开发者ID:Julyuary,项目名称:EST,代码行数:4,代码来源:MainMenu.cs

示例6: LoadContent

        public override void LoadContent()
        {
            mScene = new Scene();
            mActorMan = new ActorManager(mViews);
            GameResources.ActorManager = mActorMan;

            LevelManifest manifest;
            using (ContentManager manifestLoader = new ContentManager(SharedResources.Game.Services, "Content"))
            {
                manifest = manifestLoader.Load<LevelManifest>(mRequest.LevelName);
                manifestLoader.Unload();    // a LevelManifest does not use any Disposable resources, so this is ok.
            }

            // The IScreenHoncho tells this gameplay screen how to set up the PlayerViews and DrawSegments required to play this level
            IScreenHoncho screenHoncho = Activator.CreateInstance(Type.GetType(manifest.ScreenHonchoTypeName)) as IScreenHoncho;

            mViewContentLoader = new ContentManager(SharedResources.Game.Services, "Content");

            foreach (PlayerInfo player in GameResources.PlaySession.Players)
            {
                mViews.Add(PlayerViewFactory.Create(player,
                                                    mRequest.CharacterSelections[player.PlayerId],
                                                    screenHoncho,
                                                    mViewContentLoader));
            }

            // Determine screen layout and create DrawSegments
            if (screenHoncho.PlayersUseSeparateViewports)
            {
                switch (GameResources.PlaySession.LocalPlayers.Count)
                {
                    case 1:
                        mScreenLayout = ViewportLayout.FullScreen;
                        break;
                    case 2:
                        mScreenLayout = GameOptions.PreferHorizontalSplit ? ViewportLayout.HorizontalSplit : ViewportLayout.VerticalSplit;
                        break;
                    case 3:
                    case 4:
                        mScreenLayout = ViewportLayout.FourWaySplit;
                        break;
                    default:
                        throw new InvalidOperationException("Unsupported number of local players.");
                }

                foreach (int playerId in GameResources.PlaySession.LocalPlayers.Keys)
                {
                    HumanView playerView = mViews.Single(v => v.PlayerId == playerId) as HumanView;
                    ICameraProvider cameraPlayerView = playerView as ICameraProvider;
                    if (cameraPlayerView == null)
                        throw new LevelManifestException("When IScreenHoncho.PlayersUseSeparateViewports is true, HumanViews must implement the ICameraProvider interface.");
                    DrawSegment ds = new DrawSegment(mScene, cameraPlayerView.Camera);
                    mDrawSegments.Add(ds);
                    playerView.DrawSegment = ds;
                }
            }
            else
            {
                mScreenLayout = ViewportLayout.FullScreen;
                DrawSegment ds = new DrawSegment(mScene);
                mDrawSegments.Add(ds);
                foreach (int playerId in GameResources.PlaySession.LocalPlayers.Keys)
                {
                    HumanView playerView = mViews.Single(v => v.PlayerId == playerId) as HumanView;
                    playerView.DrawSegment = ds;
                }

            }

            // TODO: P3: Make sure all non-local players are connected
            mScene.Load();

            mActorMan.LoadContent(manifest);

            // TODO: P3: Make sure all remote clients have loaded their game.

            foreach (PlayerView view in mViews)
            {
                view.Load();
            }

            GameResources.LoadNewLevelDelegate = LoadNewLevel;

            SharedResources.Game.GraphicsDevice.DeviceLost += DeviceLostHandler;
            SharedResources.Game.GraphicsDevice.DeviceResetting += DeviceResettingHandler;
            SharedResources.Game.GraphicsDevice.DeviceReset += DeviceResetHandler;
        }
开发者ID:Tengato,项目名称:Mechadrone1,代码行数:87,代码来源:GameplayScreen.cs

示例7: _AddActivity

        private static void _AddActivity(ContentManager _content, ActorView actor, string character, string action, Backend.Activity activity)
        {
            if (System.IO.File.Exists(".\\content\\" + character + "-" + action + ".xnb"))
            {
                try
                {
                    Texture2D texture = _content.Load<Texture2D>(character + "-" + action);
                    int size = texture.Height / 8;
                    int cols = texture.Width / size;
                    actor.width = size;
                    actor.height = size;
                    int diff = 0;
                    if (size < 128)
                    {
                        diff = 128 - size;
                    }

                    // add offset / crop
                    actor.Add(activity, Backend.Direction.DownRight, character + "-" + action, new Backend.Coords(size * 0, size * 0), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2));
                    actor.Add(activity, Backend.Direction.UpRight, character + "-" + action, new Backend.Coords(size * 0, size * 1), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2)); // Ok
                    actor.Add(activity, Backend.Direction.Right, character + "-" + action, new Backend.Coords(size * 0, size * 2), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2)); // OK
                    actor.Add(activity, Backend.Direction.Up, character + "-" + action, new Backend.Coords(size * 0, size * 3), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2)); // Ok
                    actor.Add(activity, Backend.Direction.DownLeft, character + "-" + action, new Backend.Coords(size * 0, size * 4), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2)); // Ok
                    actor.Add(activity, Backend.Direction.Down, character + "-" + action, new Backend.Coords(size * 0, size * 5), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2));
                    actor.Add(activity, Backend.Direction.Left, character + "-" + action, new Backend.Coords(size * 0, size * 6), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2)); // OK
                    actor.Add(activity, Backend.Direction.UpLeft, character + "-" + action, new Backend.Coords(size * 0, size * 7), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2));
                }
                catch
                {

                }
                _content.Unload();
            }
        }
开发者ID:propra13-orga,项目名称:gruppe22,代码行数:34,代码来源:CreateXMLFiles.cs

示例8: LoadSprite2D

        void LoadSprite2D(string fileName, Sprite sprite)
        {
            Cursor = Cursors.WaitCursor;

            contentBuilder = new ContentBuilder();
            contentManager = new ContentManager(this.Services,
                                                contentBuilder.OutputDirectory);

            contentManager.Unload();
            contentBuilder.Clear();

            contentBuilder.Add(fileName, fileName.Substring(fileName.LastIndexOf(@"\") + 1, fileName.Length - fileName.LastIndexOf(@"\") - 5), null, null);

            string buildError = contentBuilder.Build();
            if (string.IsNullOrEmpty(buildError))
            {
                sprite.SpriteTexture = contentManager.Load<Texture2D>(fileName.Substring(fileName.LastIndexOf(@"\") + 1, fileName.Length - fileName.LastIndexOf(@"\") - 5));

            }
            Cursor = Cursors.Default;
        }
开发者ID:rottenronin,项目名称:mapEditor,代码行数:21,代码来源:MapDisplayer.cs

示例9: Init

 public static void Init(ContentManager cont)
 {
     ContentManager Content = new ContentManager(cont.ServiceProvider, cont.RootDirectory);
     PlayerPalette.denSkinPalettes.Add(PlayerPalette.SkinColors.c01, new PlayerPalette.PaletteData("Pale", Content.Load<Texture2D>("Shaders/Palettes/Skin/01")));
     PlayerPalette.denSkinPalettes.Add(PlayerPalette.SkinColors.c02, new PlayerPalette.PaletteData("White", Content.Load<Texture2D>("Shaders/Palettes/Skin/02")));
     PlayerPalette.denSkinPalettes.Add(PlayerPalette.SkinColors.c03, new PlayerPalette.PaletteData("Tanned", Content.Load<Texture2D>("Shaders/Palettes/Skin/03")));
     PlayerPalette.denSkinPalettes.Add(PlayerPalette.SkinColors.c04, new PlayerPalette.PaletteData("Dark", Content.Load<Texture2D>("Shaders/Palettes/Skin/04")));
     PlayerPalette.denSkinPalettes.Add(PlayerPalette.SkinColors.c05, new PlayerPalette.PaletteData("Dark", Content.Load<Texture2D>("Shaders/Palettes/Skin/05")));
     PlayerPalette.denSkinPalettes.Add(PlayerPalette.SkinColors.c06, new PlayerPalette.PaletteData("Yellow", Content.Load<Texture2D>("Shaders/Palettes/Skin/06")));
     for (byte i = 0; i < 30; i += 1)
     {
         PlayerPalette.PonchoColors en = (PlayerPalette.PonchoColors)i;
         PlayerPalette.denPonchoPalettes.Add(en, new PlayerPalette.PaletteData(en.ToString(), Content.Load<Texture2D>("Shaders/Palettes/Poncho/" + en.ToString())));
         PlayerPalette.denShirtPalettes.Add(en, new PlayerPalette.PaletteData(en.ToString(), Content.Load<Texture2D>("Shaders/Palettes/Shirt/" + en.ToString())));
         PlayerPalette.denHairPalettes.Add(en, new PlayerPalette.PaletteData(en.ToString(), Content.Load<Texture2D>("Shaders/Palettes/Hair/" + en.ToString())));
         PlayerPalette.denPantPalettes.Add(en, new PlayerPalette.PaletteData(en.ToString(), Content.Load<Texture2D>("Shaders/Palettes/Pants/" + en.ToString())));
     }
     PlayerPalette.denShoePalettes.Add(PlayerPalette.ShoeColors.Brown, new PlayerPalette.PaletteData("Brown", Content.Load<Texture2D>("Shaders/Palettes/Shoes/brown")));
     PlayerPalette.denxClothingSets.Add(PlayerPalette.ClothingSet.SetNames.TypeA, new PlayerPalette.ClothingSet(PlayerPalette.SkinColors.c02, PlayerPalette.PonchoColors.red01, PlayerPalette.PonchoColors.black01, PlayerPalette.PonchoColors.teal01));
     PlayerPalette.denxClothingSets.Add(PlayerPalette.ClothingSet.SetNames.TypeB, new PlayerPalette.ClothingSet(PlayerPalette.SkinColors.c05, PlayerPalette.PonchoColors.blue01, PlayerPalette.PonchoColors.green01, PlayerPalette.PonchoColors.red01));
     PlayerPalette.denxClothingSets.Add(PlayerPalette.ClothingSet.SetNames.TypeC, new PlayerPalette.ClothingSet(PlayerPalette.SkinColors.c06, PlayerPalette.PonchoColors.purple01, PlayerPalette.PonchoColors.black01, PlayerPalette.PonchoColors.teal01));
     Content.Unload();
     foreach (PlayerPalette.SkinColors en2 in PlayerPalette.denSkinPalettes.Keys)
     {
         PlayerPalette.lenSkinsAsList.Add(en2);
     }
     foreach (PlayerPalette.PonchoColors en3 in PlayerPalette.denPonchoPalettes.Keys)
     {
         PlayerPalette.lenPonchosAsList.Add(en3);
     }
     foreach (PlayerPalette.ShoeColors en4 in PlayerPalette.denShoePalettes.Keys)
     {
         PlayerPalette.lenShoesAsList.Add(en4);
     }
     foreach (PlayerPalette.ClothingSet.SetNames en5 in PlayerPalette.denxClothingSets.Keys)
     {
         PlayerPalette.lenSetsAsList.Add(en5);
     }
 }
开发者ID:ancientgods,项目名称:SoG,代码行数:39,代码来源:PlayerPalette.cs

示例10: UnloadContent

 public void UnloadContent(ContentManager content)
 {
     content.Unload();
 }
开发者ID:mdb5108,项目名称:UnoTheUnicorn,代码行数:4,代码来源:GameManager.cs


注:本文中的Microsoft.Xna.Framework.Content.ContentManager.Unload方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。