我是新來的,我的項目有問題。
我的項目是一個c#遊戲控制檯,與xna遊戲混合在一起。
我的項目的問題是,我添加了一個內容文件夾來加載xna精靈等,但每次我運行,它顯示,紋理加載文件沒有找到。
我試圖看看問題是否是路徑,但不是。它注意不識別內容文件夾,或換句話說,它的威脅,因爲它不存在,我的想法。
我試圖在谷歌搜索,但它不斷給我奇怪的結果,
和我在這個網站上搜索的解決方案,並沒有一個是我想要的。
我怎樣才能讓它識別我的內容文件夾,能夠加載精靈和其他東西呢?在c#控制檯上加載內容文件夾
public class Game : Microsoft.Xna.Framework.Game
{
public GraphicsDeviceManager graphics;
public SpriteBatch spriteBatch;
public Game()
{
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 640;
graphics.PreferredBackBufferHeight = 480;
graphics.IsFullScreen = false;
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
base.Initialize();
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
Program.TestPlayer = Content.Load<Texture2D>("characters/blue"); //Here is where gives the error
Program.Tiles = Content.Load<Texture2D>("tiles"); //this gives error if the above script is commented.
}
protected override void UnloadContent()
{
}
protected override void Update(GameTime gameTime)
{
switch (Procedures.gmode)
{
case GameMode.ExplorationMode:
Exploration.ExplorationMode();
break;
default:
this.EndRun();
return;
}
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.White);
spriteBatch.Begin();
switch (Procedures.gmode)
{
case GameMode.ExplorationMode:
Exploration.DrawMap();
Procedures.player.DrawTamer(spriteBatch);
break;
}
spriteBatch.End();
base.Draw(gameTime);
}
}
歡迎來到本網站!除了你對問題的描述之外,這個問題並沒有給我們太多的幫助。是否可以共享相關的代碼段以及代碼中這些點發生的特定錯誤消息?除了提供猜測外,這些細節還有很長的一段路要走上真正的幫助之路。如果您可以編輯您的問題以提供更多詳細信息,我們可能會提供幫助。 – David
我不想讓我的C#控制檯項目,識別我的項目上的內容文件夾,所以我將能夠加載我的遊戲內容。 但它不適用於Content.RootDirectory,它會導致找不到文件的錯誤。 – Nakano15
此外,顯示的錯誤是「Error loading」firsttexturetoloadname「。File not found。」。 – Nakano15