Exemplo n.º 1
0
    private IEnumerator ConvertFromLegacy()
    {
        yield return(PersistentUI.Instance.FadeInLoadingScreen());

        var events = BeatmapObjectContainerCollection.GetCollectionForType <EventsContainer>(BeatmapObject.Type.EVENT);
        Dictionary <int, Color?> chromaColorsByEventType = new Dictionary <int, Color?>();

        foreach (var obj in events.UnsortedObjects.ToArray())
        {
            MapEvent e = obj as MapEvent;
            if (chromaColorsByEventType.TryGetValue(e._type, out Color? chroma))
            {
                if (e._value >= ColourManager.RGB_INT_OFFSET)
                {
                    chromaColorsByEventType[e._type] = ColourManager.ColourFromInt(e._value);
                    events.DeleteObject(e, false, false);
                    continue;
                }
                else if (e._value == ColourManager.RGB_RESET)
                {
                    chromaColorsByEventType[e._type] = null;
                    events.DeleteObject(e, false, false);
                    continue;
                }
                if (chroma != null && e._value != MapEvent.LIGHT_VALUE_OFF)
                {
                    e.GetOrCreateCustomData()["_color"] = chroma;
                }
            }
            else
            {
                chromaColorsByEventType.Add(e._type, null);
            }
        }
        events.RefreshPool(true);

        yield return(PersistentUI.Instance.FadeOutLoadingScreen());
    }