/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { // TODO: Add your initialization code here this.Enabled = false; this.Visible = false; // Set the tileset count to 0 //m_iTileSetCount = 0; this.m_resourceManager = new ResourceManager(Game.Content); this.m_spriteBatch = Game.Services.GetService(typeof(SpriteBatch)) as SpriteBatch; base.Initialize(); }
public MapComponent(Game game, string XmlMapFile) : base(game) { // TODO: Construct any child components here m_resourceManager = game.Services.GetService(typeof(ResourceManager)) as ResourceManager; m_spriteBatch = game.Services.GetService(typeof(SpriteBatch)) as SpriteBatch; LoadMapConfig(XmlMapFile); LoadMap(XmlMapFile, 1); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); this.Services.AddService(typeof(SpriteBatch), spriteBatch); // TODO: use this.Content to load your game content here //load all sounds SoundManager.LoadContent(Content); //load all resource m_ResourceManager = new ResourceManager(this.Content); m_ResourceManager.LoadAllResource(); this.Services.AddService(typeof(ResourceManager), m_ResourceManager); m_InputManager = new InputManager(); //load scences m_HelpScence = new HelpScence(this, ResourceManager.imgBackgroundHelpScence, ResourceManager.imgForegroundHelpScence); m_StartScence = new StartScence(this, ResourceManager.smallFont, ResourceManager.largeFont, ResourceManager.imgBackgroundStartScence, ResourceManager.imgForegroundStartScence, ResourceManager.imgButton); m_ActionScence = new ActionScence(this); this.Components.Add(m_HelpScence); this.Components.Add(m_StartScence); this.Components.Add(m_ActionScence); //begin at start scence m_StartScence.ShowScreen(); this.m_ActiveScence = m_StartScence; }