/// <summary> /// Deletes a <see cref="BeatmapObject"/>. /// </summary> /// <param name="obj">To delete.</param> /// <param name="triggersAction">Whether or not it triggers a <see cref="BeatmapObjectDeletionAction"/></param> /// <param name="refreshesPool">Whether or not the pool will be refreshed as a result of this deletion.</param> /// <param name="comment">A comment that provides further description on why it was deleted.</param> public void DeleteObject(BeatmapObject obj, bool triggersAction = true, bool refreshesPool = true, string comment = "No comment.") { var removed = UnsortedObjects.Remove(obj); var removed2 = LoadedObjects.Remove(obj); if (removed && removed2) { //Debug.Log($"Deleting container with hash code {toDelete.GetHashCode()}"); SelectionController.Deselect(obj, triggersAction); if (triggersAction) { BeatmapActionContainer.AddAction(new BeatmapObjectDeletionAction(obj, comment)); } RecycleContainer(obj); if (refreshesPool) { RefreshPool(); } OnObjectDelete(obj); } else { // The objects are not in the collection, but are still being removed. // This could be because of ghost blocks, so let's try forcefully recycling that container. Debug.LogError($"Object could not be deleted, please report this ({removed}, {removed2})"); } }
//We don't need to check index as that's already done further up the chain void DespawnCallback(bool initial, int index, BeatmapObject objectData) { if (LoadedContainers.ContainsKey(objectData)) { RecycleContainer(objectData); } }
//We don't need to check index as that's already done further up the chain void SpawnCallback(bool initial, int index, BeatmapObject objectData) { if (!LoadedContainers.ContainsKey(objectData)) { CreateContainerFromPool(objectData); } }
private void EventPassed(bool initial, int index, BeatmapObject data) { if (!readyToGo || !IsActive) { return; } MapEvent e = data as MapEvent; if (!e.IsUtilityEvent()) { OscMessage message = new OscMessage(); message.address = $"/CM_EventType{e._type}"; if (e._value >= ColourManager.RGB_INT_OFFSET) { Color color = ColourManager.ColourFromInt(e._value); message.values.Add(color.r); message.values.Add(color.g); message.values.Add(color.b); } else { message.values.Add(e._value); } osc?.Send(message); } }
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 = true, bool refreshMap = 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); if (refreshMap) { SelectionController.RefreshMap(); } return(beatmapObstacle); }
private void HandleTrackAssign(string res) { if (res is null) { return; } if (res == "") { foreach (BeatmapObjectContainer obj in SelectedObjects) { if (obj.objectData._customData == null) { continue; } BeatmapObject copy = BeatmapObject.GenerateCopy(obj.objectData); copy._customData.Remove("track"); obj.objectData = copy; } } foreach (BeatmapObjectContainer obj in SelectedObjects) { BeatmapObject copy = BeatmapObject.GenerateCopy(obj.objectData); if (copy._customData == null) { copy._customData = new SimpleJSON.JSONObject(); } copy._customData["track"] = res; obj.objectData = copy; } }
public void triggerArm(BeatmapNote note, NotesContainer container) { //Ignore bombs here to improve performance. if (!Settings.Instance.BongoBoye || note._type == BeatmapNote.NOTE_TYPE_BOMB) { return; } BeatmapObject next = container.UnsortedObjects.Find(x => x._time > note._time && ((BeatmapNote)x)._type == note._type); float timer = 0.125f; if (!(next is null)) { float half = container.AudioTimeSyncController.GetSecondsFromBeat((next._time - note._time) / 2f); timer = next != null?Mathf.Clamp(half, 0.05f, 0.2f) : 0.125f; // clamp to accommodate sliders and long gaps between notes } switch (note._type) { case BeatmapNote.NOTE_TYPE_A: Larm = true; LarmTimeout = timer; break; case BeatmapNote.NOTE_TYPE_B: Rarm = true; RarmTimeout = timer; break; } }
/// <summary> /// Pastes any copied objects into the map, selecting them immediately. /// </summary> public void Paste(bool triggersAction = true) { DeselectAll(); CopiedObjects = new HashSet <BeatmapObject>(CopiedObjects.OrderBy(x => x._time)); HashSet <BeatmapObjectContainer> pasted = new HashSet <BeatmapObjectContainer>(); foreach (BeatmapObject data in CopiedObjects) { if (data == null) { continue; } float newTime = data._time + atsc.CurrentBeat; BeatmapObject newData = BeatmapObject.GenerateCopy(data); newData._time = newTime; BeatmapObjectContainer pastedContainer = collections.Where(x => x.ContainerType == newData.beatmapType).FirstOrDefault()?.SpawnObject(newData, out _); pastedContainer.UpdateGridPosition(); Select(pastedContainer, true, false, false); pasted.Add(pastedContainer); } if (triggersAction) { BeatmapActionContainer.AddAction(new SelectionPastedAction(pasted, CopiedObjects, atsc.CurrentBeat)); } RefreshSelectionMaterial(false); RefreshMap(); tracksManager.RefreshTracks(); if (eventPlacement.objectContainerCollection.RingPropagationEditing) { eventPlacement.objectContainerCollection.RingPropagationEditing = eventPlacement.objectContainerCollection.RingPropagationEditing; } Debug.Log("Pasted!"); }
public void TweakValue(BeatmapEventContainer e, int modifier) { BeatmapObject original = BeatmapObject.GenerateCopy(e.objectData); e.eventData._value += modifier; if (e.eventData._value == 4 && !e.eventData.IsUtilityEvent) { e.eventData._value += modifier; } if (e.eventData._value < 0) { e.eventData._value = 0; } if (!e.eventData.IsLaserSpeedEvent) { if (e.eventData._value > 7) { e.eventData._value = 7; } } if (e.eventData.IsRotationEvent) { tracksManager?.RefreshTracks(); } eventAppearanceSO.SetEventAppearance(e); BeatmapActionContainer.AddAction(new BeatmapObjectModifiedAction(e.objectData, e.objectData, original)); }
public override void Redo(BeatmapActionContainer.BeatmapActionParams param) { containers[0].objectData = BeatmapObject.GenerateCopy(editedData); param.nodeEditor.ObjectWasSelected(containers[0]); param.nodeEditor.UpdateAppearance(containers[0]); param.tracksManager.RefreshTracks(); }
public void NodeEditor_EndEdit(string nodeText) { CMInputCallbackInstaller.ClearDisabledActionMaps(new[] { typeof(CMInput.INodeEditorActions) }); try { if (!isEditing || !IsActive || SelectionController.SelectedObjects.Count != 1) { return; } JSONNode newNode = JSON.Parse(nodeText); //Parse JSON, and do some basic checks. if (string.IsNullOrEmpty(newNode.ToString())) //Damn you Jackz { throw new Exception("Invalid JSON!\n\nCheck to make sure the node is not empty."); } if (string.IsNullOrEmpty(newNode["_time"])) { throw new Exception("Invalid JSON!\n\nEvery object needs a \"_time\" value!"); } //From this point on, its the mappers fault for whatever shit happens from JSON. BeatmapObject original = BeatmapObject.GenerateCopy(editingContainer.objectData); editingContainer.objectData = Activator.CreateInstance(editingContainer.objectData.GetType(), new object[] { newNode }) as BeatmapObject; BeatmapActionContainer.AddAction(new NodeEditorUpdatedNodeAction(editingContainer, editingContainer.objectData, original)); UpdateAppearance(editingContainer); isEditing = false; } catch (Exception e) { PersistentUI.Instance.ShowDialogBox(e.Message, null, PersistentUI.DialogBoxPresetType.Ok); } }
internal override void ApplyToMap() { queuedData._time = (instantiatedContainer.transform.position.z / EditorScaleController.EditorScale) + atsc.CurrentBeat; if ((KeybindsController.AltHeld || (Settings.Instance.PlaceOnlyChromaEvents && Settings.Instance.PlaceChromaEvents)) && !queuedData.IsUtilityEvent()) // no more laser speed events gone wack { MapEvent justChroma = BeatmapObject.GenerateCopy(queuedData); justChroma._value = ColourManager.ColourToInt(colorPicker.CurrentColor); BeatmapEventContainer container = objectContainerCollection.SpawnObject(justChroma) as BeatmapEventContainer; BeatmapActionContainer.AddAction(new BeatmapEventPlacementAction(container, null)); SelectionController.RefreshMap(); queuedData = BeatmapObject.GenerateCopy(queuedData); return; } BeatmapEventContainer spawned = objectContainerCollection.SpawnObject(BeatmapObject.GenerateCopy(queuedData)) as BeatmapEventContainer; BeatmapEventContainer chroma = null; if (Settings.Instance.PlaceChromaEvents && !queuedData.IsUtilityEvent() && (queuedValue != MapEvent.LIGHT_VALUE_OFF)) // off events arent affected by chroma blocks, no need to create extra ones { MapEvent chromaData = BeatmapObject.GenerateCopy(queuedData); chromaData._time -= 1 / 64f; chromaData._value = ColourManager.ColourToInt(colorPicker.CurrentColor); chroma = objectContainerCollection.SpawnObject(chromaData) as BeatmapEventContainer; } BeatmapActionContainer.AddAction(new BeatmapEventPlacementAction(spawned, chroma)); SelectionController.RefreshMap(); queuedData = BeatmapObject.GenerateCopy(queuedData); }
public override void Undo(BeatmapActionContainer.BeatmapActionParams param) { BeatmapObject copy = BeatmapObject.GenerateCopy(data); switch (data.beatmapType) { case BeatmapObject.Type.NOTE: container = param.notes.SpawnObject(copy); break; case BeatmapObject.Type.BOMB: container = param.notes.SpawnObject(copy); break; case BeatmapObject.Type.CUSTOM_NOTE: container = param.notes.SpawnObject(copy); break; case BeatmapObject.Type.OBSTACLE: container = param.obstacles.SpawnObject(copy); break; case BeatmapObject.Type.EVENT: container = param.events.SpawnObject(copy); break; case BeatmapObject.Type.CUSTOM_EVENT: container = param.events.SpawnObject(copy); break; } }
protected override void UpdateContainerData(BeatmapObjectContainer con, BeatmapObject obj) { BeatmapObstacleContainer obstacle = con as BeatmapObstacleContainer; if (!obstacle.IsRotatedByNoodleExtensions) { Track track = tracksManager.GetTrackAtTime(obj._time); track.AttachContainer(con); } foreach (Material mat in obstacle.ModelMaterials) { mat.SetFloat("_CircleRadius", EditorScaleController.EditorScale * 2); if (!mat.HasProperty("_OutsideAlpha")) { continue; } if (AudioTimeSyncController.IsPlaying) { mat.SetFloat("_OutsideAlpha", 0); } else { mat.SetFloat("_OutsideAlpha", mat.GetFloat("_MainAlpha")); } } obstacleAppearanceSO.SetObstacleAppearance(obstacle); }
public void MoveSelection(float beats, bool snapObjects = false) { List <BeatmapAction> allActions = new List <BeatmapAction>(); foreach (BeatmapObject data in SelectedObjects) { BeatmapObjectContainerCollection collection = BeatmapObjectContainerCollection.GetCollectionForType(data.beatmapType); BeatmapObject original = BeatmapObject.GenerateCopy(data); collection.LoadedObjects.Remove(data); data._time += beats; if (snapObjects) { data._time = Mathf.Round(beats / (1f / atsc.gridMeasureSnapping)) * (1f / atsc.gridMeasureSnapping); } collection.LoadedObjects.Add(data); if (collection.LoadedContainers.TryGetValue(data, out BeatmapObjectContainer con)) { con.UpdateGridPosition(); } if (collection is NotesContainer notesContainer) { notesContainer.RefreshSpecialAngles(original, false, false); notesContainer.RefreshSpecialAngles(data, false, false); } allActions.Add(new BeatmapObjectModifiedAction(data, data, original, "", true)); } BeatmapActionContainer.AddAction(new ActionCollectionAction(allActions, true, true, "Shifted a selection of objects.")); BeatmapObjectContainerCollection.RefreshAllPools(); }
public void Paint() { List <BeatmapAction> allActions = new List <BeatmapAction>(); foreach (var obj in SelectionController.SelectedObjects) { if (obj is BeatmapBPMChange || obj is BeatmapCustomEvent) { continue; //These should probably not be colored. } var beforePaint = BeatmapObject.GenerateCopy(obj); if (DoPaint(obj)) { allActions.Add(new BeatmapObjectModifiedAction(obj, obj, beforePaint, "a", true)); } } if (allActions.Count == 0) { return; } foreach (var unique in SelectionController.SelectedObjects.DistinctBy(x => x.beatmapType)) { BeatmapObjectContainerCollection.GetCollectionForType(unique.beatmapType).RefreshPool(true); } BeatmapActionContainer.AddAction(new ActionCollectionAction(allActions, true, true, "Painted a selection of objects.")); }
/// <summary> /// Copies the current selection for later Pasting. /// </summary> /// <param name="cut">Whether or not to delete the original selection after copying them.</param> public void Copy(bool cut = false) { if (!HasSelectedObjects()) { return; } CopiedObjects.Clear(); float firstTime = SelectedObjects.OrderBy(x => x._time).First()._time; foreach (BeatmapObject data in SelectedObjects) { BeatmapObjectContainerCollection collection = BeatmapObjectContainerCollection.GetCollectionForType(data.beatmapType); if (collection.LoadedContainers.TryGetValue(data, out BeatmapObjectContainer con)) { con.SetOutlineColor(instance.copiedColor); } BeatmapObject copy = BeatmapObject.GenerateCopy(data); copy._time -= firstTime; CopiedObjects.Add(copy); } if (cut) { Delete(); } var bpmChanges = BeatmapObjectContainerCollection.GetCollectionForType <BPMChangesContainer>(BeatmapObject.Type.BPM_CHANGE); BeatmapBPMChange lastBPMChange = bpmChanges.FindLastBPM(atsc.CurrentBeat, true); copiedBPM = lastBPMChange?._BPM ?? atsc.song.beatsPerMinute; }
/// <summary> /// Selects objects between 2 objects, sorted by group. /// </summary> /// <param name="first">The beatmap object at the one end of the selection.</param> /// <param name="second">The beatmap object at the other end of the selection</param> /// <param name="AddsToSelection">Whether or not previously selected objects will deselect before selecting this object.</param> /// <param name="AddActionEvent">If an action event to undo the selection should be made</param> public static void SelectBetween(BeatmapObject first, BeatmapObject second, bool AddsToSelection = false, bool AddActionEvent = true) { if (!AddsToSelection) { DeselectAll(); //This SHOULD deselect every object unless you otherwise specify, but it aint working. } if (first._time > second._time) { (first, second) = (second, first); } GetObjectTypes(new BeatmapObject[] { first, second }, out bool hasNoteOrObstacle, out bool hasEvent, out bool hasBpmChange); ForEachObjectBetweenTimeByGroup(first._time, second._time, hasNoteOrObstacle, hasEvent, hasBpmChange, (collection, beatmapObject) => { if (SelectedObjects.Contains(beatmapObject)) { return; } SelectedObjects.Add(beatmapObject); if (collection.LoadedContainers.TryGetValue(beatmapObject, out BeatmapObjectContainer container)) { container.SetOutlineColor(instance.selectedColor); } if (AddActionEvent) { ObjectWasSelectedEvent.Invoke(beatmapObject); } }); if (AddActionEvent) { SelectionChangedEvent?.Invoke(); } }
/// <summary> /// Pastes any copied objects into the map, selecting them immediately. /// </summary> public void Paste(bool triggersAction = true) { DeselectAll(); CopiedObjects = CopiedObjects.OrderBy((x) => x._time).ToList(); List <BeatmapObjectContainer> pasted = new List <BeatmapObjectContainer>(); foreach (BeatmapObject data in CopiedObjects) { if (data == null) { continue; } float newTime = data._time + atsc.CurrentBeat; BeatmapObject newData = BeatmapObject.GenerateCopy(data); newData._time = newTime; BeatmapObjectContainer pastedContainer = collections.Where(x => x.ContainerType == newData.beatmapType).FirstOrDefault()?.SpawnObject(newData, out _); pasted.Add(pastedContainer); } if (triggersAction) { BeatmapActionContainer.AddAction(new SelectionPastedAction(pasted, CopiedObjects, atsc.CurrentBeat)); } foreach (BeatmapObjectContainer obj in pasted) { Select(obj, true, false); } RefreshSelectionMaterial(false); RefreshMap(); Debug.Log("Pasted!"); }
/// <summary> /// Copies the current selection for later Pasting. /// </summary> /// <param name="cut">Whether or not to delete the original selection after copying them.</param> public void Copy(bool cut = false) { Debug.Log("Copied!"); CopiedObjects.Clear(); SelectedObjects = SelectedObjects.OrderBy(x => x.objectData._time).ToList(); float firstTime = SelectedObjects.First().objectData._time; foreach (BeatmapObjectContainer con in SelectedObjects) { BeatmapObject data = null; if (con.objectData is BeatmapNote) { data = new BeatmapNote(con.objectData.ConvertToJSON()); } if (con.objectData is BeatmapObstacle) { data = new BeatmapObstacle(con.objectData.ConvertToJSON()); } if (con.objectData is MapEvent) { data = new MapEvent(con.objectData.ConvertToJSON()); } data._time = con.objectData._time - firstTime; CopiedObjects.Add(data); List <Material> containerMaterials = con.gameObject.GetComponentInChildren <MeshRenderer>().materials.ToList(); containerMaterials.Last().SetColor("_OutlineColor", instance.copiedColor); } if (cut) { Delete(); } }
public void OnSelectObjects(InputAction.CallbackContext context) { if (customStandaloneInputModule.IsPointerOverGameObject <GraphicRaycaster>(-1, true) || ObstaclePlacement.IsPlacing) { return; } isSelecting = context.performed; if (context.performed) { timeWhenFirstSelecting = Time.time; RaycastFirstObject(out T firstObject); if (firstObject == null) { return; } BeatmapObject obj = firstObject.objectData; if (massSelect && SelectionController.SelectedObjects.Count() == 1 && SelectionController.SelectedObjects.First() != obj) { SelectionController.SelectBetween(SelectionController.SelectedObjects.First(), obj, true); } else if (SelectionController.IsObjectSelected(obj)) { SelectionController.Deselect(obj); firstObject.SelectionStateChanged = true; } else if (!SelectionController.IsObjectSelected(obj)) { SelectionController.Select(obj, true); firstObject.SelectionStateChanged = true; } } }
private void EventPassed(bool initial, int index, BeatmapObject data) { if (!readyToGo || !IsActive) { return; } MapEvent e = data as MapEvent; if (!e.IsUtilityEvent()) //Filter out Ring Spin, Ring Zoom, and Laser Speeds { List <OscMessage> messages = new List <OscMessage>(); //Collection of messages to mass send OscMessage mainMessage = new OscMessage(); mainMessage.address = $"/pb/{e._type}/{e._value}"; messages.Add(mainMessage); if (e._value >= ColourManager.RGB_INT_OFFSET) //If we have a Chroma event in our hands... { Color color = ColourManager.ColourFromInt(e._value); //Grab Chroma color from data OscMessage r = new OscMessage(); OscMessage g = new OscMessage(); //We hvae to make a new message for each RGB value, yay! OscMessage b = new OscMessage(); r.address = $"/exec/\"R\"/{color.r}"; //Color values are floats from 0-1 g.address = $"/exec/\"G\"/{color.g}"; b.address = $"/exec/\"B\"/{color.b}"; messages.AddRange(new List <OscMessage>() { r, g, b }); //Smack these guys into our messages list } foreach (OscMessage message in messages) { osc?.Send(message); //Send those guys down the pipe. } } }
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._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, ref notePrefab, ref bombPrefab, ref noteAppearanceSO); beatmapNote.transform.SetParent(GridTransform); beatmapNote.UpdateGridPosition(); LoadedContainers.Add(beatmapNote); if (Settings.Instance.HighlightLastPlacedNotes) { beatmapNote.SetOutlineColor(Color.magenta); } if (refreshMap) { SelectionController.RefreshMap(); } return(beatmapNote); }
public override IEnumerable <MapEvent> StrobePassForLane(IEnumerable <MapEvent> original, int type, EventsContainer.PropMode propMode, JSONNode propID) { List <MapEvent> generatedObjects = new List <MapEvent>(); IEnumerable <MapEvent> nonGradients = original.Where(x => x._lightGradient == null); for (int i = 0; i < nonGradients.Count() - 1; i++) { MapEvent currentChroma = nonGradients.ElementAt(i); MapEvent nextChroma = nonGradients.ElementAt(i + 1); MapEvent generated = BeatmapObject.GenerateCopy(currentChroma); generated._lightGradient = new MapEvent.ChromaGradient( currentChroma._customData["_color"], //Start color nextChroma._customData["_color"], //End color nextChroma._time - currentChroma._time, //Duration easing); //Duration generated._customData.Remove("_color"); generatedObjects.Add(generated); } generatedObjects.Add(BeatmapObject.GenerateCopy(original.Last())); return(generatedObjects); }
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 void EventPassed(bool initial, int index, BeatmapObject obj) { MapEvent e = obj as MapEvent; //Two events at the same time should yield same results System.Random rng = new System.Random(Mathf.RoundToInt(obj._time * 100)); switch (e._type) //FUN PART BOIS { case 8: if (obj._customData?.HasKey("_nameFilter") ?? false) { string filter = obj._customData["_nameFilter"]; if (filter.Contains("Big") || filter.Contains("Large")) { BigRingManager?.HandleRotationEvent(obj._customData); } else if (filter.Contains("Small")) { SmallRingManager?.HandleRotationEvent(obj._customData); } else { BigRingManager?.HandleRotationEvent(obj._customData); SmallRingManager?.HandleRotationEvent(obj._customData); } } else { BigRingManager?.HandleRotationEvent(obj._customData); SmallRingManager?.HandleRotationEvent(obj._customData); } break; case 9: BigRingManager?.HandlePositionEvent(); SmallRingManager?.HandlePositionEvent(); break; case 12: foreach (RotatingLights l in LightingManagers[MapEvent.EVENT_TYPE_LEFT_LASERS].RotatingLights) { l.UpdateOffset(e._value, rng.Next(0, 180), rng.Next(0, 1) == 1, obj._customData); } break; case 13: foreach (RotatingLights r in LightingManagers[MapEvent.EVENT_TYPE_RIGHT_LASERS].RotatingLights) { r.UpdateOffset(e._value, rng.Next(0, 180), rng.Next(0, 1) == 1, obj._customData); } break; default: if (e._type < LightingManagers.Length && LightingManagers[e._type] != null) { HandleLights(LightingManagers[e._type], e._value, e); } break; } }
public override void Undo(BeatmapActionContainer.BeatmapActionParams param) { foreach (BeatmapObjectContainer obj in containers) { BeatmapObject copy = BeatmapObject.GenerateCopy(obj.objectData); param.collections.Where(x => x.ContainerType == copy.beatmapType).FirstOrDefault()?.SpawnObject(copy, out _); } }
public BeatmapEventDeletionAction(BeatmapEventContainer placedEvent, BeatmapEventContainer chroma) : base(placedEvent) { chromaEvent = chroma; if (chroma != null) { chromaData = chromaEvent.eventData; } }
/// <summary> /// Determines if this object is found to be conflicting with <paramref name="other"/>. /// </summary> /// <param name="other">Other object to check if they're conflicting.</param> /// <returns>Whether or not they are conflicting with each other.</returns> public virtual bool IsConflictingWith(BeatmapObject other, bool deletion = false) { if (Mathf.Abs(_time - other._time) < BeatmapObjectContainerCollection.Epsilon) { return(IsConflictingWithObjectAtSameTime(other, deletion)); } return(false); }