【发布时间】:2013-11-21 08:38:33
【问题描述】:
我在 XNA game stuido 中找到了加载多个对象的代码,但无法调用 load contect 方法,我需要做什么?除了Game1之外,我还需要调用另一个类吗?或者调用game1就可以了吗?
public override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
//Dictionary<string, Model> models = new Dictionary<string, Model>;
mymodel = Content.Load<Model>("Models\\tableBasse2");
aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
backgroundTexture = Content.Load<Texture2D>("123");
screenWidth = this.Window.ClientBounds.Width;
screenHeight = this.Window.ClientBounds.Height;
}
//__http://stackoverflow.com/questions/4052532/xna-get-an-array-list-of-resources
public static Dictionary<string,Model> LoadContent
此行中未调用此加载内容。我写这个一般是为了表明我称之为 LoadContent。
【问题讨论】:
-
您需要更具体地说明您需要做什么...您能详细说明您要做什么吗?
-
如果出于某种原因,您需要将它放在单独的方法中,请将其命名为例如“CustomLoadContent()”并从“Game1.LoadContent()”方法中调用它。所有内容都应该在那里加载,除非您想要延迟加载并且真正知道自己在做什么。