private bool ValidateAnswer(Fret fret) { int stringZeroPosition = _doubleScale.IndexOf(fret.StringName.ToString()); var frettedNote = _doubleScale[stringZeroPosition + fret.Position]; return(frettedNote == _requestedNote.ToString() && fret.StringName.ToString() == _requestedString); }
private void pnlBoard_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { int x = pnlBoard.Width / 23; int y = pnlBoard.Height / 6; int xPos; int yPos; xPos = e.X / x; yPos = e.Y / y; // xPos = Conversions.ToInteger(e.X / x); // yPos = Conversions.ToInteger(e.Y / y); // Me.Text = e.X & ", " & yPos Fret f = m_board.Board[yPos][xPos]; f.Color = Color.Blue; pnlBoard.Invalidate(); // For Each sc As Scale In Scales // Dim scn As ScaleNote = sc.GetScaleNote(f.Note) // If scn IsNot Nothing Then // End If // Next // Me.m_board.CalculateBoard() }
public override string ToString() { string sResult = String.Empty; foreach (EString currString in Strings) { sResult += currString.ToString() + " : " + Fret.ToString() + " "; } sResult += "\n"; return(sResult); }
public void SelectFretAtPosition(Vector2 pos) { for (int i = 0; i < _frets.Length; i++) { Fret fret = _frets[i]; if (RectTransformUtility.RectangleContainsScreenPoint(fret.Rect, pos, Camera.main)) { _selectedFret = fret; fret.Select(); break; } } }
public Fret method_3() { if (this.midiMask < 60 || this.midiMask > 106) { return(Fret.Invalid); } Fret @enum = (Fret)((this.midiMask - 60) % 12); if (@enum >= Fret.Green && @enum <= Fret.Orange) { return(@enum); } return(Fret.Invalid); }
public void FretString(Fret fret) { var isCorrectAnswer = ValidateAnswer(fret); CreateAnswer(isCorrectAnswer); }
private void pnlBoard_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { const int NUM_FRETS = 23; const int NUM_STRINGS = 6; var p = new Point(0, 0); e.Graphics.DrawImage(m_img, 0, 0, this.pnlBoard.Width, this.pnlBoard.Height); int x = 0; int y = 0; // Draw Frets var pp = new Pen(Color.Gray); x = this.pnlBoard.Width / NUM_FRETS; for (int j = 0; j < NUM_FRETS; j++) { pp.Color = Color.Gray; pp.Width = 2; e.Graphics.DrawLine(pp, x, 0, x, this.pnlBoard.Height); pp.Width = 1; pp.Color = Color.White; e.Graphics.DrawLine(pp, x, 0, x, this.pnlBoard.Height); x += this.pnlBoard.Width / NUM_FRETS; } // Draw horozontal lines pp.Color = Color.LightGray; pp.Width = 2; y = this.pnlBoard.Height / NUM_STRINGS / 2; x = this.pnlBoard.Width / NUM_FRETS; for (int i = 0; i < NUM_STRINGS; i++) { e.Graphics.DrawLine(pp, x, y, this.pnlBoard.Width, y); y += this.pnlBoard.Height / NUM_STRINGS; } pp.Dispose(); // Draw special fret markers DrawSpecialFretMarkers(e, NUM_FRETS, 3); DrawSpecialFretMarkers(e, NUM_FRETS, 5); DrawSpecialFretMarkers(e, NUM_FRETS, 7); DrawSpecialFretMarkers(e, NUM_FRETS, 9); DrawSpecialFretMarkers(e, NUM_FRETS, 12); DrawSpecialFretMarkers(e, NUM_FRETS, 15); DrawSpecialFretMarkers(e, NUM_FRETS, 17); DrawSpecialFretMarkers(e, NUM_FRETS, 19); DrawSpecialFretMarkers(e, NUM_FRETS, 21); y = 0; System.Drawing.Font fnt = this.pnlBoard.Font; System.Drawing.Font intFnt = new Font(this.pnlBoard.Font.FontFamily, 8, FontStyle.Italic); // Draw notes y = this.pnlBoard.Height / NUM_STRINGS / 2; for (int i = 0; i < NUM_STRINGS; i++) { x = this.pnlBoard.Width / NUM_FRETS; for (int j = 0; j < NUM_FRETS; j++) { Fret f = m_board.Board[i][j]; if (f.Visible & j >= m_startFret & j <= m_endFret) { string value = f.Note.ToString(); SizeF size = e.Graphics.MeasureString(value, fnt); int l = (int)size.Width / 2; var fheight = size.Height / 2; using (var b = new SolidBrush(f.Color)) { e.Graphics.FillEllipse(b, new Rectangle(x - this.pnlBoard.Width / NUM_FRETS / 2 - 12, y - 12, 24, 24)); if (f.Color != Color.Transparent) { e.Graphics.DrawEllipse(Pens.Black, new Rectangle(x - this.pnlBoard.Width / NUM_FRETS / 2 - 12, y - 12, 24, 24)); } e.Graphics.DrawString(f.Note.ToString(), fnt, Brushes.Black, x - this.pnlBoard.Width / NUM_FRETS / 2 - l, y - fheight); if (f.IntervalLabel != string.Empty) { SizeF tsize = e.Graphics.MeasureString(f.IntervalLabel, intFnt); int xt = x - this.pnlBoard.Width / NUM_FRETS / 2 - 12; xt = xt - (int)tsize.Width + 1; int yt = y - (int)fheight; yt = yt - (int)tsize.Height / 2; e.Graphics.DrawString(f.IntervalLabel, intFnt, Brushes.Black, xt, yt); } } } x += this.pnlBoard.Width / NUM_FRETS; } y += this.pnlBoard.Height / NUM_STRINGS; } intFnt.Dispose(); }