示例#1
0
文件: Keyboard.cs 项目: HaKDMoDz/geff
        private void CreateKeys()
        {
            _listKey = new List<Key>();
            ListUIChildren = new List<UIComponent>();
            countWhite = 0;

            for (int octave = 0; octave < 8; octave++)
            {
                for (int note = 0; note < 12; note++)
                {
                    if (octave * 12 + note < 88)
                    {
                        int realOctave = GetRealOctave(octave, note);
                        Key key = new Key(this, UI, GetNewTimeSpan(), _noteTable[note], realOctave, octave * 12 + note, countWhite, GetFrequency(octave, note + 1));
                        key.ClickKey += new Key.ClickKeyHandler(key_ClickKey);

                        _listKey.Add(key);
                        ListUIChildren.Add(key);

                        if (key.White)
                            countWhite++;
                    }
                }
            }

            ListUIChildren.Sort((x, y) => (((Key)x).White ? 0 : 1) - (((Key)y).White ? 0 : 1));

            foreach (UIComponent component in ListUIChildren)
            {
                component.CreationTime = GetNewTimeSpan();
            }
        }
示例#2
0
文件: Keyboard.cs 项目: HaKDMoDz/geff
 void key_ClickKey(Key key, MouseState mouseState, GameTime gameTime)
 {
     PerformNote(key);
 }
示例#3
0
文件: Keyboard.cs 项目: HaKDMoDz/geff
 public void PerformNote(Key key)
 {
     PerformNote(key.NoteKey, key.NoteName);
 }
示例#4
0
 public void AddNote(Key key)
 {
     AddNote(key.NoteKey, 1f, key.NoteName);
 }