From f02044b8ec43ad108f23ee992c934ff31765edb2 Mon Sep 17 00:00:00 2001 From: NotImplementedLife Date: Mon, 17 Jul 2023 14:59:33 +0300 Subject: [PATCH] fixed notes count --- MainForm.cs | 16 ++++++++++------ TJA.cs | 22 +++++++++++++++++++--- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/MainForm.cs b/MainForm.cs index f4634ce..7e6b5ea 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -257,10 +257,10 @@ namespace TaikoSoundEditor ns.WordSub = new Word { Key = $"song_sub_{songName}", JapaneseText = tja.Headers.Subtitle }; ns.WordDetail = new Word { Key = $"song_detail_{songName}", JapaneseText = tja.Headers.TitleJa }; - mi.EasyOnpuNum = tja.Courses[0].Converted.Notes.Length; - mi.NormalOnpuNum = tja.Courses[1].Converted.Notes.Length; - mi.HardOnpuNum = tja.Courses[2].Converted.Notes.Length; - mi.ManiaOnpuNum = tja.Courses[3].Converted.Notes.Length; + mi.EasyOnpuNum = tja.Courses[0].NotesCount; + mi.NormalOnpuNum = tja.Courses[1].NotesCount; + mi.HardOnpuNum = tja.Courses[2].NotesCount; + mi.ManiaOnpuNum = tja.Courses[3].NotesCount; mi.StarEasy = tja.Courses[0].Headers.Level; mi.StarNormal = tja.Courses[1].Headers.Level; @@ -270,7 +270,7 @@ namespace TaikoSoundEditor if (tja.Courses.ContainsKey(4)) { FeedbackBox.AppendText("URA course detected\r\n"); - mi.UraOnpuNum = tja.Courses[4].Converted.Notes.Length; + mi.UraOnpuNum = tja.Courses[4].NotesCount; mi.StarUra = tja.Courses[4].Headers.Level; ma.CanPlayUra = true; @@ -294,6 +294,8 @@ namespace TaikoSoundEditor if (ma.CanPlayUra) { + mi.ShinutiScoreUra = 1002320; + mi.ShinutiScoreUraDuet = 1002320; mi.ShinutiUra = (mi.ShinutiScoreUra / mi.UraOnpuNum) / 10 * 10; mi.ShinutiUraDuet = (mi.ShinutiScoreUraDuet / mi.UraOnpuNum) / 10 * 10; } @@ -349,7 +351,8 @@ namespace TaikoSoundEditor private void ExportDatatable(string path) { var mi = new MusicInfos(); - mi.Items.AddRange(MusicInfos.Items); + mi.Items.AddRange(MusicInfos.Items); + mi.Items.AddRange(AddedMusic.Select(_ => _.MusicInfo)); var ma = new MusicAttributes(); ma.Items.AddRange(MusicAttributes.Items); @@ -381,6 +384,7 @@ namespace TaikoSoundEditor var jwl = Json.Serialize(wl); jma = jma.Replace("\"new\": true,", "\"new\":true,"); + jma = jma.Replace("\"new\": false,", "\"new\":false,"); File.WriteAllText(Path.Combine(path,"musicinfo"), jmi); File.WriteAllText(Path.Combine(path,"music_attribute"), jma); diff --git a/TJA.cs b/TJA.cs index 2e82da7..53d4ae7 100644 --- a/TJA.cs +++ b/TJA.cs @@ -338,7 +338,19 @@ namespace TaikoSoundEditor public override string ToString() => $"C({CourseN},{Headers},{string.Join("|",Measures)})"; - public ConvertedCourse Converted => ConvertToTimes(this); + public ConvertedCourse Converted => ConvertToTimed(this); + + private static readonly List typeNote = new List { "don", "kat", "donBig", "katBig" }; + + public int NotesCount + { + get + { + Debug.WriteLine(string.Join("", Measures.Select(_ => _.MeasureData))); + return string.Join("", Measures.Select(_ => _.MeasureData)).Where(c => "1234".Contains(c)).Count(); + } + //get => Converted.Notes.Where(n => typeNote.Contains(n.Type)).Count(); + } } public class Measure @@ -449,8 +461,9 @@ namespace TaikoSoundEditor public override string ToString() => $"{Headers}\n{string.Join("\n", Courses)}"; + - public static ConvertedCourse ConvertToTimes(Course course) + public static ConvertedCourse ConvertToTimed(Course course) { List events=new List(); List notes = new List(); @@ -458,6 +471,8 @@ namespace TaikoSoundEditor int balloon=0; bool imo = false; + //Debug.WriteLine("-----------------------------------------"); + for (int m = 0; m < course.Measures.Count; m++) { var measure = course.Measures[m]; @@ -471,9 +486,10 @@ namespace TaikoSoundEditor else if (evt.Name == "gogoStart" || evt.Name == "gogoEnd") events.Add(new TimedEvent(evt.Name, 0, beat + eBeat)); } - + for(int d=0;d