private void Awake() { Nholder = FindObjectOfType <NoteHolder>(); bpmData = FindObjectOfType <BpmData>(); beatData = FindObjectOfType <BeatData>(); beatMode = FindObjectOfType <BeatMode>(); }
//LoadNotesData //ノーツ情報とBPM変化情報を読み込む //成功でTrueを返す private bool LoadNotesData(List <string> Lines) { foreach (string line in Lines) { string[] temp; if (line != "") { temp = myConstants.SplitParam(line, ' '); } else { continue; } int trash; if (temp[0][0] != '#') { continue; } if (int.TryParse(temp[0].Substring(1, 5), out trash) == false) { continue; } int barnum = int.Parse(temp[0].Substring(1, 3)); int channel = int.Parse(temp[0].Substring(4, 2)); if (channel == myConstants.Channel_ChangeBarRate) { continue; } if (channel == myConstants.Channel_ChangeBpm) { BpmData b = new BpmData(double.Parse(temp[1]), Bars[barnum].Count); continue; } int tick = Bars[barnum].Length / temp[1].Length; for (int i = 0; i < temp[1].Length; i++) { if (temp[1][i] == '0') { continue; } NoteData nt = new NoteData(Bars[barnum].Count + (tick * i), temp[1][i]); Notes[channel].Add(nt); NotesNum++; } } return(true); }
//LoadHeaderData //実際の譜面に関係ないヘッダデータ(作曲者名など)と、小節線情報のみを読み込む //ノーツ情報の読込の際に小節線情報だけ先に分かっていた方が都合がいい //成功でTrueを返す private bool LoadHeaderData(List <string> Lines) { foreach (string line in Lines) { string[] temp; if (line != "") { temp = myConstants.SplitParam(line, ' '); } else { continue; } if (temp[0][0] != '#') { continue; } switch (temp[0]) { case "#STARTBPM": BpmData startbpm = new BpmData(double.Parse(temp[1]), 0); BpmList.Add(startbpm); break; case "#TOTAL": Total = double.Parse(temp[1]); break; case "#OFFSET": break; default: int barnum = int.Parse(temp[0].Substring(1, 3)); int channel = int.Parse(temp[0].Substring(4, 2)); if (channel == myConstants.Channel_ChangeBarRate) { Bars[barnum].Rate = double.Parse(temp[1]); break; } if (EndBar < barnum) { EndBar = barnum; } break; } } EndBar++; int cnt = 0; for (int i = 0; i <= EndBar; i++) { Bars[i].Count = cnt; Bars[i].Length = Convert.ToInt32(myConstants.BarResolution * Bars[i].Rate); cnt += Bars[i].Length; } EndCount = cnt; return(true); }