本文整理汇总了C#中GameStatus.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# GameStatus.ToString方法的具体用法?C# GameStatus.ToString怎么用?C# GameStatus.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameStatus
的用法示例。
在下文中一共展示了GameStatus.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGame
public Game CreateGame(string userId, GameStatus status, bool isActive, List<string> tiles, List<string> gameTiles)
{
var user = new User(userId);
var game = new Article(Schemas.Game);
game.Set("status", status.ToString());
game.Set("tiles", string.Join(",", gameTiles));
var conn = Connection.New(Relations.GamePlayer)
.FromExistingArticle("player", userId)
.ToNewArticle("game", game);
conn.Set("ishost", true);
conn.Set("isactive", isActive);
conn.Set("tiles", string.Join("|", tiles));
conn.Set("tiles_remaining", AppConfigurations.MaxTilesPerPlayer);
conn.SaveAsync().Wait();
return game.ToModelGame();
}
示例2: SaveGameStatus
public bool SaveGameStatus(string gameId, GameStatus status)
{
var game = GetGame(gameId);
if (game != null)
{
game.Status = status.ToString();
}
return _gameDataProvider.SaveGameStatus(gameId, status);
}
示例3: SaveGameStatus
public bool SaveGameStatus(string gameId, GameStatus status)
{
var article = Articles.GetAsync(Schemas.Game, gameId, new[] {"status"}).Result;
if (!string.Equals(GameStatus.Finished.ToString(), article.Get<string>("status"), StringComparison.OrdinalIgnoreCase))
{
var game = new Article(Schemas.Game, gameId);
game.Set("status", status.ToString());
game.SaveAsync().Wait();
}
return true;
}
示例4: StartGame
public bool StartGame(string gameId, string userId, GameStatus status, bool isActive, List<string> tiles, List<string> gameTiles)
{
var game = new Article(Schemas.Game, gameId);
var players = game.GetAllConnectedArticles(Relations.GamePlayer, null, null, new[] {"__id"});
if (players != null && players.Count == 1)
{
game.Set("status", status.ToString());
game.Set("tiles", string.Join(",", gameTiles));
var conn = Connection.New(Relations.GamePlayer)
.FromExistingArticle("player", userId)
.ToExistingArticle("game", gameId);
conn.Set("ishost", false);
conn.Set("isactive", isActive);
conn.Set("tiles", string.Join("|", tiles));
conn.Set("tiles_remaining", AppConfigurations.MaxTilesPerPlayer);
conn.SaveAsync().Wait();
game.SaveAsync().Wait();
return true;
}
return false;
}
示例5: SetState
public void SetState( GameStatus status )
{
#if DEBUG
if ( status != _status )
#endif
{
Debug.Log("new status == " + status.ToString());
oldStatus = _status;
_status = status;
if (oldStatus == GameStatus.Win && status == GameStatus.PlayingAdvertisement)
{
OnStatusChanged(status, oldStatus);
}
else if (status == GameStatus.WinCompleted && oldStatus == GameStatus.PlayingAdvertisement)
{
Debug.Assert(false, "this should not happen");
//ignore... we are playing ad.. fire WinCompleted when ad is completed
}
else
OnStatusChanged(status, oldStatus);
}
}