Exemple #1
0
 public SongController(SongResources proporties)
 {
     songPlayer = new SongView(proporties);
     Results    = new GameResult();
     CurretSong = FileManager.LoadSong("AFI.xml");
     SetGameTimer(59700);
 }
Exemple #2
0
 public GMClass()
 {
     state       = new StateClass();
     gameGraphic = new GameGraphicClass();
     // TUTAJ MAGIA DYSPUTA
     songResources = new SongResources();
 }
Exemple #3
0
 // 接受 SongResources,实际就是重置状态
 public override void OnStateEnter(object args)
 {
     base.OnStateEnter(args);
     // 默认重置状态
     song           = (SongResources)args;
     playing.player = song.bgm;
     Restart();
     cv.cv.Opacity = 0.3;
 }
Exemple #4
0
        public override void OnStateEnter(object args)
        {
            base.OnStateEnter(args);
            resultBtnIdx = 0;
            song         = (SongResources)((object[])args)[0];
            combo        = (int)((object[])args)[1];
            score        = (int)((object[])args)[2];
            percent      = (decimal)((object[])args)[3];
            fadeout      = true;

            playing.player = (MediaPlayer)resources["wav.result"];
            playing.player.Play();
        }
Exemple #5
0
 public GameStageController(SongResources proporties, bool isGameEnable)
 {
     songResources = proporties;
     _currentStage = GameStages.PLAYING;
     if (isGameEnable)
     {
         actualSongType = new SongController(proporties);
     }
     else
     {
         actualSongType = new Editor(proporties);
     }
 }
Exemple #6
0
 public override void OnStateEnter(object args)
 {
     base.OnStateEnter(args);
     songList = (List <SongResources>)resources["res.songlist"];
     // 在不传参过来的时候才重置选择的歌曲
     if (null == args)
     {
         selectIndex     = 0;
         difficultyIndex = 0;
         if (songList.Count == 0)
         {
             noSong = true;
         }
         else
         {
             song = songList[selectIndex];
         }
     }
     fadeout = true;
 }
Exemple #7
0
 public ScoreBoardView(SongResources _songResources)
 {
     songProporties = _songResources;
 }
Exemple #8
0
 public SongView(SongResources proporties)
 {
     songProporties = proporties;
     SongStart();
 }
Exemple #9
0
        public override void OnDraw()
        {
            if (fadeout)
            {
                if (cv.cv.Opacity > 0.1)
                {
                    cv.cv.Opacity -= 0.2;
                    return;
                }
                fadeout = false;
            }
            if (!fadeout && cv.cv.Opacity < 1)
            {
                cv.cv.Opacity += 0.2;
            }

            if (noSong)
            {
                cv.Clear();
                cv.Text(0, 240 - 25, 50, "没有发现任何歌曲... 按下 [ESC] 返回", null, 640);
                return;
            }
            if (redraw)
            {
                redraw = false;
                cv.Clear();
                cv.Image(0, 0, 640, 480, (Brush)resources["img.bg-black"]);
                // 这里 fade 了表示切歌了,重新载入 song 和 bgm 并且开始从中间位置播放
                if (fade)
                {
                    if (playing.player != null)
                    {
                        playing.player.Stop();
                    }
                    song            = songList[selectIndex];
                    song.bg.Opacity = 0.2;
                    fade            = false;
                    song.LoadMetaAndBgm(difficultyIndex);
                    playing.player = null;
                }
                // 歌曲名称
                cv.Text(150, 80, 20, (song.name.Length > 55 ? song.name.Substring(0, 54) + "..." : song.name), Helper.ColorBrush("#ddd"), 640 - 300);
                // 歌曲封面
                cv.Text(208 - 40, 100 + 80 - 10, 40, "◀", null, 40);
                cv.Text(208 + 224, 100 + 80 - 10, 40, "▶", null, 40);
                cv.Image(208, 100, 224, 160, song.bg);
                // “选择歌曲”
                cv.Rectangle(0, 0, 640, 50, 0, null, Helper.ColorBrush("#000", 0.4));
                cv.Text(20, 12, 40, "选择歌曲");
                // 歌曲数量
                cv.Text(640 - 80, 15, 30, string.Format("({0} / {1}) ", selectIndex + 1, songList.Count));
                // 难度名显示
                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.ColorBrush("#fff"), 640 - 200);
                    }
                    else
                    {
                        cv.Text(100, 480 - 220 + 10 + 20 * i, 20, dname.Substring(0, dname.Length - 4), Helper.ColorBrush("#666"), 640 - 200);
                    }
                }
                // 开始按钮
                cv.Rectangle(260, 380, 120, 40, 3, Helper.ColorBrush("#aef"), Helper.ColorBrush("#000", 0.3));
                cv.Text(260, 385, 40, "Start!", null, 120);
            }

            // 预览音乐的播放,因为可能需要等待音乐加载所以用 previewing 检查
            if (playing.player == null && song.bgm.NaturalDuration.HasTimeSpan)
            {
                song.bgm.Position = TimeSpan.FromSeconds(song.bgm.NaturalDuration.TimeSpan.TotalSeconds / 5);
                song.bgm.Play();
                playing.player = song.bgm;
            }
            // 循环播放
            if (playing.player != null && playing.player.Position.TotalSeconds >= playing.player.NaturalDuration.TimeSpan.TotalSeconds - 5)
            {
                playing.player.Position = TimeSpan.FromSeconds(playing.player.NaturalDuration.TimeSpan.TotalSeconds / 5);
            }

            // 歌曲封面图的淡出动画
            if (song.bg.Opacity < 0.8)
            {
                song.bg.Opacity += 0.05;
            }
        }
Exemple #10
0
 public EditorView(SongResources _songProporties)
 {
     songResources = _songProporties;
     SongStart();
 }
Exemple #11
0
 public PauseMenuView(SongResources _songResources)
 {
     songResources = _songResources;
     pauseStages   = PauseStages.RETURN;
     Exit          = false;
 }