示例#1
0
        public async Task Act(Event @event)
        {
            if ([email protected]().Equals("我的戰績"))
            {
                return;
            }

            var dualPlayerGameResults = await _boardGameResultsRepository.GetResult(@event.UserId());

            var gameResults = dualPlayerGameResults.GroupBy(result => result.GameType).Select(results => new
            {
                GameName  = _gameNameDisplayDict[results.Key],
                WinCount  = results.Count(result => result.Result == GameResult.Win),
                LostCount = results.Count(result => result.Result == GameResult.Lose),
                DrawCount = results.Count(result => result.Result == GameResult.Draw),
            });

            if (!gameResults.Any())
            {
                _textRenderer.Render("你沒有任何戰績");
                return;
            }

            var stringBuilder = new StringBuilder();

            foreach (var gameResult in gameResults)
            {
                stringBuilder.Append($"你在{gameResult.GameName}贏了{gameResult.WinCount}次,輸了{gameResult.LostCount}次\n");
            }
            _textRenderer.Render(stringBuilder.ToString());
        }
示例#2
0
 protected override void Draw(GameTime gameTime)
 {
     if (this.IsActive)
     {
         _renderer.Render(gameTime);
         _textRenderer.SetText(0, "FPS: " + ((int)(1 / gameTime.ElapsedGameTime.TotalSeconds)), new Vector2(5, _screenHeight - 5), Color.CornflowerBlue);
         _textRenderer.Render(gameTime);
     }
     base.Draw(gameTime);
 }