示例#1
0
 public void OnKey(ref Game.state nowstate, ref bool redraw, KeyEventArgs e, ref Playing playing)
 {
     if (e.Key == Key.Right)
     {
         selectIndex     = (selectIndex + 1) % songList.Count;
         difficultyIndex = 0;
         redraw          = true;
         fade            = true;
     }
     else if (e.Key == Key.Left)
     {
         selectIndex     = (selectIndex - 1 + songList.Count) % songList.Count;
         difficultyIndex = 0;
         redraw          = true;
         fade            = true;
     }
     else if (e.Key == Key.Space || e.Key == Key.Enter)
     {
         nowstate       = Game.state.Playing;
         playing.song   = song;
         playing.factor = factor;
         playing.song.LoadAll(difficultyIndex);
         Stop(ref redraw);
     }
     else if (e.Key == Key.Escape)
     {
         nowstate = Game.state.Menu;
         Stop(ref redraw);
     }
     else if (e.Key == Key.Down)
     {
         difficultyIndex = (difficultyIndex + 1) % song.difficuties.Count();
         redraw          = true;
     }
     else if (e.Key == Key.Up)
     {
         difficultyIndex = (difficultyIndex - 1 + song.difficuties.Count()) % song.difficuties.Count();
         redraw          = true;
     }
     else if (e.Key == Key.Add)
     {
         if (factor <= 1)
         {
             factor += 0.05;
             redraw  = true;
         }
     }
     else if (e.Key == Key.Subtract)
     {
         if (factor >= 0.10)
         {
             factor -= 0.05;
             redraw  = true;
         }
     }
 }
示例#2
0
 public void OnMouse(ref Game.state state, ref bool redraw, Point p, double width_, double height_, ref Playing playing)
 {
     if (Helper.PointIn(p, 260, 380, 260 + 120, 380 + 40))
     {
         state          = Game.state.Playing;
         playing.song   = song;
         playing.factor = factor;
         playing.song.LoadAll(difficultyIndex);
         state = Game.state.Playing;
         Stop(ref redraw);
     }
 }