void Input() { this.BeginOrtho(5); GLUI.SetFontColor(Color.black); //this.Draw(Palette.L8, true); //this.Draw(Color.black, false); var rtNum = new RectTrans(chordNum); GLUI.SetFontColor(Color.black); var sNum = "(" + InstKeyboard.I.chordIdx.ToString() + ")"; GLUI.DrawString(sNum, rtNum.center, fontSizeNum, Vectors.half2d); var rtSS = new Rect(this.rtSS); rtSS.Draw(scaleShift ? colorSSOn : colorSSOff, true); rtSS.Draw(Color.black, false); var rt = new RectTrans(this); var startpos = rt.center; var os = rt.sizeAbs.x / names.Length; var ps = startpos.Average(os, names.Length, Vectors.halfRight2d); for (int i = 0; i < names.Length; i++) { var rect = new Rect(ps[i], os * Vector2.right + sizeOs, Vectors.half2d); if (idx == i) { rect.Draw(colorSel, true); GLUI.SetFontColor(Color.white); GLUI.DrawString(names[i], ps[i]); } else { rect.Draw(colorNormal, true); GLUI.SetFontColor(Color.black); GLUI.DrawString(names[i], ps[i]); } rect.Draw(Color.black, false); } }
void Input() { this.BeginOrtho(-2); GLUI.SetFontColor(Color.black); this.Draw(Palette.L8, true); this.Draw(Color.black, false); var rt = new RectTrans(this); var basePos = rt.centerT + Vector2.down * margin.y; // title var fn = loader.fileName.Split('.')[0]; var ss = fn.Split('-'); var songName = ss[1]; GLUI.DrawString(songName, basePos, fontSizeH1, Vector2.up + Vectors.halfRight2d); var singerName = ss[0]; GLUI.DrawString("演唱: " + singerName, basePos + h2Os, fontSizeH2, Vector2.up + Vectors.halfRight2d); basePos += Vector2.down * bodyOs; // average float barWidth = (rt.sizeAbs.x - margin.x * 2) / barPerLine; var psBar = basePos.Average(barWidth, barPerLine, Vectors.halfRight); int noteIdx = -1; //var notes = loader.notesTotal; //for (int i = 0; i < notes.Count; i++) //{ // var x = i % barPerLine; // var y = i / barPerLine; // var posBar = psBar[x] + Vector2.down * y * (lineSpace + fontSize); // var psNote = posBar.Average(barWidth, barPerLine, Vectors.halfRight); // // 弹过的音符变色 // GLUI.SetFontColor(Color.black); // noteIdx++; // if (passIdx >= noteIdx) // GLUI.SetFontColor(passFontColor); // var note = notes[i]; // var str = note.ToString().Reverse(); ; // if (str.Length == 2) // { // GLUI.DrawString(str[1], psNote[x] + fontSize * shiftOSNor, fontSizeShift, Vector2.up + Vectors.halfRight2d); // } // GLUI.DrawString(str[0], psNote[x], fontSize, Vector2.up + Vectors.halfRight2d); // // 变调小圆点 // var scaleShift = note.scale - middleScale5; // var factor = Mathf.Sign(scaleShift); // scaleShift = Mathf.Abs(scaleShift); // for (int m = 0; m < scaleShift; m++) // { // var dir = Vector2.up * factor; // GLUI.DrawString(shiftMark, // psNote[x] + Vector2.down * fontSize * 0.5f + // dir * fontSize * shiftMarkOS + // dir * shiftMarkFontSize * m * shiftMarkOSFactor, // fontSize, Vectors.half2d); // } //} for (int i = 0; i < para.bars.Count; i++) { var bar = para.bars[i]; var beats = bar.beats; var x = i % barPerLine; var y = i / barPerLine; var posBar = psBar[x] + Vector2.down * y * (lineSpace + fontSize); var beatWid = beatSpaceAdd + barWidth / beats.Count; var psBeat = posBar.Average(beatWid, beats.Count, Vectors.halfRight); for (int j = 0; j < bar.beats.Count; j++) { var beat = beats[j]; var notes = beat.notes; var noteWid = noteSpaceAdd + beatWid / notes.Count; var psNote = psBeat[j].Average(noteWid, notes.Count, Vectors.halfRight); for (int k = 0; k < notes.Count; k++) { GLUI.SetFontColor(Color.black); noteIdx++; if (passIdx >= noteIdx) { GLUI.SetFontColor(passFontColor); } var note = notes[k]; var str = note.ToString().Reverse();; if (str.Length == 2) { GLUI.DrawString(str[1], psNote[k] + fontSize * shiftOSNor, fontSizeShift, Vector2.up + Vectors.halfRight2d); } GLUI.DrawString(str[0], psNote[k], fontSize, Vector2.up + Vectors.halfRight2d); if (drawLyric) { // 歌词 var word = loader.lyric[noteIdx]; var sp = Vectors.halfDown2d * (lineSpace + fontSize); var pos = psNote[k] + sp; GLUI.DrawString(word, pos, fontSizeLyric, Vector2.up + Vectors.halfRight2d); } // 变调小圆点 var scaleShift = note.scale - middleScale5; var factor = Mathf.Sign(scaleShift); scaleShift = Mathf.Abs(scaleShift); for (int m = 0; m < scaleShift; m++) { var dir = Vector2.up * factor; GLUI.DrawString(shiftMark, psNote[k] + Vector2.down * fontSize * 0.5f + dir * fontSize * shiftMarkOS + dir * shiftMarkFontSize * m * shiftMarkOSFactor, fontSize, Vectors.half2d); } } } } }