bool isCovering(TheOnpu o1, TheOnpu o2) { float l1, w1, l2, w2; /*l1 = o1.pos; * w1 = o1.width; * l2 = o2.pos; * w2 = o2.width; */ l1 = o1.pos - 1; w1 = o1.width + 2; l2 = o2.pos - 1; w2 = o2.width + 2; if (l2 + w2 <= l1) { return(false); } if (l2 >= l1 + w1) { return(false); } return(true); }
//譜面読み込み void SonglistReadin() { TextAsset textasset = new TextAsset(); textasset = Resources.Load("SONGS/" + SongKeyword + "." + SongHard, typeof(TextAsset)) as TextAsset; string TextLines = textasset.text; TextLines = ScriptString.RemoveSlash(TextLines); //コメントの場所を取り除く //TextLines = ScriptString.RemoveSpace(TextLines); //スペースがある場所を取り除く TextLines = ScriptString.RemoveTab(TextLines); //タッブがある場所を取り除く TextLines = ScriptString.RemoveEnter(TextLines); //複数のエンターの場所を取り除く string[] s = TextLines.Split('\n'); drbfile.onpuWeightCount = 0; for (int i = 0; i < s.Length; i++) { //空き行を抜く if (s[i] == "") { continue; } //命令行を認識 if (s[i].Substring(0, 1) == "#") { //OFFSET認識 if (s[i].Substring(0, Mathf.Min(s[i].Length, "#OFFSET".Length)) == "#OFFSET") { string ss = s[i]; ss = ss.Replace("#OFFSET=", ""); ss = ss.Replace(";", ""); drbfile.offset = float.Parse(ss); } //BEAT認識 if (s[i].Substring(0, Mathf.Min(s[i].Length, "#BEAT".Length)) == "#BEAT") { string ss = s[i]; ss = ss.Replace("#BEAT=", ""); ss = ss.Replace(";", ""); drbfile.beat = float.Parse(ss); } //BPM_NUMBER認識 //if (s[i].Substring(0, "#BPM_NUMBER".Length) == "#BPM_NUMBER") //{ // string ss = s[i]; // ss = ss.Replace("#BPM_NUMBER=", ""); // ss = ss.Replace(";", ""); // drbfile.bpms = new List<BPMS>(); //} //SCN認識 //if (s[i].Substring(0, "#SCN".Length) == "#SCN") //{ // string ss = s[i]; // ss = ss.Replace("#SCN=", ""); // ss = ss.Replace(";", ""); // drbfile.scns = new List<SCNS>(); //} //BPM [i]認識 if (s[i].Substring(0, Mathf.Min(s[i].Length, ("#BPM [" + drbfile.bpms.Count + "]").Length)) == ("#BPM [" + drbfile.bpms.Count + "]")) { string ss = s[i]; string ss2 = s[i + 1]; ss = ss.Replace("#BPM [" + drbfile.bpms.Count + "]=", ""); ss = ss.Replace(";", ""); ss2 = ss2.Replace("#BPMS[" + drbfile.bpms.Count + "]=", ""); ss2 = ss2.Replace(";", ""); BPMS bpms = new BPMS(); bpms.bpm = float.Parse(ss); bpms.bpms = float.Parse(ss2); drbfile.bpms.Add(bpms); } //SC [i]認識 if (s[i].Substring(0, Mathf.Min(s[i].Length, ("#SC [" + drbfile.scns.Count + "]").Length)) == ("#SC [" + drbfile.scns.Count + "]")) { string ss = s[i]; string ss2 = s[i + 1]; ss = ss.Replace("#SC [" + drbfile.scns.Count + "]=", ""); ss = ss.Replace(";", ""); ss2 = ss2.Replace("#SCI[" + drbfile.scns.Count + "]=", ""); ss2 = ss2.Replace(";", ""); SCNS sc = new SCNS(); sc.sc = float.Parse(ss); sc.sci = float.Parse(ss2); drbfile.scns.Add(sc); } //NoteDesigner認識; if (s[i].Substring(0, Mathf.Min(s[i].Length, "#NDNAME".Length)) == "#NDNAME") { string ss = s[i]; ss = ss.Replace("#NDNAME=", ""); ss = ss.Replace(";", ""); ss = ss.Replace("\'", ""); drbfile.ndname = ss; } } //ノーツ行を認識 else { //Notesデータ取得 string ss = s[i].Replace("<", ""); string[] sss = ss.Substring(0, ss.Length - 2).Split('>'); TheOnpu onpu = new TheOnpu(); onpu.id = int.Parse(sss[0]); onpu.kind = int.Parse(sss[1]); if (onpu.kind == 12) { onpu.kind = 6; } if (onpu.kind == 8) { onpu.kind = 7; } onpu.ichi = float.Parse(sss[2]); onpu.pos = float.Parse(sss[3]); onpu.width = float.Parse(sss[4]); onpu.nsc = sss[5]; onpu.isnadnsc = sss[5].Contains(":"); if (!onpu.isnadnsc) { onpu.insc = float.Parse(sss[5]); } onpu.insc = onpu.insc == 0.0f ? 1.0f : onpu.insc; onpu.parent = int.Parse(sss[6]); if (sss.Length > 7) { onpu.mode = sss[7]; } else { onpu.mode = "n"; } if (onpu.mode == "P") { onpu.isnadnsc = true; } //ミラー処理 if (GameMirror) { onpu.pos = 16 - onpu.pos - onpu.width; if (onpu.kind == 13 || onpu.kind == 14) { onpu.kind = onpu.kind == 13 ? 14 : 13; } } drbfile.onpu.Add(onpu); drbfile.onpuWeightCount += OnpuWeight[onpu.kind]; } } }