Example #1
0
 /*ESC:返回上一个菜单
  * DFJK:4K按键
  * `(~):重新开始游戏
  * P:结算游戏*/
 public void OnDraw(CanvasHelper cv, ref bool redraw)
 {
     if (redraw)
     {
         cv.cv.Children.Clear();
         cv.Image(0, 0, 640, 480, Helper.LoadImage("Skins/GameHelper.png"));
         cv.Rectangle(0, 0, 640, 50, 1, Helper.Color("#fff"), Helper.Color("#FFC0CB", 0.4));
         cv.Text(10, 12, 40, "帮助", Helper.Color("#fff"));
         //返回菜单
         cv.Rectangle(253, 350, 128, 40, 3, Helper.Color("#aef"), Helper.Color("#000", 0.3));
         cv.Text(253, 350, 50, "返回主页面");
         //开始游戏
         cv.Rectangle(253 + 120 + 50, 350, 115, 40, 3, Helper.Color("#aef"), Helper.Color("#000", 0.3));
         cv.Text(253 + 120 + 50, 350, 50, "开始游戏");
         //cv.Text(cv.width / 2, cv.height / 2, 50, "GameHelper",Helper.Color("#000"));
         redraw = false;
     }
 }
Example #2
0
        public void OnDraw(ref CanvasHelper cv, ref bool redraw, SongResources song)
        {
            if (redraw)
            {
                cv.cv.Children.Clear();
                cv.Image(0, 0, cv.width, cv.height, summaryim);
                cv.Image(0, 50, stage, 480, song.picture);
                //SUMMARY
                cv.Rectangle(0, 0, 640, 50, 0, null, Helper.Color("#FFC0CB", 0.4));
                cv.Text(10, 12, 40, "Summary", Helper.Color("#fff"));
                summarysong = Helper.LoadMusic("Skins/result.mp3");
                summarysong.Play();
                redraw = false;
            }
            //绘制分数,score += combo + note.status
            cv.Text(stage, 50 + 0, 40, "SCORE", Helper.Color("#fff", 0.8));
            DrawScore(ref cv, 600, 50, 25, 25, score);

            //绘制hit
            {
                double op = 0.2;
                do
                {
                    cv.Image(stage, 50 + 35, 65, 30, (Brush)resources["img-hit-300g"], op);
                    cv.Image(stage, 50 + 2 * 35, 65, 30, (Brush)resources["img-hit-300"], op);
                    cv.Image(stage, 50 + 3 * 35, 65, 30, (Brush)resources["img-hit-200"], op);
                    cv.Image(stage, 50 + 4 * 35, 65, 30, (Brush)resources["img-hit-50"], op);
                    cv.Image(stage, 50 + 5 * 35, 65, 30, (Brush)resources["img-hit-0"], op);
                    op += 0.1;
                } while (op == 0.8);
                DrawScore(ref cv, 600, 50 + 35, 25, 25, statenum[0]);
                DrawScore(ref cv, 600, 50 + 35 * 2, 25, 25, statenum[1]);
                DrawScore(ref cv, 600, 50 + 35 * 3, 25, 25, statenum[2]);
                DrawScore(ref cv, 600, 50 + 35 * 4, 25, 25, statenum[3]);
                DrawScore(ref cv, 600, 50 + 35 * 5, 25, 25, statenum[4]);
            }

            if (summarysong != null && summarysong.NaturalDuration.HasTimeSpan && summarysong.Position.TotalSeconds >= summarysong.NaturalDuration.TimeSpan.TotalSeconds - 1)
            {
                summarysong.Position = TimeSpan.Zero;
            }
        }
Example #3
0
 public void OnDraw(CanvasHelper cv, ref bool redraw)
 {
     if (redraw)
     {
         cv.cv.Children.Clear();
         bgim = Helper.LoadImage("Skins/bg.jpg");
         cv.Image(0, 0, cv.width, cv.height, bgim);
         cv.Image(cv.width / 2 - 100, cv.height / 2 - 100, 200, 200, Helper.LoadImage("start_btn.png"));
         //cv.Rectangle(200, 50, 100, 100);
         //cv.Text(cv.width/2, 0,30,"MENU",Helper.Color("#fff"));
         //cv.Rectangle(300, 50, 100, 100);
         //cv.Text(cv.width / 2, cv.height /2, 30, "Start", Helper.Color("#fff"));
         bgsong = Helper.LoadMusic("Skins/startup.mp3");
         bgsong.Play();
         redraw = false;
     }
     if (bgsong != null && bgsong.NaturalDuration.HasTimeSpan && bgsong.Position.TotalSeconds >= bgsong.NaturalDuration.TimeSpan.TotalSeconds - 5)
     {
         bgsong.Position = TimeSpan.Zero;
     }
     cv.Text(0, 430, 30, "按下Tab键,查看帮助\n按下Space or Enter进入游戏", Helper.Color("#fff"), 640);
 }
Example #4
0
 public void initialze()
 {
     cv.SetRangle(640, 480);
     cv.Text(cv.width / 2, cv.height / 2, 80, "Load...", Helper.Color("#fff"));
 }
Example #5
0
        public void OnDraw(ref CanvasHelper cv, ref bool redraw)
        {
            if (redraw)
            {
                redraw = false;
                cv.cv.Children.Clear();
                cv.Image(0, 0, cv.width, cv.height, (Brush)Helper.LoadImage("Skins/bg-black.png"));
                if (songList.Count == 0)
                {
                    cv.Text(320 - 80, 240 - 40, 80, "没有发现任何歌曲");
                    return;
                }
                //fade表示切歌了,重新载入song和bgm
                if (fade)
                {
                    if (player != null)
                    {
                        player.Stop();
                    }
                    song = songList[selectIndex];
                    song.picture.Opacity = 0.2;
                    fade = false;
                    song.Load(difficultyIndex);
                    player = null;
                }
                //歌曲名字
                cv.Text(0, 50, 30, song.name, Helper.Color("#fff"), 640);
                //歌曲picture
                cv.Text(208 - 40, 100 + 80 - 10, 40, "◀", Helper.Color("#ddd"), 40);
                cv.Image(208, 100, 224, 160, song.picture);
                cv.Text(208 + 224, 100 + 80 - 10, 40, "▶", Helper.Color("#ddd"), 40);
                //选择歌曲
                cv.Rectangle(0, 0, 640, 50, 0, null, Helper.Color("#FFC0CB", 0.4));
                cv.Text(10, 12, 40, "选择歌曲", Helper.Color("#fff"));
                //方块下落速度
                cv.Ellipse(640 - 75, 180 - 65, 150, 150, 1, null, Helper.Color("#fff"));
                cv.Ellipse(600, 180 - 30, 80, 80, 1, null, Helper.Color("#FFC0CB"));
                cv.Text(600 + 20, 100 + 80 - 60, 40, "+", Helper.Color("#FFC0CB"));
                cv.Text(600 + 5, 100 + 80 - 5, 35, factor.ToString(), Helper.Color("#fff"), 40);
                cv.Text(600 + 20 + 5, 100 + 70 + 80 - 15, 40, "-", Helper.Color("#FFC0CB"));
                //歌曲数量
                cv.Text(640 - 80, 15, 30, string.Format("({0} / {1}) ", selectIndex + 1, songList.Count), Helper.Color("#fff"));

                //难度名显示
                for (int i = 0; i < song.difficuties.Count; ++i)
                {
                    string dname = song.difficuties[i].Name;
                    if (i == difficultyIndex)
                    {
                        cv.Text(100, 480 - 220 + 10 + 20 * i, 20, dname.Substring(0, dname.Length - 4), Helper.Color("#fff"), 640 - 200);
                    }
                    else
                    {
                        cv.Text(100, 480 - 220 + 10 + 20 * i, 20, dname.Substring(0, dname.Length - 4), Helper.Color("#666"), 640 - 200);
                    }
                }
                //开始按钮
                cv.Rectangle(260, 380, 120, 40, 3, Helper.Color("#aef"), Helper.Color("#000", 0.3));
                cv.Text(260, 385, 40, "Start!", Helper.Color("#fff"), 120);
            }
            if (player == null && song.bgm.NaturalDuration.HasTimeSpan)
            {
                song.bgm.Position = TimeSpan.FromSeconds(song.bgm.NaturalDuration.TimeSpan.TotalSeconds / 4);
                song.bgm.Play();
                player = song.bgm;
            }
            if (player != null && player.Position.TotalSeconds >= player.NaturalDuration.TimeSpan.TotalSeconds - 5)
            {
                player.Position = TimeSpan.FromSeconds(player.NaturalDuration.TimeSpan.TotalSeconds / 4);
            }
            //歌曲封面图淡入画面
            if (song.picture.Opacity < 0.8)
            {
                song.picture.Opacity += 0.05;
            }
        }