/// <summary>
        /// 画小时数字
        /// </summary>
        /// <param name="radius">半径</param>
        /// <returns></returns>
        private async Task DrawHourNumberAsync(double radius)
        {
            await _context.SaveAsync();

            //await _context.TranslateAsync(radius, radius);
            await _context.BeginPathAsync();

            await _context.SetFontAsync("18px Arial");

            await _context.SetFillStyleAsync("#000");

            await _context.SetTextAlignAsync(TextAlign.Center);

            await _context.SetTextBaselineAsync(TextBaseline.Middle);

            List <Task> tasks = new List <Task>();

            for (int i = 1; i <= 12; i++)
            {
                tasks.Add(DrawOneHourNumberAsync(i, radius));
            }
            await Task.WhenAll(tasks);

            await _context.RestoreAsync();
        }
        private async Task GameOver()
        {
            await _context.SetFontAsync("48px serif");

            await _context.SetTextAlignAsync(TextAlign.Center);

            await _context.FillTextAsync("GAME OVER", _gameWidth / 2, _gameHeight / 2 - 48);
        }
        public async ValueTask Render(GameContext game, Canvas2DContext context)
        {
            var y = (double)game.Display.Size.Height / 2;
            var x = (double)game.Display.Size.Width / 2;

            await context.SetFillStyleAsync("#fff").ConfigureAwait(false);

            await context.SetFontAsync("40px verdana").ConfigureAwait(false);

            await context.SetTextAlignAsync(TextAlign.Center).ConfigureAwait(false);

            await context.FillTextAsync("Blazeroids!", x, y).ConfigureAwait(false);

            await context.SetFontAsync("28px verdana").ConfigureAwait(false);

            await context.FillTextAsync("press Enter to start", x, y + 40)
            .ConfigureAwait(false);
        }
        private async Task BuildCanvas()
        {
            if (context == null)
            {
                context = await canvasReference.CreateCanvas2DAsync();

                await context.SetTextAlignAsync(TextAlign.Center);

                await context.SetTextBaselineAsync(TextBaseline.Middle);
            }

            await context.ClearRectAsync(0, 0, 150, 150);

            if (loading)
            {
                await context.FillTextAsync("Loading...", 75, 75);

                return;
            }

            Point drawPosition;

            if (character.HairBelowBody != null)
            {
                drawPosition = CalculateDrawPosition(character.HairBelowBodyPosition, character.HairBelowBody);
                await context.DrawImageAsync(HairBelowBodyRef, drawPosition.X, drawPosition.Y);
            }

            drawPosition = CalculateDrawPosition(character.BodyPosition, character.Body);
            await context.DrawImageAsync(BodyRef, drawPosition.X, drawPosition.Y);

            if (character.Mail != null)
            {
                drawPosition = CalculateDrawPosition(character.MailPosition, character.Mail);
                await context.DrawImageAsync(MailRef, drawPosition.X, drawPosition.Y);
            }


            drawPosition = CalculateDrawPosition(character.HeadPosition, character.Head);
            await context.DrawImageAsync(HeadRef, drawPosition.X, drawPosition.Y);

            if (character.EarType != EarType.Normal)
            {
                drawPosition = CalculateDrawPosition(character.EarPosition, character.Ear);
                await context.DrawImageAsync(EarRef, drawPosition.X, drawPosition.Y);
            }
            if (character.HasFace)
            {
                drawPosition = CalculateDrawPosition(character.FacePosition, character.Face);
                await context.DrawImageAsync(FaceRef, drawPosition.X, drawPosition.Y);
            }
            if (character.Hair != null)
            {
                drawPosition = CalculateDrawPosition(character.HairPosition, character.Hair);
                await context.DrawImageAsync(HairRef, drawPosition.X, drawPosition.Y);
            }
            if (character.HairOverHead != null)
            {
                drawPosition = CalculateDrawPosition(character.HairOverHeadPosition, character.HairOverHead);
                await context.DrawImageAsync(HairOverHeadRef, drawPosition.X, drawPosition.Y);
            }
            if (character.BackHair != null)
            {
                drawPosition = CalculateDrawPosition(character.BackHairPosition, character.BackHair);
                await context.DrawImageAsync(BackHairRef, drawPosition.X, drawPosition.Y);
            }
            if (character.BackHairBelowCap != null)
            {
                drawPosition = CalculateDrawPosition(character.BackHairBelowCapPosition, character.BackHairBelowCap);
                await context.DrawImageAsync(BackHairBelowCapRef, drawPosition.X, drawPosition.Y);
            }

            if (character.Pants != null)
            {
                drawPosition = CalculateDrawPosition(character.PantsPosition, character.Pants);
                await context.DrawImageAsync(PantsRef, drawPosition.X, drawPosition.Y);
            }
            if (character.Arm != null)
            {
                drawPosition = CalculateDrawPosition(character.ArmPosition, character.Arm);
                await context.DrawImageAsync(ArmRef, drawPosition.X, drawPosition.Y);
            }
            if (character.Hand != null)
            {
                drawPosition = CalculateDrawPosition(character.HandPosition, character.Hand);
                await context.DrawImageAsync(HandRef, drawPosition.X, drawPosition.Y);
            }
            if (character.MailArm != null)
            {
                drawPosition = CalculateDrawPosition(character.MailArmPosition, character.MailArm);
                await context.DrawImageAsync(MailArmRef, drawPosition.X, drawPosition.Y);
            }
        }