public static void Write([NotNull] SourceScore score, [NotNull] TextWriter writer)
        {
            var template = new ScenarioScrObj();

            ScrObjLoader.LoadScenario(template, "Resources/Templates/blsymp_scenario_sobj_shtstr.txt");

            writer.WriteHeader();

            writer.WriteNotes(score, template);

            writer.WriteTexs();
            writer.WriteScenarioNote(0, "ap_st", template.ap_st);
            writer.WriteScenarioNote(0, "ap_pose", template.ap_pose);
            writer.WriteScenarioNote(0, "ap_end", template.ap_end);
            writer.WriteScenarioNote(0, "fine_ev", template.fine_ev);
        }
        internal static void LoadScenario([NotNull] ScenarioScrObj obj, [NotNull] string path)
        {
            var lines = File.ReadAllLines(path);

            var index = 8;

            //try {
            obj.scenario = ReadEventScenarioDataList(lines, ref index);
            obj.texs     = ReadTexTargetNameList(lines, ref index);
            obj.ap_st    = ReadEventScenarioData(lines, ref index, false);
            obj.ap_pose  = ReadEventScenarioData(lines, ref index, false);
            obj.ap_end   = ReadEventScenarioData(lines, ref index, false);
            obj.fine_ev  = ReadEventScenarioData(lines, ref index, false);
            //} catch (Exception ex) {
            //    Debug.LogError("Exception happend at line " + (index + 1).ToString());
            //    Debug.LogError(ex);
            //}
        }
        private static void WriteNotes([NotNull] this TextWriter writer, [NotNull] SourceScore score, [NotNull] ScenarioScrObj template)
        {
            var notes    = score.Notes;
            var noteList = new List <EventScenarioData>();

            var specialNote = notes.FirstOrDefault(n => n.Type == NoteType.Special);

            // Mofify time: the tap buttons animation before the special note (the big round note)
            if (specialNote != null)
            {
                noteList.AddRange(template.scenario);

                var animNote = noteList.Find(n => n.type == ScenarioNoteType.BeginTapButtonsAnimation);

                if (animNote != null)
                {
                    var specialNoteTime = ScoreCompileHelper.TicksToSeconds(specialNote.Ticks, score.Conductors);

                    animNote.absTime = specialNoteTime - 0.5f;
                    animNote.tick    = ScorePreprocessor.SecondsToTicks(animNote.absTime, score.Conductors);
                }

                // Modify time: second tap buttons appearing time (the one that is after the special note)
                var reappearNote = notes.FirstOrDefault(n => n.Ticks > specialNote.Ticks);

                if (reappearNote != null && animNote != null)
                {
                    var reaNote = noteList.Where(n => n.type == ScenarioNoteType.ShowTapButtons).Skip(1).FirstOrDefault();

                    if (reaNote != null)
                    {
                        var reappearNoteTime = ScoreCompileHelper.TicksToSeconds(reappearNote.Ticks, score.Conductors);

                        reaNote.absTime = reappearNoteTime - 0.8f;
                        reaNote.tick    = ScorePreprocessor.SecondsToTicks(reaNote.absTime, score.Conductors);
                    }
                }
            }

            noteList.Sort((n1, n2) => {
                var t = n1.tick.CompareTo(n2.tick);

                if (t != 0)
                {
                    return(t);
                }

                t = ((int)n1.type).CompareTo((int)n2.type);

                if (t != 0)
                {
                    return(t);
                }

                t = n1.idol.CompareTo(n2.idol);

                if (t != 0)
                {
                    return(t);
                }

                return(n1.track.CompareTo(n2.track));
            });

            writer.Write(@"EventScenarioData scenario
	Array Array
	int size = "    );
            writer.WriteLine(noteList.Count.ToString());

            for (var i = 0; i < noteList.Count; ++i)
            {
                var sn = noteList[i];

                writer.WriteLine("		[{0}]", i.ToString());
                writer.WriteScenarioNote(2, "data", sn);
            }
        }