本文整理汇总了C#中Screen.LoadContent方法的典型用法代码示例。如果您正苦于以下问题:C# Screen.LoadContent方法的具体用法?C# Screen.LoadContent怎么用?C# Screen.LoadContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Screen
的用法示例。
在下文中一共展示了Screen.LoadContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadContent
/// <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);
// TODO: use this.Content to load your game content here
currentScreen = new Lobby();
currentScreen.LoadContent(Content);
sf = Content.Load<SpriteFont>("SpriteFont");
}
示例2: Update
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
//if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
// Exit();
// TODO: Add your update logic here
if (RoomChange)
{
switch (currentScreen.Type)
{
case "InGame":
foreach (GameObject go in AllObjects)
{
RemoveObjects.Add(go);
}
currentScreen = new InGame();
currentScreen.LoadContent(Content);
break;
case "Lobby":
foreach (GameObject go in AllObjects)
{
RemoveObjects.Add(go);
}
currentScreen = new Lobby();
currentScreen.LoadContent(Content);
break;
default:
break;
}
RoomChange = false;
}
currentScreen.Update(gameTime);
foreach (GameObject go in AddObjects)
{
AllObjects.Add(go);
go.Loadcontent(Content);
}
foreach (GameObject go in RemoveObjects)
{
AllObjects.Remove(go);
}
AddObjects.Clear();
RemoveObjects.Clear();
foreach (GameObject go in AllObjects)
{
go.Update(gameTime);
}
base.Update(gameTime);
}
示例3: Update
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
// If the game is paused, don't update anything.
if (Paused())
{
return;
}
/* State Machine */
if (currentState == State.Welcome &&
data.welcome2main)
{
currentState = State.Main;
currentScreen = new MainScreen(data);
currentScreen.Initialize();
currentScreen.LoadContent(Content);
data.welcome2main = false;
this.IsMouseVisible = false;
}
if (currentState == State.Main
&& data.main2bonus)
{
currentState = State.Bonus;
currentScreen = new BonusScreen(data);
currentScreen.Initialize();
currentScreen.LoadContent(Content);
data.main2bonus = false;
this.IsMouseVisible = true;
}
if (currentState == State.Main
&& data.main2playagain)
{
currentState = State.PlayAgain;
currentScreen = new PlayAgainScreen(data);
currentScreen.Initialize();
currentScreen.LoadContent(Content);
data.main2playagain = false;
this.IsMouseVisible = true;
}
if (currentState == State.Bonus
&& data.bonus2main)
{
currentState = State.Main;
currentScreen = new MainScreen(data, false);
currentScreen.Initialize();
currentScreen.LoadContent(Content);
data.bonus2main = false;
this.IsMouseVisible = false;
}
if (currentState == State.Bonus
&& data.bonus2playagain)
{
currentState = State.PlayAgain;
currentScreen = new PlayAgainScreen(data);
currentScreen.Initialize();
currentScreen.LoadContent(Content);
data.bonus2playagain = false;
this.IsMouseVisible = true;
}
if (currentState == State.PlayAgain
&& data.playagain2welcome)
{
currentState = State.Welcome;
currentScreen = new WelcomeScreen(data);
currentScreen.Initialize();
currentScreen.LoadContent(Content);
data.playagain2welcome = false;
this.IsMouseVisible = true;
}
if (currentState == State.PlayAgain
&& data.playagain2exit)
{
this.Exit();
}
// In case we want to exit from anywhere in the game,
// Emergency exit is E+<Esc>
//.........这里部分代码省略.........