예제 #1
0
        public TrackData(byte[] file, int startByteIndex)
        {
            nextByteIndex = startByteIndex;

            int numberOfTracks = EOFUtility.bytesToInt32(file.Skip(nextByteIndex).Take(4).ToArray());

            nextByteIndex += 4;

            for (int i = 0; i < numberOfTracks; i++)
            {
                string format = getTrackFormat(file, nextByteIndex);

                // Available formats in EOF file description
                // 0=Global,1=Legacy,2=Vocal,3=Pro Keys,4=Pro Guitar/Bass,5=Variable Lane Legacy,...
                switch (format)
                {
                case "0":
                    GeneralTrack generalTrack = new GeneralTrack(file, ref nextByteIndex);
                    tracks.Add(generalTrack);
                    break;

                case "1":
                    LegacyTrack legacyTrack = new LegacyTrack(file, ref nextByteIndex);
                    tracks.Add(legacyTrack);
                    break;

                case "2":
                    VocalTrack vocalTrack = new VocalTrack(file, ref nextByteIndex);
                    tracks.Add(vocalTrack);
                    break;

                case "3":
                    ProKeysTrack proKeysTrack = new ProKeysTrack(file, ref nextByteIndex);
                    tracks.Add(proKeysTrack);
                    break;

                case "4":
                    ProGuitarTrack proGuitarTrack = new ProGuitarTrack(file, ref nextByteIndex);
                    tracks.Add(proGuitarTrack);
                    break;

                case "5":
                    LaneLegacyTrack laneLegacyTrack = new LaneLegacyTrack(file, ref nextByteIndex);
                    tracks.Add(laneLegacyTrack);
                    break;
                }
            }

            endByteIndex = nextByteIndex;
        }
예제 #2
0
        static public List <Game8_Sequencer.NoteData> getNotes()
        {
            {
                // Read file
                TextAsset asset = Resources.Load("notes_2") as TextAsset;
                byte[]    file  = asset.bytes;
                // byte[] file = File.ReadAllBytes("Assets/EditorOnFireFileParser/Resources/notes_2.eof");

                // Get file header
                char[] fileHeader = (from header in file.Take(8) select Convert.ToChar(header)).ToArray();

                // Get chart properties
                ChartProperties chartProperties = new ChartProperties(file);

                // Get song properties
                SongProperties songProperties = new SongProperties(file);

                // Get chart data
                ChartData chartData = new ChartData(file, songProperties.endByteIndex);

                // Get tracks data
                TrackData tracks = new TrackData(file, chartData.endByteIndex);

                LegacyTrack t = tracks.tracks.OfType <LegacyTrack>().ElementAt(0);

                List <Game8_Sequencer.NoteData> notes = new List <Game8_Sequencer.NoteData>();

                foreach (var note in t.notes)
                {
                    // For each lane in this note (one "note" can be one note on each 2 lanes for Deadly Riff) we add a note to the sequencer
                    for (int i = 0; i < 2; i++)
                    {
                        if (note.lanes[i])
                        {
                            // Convert from millisecond to second
                            if (note.length <= 1)
                            {
                                notes.Add(new Game8_Sequencer.NoteData((float)note.position / 1000, i, 0.0f));
                            }
                            else
                            {
                                notes.Add(new Game8_Sequencer.NoteData((float)note.position / 1000, i, (float)note.length / 1000));
                            }
                        }
                    }
                }

                return(notes);
            }
        }