From fdccbf42ae5d67f892f961181b8bd8c167bb475c Mon Sep 17 00:00:00 2001 From: thiEFcat Date: Sat, 6 Jan 2018 13:04:27 +0900 Subject: [PATCH] Long time no see, everybody! --- ScrObjAnalyzer/DataParser.cs | 37 +- ScrObjAnalyzer/Form1.Designer.cs | 344 +++++++++++++++++- ScrObjAnalyzer/Form1.cs | 185 +++++++++- .../Properties/Resources.Designer.cs | 2 +- .../Properties/Settings.Designer.cs | 2 +- ScrObjAnalyzer/ScrObjAnalyzer.csproj | 2 + ScrObjAnalyzer/TWxCore.cs | 18 +- 7 files changed, 535 insertions(+), 55 deletions(-) diff --git a/ScrObjAnalyzer/DataParser.cs b/ScrObjAnalyzer/DataParser.cs index 3148102..ad5d092 100644 --- a/ScrObjAnalyzer/DataParser.cs +++ b/ScrObjAnalyzer/DataParser.cs @@ -13,7 +13,7 @@ public DataParser() } - public string ParseToTWx(int twxMode, List data, List bpm, byte[] color) + public string ParseToTWx(int twxMode, List data, List bpm, byte[] color, Metadata meta) { List NoteList = new List(); int bpmIndex = -1; @@ -36,7 +36,7 @@ public string ParseToTWx(int twxMode, List data, List bpm, by double start = data[i].StartPos + 1; Note note = new Note(); - note.CreateNote(data[i].ID, size, color, mode, flick, data[i].Time, data[i].Tick, data[i].Speed, start, data[i].EndPos + 1.0, new int[] { 0 }); + note.CreateNote(data[i].ID, size, data[i].NoteColor, mode, flick, data[i].Time, data[i].Tick, data[i].Speed, start, data[i].EndPos + 1.0, new int[] { 0 }); NoteList.Add(note); if (data[i].Type.Equals(5) || data[i].Type.Equals(7)) { @@ -46,7 +46,7 @@ public string ParseToTWx(int twxMode, List data, List bpm, by else if (data[i].EndType.Equals(2)) { newflick = 3; } else if (data[i].EndType.Equals(3)) { newflick = 2; } Note tail = new Note(); - tail.CreateNote(data[i].ID + 1, size, color, mode, newflick, data[i].Time + (data[i].TickDistance * bpm[bpmIndex].SecPerTick), data[i].Tick + data[i].TickDistance, data[i].Speed, start, data[i].EndPos + 1, new int[] { data[i].ID }); + tail.CreateNote(data[i].ID + 1, size, data[i].SubColor[0], mode, newflick, data[i].Time + (data[i].TickDistance * bpm[bpmIndex].SecPerTick), data[i].Tick + data[i].TickDistance, data[i].Speed, start, data[i].EndPos + 1, new int[] { data[i].ID }); NoteList.Add(tail); } else if (data[i].Type.Equals(6)) @@ -54,7 +54,7 @@ public string ParseToTWx(int twxMode, List data, List bpm, by for (int j = 1; j < data[i].SubPos.Count; j++) { Note sub = new Note(); - sub.CreateNote(data[i].ID + j, size, color, mode, 0, data[i].Time + (data[i].SubTick[j] * bpm[bpmIndex].SecPerTick), data[i].Tick + data[i].SubTick[j], data[i].Speed, data[i].SubPos[j] + 1, data[i].SubPos[j] + 1, new int[] { data[i].ID + j - 1 }); + sub.CreateNote(data[i].ID + j, size, data[i].SubColor[j - 1], mode, 0, data[i].Time + (data[i].SubTick[j] * bpm[bpmIndex].SecPerTick), data[i].Tick + data[i].SubTick[j], data[i].Speed, data[i].SubPos[j] + 1, data[i].SubPos[j] + 1, new int[] { data[i].ID + j - 1 }); if (j.Equals(data[i].SubPos.Count - 1)) { int newflick = 0; @@ -70,6 +70,7 @@ public string ParseToTWx(int twxMode, List data, List bpm, by } NoteData notedata = new NoteData(); + notedata.metadata = meta; notedata.notes = NoteList.ToArray(); string json = JsonMapper.ToJson(notedata); @@ -82,42 +83,14 @@ private double ConvertStartPos(int twxMode, double value) if (twxMode.Equals(2)) { - /* - if (value.Equals(-1)) { start = 0.666666; } - else if (value.Equals(0)) { start = 1.222222; } - else if (value.Equals(1)) { start = 1.777777; } - else if (value.Equals(2)) { start = 2.333333; } - */ start = (11.0 / 9.0) + ((5.0 / 9.0) * value); } else if (twxMode.Equals(4)) { - /* - if (value.Equals(-2)) { start = 0.555555; } - else if (value.Equals(-1)) { start = 1.111111; } - else if (value.Equals(0)) { start = 1.666666; } - else if (value.Equals(1)) { start = 2.222222; } - else if (value.Equals(2)) { start = 2.777777; } - else if (value.Equals(3)) { start = 3.333333; } - else if (value.Equals(4)) { start = 3.888888; } - else if (value.Equals(5)) { start = 4.444444; } - */ start = (15.0 / 9.0) + ((5.0 / 9.0) * value); } else if (twxMode.Equals(6)) { - /* - if (value.Equals(-2)) { start = 1.0; } - else if (value.Equals(-1)) { start = 1.555555; } - else if (value.Equals(0)) { start = 2.111111; } - else if (value.Equals(1)) { start = 2.666666; } - else if (value.Equals(2)) { start = 3.222222; } - else if (value.Equals(3)) { start = 3.777777; } - else if (value.Equals(4)) { start = 4.333333; } - else if (value.Equals(5)) { start = 4.888888; } - else if (value.Equals(6)) { start = 5.444444; } - else if (value.Equals(7)) { start = 6.0; } - */ start = (19.0 / 9.0) + ((5.0 / 9.0) * value); } diff --git a/ScrObjAnalyzer/Form1.Designer.cs b/ScrObjAnalyzer/Form1.Designer.cs index 3f48571..c549a7d 100644 --- a/ScrObjAnalyzer/Form1.Designer.cs +++ b/ScrObjAnalyzer/Form1.Designer.cs @@ -46,23 +46,52 @@ private void InitializeComponent() this.EndPos = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Speed = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.EndType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.Description = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.OpenDialog = new System.Windows.Forms.OpenFileDialog(); this.ReshowBtn = new System.Windows.Forms.Button(); this.ExportBtn = new System.Windows.Forms.Button(); this.ExportDialog = new System.Windows.Forms.SaveFileDialog(); this.ExportBox = new System.Windows.Forms.GroupBox(); + this.MetadataBox = new System.Windows.Forms.GroupBox(); + this.DensityVal = new System.Windows.Forms.NumericUpDown(); + this.label3 = new System.Windows.Forms.Label(); + this.LevelBox = new System.Windows.Forms.GroupBox(); + this.CustomLevelVal = new System.Windows.Forms.NumericUpDown(); + this.CustomRadio = new System.Windows.Forms.RadioButton(); + this.ApexRadio = new System.Windows.Forms.RadioButton(); + this.HardRadio = new System.Windows.Forms.RadioButton(); + this.NormalRadio = new System.Windows.Forms.RadioButton(); + this.EasyRadio = new System.Windows.Forms.RadioButton(); + this.Mapper = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.Artist = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); this.ExpColorBox = new System.Windows.Forms.GroupBox(); + this.ApplyAllCheck = new System.Windows.Forms.CheckBox(); + this.ColorApplyBtn = new System.Windows.Forms.Button(); + this.Palette = new System.Windows.Forms.Panel(); this.ColorA = new System.Windows.Forms.NumericUpDown(); this.ColorB = new System.Windows.Forms.NumericUpDown(); this.ColorG = new System.Windows.Forms.NumericUpDown(); this.ColorR = new System.Windows.Forms.NumericUpDown(); + this.SelectedTargetBox = new System.Windows.Forms.GroupBox(); + this.SpecificNoteList = new System.Windows.Forms.ListView(); + this.State = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.EndLine = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.Color = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.NoteOrNot = new System.Windows.Forms.Label(); this.ModePanel.SuspendLayout(); this.ExportBox.SuspendLayout(); + this.MetadataBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.DensityVal)).BeginInit(); + this.LevelBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.CustomLevelVal)).BeginInit(); this.ExpColorBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.ColorA)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ColorB)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ColorG)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ColorR)).BeginInit(); + this.SelectedTargetBox.SuspendLayout(); this.SuspendLayout(); // // ModePanel @@ -74,7 +103,7 @@ private void InitializeComponent() this.ModePanel.Controls.Add(this.Mix4); this.ModePanel.Controls.Add(this.MixM); this.ModePanel.Controls.Add(this.Mix6); - this.ModePanel.Location = new System.Drawing.Point(636, 120); + this.ModePanel.Location = new System.Drawing.Point(706, 116); this.ModePanel.Name = "ModePanel"; this.ModePanel.Size = new System.Drawing.Size(236, 189); this.ModePanel.TabIndex = 1; @@ -149,7 +178,7 @@ private void InitializeComponent() // LoadBtn // this.LoadBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.LoadBtn.Location = new System.Drawing.Point(636, 12); + this.LoadBtn.Location = new System.Drawing.Point(706, 12); this.LoadBtn.Name = "LoadBtn"; this.LoadBtn.Size = new System.Drawing.Size(236, 46); this.LoadBtn.TabIndex = 5; @@ -171,15 +200,19 @@ private void InitializeComponent() this.StartPos, this.EndPos, this.Speed, - this.EndType}); + this.EndType, + this.Description}); + this.TextList.FullRowSelect = true; this.TextList.GridLines = true; + this.TextList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.TextList.Location = new System.Drawing.Point(12, 12); this.TextList.MultiSelect = false; this.TextList.Name = "TextList"; - this.TextList.Size = new System.Drawing.Size(618, 427); + this.TextList.Size = new System.Drawing.Size(688, 787); this.TextList.TabIndex = 6; this.TextList.UseCompatibleStateImageBehavior = false; this.TextList.View = System.Windows.Forms.View.Details; + this.TextList.SelectedIndexChanged += new System.EventHandler(this.TextList_SelectedIndexChanged); // // ID // @@ -228,7 +261,13 @@ private void InitializeComponent() // this.EndType.Text = "EndType"; this.EndType.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.EndType.Width = 70; + this.EndType.Width = 65; + // + // Description + // + this.Description.Text = "Description"; + this.Description.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.Description.Width = 79; // // OpenDialog // @@ -240,7 +279,7 @@ private void InitializeComponent() // this.ReshowBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.ReshowBtn.Enabled = false; - this.ReshowBtn.Location = new System.Drawing.Point(636, 65); + this.ReshowBtn.Location = new System.Drawing.Point(706, 64); this.ReshowBtn.Name = "ReshowBtn"; this.ReshowBtn.Size = new System.Drawing.Size(236, 46); this.ReshowBtn.TabIndex = 5; @@ -252,7 +291,7 @@ private void InitializeComponent() // this.ExportBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.ExportBtn.Enabled = false; - this.ExportBtn.Location = new System.Drawing.Point(6, 74); + this.ExportBtn.Location = new System.Drawing.Point(6, 224); this.ExportBtn.Name = "ExportBtn"; this.ExportBtn.Size = new System.Drawing.Size(224, 46); this.ExportBtn.TabIndex = 7; @@ -267,30 +306,210 @@ private void InitializeComponent() // ExportBox // this.ExportBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.ExportBox.Controls.Add(this.ExpColorBox); + this.ExportBox.Controls.Add(this.MetadataBox); this.ExportBox.Controls.Add(this.ExportBtn); - this.ExportBox.Location = new System.Drawing.Point(636, 315); + this.ExportBox.Location = new System.Drawing.Point(706, 528); this.ExportBox.Name = "ExportBox"; - this.ExportBox.Size = new System.Drawing.Size(236, 126); + this.ExportBox.Size = new System.Drawing.Size(236, 276); this.ExportBox.TabIndex = 8; this.ExportBox.TabStop = false; this.ExportBox.Text = "Export setting"; // + // MetadataBox + // + this.MetadataBox.Controls.Add(this.DensityVal); + this.MetadataBox.Controls.Add(this.label3); + this.MetadataBox.Controls.Add(this.LevelBox); + this.MetadataBox.Controls.Add(this.Mapper); + this.MetadataBox.Controls.Add(this.label2); + this.MetadataBox.Controls.Add(this.Artist); + this.MetadataBox.Controls.Add(this.label1); + this.MetadataBox.Location = new System.Drawing.Point(6, 20); + this.MetadataBox.Name = "MetadataBox"; + this.MetadataBox.Size = new System.Drawing.Size(224, 197); + this.MetadataBox.TabIndex = 8; + this.MetadataBox.TabStop = false; + this.MetadataBox.Text = "Metadata"; + // + // DensityVal + // + this.DensityVal.Location = new System.Drawing.Point(127, 170); + this.DensityVal.Maximum = new decimal(new int[] { + 99, + 0, + 0, + 0}); + this.DensityVal.Name = "DensityVal"; + this.DensityVal.Size = new System.Drawing.Size(84, 21); + this.DensityVal.TabIndex = 6; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 172); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(108, 12); + this.label3.TabIndex = 5; + this.label3.Text = "Density (Difficulty)"; + // + // LevelBox + // + this.LevelBox.Controls.Add(this.CustomLevelVal); + this.LevelBox.Controls.Add(this.CustomRadio); + this.LevelBox.Controls.Add(this.ApexRadio); + this.LevelBox.Controls.Add(this.HardRadio); + this.LevelBox.Controls.Add(this.NormalRadio); + this.LevelBox.Controls.Add(this.EasyRadio); + this.LevelBox.Location = new System.Drawing.Point(6, 72); + this.LevelBox.Name = "LevelBox"; + this.LevelBox.Size = new System.Drawing.Size(211, 92); + this.LevelBox.TabIndex = 4; + this.LevelBox.TabStop = false; + this.LevelBox.Text = "Level"; + // + // CustomLevelVal + // + this.CustomLevelVal.Location = new System.Drawing.Point(121, 64); + this.CustomLevelVal.Name = "CustomLevelVal"; + this.CustomLevelVal.Size = new System.Drawing.Size(84, 21); + this.CustomLevelVal.TabIndex = 5; + // + // CustomRadio + // + this.CustomRadio.AutoSize = true; + this.CustomRadio.Location = new System.Drawing.Point(6, 64); + this.CustomRadio.Name = "CustomRadio"; + this.CustomRadio.Size = new System.Drawing.Size(67, 16); + this.CustomRadio.TabIndex = 4; + this.CustomRadio.TabStop = true; + this.CustomRadio.Text = "Custom"; + this.CustomRadio.UseVisualStyleBackColor = true; + // + // ApexRadio + // + this.ApexRadio.AutoSize = true; + this.ApexRadio.Location = new System.Drawing.Point(121, 42); + this.ApexRadio.Name = "ApexRadio"; + this.ApexRadio.Size = new System.Drawing.Size(72, 16); + this.ApexRadio.TabIndex = 3; + this.ApexRadio.TabStop = true; + this.ApexRadio.Text = "Apex (4)"; + this.ApexRadio.UseVisualStyleBackColor = true; + // + // HardRadio + // + this.HardRadio.AutoSize = true; + this.HardRadio.Location = new System.Drawing.Point(6, 42); + this.HardRadio.Name = "HardRadio"; + this.HardRadio.Size = new System.Drawing.Size(69, 16); + this.HardRadio.TabIndex = 2; + this.HardRadio.TabStop = true; + this.HardRadio.Text = "Hard (3)"; + this.HardRadio.UseVisualStyleBackColor = true; + // + // NormalRadio + // + this.NormalRadio.AutoSize = true; + this.NormalRadio.Location = new System.Drawing.Point(121, 20); + this.NormalRadio.Name = "NormalRadio"; + this.NormalRadio.Size = new System.Drawing.Size(84, 16); + this.NormalRadio.TabIndex = 1; + this.NormalRadio.TabStop = true; + this.NormalRadio.Text = "Normal (2)"; + this.NormalRadio.UseVisualStyleBackColor = true; + // + // EasyRadio + // + this.EasyRadio.AutoSize = true; + this.EasyRadio.Location = new System.Drawing.Point(6, 20); + this.EasyRadio.Name = "EasyRadio"; + this.EasyRadio.Size = new System.Drawing.Size(72, 16); + this.EasyRadio.TabIndex = 0; + this.EasyRadio.TabStop = true; + this.EasyRadio.Text = "Easy (1)"; + this.EasyRadio.UseVisualStyleBackColor = true; + // + // Mapper + // + this.Mapper.Location = new System.Drawing.Point(60, 45); + this.Mapper.Name = "Mapper"; + this.Mapper.Size = new System.Drawing.Size(157, 21); + this.Mapper.TabIndex = 3; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(6, 49); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(48, 12); + this.label2.TabIndex = 2; + this.label2.Text = "Mapper"; + // + // Artist + // + this.Artist.Location = new System.Drawing.Point(60, 18); + this.Artist.Name = "Artist"; + this.Artist.Size = new System.Drawing.Size(157, 21); + this.Artist.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(6, 21); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(33, 12); + this.label1.TabIndex = 0; + this.label1.Text = "Artist"; + // // ExpColorBox // + this.ExpColorBox.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.ExpColorBox.Controls.Add(this.ApplyAllCheck); + this.ExpColorBox.Controls.Add(this.ColorApplyBtn); + this.ExpColorBox.Controls.Add(this.Palette); this.ExpColorBox.Controls.Add(this.ColorA); this.ExpColorBox.Controls.Add(this.ColorB); this.ExpColorBox.Controls.Add(this.ColorG); this.ExpColorBox.Controls.Add(this.ColorR); - this.ExpColorBox.Location = new System.Drawing.Point(7, 21); + this.ExpColorBox.Location = new System.Drawing.Point(7, 126); this.ExpColorBox.Name = "ExpColorBox"; - this.ExpColorBox.Size = new System.Drawing.Size(223, 47); + this.ExpColorBox.Size = new System.Drawing.Size(225, 79); this.ExpColorBox.TabIndex = 8; this.ExpColorBox.TabStop = false; - this.ExpColorBox.Text = "Color (R, G, B, A)"; + this.ExpColorBox.Text = "Set color (R, G, B, A)"; + // + // ApplyAllCheck + // + this.ApplyAllCheck.AutoSize = true; + this.ApplyAllCheck.Location = new System.Drawing.Point(90, 53); + this.ApplyAllCheck.Name = "ApplyAllCheck"; + this.ApplyAllCheck.Size = new System.Drawing.Size(73, 16); + this.ApplyAllCheck.TabIndex = 14; + this.ApplyAllCheck.Text = "All notes"; + this.ApplyAllCheck.UseVisualStyleBackColor = true; + // + // ColorApplyBtn + // + this.ColorApplyBtn.Location = new System.Drawing.Point(169, 48); + this.ColorApplyBtn.Name = "ColorApplyBtn"; + this.ColorApplyBtn.Size = new System.Drawing.Size(48, 25); + this.ColorApplyBtn.TabIndex = 13; + this.ColorApplyBtn.Text = "Apply"; + this.ColorApplyBtn.UseVisualStyleBackColor = true; + this.ColorApplyBtn.Click += new System.EventHandler(this.ColorApplyBtn_Click); + // + // Palette + // + this.Palette.BackColor = System.Drawing.Color.White; + this.Palette.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.Palette.Location = new System.Drawing.Point(7, 48); + this.Palette.Name = "Palette"; + this.Palette.Size = new System.Drawing.Size(73, 25); + this.Palette.TabIndex = 12; // // ColorA // + this.ColorA.BackColor = System.Drawing.SystemColors.Window; this.ColorA.Location = new System.Drawing.Point(169, 20); this.ColorA.Maximum = new decimal(new int[] { 255, @@ -305,6 +524,7 @@ private void InitializeComponent() 0, 0, 0}); + this.ColorA.ValueChanged += new System.EventHandler(this.ColorChanged); // // ColorB // @@ -322,6 +542,7 @@ private void InitializeComponent() 0, 0, 0}); + this.ColorB.ValueChanged += new System.EventHandler(this.ColorChanged); // // ColorG // @@ -339,6 +560,7 @@ private void InitializeComponent() 0, 0, 0}); + this.ColorG.ValueChanged += new System.EventHandler(this.ColorChanged); // // ColorR // @@ -356,29 +578,95 @@ private void InitializeComponent() 0, 0, 0}); + this.ColorR.ValueChanged += new System.EventHandler(this.ColorChanged); + // + // SelectedTargetBox + // + this.SelectedTargetBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.SelectedTargetBox.Controls.Add(this.SpecificNoteList); + this.SelectedTargetBox.Controls.Add(this.NoteOrNot); + this.SelectedTargetBox.Controls.Add(this.ExpColorBox); + this.SelectedTargetBox.Location = new System.Drawing.Point(706, 311); + this.SelectedTargetBox.Name = "SelectedTargetBox"; + this.SelectedTargetBox.Size = new System.Drawing.Size(238, 211); + this.SelectedTargetBox.TabIndex = 9; + this.SelectedTargetBox.TabStop = false; + this.SelectedTargetBox.Text = "Selected item"; + // + // SpecificNoteList + // + this.SpecificNoteList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.State, + this.EndLine, + this.Color}); + this.SpecificNoteList.FullRowSelect = true; + this.SpecificNoteList.GridLines = true; + this.SpecificNoteList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.SpecificNoteList.Location = new System.Drawing.Point(6, 32); + this.SpecificNoteList.Name = "SpecificNoteList"; + this.SpecificNoteList.Size = new System.Drawing.Size(224, 88); + this.SpecificNoteList.TabIndex = 10; + this.SpecificNoteList.UseCompatibleStateImageBehavior = false; + this.SpecificNoteList.View = System.Windows.Forms.View.Details; + // + // State + // + this.State.Text = "State"; + this.State.Width = 50; + // + // EndLine + // + this.EndLine.Text = "End"; + this.EndLine.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.EndLine.Width = 40; + // + // Color + // + this.Color.Text = "Color"; + this.Color.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.Color.Width = 110; + // + // NoteOrNot + // + this.NoteOrNot.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.NoteOrNot.Location = new System.Drawing.Point(84, 17); + this.NoteOrNot.Name = "NoteOrNot"; + this.NoteOrNot.Size = new System.Drawing.Size(148, 12); + this.NoteOrNot.TabIndex = 9; + this.NoteOrNot.Text = "Nothing selected."; + this.NoteOrNot.TextAlign = System.Drawing.ContentAlignment.TopRight; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(884, 451); + this.ClientSize = new System.Drawing.Size(954, 811); + this.Controls.Add(this.SelectedTargetBox); this.Controls.Add(this.ExportBox); this.Controls.Add(this.ReshowBtn); this.Controls.Add(this.TextList); this.Controls.Add(this.LoadBtn); this.Controls.Add(this.ModePanel); - this.MinimumSize = new System.Drawing.Size(900, 490); + this.MinimumSize = new System.Drawing.Size(970, 850); this.Name = "Form1"; - this.Text = "ScrObjAnalyzer 1.2.1a"; + this.Text = "ScrObjAnalyzer 1.3"; this.Load += new System.EventHandler(this.Form1_Load); this.ModePanel.ResumeLayout(false); this.ModePanel.PerformLayout(); this.ExportBox.ResumeLayout(false); + this.MetadataBox.ResumeLayout(false); + this.MetadataBox.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.DensityVal)).EndInit(); + this.LevelBox.ResumeLayout(false); + this.LevelBox.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.CustomLevelVal)).EndInit(); this.ExpColorBox.ResumeLayout(false); + this.ExpColorBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.ColorA)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ColorB)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ColorG)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ColorR)).EndInit(); + this.SelectedTargetBox.ResumeLayout(false); this.ResumeLayout(false); } @@ -412,6 +700,30 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown ColorG; private System.Windows.Forms.NumericUpDown ColorR; private System.Windows.Forms.ColumnHeader Tick; + private System.Windows.Forms.ColumnHeader Description; + private System.Windows.Forms.GroupBox MetadataBox; + private System.Windows.Forms.NumericUpDown DensityVal; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.GroupBox LevelBox; + private System.Windows.Forms.NumericUpDown CustomLevelVal; + private System.Windows.Forms.RadioButton CustomRadio; + private System.Windows.Forms.RadioButton ApexRadio; + private System.Windows.Forms.RadioButton HardRadio; + private System.Windows.Forms.RadioButton NormalRadio; + private System.Windows.Forms.RadioButton EasyRadio; + private System.Windows.Forms.TextBox Mapper; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox Artist; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button ColorApplyBtn; + private System.Windows.Forms.Panel Palette; + private System.Windows.Forms.GroupBox SelectedTargetBox; + private System.Windows.Forms.ListView SpecificNoteList; + private System.Windows.Forms.ColumnHeader State; + private System.Windows.Forms.ColumnHeader EndLine; + private System.Windows.Forms.ColumnHeader Color; + private System.Windows.Forms.Label NoteOrNot; + private System.Windows.Forms.CheckBox ApplyAllCheck; } } diff --git a/ScrObjAnalyzer/Form1.cs b/ScrObjAnalyzer/Form1.cs index 514ca76..497862c 100644 --- a/ScrObjAnalyzer/Form1.cs +++ b/ScrObjAnalyzer/Form1.cs @@ -2,12 +2,16 @@ using System.Collections.Generic; using System.Windows.Forms; using System.IO; +using System.Drawing; +using TempestWave.TWx; namespace ScrObjAnalyzer { public partial class Form1 : Form { public string OriginText; + public Color PaletteColor; + public ListData PickedData; public List ListDatas = new List(), CurrentDatas = new List(); public List BPMs = new List(); @@ -93,8 +97,13 @@ private void ReadFumenFile(string[] target) { int val = int.Parse(data[3]); ListDatas[totalCount].Type = val; + ListDatas[totalCount].NoteColor = new byte[4] { 255, 255, 255, 255 }; - if (val.Equals(5) || val.Equals(7)) { trackDic[ListDatas[totalCount].MyMix]++; } + if (val.Equals(5) || val.Equals(7)) + { + trackDic[ListDatas[totalCount].MyMix]++; + ListDatas[totalCount].SubColor.Add(new byte[4] { 255, 255, 255, 255 }); + } } else if (data.Length > 2 && data[1].Equals("startPosx")) { @@ -126,7 +135,11 @@ private void ReadFumenFile(string[] target) int val = int.Parse(data[3]); ListDatas[totalCount].SubTick.Add(val); - if(ListDatas[totalCount].SubTick.Count > 1) { trackDic[ListDatas[totalCount].MyMix]++; } + if(ListDatas[totalCount].SubTick.Count > 1) + { + trackDic[ListDatas[totalCount].MyMix]++; + ListDatas[totalCount].SubColor.Add(new byte[4] { 255, 255, 255, 255 }); + } } else if (data.Length > 2 && data[1].Equals("posx")) { @@ -141,6 +154,7 @@ private void ReadFumenFile(string[] target) } AddToList(ListDatas); + for (int i = 0; i < ListDatas.Count; i++) { CurrentDatas.Add(ListDatas[i]); } } private void FilterBtn_Click(object sender, EventArgs e) @@ -190,6 +204,12 @@ private void AddToList(List datas) item.SubItems.Add(datas[i].Speed.ToString()); item.SubItems.Add(datas[i].EndType.ToString()); + if(datas[i].MyMix >= 100) + { + if (datas[i].Type.Equals(6)) { item.SubItems.Add("Slide note."); } + else if (datas[i].Type.Equals(5) || datas[i].Type.Equals(7)) { item.SubItems.Add("Hold note."); } + } + TextList.Items.Add(item); } } @@ -197,12 +217,157 @@ private void AddToList(List datas) private void ReshowBtn_Click(object sender, EventArgs e) { AddToList(ListDatas); + for (int i = 0; i < ListDatas.Count; i++) { CurrentDatas.Add(ListDatas[i]); } ExportBtn.Enabled = false; } private void Form1_Load(object sender, EventArgs e) { OriginText = Text; + PaletteColor = System.Drawing.Color.FromArgb(255, 255, 255, 255); + } + + private void TextList_SelectedIndexChanged(object sender, EventArgs e) + { + SpecificNoteList.Items.Clear(); + ColorApplyBtn.Enabled = false; + + if (TextList.SelectedIndices.Count > 0) + { + ListData pickData = CurrentDatas[TextList.SelectedIndices[0]]; + if (pickData.MyMix < 100) + { + NoteOrNot.Text = "This is not a note."; + } + else + { + if (pickData.Type.Equals(5) || pickData.Type.Equals(7)) + { + NoteOrNot.Text = "Hold note selected. #" + pickData.ID.ToString(); + + ListViewItem itemHead = new ListViewItem("Start"); + itemHead.SubItems.Add(pickData.EndPos.ToString()); + itemHead.SubItems.Add(pickData.NoteColor[0].ToString() + "," + pickData.NoteColor[1].ToString() + "," + pickData.NoteColor[2].ToString() + "," + pickData.NoteColor[3].ToString()); + SpecificNoteList.Items.Add(itemHead); + + ListViewItem itemTail = new ListViewItem("End"); + itemTail.SubItems.Add(pickData.EndPos.ToString()); + itemTail.SubItems.Add(pickData.SubColor[0][0].ToString() + "," + pickData.SubColor[0][1].ToString() + "," + pickData.SubColor[0][2].ToString() + "," + pickData.SubColor[0][3].ToString()); + SpecificNoteList.Items.Add(itemTail); + } + else if (pickData.Type.Equals(6)) + { + NoteOrNot.Text = "Slide note selected. #" + pickData.ID.ToString(); + + ListViewItem itemHead = new ListViewItem("Start"); + itemHead.SubItems.Add(pickData.EndPos.ToString()); + itemHead.SubItems.Add(pickData.NoteColor[0].ToString() + "," + pickData.NoteColor[1].ToString() + "," + pickData.NoteColor[2].ToString() + "," + pickData.NoteColor[3].ToString()); + SpecificNoteList.Items.Add(itemHead); + + for (int i = 1; i < pickData.SubPos.Count; i++) + { + ListViewItem itemCheck; + if (i.Equals(pickData.SubPos.Count - 1)) { itemCheck = new ListViewItem("End"); } + else { itemCheck = new ListViewItem("Check"); } + itemCheck.SubItems.Add(pickData.SubPos[i].ToString()); + itemCheck.SubItems.Add(pickData.SubColor[i - 1][0].ToString() + "," + pickData.SubColor[i - 1][1].ToString() + "," + pickData.SubColor[i - 1][2].ToString() + "," + pickData.SubColor[i - 1][3].ToString()); + SpecificNoteList.Items.Add(itemCheck); + } + } + else + { + ListViewItem itemHead = new ListViewItem("Start"); + itemHead.SubItems.Add(pickData.EndPos.ToString()); + itemHead.SubItems.Add(pickData.NoteColor[0].ToString() + "," + pickData.NoteColor[1].ToString() + "," + pickData.NoteColor[2].ToString() + "," + pickData.NoteColor[3].ToString()); + SpecificNoteList.Items.Add(itemHead); + + if (pickData.Type.Equals(2) || pickData.Type.Equals(3) || pickData.Type.Equals(4)) { NoteOrNot.Text = "Flick note selected. #" + pickData.ID.ToString(); } + else { NoteOrNot.Text = "Tap note selected. #" + pickData.ID.ToString(); } + } + ColorApplyBtn.Enabled = true; + } + PickedData = pickData; + } + } + + private void ReloadSpecificList() + { + SpecificNoteList.Items.Clear(); + + if (PickedData.Type.Equals(5) || PickedData.Type.Equals(7)) + { + ListViewItem itemHead = new ListViewItem("Start"); + itemHead.SubItems.Add(PickedData.EndPos.ToString()); + itemHead.SubItems.Add(PickedData.NoteColor[0].ToString() + "," + PickedData.NoteColor[1].ToString() + "," + PickedData.NoteColor[2].ToString() + "," + PickedData.NoteColor[3].ToString()); + SpecificNoteList.Items.Add(itemHead); + + ListViewItem itemTail = new ListViewItem("End"); + itemTail.SubItems.Add(PickedData.EndPos.ToString()); + itemTail.SubItems.Add(PickedData.SubColor[0][0].ToString() + "," + PickedData.SubColor[0][1].ToString() + "," + PickedData.SubColor[0][2].ToString() + "," + PickedData.SubColor[0][3].ToString()); + SpecificNoteList.Items.Add(itemTail); + } + else if (PickedData.Type.Equals(6)) + { + ListViewItem itemHead = new ListViewItem("Start"); + itemHead.SubItems.Add(PickedData.EndPos.ToString()); + itemHead.SubItems.Add(PickedData.NoteColor[0].ToString() + "," + PickedData.NoteColor[1].ToString() + "," + PickedData.NoteColor[2].ToString() + "," + PickedData.NoteColor[3].ToString()); + SpecificNoteList.Items.Add(itemHead); + + for (int i = 1; i < PickedData.SubPos.Count; i++) + { + ListViewItem itemCheck; + if (i.Equals(PickedData.SubPos.Count - 1)) { itemCheck = new ListViewItem("End"); } + else { itemCheck = new ListViewItem("Check"); } + itemCheck.SubItems.Add(PickedData.SubPos[i].ToString()); + itemCheck.SubItems.Add(PickedData.SubColor[i - 1][0].ToString() + "," + PickedData.SubColor[i - 1][1].ToString() + "," + PickedData.SubColor[i - 1][2].ToString() + "," + PickedData.SubColor[i - 1][3].ToString()); + SpecificNoteList.Items.Add(itemCheck); + } + } + else + { + ListViewItem itemHead = new ListViewItem("Start"); + itemHead.SubItems.Add(PickedData.EndPos.ToString()); + itemHead.SubItems.Add(PickedData.NoteColor[0].ToString() + "," + PickedData.NoteColor[1].ToString() + "," + PickedData.NoteColor[2].ToString() + "," + PickedData.NoteColor[3].ToString()); + SpecificNoteList.Items.Add(itemHead); + } + } + + private void ColorApplyBtn_Click(object sender, EventArgs e) + { + if(ApplyAllCheck.Checked) + { + for(int i = 0; i < CurrentDatas.Count; i++) + { + CurrentDatas[i].NoteColor = new byte[4] { PaletteColor.R, PaletteColor.G, PaletteColor.B, PaletteColor.A }; + if(CurrentDatas[i].SubColor.Count > 0) + { + for (int j = 0; j < CurrentDatas[i].SubColor.Count; j++) { CurrentDatas[i].SubColor[j] = new byte[4] { PaletteColor.R, PaletteColor.G, PaletteColor.B, PaletteColor.A }; } + } + } + if (SpecificNoteList.Items.Count > 0) { ReloadSpecificList(); } + } + else + { + if (SpecificNoteList.SelectedIndices.Count > 0) + { + if (SpecificNoteList.Items.Count > 1) + { + for (int i = 0; i < SpecificNoteList.SelectedIndices.Count; i++) + { + if (SpecificNoteList.SelectedIndices[i].Equals(0)) { PickedData.NoteColor = new byte[4] { PaletteColor.R, PaletteColor.G, PaletteColor.B, PaletteColor.A }; } + else { PickedData.SubColor[SpecificNoteList.SelectedIndices[i] - 1] = new byte[4] { PaletteColor.R, PaletteColor.G, PaletteColor.B, PaletteColor.A }; } + } + ReloadSpecificList(); + } + else { PickedData.NoteColor = new byte[4] { PaletteColor.R, PaletteColor.G, PaletteColor.B, PaletteColor.A }; } + } + } + } + + private void ColorChanged(object sender, EventArgs e) + { + PaletteColor = System.Drawing.Color.FromArgb((byte)ColorA.Value, (byte)ColorR.Value, (byte)ColorG.Value, (byte)ColorB.Value); + Palette.BackColor = PaletteColor; } private void ExportBtn_Click(object sender, EventArgs e) @@ -230,8 +395,18 @@ private void ExportBtn_Click(object sender, EventArgs e) DialogResult res = ExportDialog.ShowDialog(); if(res.Equals(DialogResult.OK)) { + Metadata data = new Metadata(); + if (EasyRadio.Checked) { data.level = 1; } + else if (NormalRadio.Checked) { data.level = 2; } + else if (HardRadio.Checked) { data.level = 3; } + else if (ApexRadio.Checked) { data.level = 4; } + else if (CustomRadio.Checked) { data.level = (int)CustomLevelVal.Value; } + data.artist = Artist.Text; + data.mapper = Mapper.Text; + data.density = (int)DensityVal.Value; + DataParser parser = new DataParser(); - string jsonText = parser.ParseToTWx(curParseMode, CurrentDatas, BPMs, new byte[] { (byte)ColorR.Value, (byte)ColorG.Value, (byte)ColorB.Value, (byte)ColorA.Value }); + string jsonText = parser.ParseToTWx(curParseMode, CurrentDatas, BPMs, new byte[] { (byte)ColorR.Value, (byte)ColorG.Value, (byte)ColorB.Value, (byte)ColorA.Value }, data); StreamWriter writer = new StreamWriter(ExportDialog.OpenFile()); writer.Write(jsonText); @@ -255,13 +430,17 @@ public class ListData public double Speed { get; set; } public int TickDistance { get; set; } public int EndType { get; set; } + public byte[] NoteColor { get; set; } public List SubPos { get; set; } public List SubTick { get; set; } + public List SubColor { get; set; } public ListData() { + NoteColor = new byte[4] { 255, 255, 255, 255 }; SubPos = new List(); SubTick = new List(); + SubColor = new List(4); } } diff --git a/ScrObjAnalyzer/Properties/Resources.Designer.cs b/ScrObjAnalyzer/Properties/Resources.Designer.cs index d85a867..101857b 100644 --- a/ScrObjAnalyzer/Properties/Resources.Designer.cs +++ b/ScrObjAnalyzer/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace ScrObjAnalyzer.Properties { // 클래스에서 자동으로 생성되었습니다. // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을 // 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/ScrObjAnalyzer/Properties/Settings.Designer.cs b/ScrObjAnalyzer/Properties/Settings.Designer.cs index 7938111..a89e1bb 100644 --- a/ScrObjAnalyzer/Properties/Settings.Designer.cs +++ b/ScrObjAnalyzer/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace ScrObjAnalyzer.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/ScrObjAnalyzer/ScrObjAnalyzer.csproj b/ScrObjAnalyzer/ScrObjAnalyzer.csproj index f4e4b85..804ad9d 100644 --- a/ScrObjAnalyzer/ScrObjAnalyzer.csproj +++ b/ScrObjAnalyzer/ScrObjAnalyzer.csproj @@ -22,6 +22,7 @@ DEBUG;TRACE prompt 4 + false AnyCPU @@ -31,6 +32,7 @@ TRACE prompt 4 + false diff --git a/ScrObjAnalyzer/TWxCore.cs b/ScrObjAnalyzer/TWxCore.cs index 10343bd..acc36c0 100644 --- a/ScrObjAnalyzer/TWxCore.cs +++ b/ScrObjAnalyzer/TWxCore.cs @@ -3,11 +3,12 @@ public class NoteData { public int version { get; } + public Metadata metadata { get; set; } public Note[] notes { get; set; } public NoteData() { - version = 1; + version = 2; } } @@ -43,7 +44,7 @@ public void CreateNote(int id, int size, byte[] color, int mode, int flick, doub Color = color; Mode = mode; Flick = flick; - Time = time; + Time = (float)time; Tick = tick; Speed = speed; StartLine = start; @@ -51,4 +52,17 @@ public void CreateNote(int id, int size, byte[] color, int mode, int flick, doub PrevIDs = prev; } } + + public class Metadata + { + public int level { get; set; } + public string artist { get; set; } + public string mapper { get; set; } + public int density { get; set; } + + public Metadata() + { + + } + } }