Exemple #1
0
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj, out BeatmapObjectContainer conflicting, bool removeConflicting = true)
    {
        UseChunkLoading = false;
        conflicting     = LoadedContainers.FirstOrDefault(x => x.objectData._time == obj._time &&
                                                          (obj as MapEvent)._type == (x.objectData as MapEvent)._type &&
                                                          (obj as MapEvent)._customData == (x.objectData as MapEvent)._customData
                                                          );
        if (conflicting != null && removeConflicting)
        {
            DeleteObject(conflicting);
        }
        BeatmapEventContainer beatmapEvent = BeatmapEventContainer.SpawnEvent(obj as MapEvent, ref eventPrefab, ref eventAppearanceSO);

        beatmapEvent.transform.SetParent(GridTransform);
        beatmapEvent.UpdateGridPosition();
        if (RingPropagationEditing && (obj as MapEvent)._type == MapEvent.EVENT_TYPE_RING_LIGHTS)
        {
            int pos = 0;
            if (!(obj._customData is null))
            {
                pos = obj._customData["_propID"].AsInt + 1;
            }
            Debug.Log(pos);
            beatmapEvent.transform.localPosition = new Vector3(pos + 0.5f, 0.5f, beatmapEvent.transform.localPosition.z);
        }
        LoadedContainers.Add(beatmapEvent);
        SelectionController.RefreshMap();
        return(beatmapEvent);
    }
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj, out BeatmapObjectContainer conflicting, bool removeConflicting = true, bool refreshMap = true)
    {
        UseChunkLoading = false;
        conflicting     = null;
        if (removeConflicting)
        {
            conflicting = LoadedContainers.FirstOrDefault(x => x.objectData._time == obj._time &&
                                                          (obj as MapEvent)._type == (x.objectData as MapEvent)._type &&
                                                          (obj as MapEvent)._customData == (x.objectData as MapEvent)._customData
                                                          );
            if (conflicting != null)
            {
                DeleteObject(conflicting, true, $"Conflicted with a newer object at time {obj._time}");
            }
        }
        BeatmapEventContainer beatmapEvent = BeatmapEventContainer.SpawnEvent(this, obj as MapEvent, ref eventPrefab, ref eventAppearanceSO, ref tracksManager);

        beatmapEvent.transform.SetParent(GridTransform);
        beatmapEvent.UpdateGridPosition();
        LoadedContainers.Add(beatmapEvent);
        if (refreshMap)
        {
            SelectionController.RefreshMap();
        }
        if (PropagationEditing)
        {
            UpdatePropagationMode();
        }
        return(beatmapEvent);
    }
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj, out BeatmapObjectContainer conflicting, bool removeConflicting = false, bool refreshMap = true)
    {
        UseChunkLoading = false;
        conflicting     = null;
        if (removeConflicting)
        {
            conflicting = LoadedContainers.FirstOrDefault(x => x.objectData._time == obj._time &&
                                                          (obj as MapEvent)._type == (x.objectData as MapEvent)._type &&
                                                          (obj as MapEvent)._customData == (x.objectData as MapEvent)._customData
                                                          );
            if (conflicting != null)
            {
                DeleteObject(conflicting, true, $"Conflicted with a newer object at time {obj._time}");
            }
        }
        BeatmapEventContainer beatmapEvent = BeatmapEventContainer.SpawnEvent(this, obj as MapEvent, ref eventPrefab, ref eventAppearanceSO, ref tracksManager);

        beatmapEvent.transform.SetParent(GridTransform);
        beatmapEvent.UpdateGridPosition();
        if (RingPropagationEditing && (obj as MapEvent)._type == MapEvent.EVENT_TYPE_RING_LIGHTS)
        {
            int pos = 0;
            if (!(obj._customData is null) && (obj._customData["_propID"].IsNumber))
            {
                pos = (obj._customData["_propID"]?.AsInt ?? -1) + 1;
            }
            beatmapEvent.transform.localPosition = new Vector3(pos + 0.5f, 0.5f, beatmapEvent.transform.localPosition.z);
        }
        LoadedContainers.Add(beatmapEvent);
        if (refreshMap)
        {
            SelectionController.RefreshMap();
        }
        if (RingPropagationEditing)
        {
            UpdateRingPropagationMode();
        }
        return(beatmapEvent);
    }