本文整理汇总了C#中GameScreen类的典型用法代码示例。如果您正苦于以下问题:C# GameScreen类的具体用法?C# GameScreen怎么用?C# GameScreen使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GameScreen类属于命名空间,在下文中一共展示了GameScreen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlayerSpaceInvaders
public PlayerSpaceInvaders(GameScreen i_GameScreen, string i_PlayerNickname, eSpaceShipType i_SpaceShipType)
: base(i_GameScreen.Game, i_PlayerNickname)
{
m_LoseLifeSound = SoundFactory.CreateSound(this.Game, SoundFactory.eSoundType.LifeDie) as Sound;
m_Nickname = i_PlayerNickname;
m_SpaceShipType = i_SpaceShipType;
m_ScoreText = SpritesFactory.CreateSprite(i_GameScreen, SpritesFactory.eSpriteType.SmallText) as Text;
SpritesFactory.eSpriteType lifeType = SpritesFactory.eSpriteType.LifeBlueSpaceShip;
switch (m_SpaceShipType)
{
case eSpaceShipType.Blue:
m_SpaceShip = SpritesFactory.CreateSprite(i_GameScreen, SpritesFactory.eSpriteType.BlueSpaceShip) as SpaceShip;
m_ScoreText.TintColor = Color.Blue;
lifeType = SpritesFactory.eSpriteType.LifeBlueSpaceShip;
break;
case eSpaceShipType.Green:
m_SpaceShip = SpritesFactory.CreateSprite(i_GameScreen, SpritesFactory.eSpriteType.GreenSpaceShip) as SpaceShip;
m_ScoreText.TintColor = Color.Green;
lifeType = SpritesFactory.eSpriteType.LifeGreenSpaceShip;
break;
}
for (int i = 0; i < this.Lifes; i++)
{
Life life = SpritesFactory.CreateSprite(i_GameScreen, lifeType) as Life;
life.Initialize();
this.LifesSprites.Add(life);
}
}
示例2: MenuScreen
public MenuScreen(GameScreen screen)
{
TransitionOnTime = TransitionOffTime = TimeSpan.FromSeconds(1.5);
if (screen.ScreenState != ScreenState.Frozen)
screen.ScreenState = ScreenState.Frozen;
parent = screen;
}
示例3: ScreenManager
public ScreenManager(Game game)
: base(game)
{
menuScreen = new MenuScreen();
gameScreen = new GameScreen();
keyboard = new Input();
}
示例4: Draw
public override void Draw(GameScreen gameScreen, GameTime gameTime)
{
SpriteBatch spriteBatch = gameScreen.ScreenManager.SpriteBatch;
SpriteFont font = gameScreen.ScreenManager.BigFont;
ButtonTexture = ButtonTexture ?? gameScreen.ScreenManager.BlankTexture;
var newPosition = Position;
var textSize = font.MeasureString(Text);
if (ShowText)
{
newPosition.Y -= textSize.Y / 1.5f;
}
Rectangle rec = new Rectangle((int)newPosition.X, (int)newPosition.Y, (int)Size.X, (int)Size.Y);
if(!IsHovered)
spriteBatch.Draw(Icon, rec, Color.White);
else
spriteBatch.Draw(Icon, rec, HoverColor);
var textPosition = newPosition;
textPosition.Y += Size.Y + 10;
textPosition.X += (Size.X - textSize.X)/2;
spriteBatch.DrawString(font, Text, textPosition, TextColor);
}
示例5: Effects
public Effects(GameScreen gameScreen)
{
this.gameScreen = gameScreen;
//Create List Models
ListModelEffects = new List<ModelStruct>();
DiccModelsEffects = new Dictionary<int, string>();
}
示例6: Game
public Game(StartupScreen startScreen, GameScreen gameScreen)
{
this.startScreen = startScreen;
startScreen.GameStarted += OnStartupScreenGameStarted;
this.gameScreen = gameScreen;
gameScreen.Hide();
}
示例7: PathCPUParticleEmitter
public PathCPUParticleEmitter(GameScreen scrn, Vector2 pos, VectorPath path, ParticleEmitterConfig cfg) : base(scrn, cfg)
{
vectorPath = path;
vectorPathCenter = path.Boundings.Center;
Position = pos;
}
示例8: ShowScreen
public void ShowScreen()
{
Resolve<Window>().ViewportPixelSize = new Size(1280, 800);
var screen = new GameScreen();
screen.FadeIn();
screen.StartNextLevel();
}
示例9: Button
/// <summary>
/// Button class constructor.
/// </summary>
/// <param name="position">The top-left corner of the Button.</param>
/// <param name="width">The Button's width.</param>
/// <param name="height">The Button's height.</param>
/// <param name="screen">Reference to the screen on which the Button exists.</param>
public Button( Point position, int width, int height, GameScreen screen )
: base(position, width, height, screen)
{
// Starting state is inert
state = 0;
textColours = new Color[4];
}
示例10: Initialize
public override void Initialize(GraphicsDevice Device, ScreenManager manager)
{
base.Initialize(Device, manager);
Settings.LoadSettings();
Panel panel = new Panel(this, new Vector2(300, 160), new Vector2(200, 280), Content.ContentInterface.LoadTexture("UITest"));
Button button = new Button(this, new Vector2(60, 30), new Vector2(80, 40), Content.ContentInterface.LoadTexture("UITest"),
delegate { Settings.ServerAddress = "localhost";
_manager.RemoveScreen(this); GameScreen screen = new GameScreen();
screen.SetupLocalServer(); _manager.AddScreen(screen); },
"Local");
AddChild(panel);
panel.AddChild(button);
button = new Button(this, new Vector2(20, 90), new Vector2(160, 40), Content.ContentInterface.LoadTexture("UITest"),
delegate { _manager.RemoveScreen(this); _manager.AddScreen(new GameScreen()); },
"Online");
panel.AddChild(button);
button = new Button(this, new Vector2(20, 150), new Vector2(160, 40), Content.ContentInterface.LoadTexture("UITest"),
delegate { Console.WriteLine("Test2"); },
"Testbutton2");
panel.AddChild(button);
button = new Button(this, new Vector2(20, 210), new Vector2(160, 40), Content.ContentInterface.LoadTexture("UITest"),
delegate { Console.WriteLine("Test3"); },
"Testbutton3");
panel.AddChild(button);
}
示例11: Marble
public Marble(GameScreen game)
: base(game, "marble")
{
preferPerPixelLighting = true;
// Load the texture of the marble
m_marbleTexture = Engine.Content.Load<Texture2D>(@"Textures\Marble");
}
示例12: ActionToggleButton
/// <summary>
/// Initializes a new instance of the <see cref="ActionToggleButton"/> class.
/// </summary>
/// <param name="screen">The screen.</param>
/// <param name="text">The text to display.</param>
/// <param name="stateText">The state text.</param>
/// <param name="id">The id of this element.</param>
public ActionToggleButton(GameScreen screen, string text, string stateText, int id)
{
this.text = text;
this.Id = id;
this.Owner = screen;
this.stateText = stateText;
}
示例13: 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);
}
示例14: ListView
/// <summary>
/// ListView class constructor.
/// </summary>
/// <param name="elements">The number of visible elements in ListView.</param>
/// <param name="position">The top-left corner of the ListView.</param>
/// <param name="width">The ListView's width.</param>
/// <param name="height">The ListView's height.</param>
/// <param name="screen">Reference to the screen on which the ListView exists.</param>
public ListView(int elements, Point position, int width, int height, GameScreen screen)
: base(position, width, height, screen)
{
// up button initialization
up = new Button(new Point(base.Position.X + 10 + base.width, position.Y), 50, 50, base.screen);
this.elements = elements;
//listview button height
int buttonHeight = base.height / elements;
//down button initialization
down = new Button(new Point(base.Position.X + 10 + base.width, position.Y + buttonHeight * (elements - 1)), 50, 50, base.screen);
//arrow button callbacks
up.RegisterCallback(Up_OnClick);
down.RegisterCallback(Down_OnClick);
//minimum threshold check for listview buttons height
if (buttonHeight < 21)
{
buttonHeight = 21;
}
//initialize listview buttons
for (int i = 0; i < elements; i++)
{
Buttons.Add(new Button(new Point(base.position.X, base.position.Y + (i * buttonHeight)), base.width, buttonHeight, base.screen));
}
}
示例15: OnOffToggleButton
/// <summary>
/// Initializes a new instance of the <see cref="OnOffToggleButton"/> class.
/// </summary>
/// <param name="screen">The screen.</param>
/// <param name="text">The text to display.</param>
/// <param name="on">if set to <c>true</c> [on].</param>
/// <param name="id">The id of this element.</param>
public OnOffToggleButton(GameScreen screen, string text, bool on, int id)
{
this.text = text;
this.Id = id;
this.Owner = screen;
this.value = on;
}