Beispiel #1
0
 public override void SortObjects()
 {
     LoadedContainers = LoadedContainers.OrderBy(x => x.objectData._time).ThenBy(x => (x.objectData as BeatmapCustomEvent)?._type).ToList();
     customEventTypes = customEventTypes.OrderBy(x => x).ToList();
     RefreshTrack();
     UseChunkLoading = true;
 }
 public override void SortObjects()
 {
     LoadedContainers = LoadedContainers.OrderBy(x => x.objectData._time).ToList();
     foreach (BeatmapBPMChangeContainer con in LoadedContainers)
     {
         con.UpdateGridPosition();
     }
 }
Beispiel #3
0
 public void UpdateSwingArcVisualizer()
 {
     ShowArcVisualizer = !ShowArcVisualizer;
     foreach (BeatmapNoteContainer note in LoadedContainers.Cast <BeatmapNoteContainer>())
     {
         note.SetArcVisible(ShowArcVisualizer);
     }
 }
Beispiel #4
0
 /// <summary>
 /// Find the last <see cref="BeatmapBPMChange"/> before a given beat time.
 /// </summary>
 /// <param name="beatTimeInSongBPM">Time in raw beats (Unmodified by any BPM Changes)</param>
 /// <param name="inclusive">Whether or not to include <see cref="BeatmapBPMChange"/>s with the same time value.</param>
 /// <returns>The last <see cref="BeatmapBPMChange"/> before the given beat (or <see cref="null"/> if there is none).</returns>
 public BeatmapBPMChange FindLastBPM(float beatTimeInSongBPM, bool inclusive = true)
 {
     if (inclusive)
     {
         return(LoadedContainers.LastOrDefault(x => x.objectData._time <= beatTimeInSongBPM)?.objectData as BeatmapBPMChange ?? null);
     }
     return(LoadedContainers.LastOrDefault(x => x.objectData._time < beatTimeInSongBPM &&
                                           beatTimeInSongBPM - x.objectData._time > 0.01f)?.objectData as BeatmapBPMChange ?? null);
 }
Beispiel #5
0
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj)
    {
        BeatmapBPMChangeContainer beatmapBPMChange = BeatmapBPMChangeContainer.SpawnBPMChange(obj as BeatmapBPMChange, ref bpmPrefab);

        beatmapBPMChange.transform.SetParent(GridTransform);
        beatmapBPMChange.UpdateGridPosition();
        LoadedContainers.Add(beatmapBPMChange);
        return(beatmapBPMChange);
    }
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj, out BeatmapObjectContainer conflicting, bool removeConflicting = true)
    {
        conflicting = null;
        BeatmapBPMChangeContainer beatmapBPMChange = BeatmapBPMChangeContainer.SpawnBPMChange(obj as BeatmapBPMChange, ref bpmPrefab);

        beatmapBPMChange.transform.SetParent(GridTransform);
        beatmapBPMChange.UpdateGridPosition();
        LoadedContainers.Add(beatmapBPMChange);
        SelectionController.RefreshMap();
        return(beatmapBPMChange);
    }
Beispiel #7
0
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj, out BeatmapObjectContainer conflicting, bool removeConflicting = true)
    {
        conflicting = null;
        if (!customEventTypes.Contains((obj as BeatmapCustomEvent)?._type))
        {
            customEventTypes.Add((obj as BeatmapCustomEvent)?._type);
            RefreshTrack();
        }
        BeatmapCustomEventContainer beatmapCustomEvent = BeatmapCustomEventContainer.SpawnCustomEvent(obj as BeatmapCustomEvent, this, ref customEventPrefab);

        beatmapCustomEvent.transform.SetParent(GridTransform);
        beatmapCustomEvent.UpdateGridPosition();
        LoadedContainers.Add(beatmapCustomEvent);
        SelectionController.RefreshMap();
        return(beatmapCustomEvent);
    }
Beispiel #8
0
    public override void SortObjects()
    {
        LoadedContainers = LoadedContainers.OrderBy(x => x.objectData._time).ToList();
        uint id = 0;

        for (int i = 0; i < LoadedContainers.Count; i++)
        {
            if (LoadedContainers[i].objectData is BeatmapNote noteData)
            {
                noteData.id = id;
                LoadedContainers[i].gameObject.name = "Note " + id;
                id++;
            }
        }
        UseChunkLoading = true;
    }
Beispiel #9
0
    public override void SortObjects()
    {
        RefreshRenderers();
        LoadedContainers = LoadedContainers.OrderBy(x => x.objectData._time).ToList();
        uint id = 0;

        foreach (var t in LoadedContainers)
        {
            if (t.objectData is BeatmapObstacle noteData)
            {
                noteData.id       = id;
                t.gameObject.name = "Obstacle " + id;
                id++;
            }
        }
        UseChunkLoading = true;
    }
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj)
    {
        BeatmapObjectContainer conflicting = LoadedContainers.FirstOrDefault(x => x.objectData._time == obj._time &&
                                                                             (obj as BeatmapObstacle)._lineIndex == (x.objectData as BeatmapObstacle)._lineIndex &&
                                                                             (obj as BeatmapObstacle)._type == (x.objectData as BeatmapObstacle)._type
                                                                             );

        if (conflicting != null)
        {
            DeleteObject(conflicting);
        }
        BeatmapObstacleContainer beatmapObstacle = BeatmapObstacleContainer.SpawnObstacle(obj as BeatmapObstacle, AudioTimeSyncController, ref obstaclePrefab, ref obstacleAppearanceSO);

        beatmapObstacle.transform.SetParent(GridTransform);
        beatmapObstacle.UpdateGridPosition();
        LoadedContainers.Add(beatmapObstacle);
        return(beatmapObstacle);
    }
Beispiel #11
0
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj, out BeatmapObjectContainer conflicting, bool removeConflicting = true, bool refreshMap = true)
    {
        if (LoadedContainers.Count >= ShaderArrayMaxSize)
        {
            Debug.LogError("Something's wrong, I can feel it!\nMore BPM Changes are present then what Unity shaders allow!");
        }
        conflicting = null;
        BeatmapBPMChangeContainer beatmapBPMChange = BeatmapBPMChangeContainer.SpawnBPMChange(obj as BeatmapBPMChange, ref bpmPrefab);

        beatmapBPMChange.transform.SetParent(GridTransform);
        beatmapBPMChange.UpdateGridPosition();
        LoadedContainers.Add(beatmapBPMChange);
        if (refreshMap)
        {
            SelectionController.RefreshMap();
        }
        return(beatmapBPMChange);
    }
Beispiel #12
0
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj)
    {
        BeatmapObjectContainer conflicting = LoadedContainers.FirstOrDefault(x => x.objectData._time == obj._time &&
                                                                             (obj as BeatmapNote)._lineLayer == (x.objectData as BeatmapNote)._lineLayer &&
                                                                             (obj as BeatmapNote)._lineIndex == (x.objectData as BeatmapNote)._lineIndex
                                                                             );

        if (conflicting != null)
        {
            DeleteObject(conflicting);
        }
        BeatmapNoteContainer beatmapNote = BeatmapNoteContainer.SpawnBeatmapNote(obj as BeatmapNote, ref notePrefab, ref bombPrefab, ref noteAppearanceSO);

        beatmapNote.transform.SetParent(GridTransform);
        beatmapNote.UpdateGridPosition();
        LoadedContainers.Add(beatmapNote);
        return(beatmapNote);
    }
    public override void SortObjects()
    {
        obstacleRenderer = GridTransform.GetComponentsInChildren <Renderer>();
        LoadedContainers = LoadedContainers.OrderBy(x => x.objectData._time).ToList();
        uint id = 0;

        for (int i = 0; i < LoadedContainers.Count; i++)
        {
            if (LoadedContainers[i].objectData is BeatmapObstacle)
            {
                BeatmapObstacle noteData = (BeatmapObstacle)LoadedContainers[i].objectData;
                noteData.id = id;
                LoadedContainers[i].gameObject.name = "Obstacle " + id;
                id++;
            }
        }
        UseChunkLoading = true;
    }
Beispiel #14
0
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj, out BeatmapObjectContainer conflicting, bool removeConflicting = true)
    {
        conflicting = LoadedContainers.FirstOrDefault(x => x.objectData._time == obj._time &&
                                                      (obj as BeatmapNote)._lineLayer == (x.objectData as BeatmapNote)._lineLayer &&
                                                      (obj as BeatmapNote)._lineIndex == (x.objectData as BeatmapNote)._lineIndex &&
                                                      (obj as BeatmapNote)._type == (x.objectData as BeatmapNote)._type &&
                                                      ConflictingByTrackIDs(obj, x.objectData)
                                                      );
        if (conflicting != null && removeConflicting)
        {
            DeleteObject(conflicting);
        }
        BeatmapNoteContainer beatmapNote = BeatmapNoteContainer.SpawnBeatmapNote(obj as BeatmapNote, ref notePrefab, ref bombPrefab, ref noteAppearanceSO);

        beatmapNote.transform.SetParent(GridTransform);
        beatmapNote.UpdateGridPosition();
        LoadedContainers.Add(beatmapNote);
        SelectionController.RefreshMap();
        return(beatmapNote);
    }
Beispiel #15
0
    public override void SortObjects()
    {
        LoadedContainers = LoadedContainers.OrderBy(x => x.objectData._time)      //0 -> end of map
                           .ThenBy(x => (x.objectData as BeatmapNote)._lineLayer) //0 -> 2
                           .ThenBy(x => (x.objectData as BeatmapNote)._type)      //Red -> Blue -> Bomb
                           .ThenBy(x => (x.objectData as BeatmapNote)._lineIndex) //0 -> 3
                           .ToList();
        uint id = 0;

        for (int i = 0; i < LoadedContainers.Count; i++)
        {
            if (LoadedContainers[i].objectData is BeatmapNote noteData)
            {
                noteData.id = id;
                LoadedContainers[i].gameObject.name = "Note " + id;
                id++;
            }
        }
        UseChunkLoading = true;
    }
Beispiel #16
0
    public override void SortObjects()
    {
        LoadedContainers = LoadedContainers.OrderBy(x => x.objectData._time)    //0 -> end of map
                           .ThenBy(x => ((BeatmapNote)x.objectData)._lineLayer) //0 -> 2
                           .ThenBy(x => ((BeatmapNote)x.objectData)._lineIndex) //0 -> 3
                           .ThenBy(x => ((BeatmapNote)x.objectData)._type)      //Red -> Blue -> Bomb
                           .ToList();
        uint id = 0;

        foreach (var t in LoadedContainers)
        {
            if (t.objectData is BeatmapNote noteData)
            {
                noteData.id       = id;
                t.gameObject.name = "Note " + id;
                id++;
            }
        }
        UseChunkLoading = true;
    }
Beispiel #17
0
        public void AddReplacer(AssetsReplacer replacer, MemoryStream previewStream = null)
        {
            if (replacer == null)
            {
                return;
            }
            var forInstance = LoadedFiles[replacer.GetFileID()];
            var assetId     = new AssetID(forInstance.path, replacer.GetPathID());
            var index       = LoadedAssets.FindIndex(i => i.FileID == replacer.GetFileID() && i.PathID == replacer.GetPathID());
            var item        = LoadedAssets[index];

            if (NewAssets.ContainsKey(assetId))
            {
                RemoveReplacer(replacer);
            }

            NewAssets[assetId] = replacer;

            if (previewStream == null)
            {
                var newStream = new MemoryStream();
                var newWriter = new AssetsFileWriter(newStream);
                replacer.Write(newWriter);
                newStream.Position = 0;
                previewStream      = newStream;
            }

            NewAssetDatas[assetId] = previewStream;

            if (replacer is AssetsRemover)
            {
                LoadedContainers.Remove(assetId);
            }
            else
            {
                var cont = MakeAssetContainer(item, NewAssetDatas[assetId]);
                UpdateAssetInfo(cont, assetId, index);
            }

            Modified = true;
        }
Beispiel #18
0
        public AssetContainer GetAssetContainer(AssetItem item)
        {
            var fileInst = LoadedFiles[item.FileID];
            var assetId  = new AssetID(fileInst.path, item.PathID);

            if (!LoadedContainers.TryGetValue(assetId, out var cont))
            {
                return(null);
            }

            if (cont.HasInstance)
            {
                return(cont);
            }

            var newData = NewAssetDatas.ContainsKey(assetId);

            cont = newData ? MakeAssetContainer(item, NewAssetDatas[assetId]) : MakeAssetContainer(item);
            LoadedContainers[assetId] = cont;
            return(cont);
        }
Beispiel #19
0
    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);
    }
Beispiel #20
0
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj, out BeatmapObjectContainer conflicting, bool removeConflicting = true, bool refreshMap = true)
    {
        conflicting = null;
        if (removeConflicting)
        {
            conflicting = LoadedContainers.FirstOrDefault(x => x.objectData.ConvertToJSON() == obj.ConvertToJSON());
            if (conflicting != null)
            {
                DeleteObject(conflicting, true, $"Conflicted with a newer object at time {obj._time}");
            }
        }
        BeatmapObstacleContainer beatmapObstacle = BeatmapObstacleContainer.SpawnObstacle(obj as BeatmapObstacle, AudioTimeSyncController, tracksManager, ref obstaclePrefab, ref obstacleAppearanceSO);

        beatmapObstacle.transform.SetParent(GridTransform);
        beatmapObstacle.UpdateGridPosition();
        LoadedContainers.Add(beatmapObstacle);
        if (refreshMap)
        {
            SelectionController.RefreshMap();
        }
        return(beatmapObstacle);
    }
Beispiel #21
0
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj, out BeatmapObjectContainer conflicting, bool removeConflicting = true)
    {
        conflicting = null;
        if (removeConflicting)
        {
            conflicting = LoadedContainers.FirstOrDefault(x => x.objectData._time == obj._time &&
                                                          ((BeatmapNote)obj)._lineLayer == ((BeatmapNote)x.objectData)._lineLayer &&
                                                          ((BeatmapNote)obj)._lineIndex == ((BeatmapNote)x.objectData)._lineIndex &&
                                                          ((BeatmapNote)obj)._type == ((BeatmapNote)x.objectData)._type &&
                                                          ConflictingByTrackIDs(obj, x.objectData)
                                                          );
            if (conflicting != null)
            {
                DeleteObject(conflicting, true, $"Conflicted with a newer object at time {obj._time}");
            }
        }
        BeatmapNoteContainer beatmapNote = BeatmapNoteContainer.SpawnBeatmapNote(obj as BeatmapNote, AudioTimeSyncController, ref notePrefab, ref bombPrefab, ref noteAppearanceSO);

        beatmapNote.transform.SetParent(GridTransform);
        beatmapNote.UpdateGridPosition();
        LoadedContainers.Add(beatmapNote);
        List <BeatmapObjectContainer> highlighted = LoadedContainers.Where(x => x.OutlineVisible &&
                                                                           ((BeatmapNote)x.objectData)._type == ((BeatmapNote)obj)._type).ToList();

        foreach (BeatmapObjectContainer container in highlighted)
        {
            if (!SelectionController.IsObjectSelected(container))
            {
                container.OutlineVisible = false;
            }
        }
        if (Settings.Instance.HighlightLastPlacedNotes)
        {
            beatmapNote.SetOutlineColor(Color.magenta);
        }
        SelectionController.RefreshMap();
        return(beatmapNote);
    }
Beispiel #22
0
    public override BeatmapObjectContainer SpawnObject(BeatmapObject obj, out BeatmapObjectContainer conflicting, bool removeConflicting = true)
    {
        conflicting = null;
        if (removeConflicting)
        {
            conflicting = LoadedContainers.FirstOrDefault(x => x.objectData._time == obj._time &&
                                                          ((BeatmapObstacle)obj)._lineIndex == ((BeatmapObstacle)x.objectData)._lineIndex &&
                                                          ((BeatmapObstacle)obj)._type == ((BeatmapObstacle)x.objectData)._type &&
                                                          ConflictingByTrackIDs(obj, x.objectData)
                                                          );
            if (conflicting != null)
            {
                DeleteObject(conflicting, true, $"Conflicted with a newer object at time {obj._time}");
            }
        }
        BeatmapObstacleContainer beatmapObstacle = BeatmapObstacleContainer.SpawnObstacle(obj as BeatmapObstacle, AudioTimeSyncController, ref obstaclePrefab, ref obstacleAppearanceSO);

        beatmapObstacle.transform.SetParent(GridTransform);
        beatmapObstacle.UpdateGridPosition();
        LoadedContainers.Add(beatmapObstacle);
        SelectionController.RefreshMap();
        return(beatmapObstacle);
    }
Beispiel #23
0
 public override void SortObjects()
 {
     LoadedContainers = LoadedContainers.OrderBy(x => x.objectData._time).ToList();
     StartCoroutine(WaitUntilChunkLoad());
 }