internal override void OnMouseOver() { if (Input.GetMouseButtonDown(2) && !KeybindsController.ShiftHeld) { if (eventData.IsUtilityEvent()) { return; } if (eventData._value > 4 && eventData._value < 8) { eventData._value -= 4; } else if (eventData._value > 0) { eventData._value += 4; } eventAppearance.SetEventAppearance(this); } else if (Input.GetAxis("Mouse ScrollWheel") != 0) { if (KeybindsController.AltHeld && (eventData._type == MapEvent.EVENT_TYPE_LEFT_LASERS_SPEED || eventData._type == MapEvent.EVENT_TYPE_RIGHT_LASERS_SPEED)) { eventData._value += (Input.GetAxis("Mouse ScrollWheel") > 0 ? -1 : 1); if (eventData._value < 0) { eventData._value = 0; } eventAppearance.SetEventAppearance(this); } } else { base.OnMouseOver(); } }
private void LevelLoaded() { noteAppearance.UpdateColor(redNote.color, blueNote.color); foreach (BeatmapObjectContainer con in BeatmapObjectContainerCollection.GetCollectionForType(BeatmapObject.Type.NOTE).LoadedContainers) { BeatmapNote note = (con.objectData as BeatmapNote); if (note._type != BeatmapNote.NOTE_TYPE_BOMB) { Color color = note._type == BeatmapNote.NOTE_TYPE_A ? redNote.color : blueNote.color; if (note._customData?.HasKey("_color") ?? false) { color = note._customData["_color"]; } (con as BeatmapNoteContainer).SetColor(color); } } foreach (BeatmapObjectContainer con in events.LoadedContainers) { eventAppearance.SetEventAppearance(con as BeatmapEventContainer, true, platform); } foreach (BeatmapObjectContainer con in obstacles.LoadedContainers) { obstacleAppearance.SetObstacleAppearance(con as BeatmapObstacleContainer, platform); } }
public void UpdateRedLight() { redLight.color = picker.CurrentColor; BeatSaberSongContainer.Instance.difficultyData.envColorLeft = picker.CurrentColor; platform.RedColor = picker.CurrentColor; foreach (BeatmapObjectContainer con in events.LoadedContainers) { eventAppearance.SetEventAppearance(con as BeatmapEventContainer); } }
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 void OnInvertEventValue(InputAction.CallbackContext context) { if (customStandaloneInputModule.IsPointerOverGameObject <GraphicRaycaster>(-1, true)) { return; } if (KeybindsController.AnyCriticalKeys) { return; } RaycastFirstObject(out BeatmapEventContainer e); if (e != null) { if (e.eventData.IsRotationEvent) { int?rotation = e.eventData.GetRotationDegreeFromValue(); if (rotation != null) { if (e.eventData._value >= 0 && e.eventData._value < MapEvent.LIGHT_VALUE_TO_ROTATION_DEGREES.Length) { e.eventData._value = MapEvent.LIGHT_VALUE_TO_ROTATION_DEGREES.ToList().IndexOf((rotation ?? 0) * -1); } else if (e.eventData._value >= 1000 && e.eventData._value <= 1720) //Invert Mapping Extensions rotation { e.eventData._value = 1720 - (e.eventData._value - 1000); } } eventAppearanceSO?.SetEventAppearance(e); tracksManager?.RefreshTracks(); return; } if (e.eventData.IsUtilityEvent) { return; } if (e.eventData._value > 4 && e.eventData._value < 8) { e.eventData._value -= 4; } else if (e.eventData._value > 0 && e.eventData._value <= 4) { e.eventData._value += 4; } eventAppearanceSO?.SetEventAppearance(e); } }
public static BeatmapEventContainer SpawnEvent(MapEvent data, ref GameObject prefab, ref EventAppearanceSO eventAppearanceSO) { BeatmapEventContainer container = Instantiate(prefab).GetComponent <BeatmapEventContainer>(); container.eventData = data; container.eventAppearance = eventAppearanceSO; eventAppearanceSO.SetEventAppearance(container); return(container); }
private void UpdateAppearance() { if (instantiatedContainer is null) { RefreshVisuals(); } instantiatedContainer.eventData = queuedData; eventAppearanceSO.SetEventAppearance(instantiatedContainer, false); }
private void UpdateAppearance() { if (instantiatedContainer is null) { return; } instantiatedContainer.eventData = queuedData; eventAppearanceSO.SetEventAppearance(instantiatedContainer); }
public void UpdateAppearance(BeatmapObjectContainer obj) { if (obj is BeatmapNoteContainer note) { note.Directionalize(note.mapNoteData._cutDirection); noteAppearance.SetNoteAppearance(note); } else if (obj is BeatmapEventContainer e) { eventAppearance.SetEventAppearance(e); } else if (obj is BeatmapObstacleContainer o) { obstacleAppearance.SetObstacleAppearance(o); } obj.UpdateGridPosition(); SelectionController.RefreshMap(); }
public void OnTweakEventValue(InputAction.CallbackContext context) { if (customStandaloneInputModule.IsPointerOverGameObject <GraphicRaycaster>(-1, true)) { return; } if (!KeybindsController.AltHeld) { return; } RaycastFirstObject(out BeatmapEventContainer e); if (e != null) { int modifier = context.ReadValue <float>() > 0 ? 1 : -1; 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); } }
public void UpdateAppearance(BeatmapObjectContainer obj) { switch (obj) { case BeatmapNoteContainer note: note.Directionalize(note.mapNoteData._cutDirection); noteAppearance.SetNoteAppearance(note); break; case BeatmapEventContainer e: eventAppearance.SetEventAppearance(e); break; case BeatmapObstacleContainer o: obstacleAppearance.SetObstacleAppearance(o); break; } tracksManager.RefreshTracks(); obj.UpdateGridPosition(); SelectionController.RefreshMap(); }
public void InvertEvent(BeatmapEventContainer e) { BeatmapObject original = BeatmapObject.GenerateCopy(e.objectData); if (e.eventData.IsRotationEvent) { int?rotation = e.eventData.GetRotationDegreeFromValue(); if (rotation != null) { if (e.eventData._value >= 0 && e.eventData._value < MapEvent.LIGHT_VALUE_TO_ROTATION_DEGREES.Length) { e.eventData._value = MapEvent.LIGHT_VALUE_TO_ROTATION_DEGREES.ToList().IndexOf((rotation ?? 0) * -1); } else if (e.eventData._value >= 1000 && e.eventData._value <= 1720) //Invert Mapping Extensions rotation { e.eventData._value = 1720 - (e.eventData._value - 1000); } tracksManager?.RefreshTracks(); } } else if (e.eventData.IsUtilityEvent) { return; } else { if (e.eventData._value > 4 && e.eventData._value < 8) { e.eventData._value -= 4; } else if (e.eventData._value > 0 && e.eventData._value <= 4) { e.eventData._value += 4; } } eventAppearanceSO?.SetEventAppearance(e); BeatmapActionContainer.AddAction(new BeatmapObjectModifiedAction(e.objectData, e.objectData, original)); }
public void Mirror() { if (!SelectionController.HasSelectedObjects()) { PersistentUI.Instance.DisplayMessage("Select stuff first!", PersistentUI.DisplayMessageType.BOTTOM); return; } foreach (BeatmapObjectContainer con in SelectionController.SelectedObjects) { if (con is BeatmapObstacleContainer obstacle) { bool precisionWidth = obstacle.obstacleData._width >= 1000; int __state = obstacle.obstacleData._lineIndex; if (__state > 3 || __state < 0 || precisionWidth) // thank you past me for this code { if (__state >= 1000 || __state <= -1000 || precisionWidth) // precision lineIndex { int newIndex = __state; if (newIndex <= -1000) // normalize index values, we'll fix them later { newIndex += 1000; } else if (newIndex >= 1000) { newIndex -= 1000; } else { newIndex = newIndex * 1000; //convert lineIndex to precision if not already } newIndex = (((newIndex - 2000) * -1) + 2000); //flip lineIndex int newWidth = obstacle.obstacleData._width; //normalize wall width if (newWidth < 1000) { newWidth = newWidth * 1000; } else { newWidth -= 1000; } newIndex = newIndex - newWidth; if (newIndex < 0) { //this is where we fix them newIndex -= 1000; } else { newIndex += 1000; } obstacle.obstacleData._lineIndex = newIndex; } else // state > -1000 || state < 1000 assumes no precision width { int mirrorLane = (((__state - 2) * -1) + 2); //flip lineIndex obstacle.obstacleData._lineIndex = mirrorLane - obstacle.obstacleData._width; //adjust for wall width } } con.UpdateGridPosition(); } else if (con is BeatmapNoteContainer note) { int __state = note.mapNoteData._lineIndex; // flip line index if (__state > 3 || __state < 0) // precision case { int newIndex = __state; if (newIndex <= -1000) // normalize index values, we'll fix them later { newIndex += 1000; } else if (newIndex >= 1000) { newIndex -= 1000; } newIndex = (((newIndex - 1500) * -1) + 1500); //flip lineIndex if (newIndex < 0) //this is where we fix them { newIndex -= 1000; } else { newIndex += 1000; } note.mapNoteData._lineIndex = newIndex; } else { int mirrorLane = (int)(((__state - 1.5f) * -1) + 1.5f); note.mapNoteData._lineIndex = mirrorLane; } con.UpdateGridPosition(); //flip colors if (note.mapNoteData is BeatmapChromaNote chroma) { note.mapNoteData = chroma.originalNote; //Revert Chroma status, then invert types } if (note.mapNoteData._type != BeatmapNote.NOTE_TYPE_BOMB) { note.mapNoteData._type = note.mapNoteData._type == BeatmapNote.NOTE_TYPE_A ? BeatmapNote.NOTE_TYPE_B : BeatmapNote.NOTE_TYPE_A; //flip cut direction horizontally if (CutDirectionToMirrored.ContainsKey(note.mapNoteData._cutDirection)) { note.mapNoteData._cutDirection = CutDirectionToMirrored[note.mapNoteData._cutDirection]; note.Directionalize(note.mapNoteData._cutDirection); } } noteAppearance.SetNoteAppearance(note); } else if (con is BeatmapEventContainer e) { if (e.eventData.IsUtilityEvent()) { return; } if (e.eventData._value > 4 && e.eventData._value < 8) { e.eventData._value -= 4; } else if (e.eventData._value > 0 && e.eventData._value <= 4) { e.eventData._value += 4; } eventAppearance.SetEventAppearance(e); } } SelectionController.RefreshMap(); }
public void Mirror() { if (!SelectionController.HasSelectedObjects()) { PersistentUI.Instance.DisplayMessage("Select stuff first!", PersistentUI.DisplayMessageType.BOTTOM); return; } foreach (BeatmapObjectContainer con in SelectionController.SelectedObjects) { if (con is BeatmapObstacleContainer obstacle) { bool precisionWidth = obstacle.obstacleData._width >= 1000; int __state = obstacle.obstacleData._lineIndex; if (__state >= 1000 || __state <= -1000 || precisionWidth) // precision lineIndex { int newIndex = __state; if (newIndex <= -1000) // normalize index values, we'll fix them later { newIndex += 1000; } else if (newIndex >= 1000) { newIndex -= 1000; } else { newIndex = newIndex * 1000; //convert lineIndex to precision if not already } newIndex = (((newIndex - 2000) * -1) + 2000); //flip lineIndex int newWidth = obstacle.obstacleData._width; //normalize wall width if (newWidth < 1000) { newWidth = newWidth * 1000; } else { newWidth -= 1000; } newIndex = newIndex - newWidth; if (newIndex < 0) { //this is where we fix them newIndex -= 1000; } else { newIndex += 1000; } obstacle.obstacleData._lineIndex = newIndex; } else // state > -1000 || state < 1000 assumes no precision width { int mirrorLane = (((__state - 2) * -1) + 2); //flip lineIndex obstacle.obstacleData._lineIndex = mirrorLane - obstacle.obstacleData._width; //adjust for wall width } con.UpdateGridPosition(); } else if (con is BeatmapNoteContainer note) { int __state = note.mapNoteData._lineIndex; // flip line index if (__state > 3 || __state < 0) // precision case { int newIndex = __state; if (newIndex <= -1000) // normalize index values, we'll fix them later { newIndex += 1000; } else if (newIndex >= 1000) { newIndex -= 1000; } newIndex = (((newIndex - 1500) * -1) + 1500); //flip lineIndex if (newIndex < 0) //this is where we fix them { newIndex -= 1000; } else { newIndex += 1000; } note.mapNoteData._lineIndex = newIndex; } else { int mirrorLane = (int)(((__state - 1.5f) * -1) + 1.5f); note.mapNoteData._lineIndex = mirrorLane; } con.UpdateGridPosition(); //flip colors if (note.mapNoteData is BeatmapChromaNote chroma) { note.mapNoteData = chroma.originalNote; //Revert Chroma status, then invert types } if (note.mapNoteData._type != BeatmapNote.NOTE_TYPE_BOMB) { note.mapNoteData._type = note.mapNoteData._type == BeatmapNote.NOTE_TYPE_A ? BeatmapNote.NOTE_TYPE_B : BeatmapNote.NOTE_TYPE_A; //flip cut direction horizontally if (CutDirectionToMirrored.ContainsKey(note.mapNoteData._cutDirection)) { note.mapNoteData._cutDirection = CutDirectionToMirrored[note.mapNoteData._cutDirection]; note.transform.localEulerAngles = BeatmapNoteContainer.Directionalize(note.mapNoteData); } } noteAppearance.SetNoteAppearance(note); } else if (con is BeatmapEventContainer e) { if (e.eventData.IsRotationEvent) { int?rotation = e.eventData.GetRotationDegreeFromValue(); if (rotation != null) { if (e.eventData._value >= 0 && e.eventData._value < MapEvent.LIGHT_VALUE_TO_ROTATION_DEGREES.Length) { e.eventData._value = MapEvent.LIGHT_VALUE_TO_ROTATION_DEGREES.ToList().IndexOf((rotation ?? 0) * -1); } else if (e.eventData._value >= 1000 && e.eventData._value <= 1720) //Invert Mapping Extensions rotation { e.eventData._value = 1720 - (e.eventData._value - 1000); } } eventAppearance?.SetEventAppearance(e); tracksManager?.RefreshTracks(); return; } if (e.eventData.IsUtilityEvent) { return; } if (e.eventData._value > 4 && e.eventData._value < 8) { e.eventData._value -= 4; } else if (e.eventData._value > 0 && e.eventData._value <= 4) { e.eventData._value += 4; } eventAppearance?.SetEventAppearance(e); } } SelectionController.RefreshMap(); }