本文整理汇总了C#中GameStateManagement.GameScreen类的典型用法代码示例。如果您正苦于以下问题:C# GameScreen类的具体用法?C# GameScreen怎么用?C# GameScreen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameScreen类属于GameStateManagement命名空间,在下文中一共展示了GameScreen类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LoadingScreen
/// <summary>
/// The constructor is private: loading screens should
/// be activated via the static Load method instead.
/// </summary>
private LoadingScreen (ScreenManager screenManager,bool loadingIsSlow,
GameScreen[] screensToLoad)
{
this.loadingIsSlow = loadingIsSlow;
this.screensToLoad = screensToLoad;
TransitionOnTime = TimeSpan.FromSeconds (0.5);
// If this is going to be a slow load operation, create a background
// thread that will update the network session and draw the load screen
// animation while the load is taking place.
if (loadingIsSlow) {
backgroundThread = new Thread (BackgroundWorkerThread);
backgroundThreadExit = new ManualResetEvent (false);
graphicsDevice = screenManager.GraphicsDevice;
// Look up some services that will be used by the background thread.
IServiceProvider services = screenManager.Game.Services;
networkSession = (NetworkSession)services.GetService (
typeof(NetworkSession));
messageDisplay = (IMessageDisplay)services.GetService (
typeof(IMessageDisplay));
}
}
开发者ID:Nailz,项目名称:MonoGame-Samples,代码行数:31,代码来源:LoadingScreen.cs
示例2: GetTexture
// System.Drawing is NOT avaiable on WP7 or Xbox
/*
* http://stackoverflow.com/a/7394185/195722
*
*
*
*/
public static Texture2D GetTexture(this System.Drawing.Bitmap bitmap, GameScreen gameScreen)
{
BlendState oldstate = gameScreen.ScreenManager.GraphicsDevice.BlendState;
gameScreen.ScreenManager.GraphicsDevice.BlendState = BlendState.AlphaBlend;
Texture2D tex = new Texture2D(gameScreen.ScreenManager.GraphicsDevice, bitmap.Width, bitmap.Height, true, SurfaceFormat.Color);
System.Drawing.Imaging.BitmapData data = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, bitmap.PixelFormat);
int bufferSize = data.Height * data.Stride;
//create data buffer
byte[] bytes = new byte[bufferSize];
// copy bitmap data into buffer
System.Runtime.InteropServices.Marshal.Copy(data.Scan0, bytes, 0, bytes.Length);
// copy our buffer to the texture
tex.SetData(bytes);
// unlock the bitmap data
bitmap.UnlockBits(data);
gameScreen.ScreenManager.GraphicsDevice.BlendState = oldstate;
return tex;
}
开发者ID:nadams810,项目名称:axiosengine,代码行数:32,代码来源:Bitmap.cs
示例3: SongSelectionBox
public SongSelectionBox(GameScreen screen, Vector2 position, Vector2 size)
: base(screen.ScreenManager.Game)
{
this.screen = screen;
this.position = position;
this.size = size;
}
开发者ID:kmatzen,项目名称:EECS-494-Final-Project,代码行数:7,代码来源:SongSelectionBox.cs
示例4: Widget
public Widget(GameScreen screen, ContentManager content)
{
Screen = screen;
spriteBatch = screen.ScreenManager.SpriteBatch;
contentManager = content;
LoadContent();
}
开发者ID:szyszart,项目名称:Junkyard,代码行数:7,代码来源:UIControls.cs
示例5: LoadModScripts
// this is not a permanent solution!
public static void LoadModScripts(GameScreen gameScreen, string dir)
{
foreach (string filename in Directory.GetFiles(dir))
{
if (filename.EndsWith(".fazemod"))
{
bool add = false; // add this script to screen or not?
Script scriptToAdd = GetScriptFromAssembly(filename);
// we have got the script and it's initialized, but is it the one we want?
if (scriptToAdd.SupportedScreenTypes != null)
{
foreach (Type type in scriptToAdd.SupportedScreenTypes)
if (type == gameScreen.GetType()) add = true;
}
else
add = true;
if (add)
{
scriptToAdd.GameScreen = gameScreen;
scriptToAdd.FileName = Path.GetFileName(filename);
gameScreen.Scripts.Add(scriptToAdd);
scriptToAdd.Init(); // dont forget to init them
}
}
}
}
开发者ID:rossmas,项目名称:zomination,代码行数:27,代码来源:ScriptLoader.cs
示例6: PauseScreen
public PauseScreen(GameScreen backgroundScreen, Player human, Player computer)
: base(String.Empty)
{
IsPopup = true;
this.backgroundScreen = backgroundScreen;
// Create our menu entries.
MenuEntry startGameMenuEntry = new MenuEntry("Return");
MenuEntry exitMenuEntry = new MenuEntry("Quit Game");
// Hook up menu event handlers.
startGameMenuEntry.Selected += StartGameMenuEntrySelected;
exitMenuEntry.Selected += OnCancel;
// Add entries to the menu.
MenuEntries.Add(startGameMenuEntry);
MenuEntries.Add(exitMenuEntry);
this.human = human;
this.computer = computer;
// Preserve the old state of the game
prevHumanIsActive = this.human.Catapult.IsActive;
prevCompuerIsActive = this.computer.Catapult.IsActive;
// Pause the game logic progress
this.human.Catapult.IsActive = false;
this.computer.Catapult.IsActive = false;
AudioManager.PauseResumeSounds(false);
}
开发者ID:Nailz,项目名称:MonoGame-Samples,代码行数:32,代码来源:PauseScreen.cs
示例7: StoryScreen
/// <summary>
/// Constructor.
/// </summary>
public StoryScreen( List<String> storytext, List<String> titletext, GameScreen DestScreen, GameData saveData)
: base(titletext[0])
{
saveGameData = saveData;
this.DestScreen = DestScreen;
//SpriteFont font = ScreenManager.Font; //Get font of the ScreenManager
// Create our menu entries.
Storyline = storytext;
StoryTitles = titletext;
StorylineEntry = new VarSizeMenuEntry ( Storyline[0] , 0.7f);
BlankEntry = new VarSizeMenuEntry ( " ", 0.7f);
MenuEntry ContinueEntry = new VarSizeMenuEntry ( "Continue", 1f);
// Hook up menu event handlers.
ContinueEntry.Selected += continueSelected;
// Add entries to the menu.
MenuEntries.Add ( StorylineEntry );
MenuEntries.Add ( BlankEntry );
MenuEntries.Add ( ContinueEntry );
//Select the first selectable entry
while (menuEntries[selectedEntry].HasNoHandle)
{
selectedEntry++;
}
}
开发者ID:matthewlouis,项目名称:MadScienceLab,代码行数:32,代码来源:StoryScreen.cs
示例8: Scenario
public Scenario(GameScreen gameScreen, GameWorld world, Camera2D camera)
: base(gameScreen, world, camera)
{
levelNumber = 0;
physics.bodys = new Body[1]{ new Body(world) };
images = new List<SpriteSheet>();
}
开发者ID:maxrevilo,项目名称:Juego2D,代码行数:7,代码来源:Scenario.cs
示例9: Draw
public void Draw(GameScreen screen)
{
// Grab some common items from the ScreenManager
SpriteBatch spriteBatch = screen.ScreenManager.SpriteBatch;
SpriteFont font = screen.ScreenManager.Font;
spriteBatch.DrawString(font, Text, Position, Microsoft.Xna.Framework.Color.Yellow);
}
开发者ID:kolphi,项目名称:DonkeyKong,代码行数:8,代码来源:Label.cs
示例10: LoadingScreen
/// <summary>
/// The constructor is private: loading screens should
/// be activated via the static Load method instead.
/// </summary>
private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
GameScreen[] screensToLoad)
{
this.loadingIsSlow = loadingIsSlow;
this.screensToLoad = screensToLoad;
TransitionOnTime = TimeSpan.FromSeconds(0.5);
}
开发者ID:LarsTijsmans,项目名称:curve-game,代码行数:12,代码来源:LoadingScreen.cs
示例11: AddScreen
public void AddScreen(GameScreen screen)
{
screen.ScreenManager = this;
screen.IsExiting = false;
if (isInitialized)
screen.Activate(false);
screens.Add(screen);
}
开发者ID:BenFradet,项目名称:OldXnaStuff,代码行数:9,代码来源:ScreenManager.cs
示例12: LoadingScreen
/// <summary>
/// The constructor is private: loading screens should
/// be activated via the static Load method instead.
/// </summary>
private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
GameScreen[] screensToLoad)
: base(false)
{
this.loadingIsSlow = loadingIsSlow;
this.screensToLoad = screensToLoad;
EnabledGestures = GestureType.Tap; // Monogame goes on an infinite loop if I don't do this..
}
开发者ID:kktseng,项目名称:CritterCampClient,代码行数:13,代码来源:LoadingScreen.cs
示例13: PhysicObject
public PhysicObject(GameScreen gameScreen, GameWorld world, Camera2D camera)
: base(gameScreen.ScreenManager.Game)
{
this.gameScreen = gameScreen;
physics.world = world;
physics.bodys = null;
this.camera = camera;
}
开发者ID:maxrevilo,项目名称:Juego2D,代码行数:10,代码来源:PhysicObject.cs
示例14: MenuButton
/// <summary>
/// Constructs a new menu entry with the specified text.
/// </summary>
public MenuButton(Texture2D sprite, bool flip, Vector2 position, GameScreen screen)
{
_screen = screen;
_scale = 1f;
_sprite = sprite;
_baseOrigin = new Vector2(_sprite.Width / 2f, _sprite.Height / 2f);
_hover = false;
_flip = flip;
Position = position;
}
开发者ID:nadams810,项目名称:axiosengine,代码行数:13,代码来源:MenuButton.cs
示例15: LoadingScreen
/// <summary>
/// The constructor is private: loading screens should
/// be activated via the static Load method instead.
/// </summary>
private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
GameScreen[] screensToLoad)
{
this.loadingIsSlow = loadingIsSlow;
this.screensToLoad = screensToLoad;
rnd = new Random();
randInt = rnd.Next(3); // 0 to 2
TransitionOnTime = TimeSpan.FromSeconds(0.5);
}
开发者ID:hvp,项目名称:Squareosity,代码行数:15,代码来源:LoadingScreen.cs
示例16: Player
public Player(GameScreen gameScreen, GameWorld world, Camera2D camera)
: base(gameScreen, world, camera)
{
rightwheelContacts = 0;
leftwheelContacts = 0;
jumpedTime = 0f;
lookingLeft = false;
timeOnAir = 0f;
moving = false;
resetNTImpulses();
}
开发者ID:maxrevilo,项目名称:Juego2D,代码行数:12,代码来源:Player.cs
示例17: Draw
public override void Draw(GameScreen screen, bool isSelected, GameTime gameTime)
{
ScreenManager screenManager = screen.ScreenManager;
SpriteBatch spriteBatch = screenManager.SpriteBatch;
GraphicsDevice graphics = screenManager.GraphicsDevice;
outline.Location = position;
outline.Width = (graphics.Viewport.Width / 45);
outline.Height = (graphics.Viewport.Width / 10);
spriteBatch.Draw(icon, outline, Color.White);
}
开发者ID:pquinn,项目名称:time-sink,代码行数:12,代码来源:MagicBar.cs
示例18: Draw
public override void Draw(GameScreen screen, bool isSelected, Microsoft.Xna.Framework.GameTime gameTime)
{
ScreenManager screenManager = screen.ScreenManager;
SpriteBatch spriteBatch = screenManager.SpriteBatch;
GraphicsDevice graphics = screenManager.GraphicsDevice;
outline.Location = position;
outline.Width = ((graphics.PresentationParameters.BackBufferWidth / 45) * 14);
outline.Height = (graphics.Viewport.Width / 30);
spriteBatch.Draw(icon, outline, Color.SkyBlue);
}
开发者ID:pquinn,项目名称:time-sink,代码行数:12,代码来源:ShieldBar.cs
示例19: LoadingScreen
/// <summary>
/// The constructor is private: loading screens should
/// be activated via the static Load method instead.
/// </summary>
private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
GameScreen[] screensToLoad)
{
this.loadingIsSlow = loadingIsSlow;
this.screensToLoad = screensToLoad;
// we don't serialize loading screens. if the user exits while the
// game is at a loading screen, the game will resume at the screen
// before the loading screen.
IsSerializable = false;
TransitionOnTime = TimeSpan.FromSeconds(0.5);
}
开发者ID:sagarpatel,项目名称:CSGames2011,代码行数:17,代码来源:LoadingScreen.cs
示例20: AddScreen
/// <summary>
/// Adds a new screen to the screen manager.
/// </summary>
public void AddScreen(GameScreen screen, PlayerIndex? controllingPlayer)
{
screen.ControllingPlayer = controllingPlayer;
screen.ScreenManager = this;
screen.IsExiting = false;
// If we have a graphics device, tell the screen to load content.
if (_isInitialized) {
screen.LoadContent();
}
screens.Add(screen);
// update the TouchPanel to respond to gestures this screen is interested in
TouchPanel.EnabledGestures = screen.EnabledGestures;
}
开发者ID:nXqd,项目名称:XNAGame,代码行数:19,代码来源:ScreenManager.cs
注:本文中的GameStateManagement.GameScreen类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论