本文整理汇总了C#中model.NewGame方法的典型用法代码示例。如果您正苦于以下问题:C# model.NewGame方法的具体用法?C# model.NewGame怎么用?C# model.NewGame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model
的用法示例。
在下文中一共展示了model.NewGame方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Play
public bool Play(model.Game a_game, view.IView a_view)
{
//Initialize fields
m_view = a_view;
m_game = a_game;
a_view.DisplayWelcomeMessage();
a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());
if (a_game.IsGameOver())
{
a_view.DisplayGameOver(a_game.IsDealerWinner());
}
view.Input input = a_view.GetInput();
if (input == view.Input.Play)
{
a_game.NewGame();
}
else if (input == view.Input.Hit)
{
a_game.Hit();
}
else if (input == view.Input.Stand)
{
a_game.Stand();
}
return input != view.Input.Quit;
}
示例2: Play
public bool Play(model.Game a_game, view.IView a_view)
{
a_view.DisplayWelcomeMessage();
a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());
if (a_game.IsGameOver())
{
a_view.DisplayGameOver(a_game.IsDealerWinner());
}
int input = a_view.GetInput();
if (input == 'p')
{
a_game.NewGame();
}
else if (input == 'h')
{
a_game.Hit();
}
else if (input == 's')
{
a_game.Stand();
}
return input != 'q';
}
示例3: Play
public bool Play(model.Game a_game, view.IView a_view)
{
m_view = a_view;
m_game = a_game;
a_view.DisplayWelcomeMessage();
a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());
if (a_game.IsGameOver())
{
a_view.DisplayGameOver(a_game.IsDealerWinner());
}
BlackJack.view.Events input = (BlackJack.view.Events)a_view.GetInput();
if (input == view.Events.Play)
{
a_game.NewGame();
}
else if (input == view.Events.Hit)
{
a_game.Hit();
}
else if (input == view.Events.Stand)
{
a_game.Stand();
}
return input != view.Events.Quit;
}
示例4: Play
public bool Play(model.Game a_game)
{
//a_game.AddSubscriber(this);
m_view.DisplayWelcomeMessage();
// m_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
//m_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());//
if (a_game.IsGameOver())
{
m_view.DisplayGameOver(a_game.IsDealerWinner());
}
model.Game.Status input = m_view.GetInput();
if (input == model.Game.Status.NewGame)
{
a_game.NewGame();
}
else if (input == model.Game.Status.Hit)
{
a_game.Hit();
}
else if (input == model.Game.Status.Stand)
{
a_game.Stand();
}
return input != model.Game.Status.Quit;
}
示例5: Play
public bool Play(model.Game a_game)
{
m_view.DisplayWelcomeMessage();
if (a_game.GetPlayerScore() != 0)
{
m_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
m_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());
}
if (a_game.IsGameOver())
{
m_view.DisplayGameOver(a_game.IsDealerWinner());
}
gameAction input = m_view.GetInput();
if (input == gameAction.play)
{
m_view.DisplayWelcomeMessage();
var test = a_game.NewGame();
}
else if (input == gameAction.hit)
{
a_game.Hit();
}
else if (input == gameAction.stand)
{
a_game.Stand();
}
return input != gameAction.quit;
}
示例6: Play
public bool Play(model.Game a_game, view.IView a_view)
{
a_view.DisplayWelcomeMessage();
a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());
if (a_game.IsGameOver())
{
a_view.DisplayGameOver(a_game.IsDealerWinner());
}
//int input = a_view.GetInput(); removed due to hidden depencendy.
int input = System.Console.In.Read();
if (input == 'p')
{
a_game.NewGame();
}
else if (input == 'h')
{
a_game.Hit();
}
else if (input == 's')
{
a_game.Stand();
}
return input != 'q';
}
示例7: Play
public bool Play(model.Game a_game)
{
m_view.DisplayWelcomeMessage();
m_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
m_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());
if (a_game.IsGameOver())
{
m_view.DisplayGameOver(a_game.IsDealerWinner());
}
switch((view.Choices)m_view.GetInput())
{
case view.Choices.Play:
a_game.NewGame();
break;
case view.Choices.Hit:
a_game.Hit();
break;
case view.Choices.Stand:
a_game.Stand();
break;
case view.Choices.Quit:
return false;
default:
break;
}
return true;
}
示例8: Play
public bool Play(model.Game a_game, view.IView a_view)
{
m_view = a_view;
m_game = a_game;
if (!isWelcomed)
{
isWelcomed = true;
a_view.DisplayWelcomeMessage();
m_view.DisplayRules(m_game.GetHitRule(), m_game.GetNewGameRule(), m_game.GetWinRule());
}
else {
a_view.DisplayResults(a_game.GetPlayerHand(), a_game.GetPlayerScore(), a_game.GetDealerHand(), a_game.GetDealerScore());
}
if (a_game.IsGameOver())
{
a_view.DisplayGameOver(a_game.IsDealerWinner());
}
view.Action action = a_view.GetInput();
switch (action)
{
case view.Action.NewGame:
a_game.NewGame();
break;
case view.Action.Hit:
a_game.Hit();
break;
case view.Action.Stand:
a_game.Stand();
break;
}
return action != view.Action.Quit;
}