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


C# Village.LoadContent方法代码示例

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


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

示例1: LoadContent

        public override void LoadContent()
        {
            if (_content == null)
                _content = new ContentManager(ScreenManager.Game.Services, "Content");

            //_gameFont = _content.Load<SpriteFont>(@"Fonts\gamefont");

            _gameSound = _content.Load<Song>(@"SFX\gameSound");
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume = Settings.MainVolume;
            MediaPlayer.Play(_gameSound);

            _CreateWorld();

            World.Selection.LoadContent(_content);

            MapObjectLayer objects = World.Map.GetLayer("Objects") as MapObjectLayer;
            if (objects != null) {

                MapObject headQuarterLocation = objects.GetObject("HQ");
                World.HeadQuarter = new HeadQuarter(new Vector2(headQuarterLocation.Bounds.X, headQuarterLocation.Bounds.Y),
                                                        @"Textures\Buildings\HQ", 300, 500, 999, 500, 999);
                World.HeadQuarter.LoadContent(_content);

                World.ResourcesManager = new ResourcesManager(World.HeadQuarter);
                World.ResourcesManager.LoadContent(_content);

                foreach (MapObject obj in objects.GetObjectsByType("Village"))
                {
                    int initFood = Convert.ToInt32(obj.Properties["Food"].RawValue);
                    int initMedicine = Convert.ToInt32(obj.Properties["Medicine"].RawValue);
                    int initPopulation = Convert.ToInt32(obj.Properties["Population"].RawValue);

                    Village village = new Village(new Vector2(obj.Bounds.X, obj.Bounds.Y), initFood, 999, initMedicine, 999, initPopulation);
                    village.LoadContent(_content);
                    World.Sprites.Add(village);
                }

                World.Sprites.Add(World.HeadQuarter);
            }

            World.Camera.Focus(World.HeadQuarter.Position);

            World.LoadCollisionClip();

            World.Time = new WorldTime(12, 10, 2012, 6, 0);

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();
        }
开发者ID:Righteous-Noodle,项目名称:Eva-Frontier,代码行数:52,代码来源:GameplayScreen.cs


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