本文整理汇总了C#中CardGames.GameLogic.Snap类的典型用法代码示例。如果您正苦于以下问题:C# Snap类的具体用法?C# Snap怎么用?C# Snap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Snap类属于CardGames.GameLogic命名空间,在下文中一共展示了Snap类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleUserInput
/// <summary>
/// Respond to the user input -- with requests affecting myGame
/// </summary>
/// <param name="myGame">The game object to update in response to events.</param>
private static void HandleUserInput(Snap myGame)
{
//Fetch the next batch of UI interaction
SwinGame.ProcessEvents();
if (SwinGame.KeyTyped (KeyCode.vk_SPACE))
{
myGame.FlipNextCard ();
}
if (myGame.IsStarted)
{
if ( SwinGame.KeyTyped (KeyCode.vk_LSHIFT) &&
SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
{
//TODO: add sound effects
}
else if (SwinGame.KeyTyped (KeyCode.vk_LSHIFT))
{
myGame.PlayerHit (0);
}
else if (SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
{
myGame.PlayerHit (1);
}
}
}
示例2: DrawGame
/// <summary>
/// Draws the game to the Window.
/// </summary>
/// <param name="myGame">The details of the game -- mostly top card and scores.</param>
private static void DrawGame(Snap myGame)
{
SwinGame.DrawBitmap("cardsBoard.png",0, 0);
// Draw the top card
Card top = myGame.TopCard;
if (top != null)
{
SwinGame.DrawText ("Top Card is " + top.ToString (), Color.RoyalBlue, 0, 20);
SwinGame.DrawText ("Player 1 score: " + myGame.Score(0), Color.RoyalBlue, 0, 30);
SwinGame.DrawText ("Player 2 score: " + myGame.Score(1), Color.RoyalBlue, 0, 40);
SwinGame.DrawCell (SwinGame.BitmapNamed ("Cards"), top.CardIndex, 521, 153);
SwinGame.DrawText (""+ myGame.Score(0), Color.White,"GameFont",0,30);
}
else
{
SwinGame.DrawText ("No card played yet...", Color.RoyalBlue, 0, 20);
}
// Draw the back of the cards... to represent the deck
SwinGame.DrawCell (SwinGame.BitmapNamed ("Cards"), 52, 155, 153);
//Draw onto the screen
SwinGame.RefreshScreen(60);
}
示例3: HandleUserInput
/// <summary>
/// Respond to the user input -- with requests affecting myGame
/// </summary>
/// <param name="myGame">The game object to update in response to events.</param>
private static void HandleUserInput(Snap myGame)
{
//Fetch the next batch of UI interaction
SwinGame.ProcessEvents();
if (SwinGame.KeyTyped (KeyCode.vk_SPACE))
{
myGame.Start ();
}
if(myGame.IsStarted)
{
if(SwinGame.KeyTyped (KeyCode.vk_LSHIFT) &&SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
{
SwinGame.PlaySoundEffect ("Slap");
}
else if(SwinGame.KeyTyped (KeyCode.vk_LSHIFT))
{
myGame.PlayerHit (0);
}
else if (SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
{
myGame.PlayerHit (1);
}
}
}
示例4: HandleUserInput
/// <summary>
/// Respond to the user input -- with requests affecting myGame
/// </summary>
/// <param name="myGame">The game object to update in response to events.</param>
private static void HandleUserInput(Snap myGame)
{
//Fetch the next batch of UI interaction
SwinGame.ProcessEvents();
if (SwinGame.KeyTyped (KeyCode.vk_SPACE))
{
myGame.Start ();
}
if (myGame.IsStarted)
{
if ( SwinGame.KeyTyped (KeyCode.vk_LSHIFT) &&
SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
{
//TODO: add sound effects
SwinGame.LoadSoundEffectNamed("Buzz","Buzz.wav");
SwinGame.PlaySoundEffect("Buzz");
}
else if (SwinGame.KeyTyped (KeyCode.vk_LSHIFT))
{
myGame.PlayerHit (0);
SwinGame.LoadSoundEffectNamed("Slap","Slap.wav");
SwinGame.PlaySoundEffect("Slap");
}
else if (SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
{
myGame.PlayerHit (1);
SwinGame.LoadSoundEffectNamed("Slap2","Slap2.wav");
SwinGame.PlaySoundEffect("Slap2");
}
}
}
示例5: HandleUserInput
/// <summary>
/// Respond to the user input -- with requests affecting myGame
/// </summary>
/// <param name="myGame">The game object to update in response to events.</param>
private static void HandleUserInput(Snap myGame)
{
//Fetch the next batch of UI interaction
SwinGame.ProcessEvents();
if (SwinGame.KeyTyped (KeyCode.vk_SPACE))
{
myGame.Start ();
}
<<<<<<< HEAD
=======
if (myGame.IsStarted)
{
if (SwinGame.KeyTyped (KeyCode.vk_LSHIFT) &&
SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
{
//Insert sound here
//Personal note: Pretty sure sound here will never play unless both
}
else if (SwinGame.KeyTyped (KeyCode.vk_LSHIFT))
{
myGame.PlayerHit (0);
}
else if (SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
{
myGame.PlayerHit (1);
}
}
>>>>>>> add-player-hit
}
示例6: HandleUserInput
/// <summary>
/// Respond to the user input -- with requests affecting myGame
/// </summary>
/// <param name="myGame">The game object to update in response to events.</param>
private static void HandleUserInput(Snap myGame)
{
//Fetch the next batch of UI interaction
SwinGame.ProcessEvents();
if (SwinGame.KeyTyped (KeyCode.vk_SPACE))
{
myGame.Start ();
}
}
示例7: Main
public static void Main()
{
//Open the game window
SwinGame.OpenGraphicsWindow("Snap!", 860, 500);
//Load the card images and set their cell details
LoadResources();
// Create the game!
Snap myGame = new Snap ();
//Run the game loop
while(false == SwinGame.WindowCloseRequested())
{
HandleUserInput (myGame);
DrawGame (myGame);
UpdateGame (myGame);
}
}
示例8: UpdateGame
/// <summary>
/// Updates the game -- it should flip the cards itself once started!
/// </summary>
/// <param name="myGame">The game to be updated...</param>
private static void UpdateGame(Snap myGame)
{
myGame.Update(); // just ask the game to do this...
}
示例9: TestSnapCreation
public void TestSnapCreation()
{
Snap s = new Snap();
Assert.IsTrue(s.CardsRemain);
Assert.IsNull (s.TopCard);
}
示例10: TestFlipNextCard
public void TestFlipNextCard()
{
Snap s = new Snap();
Assert.IsTrue(s.CardsRemain);
Assert.IsNull (s.TopCard);
s.FlipNextCard ();
Assert.IsNull (s._topCards [0]);
Assert.IsNotNull (s._topCards [1]);
}
示例11: DrawGame
/// <summary>
/// Draws the game to the Window.
/// </summary>
/// <param name="myGame">The details of the game -- mostly top card and scores.</param>
private static void DrawGame(Snap myGame)
{
示例12: Sheffle
//shuffle
private static void Sheffle(Snap myGame)
{
myGame.shuffle(); // just ask the game to do this...
}