Esempio n. 1
0
    public static void UpdateCacheList <T, U>(SongObjectCache <T> cache, List <U> objectsToCache)
        where U : SongObject
        where T : U
    {
        var cacheObjectList = cache.EditCache();

        cacheObjectList.Clear();
        cacheObjectList.AddRange(objectsToCache.OfType <T>());
    }
        public SongObjectTracker(SongObjectCache <T> objects, uint startTick)
        {
            this.objects = objects;

            // Skip ahead to where we're actually going to start
            int startIndex = SongObjectHelper.FindClosestPositionRoundedDown(startTick, objects);

            if (startIndex != SongObjectHelper.NOTFOUND)
            {
                currentIndex = startIndex;
            }
        }
Esempio n. 3
0
    /// <summary>
    /// Creates a new chart object.
    /// </summary>
    /// <param name="song">The song to associate this chart with.</param>
    /// <param name="name">The name of the chart (easy single, expert double guitar, etc.</param>
    public Chart(Song song, GameMode gameMode, string name = "")
    {
        _song         = song;
        _chartObjects = new List <ChartObject>();
        _gameMode     = gameMode;

        notes     = new SongObjectCache <Note>();       // new Note[0];
        starPower = new SongObjectCache <Starpower>();  // new Starpower[0];
        events    = new SongObjectCache <ChartEvent>(); // new ChartEvent[0];

        _note_count = 0;

        this.name = name;
    }
Esempio n. 4
0
    public static void UpdateCacheList <T, U>(SongObjectCache <T> cache, List <U> objectsToCache)
        where U : SongObject
        where T : U
    {
        var cacheObjectList = cache.EditCache();

        cacheObjectList.Clear();

        foreach (U objectToCache in objectsToCache)
        {
            if (objectToCache.GetType() == typeof(T))
            {
                cacheObjectList.Add(objectToCache as T);
            }
        }
    }
Esempio n. 5
0
    /// <summary>
    /// Default constructor for a new chart. Initialises all lists and adds locked bpm and timesignature objects.
    /// </summary>
    public Song()
    {
        AUDIO_INSTUMENT_COUNT = EnumX <AudioInstrument> .Count;
        DIFFICULTY_COUNT      = EnumX <Difficulty> .Count;

        _events    = new List <Event>();
        _syncTrack = new List <SyncTrack>();

        eventsAndSections = new ReadOnlyList <Event>(_events);
        syncTrack         = new ReadOnlyList <SyncTrack>(_syncTrack);

        events         = new SongObjectCache <Event>();
        sections       = new SongObjectCache <Section>();
        bpms           = new SongObjectCache <BPM>();
        timeSignatures = new SongObjectCache <TimeSignature>();

        audioSampleData  = new SampleData[AUDIO_INSTUMENT_COUNT];
        bassAudioStreams = new TempoStream[AUDIO_INSTUMENT_COUNT];
        audioLocations   = new string[AUDIO_INSTUMENT_COUNT];

        Add(new BPM());
        Add(new TimeSignature());

        // Chart initialisation
        int numberOfInstruments = EnumX <Instrument> .Count - 1;     // Don't count the "Unused" instrument

        charts = new Chart[numberOfInstruments * DIFFICULTY_COUNT];

        for (int i = 0; i < charts.Length; ++i)
        {
            Instrument instrument = (Instrument)(i / DIFFICULTY_COUNT);
            charts[i] = new Chart(this, instrument);
        }

        // Set the name of the chart
        foreach (Instrument instrument in EnumX <Instrument> .Values)
        {
            if (instrument == Instrument.Unrecognised)
            {
                continue;
            }

            string instrumentName = string.Empty;
            switch (instrument)
            {
            case (Instrument.Guitar):
                instrumentName += "Guitar - ";
                break;

            case (Instrument.GuitarCoop):
                instrumentName += "Guitar - Co-op - ";
                break;

            case (Instrument.Bass):
                instrumentName += "Bass - ";
                break;

            case (Instrument.Rhythm):
                instrumentName += "Rhythm - ";
                break;

            case (Instrument.Keys):
                instrumentName += "Keys - ";
                break;

            case (Instrument.Drums):
                instrumentName += "Drums - ";
                break;

            case (Instrument.GHLiveGuitar):
                instrumentName += "GHLive Guitar - ";
                break;

            case (Instrument.GHLiveBass):
                instrumentName += "GHLive Bass - ";
                break;

            default:
                continue;
            }

            foreach (Difficulty difficulty in EnumX <Difficulty> .Values)
            {
                GetChart(instrument, difficulty).name = instrumentName + difficulty.ToString();
            }
        }

        for (int i = 0; i < audioLocations.Length; ++i)
        {
            audioLocations[i] = string.Empty;
        }

        for (int i = 0; i < audioSampleData.Length; ++i)
        {
            audioSampleData[i] = new SampleData(string.Empty);
        }

        UpdateCache();
    }