public void UpdateSlice(Vector3 cutPoint, Vector3 cutPlaneNormal, NoteCutDirection noteDirectionType) { cutPoint = new Vector3(cutPoint.x, cutPoint.y); Vector3 uiCutPoint = cutPoint * _uiScale * _cutLineSensitivity; Vector3 cutDirection = new Vector3(-cutPlaneNormal.y, cutPlaneNormal.x).normalized; float cutRotation = Mathf.Atan2(cutDirection.y, cutDirection.x) * Mathf.Rad2Deg; float noteArrowAlpha = noteDirectionType >= NoteCutDirection.Any ? 0f : _noteArrowAlpha; _noteArrowImage.color = new Color(1f, 1f, 1f, noteArrowAlpha); float noteRotation = RotationFromNoteCutDirection(noteDirectionType); SetBackgroundRotation(noteRotation); _sliceTransform.localPosition = uiCutPoint; _sliceTransform.localRotation = Quaternion.Euler(0f, 0f, cutRotation); bool isCenterIsLeft = IsCenterLeftOfCut(cutPlaneNormal, cutPoint); float missedAreaRotation = cutRotation - noteRotation + (isCenterIsLeft ? 180f : 0f); float cutPointDistance = cutPoint.magnitude; _cutOffsetTransform.sizeDelta = new Vector2(_cutOffsetTransform.rect.width, cutPointDistance * _uiScale * _cutLineSensitivity); _cutOffsetTransform.localRotation = Quaternion.Euler(0f, 0f, missedAreaRotation); _timeSinceSliced = 0f; _isAlive = true; }
private static void Postfix(NoteCutDirection noteCutDirection, ref Vector3 __result) { if (!Plugin.active) { return; } switch ((int)noteCutDirection) { case >= 1000 and <= 1360: { var quaternion = default(Quaternion); quaternion.eulerAngles = new Vector3(0f, 0f, 1000 - (int)noteCutDirection); __result = quaternion * Vector3.down; break; } case >= 2000 and <= 2360: { var quaternion = default(Quaternion); quaternion.eulerAngles = new Vector3(0f, 0f, 2000 - (int)noteCutDirection); __result = quaternion * Vector3.down; break; } } }
private float RotationFromNoteCutDirection(NoteCutDirection cutDirection) { if (!_shouldRotateUIWithNote) { return(0f); } switch (cutDirection) { case NoteCutDirection.Down: return(0f); case NoteCutDirection.DownRight: return(45f); case NoteCutDirection.Right: return(90f); case NoteCutDirection.UpRight: return(135f); case NoteCutDirection.Up: return(180f); case NoteCutDirection.UpLeft: return(225f); case NoteCutDirection.Left: return(270f); case NoteCutDirection.DownLeft: return(315f); default: return(0f); } }
static void Postfix(NoteCutDirection cutDirection, ref Vector2 __result) { if (!Plugin.active) { return; } if ((int)cutDirection >= 1000 && (int)cutDirection <= 1360) { int angle = 1000 - (int)cutDirection; var quaternion = default(Quaternion); quaternion.eulerAngles = new Vector3(0f, 0f, 1000 - (int)cutDirection); Vector3 dir = quaternion * Vector3.forward; __result = new Vector2(dir.x, dir.y); Debug.Log(__result); return; } if ((int)cutDirection >= 2000 && (int)cutDirection <= 2360) { int angle = 2000 - (int)cutDirection; var quaternion = default(Quaternion); quaternion.eulerAngles = new Vector3(0f, 0f, 2000 - (int)cutDirection); Vector3 dir = quaternion * Vector3.forward; __result = new Vector2(dir.x, dir.y); Debug.Log(__result); return; } }
public void AddNote(NoteData note) { if (_notes.Count == 0) { SwingDirection = note.cutDirection; } _notes.Add(note); }
public static void GetBasicCutInfo(ref NoteCutDirection cutDirection) { GameplayModifiers gameplayModifiers = ZenjectReceiver.instance?.gameplayCoreSceneSetupData?.gameplayModifiers; if (gameplayModifiers != null && gameplayModifiers.noArrows) { cutDirection = NoteCutDirection.Any; } }
private static void Prefix(ref NoteCutDirection cutDirection) { if (!Plugin.active) { return; } if ((int)cutDirection is >= 2000 and <= 2360) { cutDirection = NoteCutDirection.Any; } }
static void Postfix(ref NoteData __instance, ref NoteCutDirection __state) { if (!Plugin.active) { return; } if ((int)__state >= 1000) { int cutdir = (int)__state; int newdir = 2360 - cutdir; __instance.SetProperty("cutDirection", (NoteCutDirection)newdir); } }
private static void Postfix(NoteCutDirection cutDirection, ref float __result) { if (!Plugin.active) { return; } switch ((int)cutDirection) { case >= 1000 and <= 1360: __result = 1000 - (int)cutDirection; break; case >= 2000 and <= 2360: __result = 2000 - (int)cutDirection; break; } }
static void Postfix(NoteCutDirection cutDirection, ref Quaternion __result) { if ((int)cutDirection >= 1000 && (int)cutDirection <= 1360) { int angle = 1000 - (int)cutDirection; __result = default(Quaternion); __result.eulerAngles = new Vector3(0f, 0f, 1000 - (int)cutDirection); return; } if ((int)cutDirection >= 2000 && (int)cutDirection <= 2360) { int angle = 2000 - (int)cutDirection; __result = default(Quaternion); __result.eulerAngles = new Vector3(0f, 0f, 2000 - (int)cutDirection); return; } }
private static void Postfix(NoteCutDirection cutDirection, ref Quaternion __result) { if (!Plugin.active) { return; } switch ((int)cutDirection) { case >= 1000 and <= 1360: __result = default; __result.eulerAngles = new Vector3(0f, 0f, 1000 - (int)cutDirection); break; case >= 2000 and <= 2360: __result = default; __result.eulerAngles = new Vector3(0f, 0f, 2000 - (int)cutDirection); break; } }
public static bool IsContraryDirectionBetweenSwings(this NoteData note, NoteCutDirection prevCutDirection) { if (note.cutDirection == NoteCutDirection.Any) { return(false); } else { float angleDiff = note.cutDirection.RotationAngle() - prevCutDirection.RotationAngle(); if (Mathf.Abs(angleDiff) < 90f) { return(true); } else { return(false); } } }
static void Postfix(NoteCutDirection cutDirection, ref float __result) { if (!Plugin.active) { return; } if ((int)cutDirection >= 1000 && (int)cutDirection <= 1360) { int angle = 1000 - (int)cutDirection; __result = angle; return; } if ((int)cutDirection >= 2000 && (int)cutDirection <= 2360) { int angle = 2000 - (int)cutDirection; __result = angle; return; } }
private Note(NoteData data, CutType cut) { if (data.colorType == ColorType.ColorB) { noteType = BSDNoteType.right; } else if (data.colorType == ColorType.ColorA) { noteType = BSDNoteType.left; } score = new int[] { 0, 0, 0 }; index = data.lineIndex + 4 * (int)data.noteLineLayer; time = data.time; id = actualId; actualId++; noteDirection = data.cutDirection; cutType = cut; }
private static void Postfix(ref NoteCutDirection __result, NoteCutDirection __state) { switch ((int)__state) { case >= 1000 and <= 1360: { var cutDir = (int)__state; int newDir = 2360 - cutDir; __result = (NoteCutDirection)newDir; break; } case >= 2000 and <= 2360: { var cutDir = (int)__state; int newDir = 4360 - cutDir; __result = (NoteCutDirection)newDir; break; } } }
private void OnNoteCut(INoteController noteController, NoteCutInfo info) { NoteData data = noteController.noteData; if (ShouldDisplayNote(data, info)) { Vector3 center = noteController.noteTransform.position; Vector3 localCutPoint = info.cutPoint - center; NoteCutDirection directionType = data.cutDirection; if (TwoNoteMode) { int index = (int)info.saberType; SliceController sliceController = _sliceControllers[index]; sliceController.UpdateSlice(localCutPoint, info.cutNormal, directionType); } else { int index = 3 * data.lineIndex + (int)data.noteLineLayer; SliceController sliceController = _sliceControllers[index]; Color color = UseCustomNoteColors ? _colorManager.ColorForSaberType(info.saberType) : _defaultColors[(int)info.saberType]; sliceController.UpdateBlockColor(color); sliceController.UpdateSlice(localCutPoint, info.cutNormal, directionType); } if (_logNotesCut) { Console.WriteLine($"[CutVisualizer] OnNoteCut -------------------------------"); Console.WriteLine($"[CutVisualizer] Center: ({center.x} {center.y})"); Console.WriteLine($"[CutVisualizer] Cut Normal: ({info.cutNormal.x} {info.cutNormal.y})"); Console.WriteLine($"[CutVisualizer] Cut Point: ({info.cutPoint.x} {info.cutPoint.y})"); Console.WriteLine($"[CutVisualizer] Cut Local: ({localCutPoint.x} {localCutPoint.y})"); } } }
private static bool ShouldConvertToDotNote(NoteCutDirection cutDirection) { return(Plugin.active && (int)cutDirection >= 2000 && (int)cutDirection <= 2360); }
public CustomNoteData(int id, float time, int lineIndex, NoteLineLayer noteLineLayer, NoteLineLayer startNoteLineLayer, NoteType noteType, NoteCutDirection cutDirection, float timeToNextBasicNote, float timeToPrevBasicNote, dynamic customData) : base(id, time, lineIndex, noteLineLayer, startNoteLineLayer, noteType, cutDirection, timeToNextBasicNote, timeToPrevBasicNote) { this.customData = customData; }
/// <summary> /// Gets a custom arrow or dot note depending on the requirements. Returns null if custom note is already attached to a parent note. /// </summary> /// <param name="noteChild">Parent note</param> /// <param name="noteArrow">Custom Arrow Note</param> /// <param name="noteDot">Custom Dot Note</param> /// <param name="noteCutDirection">The cut direction of the noteChild</param> /// <param name="name">Custom Note name</param> /// <returns></returns> private static GameObject GetCustomNote(Transform noteChild, GameObject noteArrow, GameObject noteDot, NoteCutDirection noteCutDirection, out string name, out GameObject recolorizeBlock) { name = "DuplicateOrInvalid"; recolorizeBlock = null; GameObject customNote = null; Transform dotObject = noteCutDirection == NoteCutDirection.Any ? noteChild.Find("customNoteDot") : null; Transform arrObject = dotObject == null?noteChild.Find("customNoteArrow") : null; if (noteCutDirection == NoteCutDirection.Any) { // CustomNote Dot not attached to childNote if (dotObject == null || dotObject.gameObject == null) { name = "customNoteDot"; customNote = noteDot ?? noteArrow; } else { recolorizeBlock = dotObject.gameObject; } } else { // CustomNote Arrow not attached to childNote if (arrObject == null || arrObject.gameObject == null) { name = "customNoteArrow"; customNote = noteArrow; } else { recolorizeBlock = arrObject.gameObject; } } return(customNote); }
static void Prefix(ref NoteData __instance, ref NoteCutDirection __state) { __state = __instance.cutDirection; }
static bool Prefix(ref BeatmapDataLoader __instance, List <BeatmapSaveData.NoteData> notesSaveData, List <BeatmapSaveData.ObstacleData> obstaclesSaveData, List <BeatmapSaveData.EventData> eventsSaveData, float startBPM, float shuffle, float shufflePeriod, ref Object ____notesInTimeRowProcessor, ref BeatmapData __result) { List <BeatmapObjectData>[] array = new List <BeatmapObjectData> [4]; List <BeatmapEventData> list = new List <BeatmapEventData>(eventsSaveData.Count); List <BPMChangeData> list2 = new List <BPMChangeData>(); list2.Add(new BPMChangeData(0f, 0f, startBPM)); BPMChangeData bpmchangeData = list2[0]; foreach (BeatmapSaveData.EventData eventData in eventsSaveData) { if (eventData.type.IsBPMChangeEvent()) { float time = eventData.time; int value = eventData.value; float bpmChangeStartTime = bpmchangeData.bpmChangeStartTime + __instance.GetRealTimeFromBPMTime(time - bpmchangeData.bpmChangeStartBPMTime, (float)value, shuffle, shufflePeriod); list2.Add(new BPMChangeData(bpmChangeStartTime, time, (float)value)); } } for (int i = 0; i < 4; i++) { array[i] = new List <BeatmapObjectData>(3000); } int num = 0; float num2 = -1f; List <NoteData> list3 = new List <NoteData>(4); List <NoteData> list4 = new List <NoteData>(4); int num3 = 0; foreach (BeatmapSaveData.NoteData noteData in notesSaveData) { float time2 = noteData.time; while (num3 < list2.Count - 1 && list2[num3 + 1].bpmChangeStartBPMTime < time2) { num3++; } BPMChangeData bpmchangeData2 = list2[num3]; float num4 = bpmchangeData2.bpmChangeStartTime + __instance.GetRealTimeFromBPMTime(time2 - bpmchangeData2.bpmChangeStartBPMTime, bpmchangeData2.bpm, shuffle, shufflePeriod); int lineIndex = noteData.lineIndex; NoteLineLayer lineLayer = noteData.lineLayer; NoteLineLayer startNoteLineLayer = NoteLineLayer.Base; NoteType type = noteData.type; NoteCutDirection cutDirection = noteData.cutDirection; if (list3.Count > 0 && list3[0].time < num4 - 0.001f && type.IsBasicNote()) { ____notesInTimeRowProcessor.InvokeMethod("ProcessBasicNotesInTimeRow", list3, num4); num2 = list3[0].time; list3.Clear(); } if (list4.Count > 0 && list4[0].time < num4 - 0.001f) { ____notesInTimeRowProcessor.InvokeMethod("ProcessNotesInTimeRow", list4); list4.Clear(); } NoteData noteData2 = new NoteData(num++, num4, lineIndex, lineLayer, startNoteLineLayer, type, cutDirection, float.MaxValue, num4 - num2); int lineNum = lineIndex > 3 ? 3 : lineIndex < 0 ? 0 : lineIndex; array[lineNum].Add(noteData2); NoteData item = noteData2; if (noteData2.noteType.IsBasicNote()) { list3.Add(item); } list4.Add(item); } ____notesInTimeRowProcessor.InvokeMethod("ProcessBasicNotesInTimeRow", list3, float.MaxValue); ____notesInTimeRowProcessor.InvokeMethod("ProcessNotesInTimeRow", list4); num3 = 0; foreach (BeatmapSaveData.ObstacleData obstacleData in obstaclesSaveData) { float time3 = obstacleData.time; while (num3 < list2.Count - 1 && list2[num3 + 1].bpmChangeStartBPMTime < time3) { num3++; } BPMChangeData bpmchangeData3 = list2[num3]; float time4 = bpmchangeData3.bpmChangeStartTime + __instance.GetRealTimeFromBPMTime(time3 - bpmchangeData3.bpmChangeStartBPMTime, bpmchangeData3.bpm, shuffle, shufflePeriod); int lineIndex2 = obstacleData.lineIndex; ObstacleType type2 = obstacleData.type; float realTimeFromBPMTime = __instance.GetRealTimeFromBPMTime(obstacleData.duration, startBPM, shuffle, shufflePeriod); int width = obstacleData.width; ObstacleData item2 = new ObstacleData(num++, time4, lineIndex2, type2, realTimeFromBPMTime, width); int lineNum = lineIndex2 > 3 ? 3 : lineIndex2 < 0 ? 0 : lineIndex2; array[lineNum].Add(item2); } foreach (BeatmapSaveData.EventData eventData2 in eventsSaveData) { float time5 = eventData2.time; while (num3 < list2.Count - 1 && list2[num3 + 1].bpmChangeStartBPMTime < time5) { num3++; } BPMChangeData bpmchangeData4 = list2[num3]; float time6 = bpmchangeData4.bpmChangeStartTime + __instance.GetRealTimeFromBPMTime(time5 - bpmchangeData4.bpmChangeStartBPMTime, bpmchangeData4.bpm, shuffle, shufflePeriod); BeatmapEventType type3 = eventData2.type; int value2 = eventData2.value; BeatmapEventData item3 = new BeatmapEventData(time6, type3, value2); list.Add(item3); } if (list.Count == 0) { list.Add(new BeatmapEventData(0f, BeatmapEventType.Event0, 1)); list.Add(new BeatmapEventData(0f, BeatmapEventType.Event4, 1)); } BeatmapLineData[] array2 = new BeatmapLineData[4]; for (int j = 0; j < 4; j++) { array[j].Sort(delegate(BeatmapObjectData x, BeatmapObjectData y) { if (x.time == y.time) { return(0); } if (x.time <= y.time) { return(-1); } return(1); }); array2[j] = new BeatmapLineData(); array2[j].beatmapObjectsData = array[j].ToArray(); } __result = new BeatmapData(array2, list.ToArray()); return(false); }
public GameNote(PlayerType type, int selectionNum, float time, int lineIndex, NoteLineLayer noteLineLayer, NoteLineLayer startNoteLineLayer, ColorType noteType, NoteCutDirection cutDirection, float timeToNextBasicNote, float timeToPrevBasicNote) : base(time, lineIndex, noteLineLayer, startNoteLineLayer, GameplayType.Normal, ScoringType.NoScore, noteType, cutDirection, timeToNextBasicNote, timeToPrevBasicNote, lineIndex, 0f, 0f, 1f) { playerType = type; this.selectionNum = selectionNum; }
public NoteData(float time, int lineIndex, NoteLineLayer lineLayer, NoteType type, NoteCutDirection cutDirection) { this._time = time; this._lineIndex = lineIndex; this._lineLayer = lineLayer; this._type = type; this._cutDirection = cutDirection; }
/*public CustomNoteData(float time, int lineIndex, NoteLineLayer noteLineLayer, NoteLineLayer startNoteLineLayer, ColorType colorType, NoteCutDirection cutDirection, * float timeToNextBasicNote, float timeToPrevBasicNote, dynamic customData) * : base(time, lineIndex, noteLineLayer, startNoteLineLayer, colorType, cutDirection, timeToNextBasicNote, timeToPrevBasicNote, duration) * { * this.customData = customData; * } */ public CustomNoteData(float time, int lineIndex, NoteLineLayer noteLineLayer, NoteLineLayer startNoteLineLayer, ColorType colorType, NoteCutDirection cutDirection, float timeToNextBasicNote, float timeToPrevBasicNote, int flipLineIndex, float flipYSide, float duration, dynamic customData) : base(time, lineIndex, noteLineLayer, startNoteLineLayer, colorType, cutDirection, timeToNextBasicNote, timeToPrevBasicNote, flipLineIndex, flipYSide, duration) { this.customData = customData; }
// Token: 0x0600125F RID: 4703 RVA: 0x000404A0 File Offset: 0x0003E6A0 public static CustomBeatmapData GetBeatmapDataFromBeatmapSaveData(List <CustomBeatmapSaveData.NoteData> notesSaveData, List <CustomBeatmapSaveData.ObstacleData> obstaclesSaveData, List <CustomBeatmapSaveData.EventData> eventsSaveData, float startBPM, float shuffle, float shufflePeriod, List <CustomBeatmapSaveData.CustomEventData> customEventsSaveData, dynamic customData, dynamic customLevelData, BeatmapDataLoader beatmapDataLoader) { try { // IPA's reflectionutil sucks object _notesInTimeRowProcessor = beatmapDataLoader.GetType().GetField("_notesInTimeRowProcessor", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(beatmapDataLoader); MethodInfo ProcessBasicNotesInTimeRow = _notesInTimeRowProcessor.GetType().GetMethod("ProcessBasicNotesInTimeRow", BindingFlags.Instance | BindingFlags.Public); MethodInfo ProcessNotesInTimeRow = _notesInTimeRowProcessor.GetType().GetMethod("ProcessNotesInTimeRow", BindingFlags.Instance | BindingFlags.Public); // remainder of this method copied from SongLoaderPlugin@12de0cf, with changes: // BeatmapData, NoteData, EventData, and ObstacleData replaced with their Custom counterparts // customData fields propagated to new objects List <BeatmapObjectData>[] array = new List <BeatmapObjectData> [4]; List <BeatmapEventData> list = new List <BeatmapEventData>(eventsSaveData.Count); List <BPMChangeData> list2 = new List <BPMChangeData>(); list2.Add(new BPMChangeData(0f, 0f, startBPM)); BPMChangeData bpmchangeData = list2[0]; foreach (CustomBeatmapSaveData.EventData eventData in eventsSaveData) { if (eventData.type.IsBPMChangeEvent()) { float time = eventData.time; int value = eventData.value; float bpmChangeStartTime = bpmchangeData.bpmChangeStartTime + beatmapDataLoader.GetRealTimeFromBPMTime(time - bpmchangeData.bpmChangeStartBPMTime, (float)value, shuffle, shufflePeriod); list2.Add(new BPMChangeData(bpmChangeStartTime, time, (float)value)); } } for (int i = 0; i < 4; i++) { array[i] = new List <BeatmapObjectData>(3000); } int num = 0; float num2 = -1f; List <CustomNoteData> list3 = new List <CustomNoteData>(4); List <CustomNoteData> list4 = new List <CustomNoteData>(4); int num3 = 0; foreach (CustomBeatmapSaveData.NoteData noteData in notesSaveData) { float time2 = noteData.time; while (num3 < list2.Count - 1 && list2[num3 + 1].bpmChangeStartBPMTime < time2) { num3++; } BPMChangeData bpmchangeData2 = list2[num3]; float num4 = bpmchangeData2.bpmChangeStartTime + beatmapDataLoader.GetRealTimeFromBPMTime(time2 - bpmchangeData2.bpmChangeStartBPMTime, bpmchangeData2.bpm, shuffle, shufflePeriod); int lineIndex = noteData.lineIndex; NoteLineLayer lineLayer = noteData.lineLayer; NoteLineLayer startNoteLineLayer = NoteLineLayer.Base; NoteType type = noteData.type; NoteCutDirection cutDirection = noteData.cutDirection; if (list3.Count > 0 && list3[0].time < num4 - 0.001f && type.IsBasicNote()) { ProcessBasicNotesInTimeRow.Invoke(_notesInTimeRowProcessor, new object[] { list3.Cast <NoteData>().ToList(), num4 }); num2 = list3[0].time; list3.Clear(); } if (list4.Count > 0 && list4[0].time < num4 - 0.001f) { ProcessNotesInTimeRow.Invoke(_notesInTimeRowProcessor, new object[] { list4.Cast <NoteData>().ToList() }); list4.Clear(); } CustomNoteData noteData2 = new CustomNoteData(num++, num4, lineIndex, lineLayer, startNoteLineLayer, type, cutDirection, float.MaxValue, num4 - num2, noteData._customData ?? Tree()); int lineNum = lineIndex > 3 ? 3 : lineIndex < 0 ? 0 : lineIndex; array[lineNum].Add(noteData2); CustomNoteData item = noteData2; if (noteData2.noteType.IsBasicNote()) { list3.Add(item); } list4.Add(item); } ProcessBasicNotesInTimeRow.Invoke(_notesInTimeRowProcessor, new object[] { list3.Cast <NoteData>().ToList(), float.MaxValue }); ProcessNotesInTimeRow.Invoke(_notesInTimeRowProcessor, new object[] { list4.Cast <NoteData>().ToList() }); num3 = 0; foreach (CustomBeatmapSaveData.ObstacleData obstacleData in obstaclesSaveData) { float time3 = obstacleData.time; while (num3 < list2.Count - 1 && list2[num3 + 1].bpmChangeStartBPMTime < time3) { num3++; } BPMChangeData bpmchangeData3 = list2[num3]; float time4 = bpmchangeData3.bpmChangeStartTime + beatmapDataLoader.GetRealTimeFromBPMTime(time3 - bpmchangeData3.bpmChangeStartBPMTime, bpmchangeData3.bpm, shuffle, shufflePeriod); int lineIndex2 = obstacleData.lineIndex; ObstacleType type2 = obstacleData.type; float realTimeFromBPMTime = beatmapDataLoader.GetRealTimeFromBPMTime(obstacleData.duration, startBPM, shuffle, shufflePeriod); int width = obstacleData.width; CustomObstacleData item2 = new CustomObstacleData(num++, time4, lineIndex2, type2, realTimeFromBPMTime, width, obstacleData._customData ?? Tree()); int lineNum = lineIndex2 > 3 ? 3 : lineIndex2 < 0 ? 0 : lineIndex2; array[lineNum].Add(item2); } foreach (CustomBeatmapSaveData.EventData eventData2 in eventsSaveData) { float time5 = eventData2.time; while (num3 < list2.Count - 1 && list2[num3 + 1].bpmChangeStartBPMTime < time5) { num3++; } BPMChangeData bpmchangeData4 = list2[num3]; float time6 = bpmchangeData4.bpmChangeStartTime + beatmapDataLoader.GetRealTimeFromBPMTime(time5 - bpmchangeData4.bpmChangeStartBPMTime, bpmchangeData4.bpm, shuffle, shufflePeriod); BeatmapEventType type3 = eventData2.type; int value2 = eventData2.value; CustomBeatmapEventData item3 = new CustomBeatmapEventData(time6, type3, value2, eventData2.customData ?? Tree()); list.Add(item3); } if (list.Count == 0) { list.Add(new CustomBeatmapEventData(0f, BeatmapEventType.Event0, 1, Tree())); list.Add(new CustomBeatmapEventData(0f, BeatmapEventType.Event4, 1, Tree())); } var customEvents = new Dictionary <string, List <CustomEventData> >(customEventsSaveData.Count); foreach (CustomBeatmapSaveData.CustomEventData customEventData in customEventsSaveData) { if (!customEvents.ContainsKey(customEventData.type)) { customEvents[customEventData.type] = new List <CustomEventData>(); } float time7 = customEventData.time; while (num3 < list2.Count - 1 && list2[num3 + 1].bpmChangeStartBPMTime < time7) { num3++; } BPMChangeData bpmchangeData5 = list2[num3]; float time8 = bpmchangeData5.bpmChangeStartTime + beatmapDataLoader.GetRealTimeFromBPMTime(time7 - bpmchangeData5.bpmChangeStartBPMTime, bpmchangeData5.bpm, shuffle, shufflePeriod); customEvents[customEventData.type].Add(new CustomEventData(time8, customEventData.type, customEventData.data ?? Tree())); } foreach (var pair in customEvents) { pair.Value.Sort((x, y) => x.time.CompareTo(y.time)); } BeatmapLineData[] array2 = new BeatmapLineData[4]; for (int j = 0; j < 4; j++) { array[j].Sort(delegate(BeatmapObjectData x, BeatmapObjectData y) { if (x.time == y.time) { return(0); } return((x.time <= y.time) ? -1 : 1); }); array2[j] = new BeatmapLineData(); array2[j].beatmapObjectsData = array[j].ToArray(); } return(new CustomBeatmapData(array2, list.ToArray(), customEvents, customData, customLevelData)); } catch (Exception e) { Plugin.logger.Critical("Exception loading CustomBeatmap!"); Plugin.logger.Critical(e); Debug.LogError("Exception loading CustomBeatmap!"); Debug.LogError(e); throw e; } }
private static void Prefix(NoteCutDirection cutDirection, out NoteCutDirection __state) { __state = cutDirection; }
public static void Postfix(NoteJump __instance, Vector3 startPos, Vector3 endPos, float jumpDuration, float startTime, float gravity, float flipYSide, NoteCutDirection cutDirection, ref Quaternion ____startRotation, ref Quaternion ____middleRotation, ref Quaternion ____endRotation, ref int ____randomRotationIdx, ref Vector3[] ____randomRotations) { if (!Plugin.active) { return; } Vector3 eulerAngles = ____endRotation.eulerAngles; eulerAngles.y = __instance.transform.rotation.eulerAngles.y; ____endRotation.eulerAngles = eulerAngles; Vector3 vector = ____endRotation.eulerAngles; ____randomRotationIdx = (____randomRotationIdx + Mathf.RoundToInt(Mathf.Abs(startPos.x) * 10f) + 1) % ____randomRotations.Length; vector += ____randomRotations[____randomRotationIdx] * 20f; ____middleRotation = Quaternion.Euler(vector); ____startRotation = __instance.transform.rotation; }
private static bool Prefix(NoteMovement __instance, Vector3 moveStartPos, Vector3 moveEndPos, Vector3 jumpEndPos, float moveDuration, float jumpDuration, float startTime, float jumpGravity, float flipYSide, NoteCutDirection cutDirection, ref float ____zOffset, ref NoteFloorMovement ____floorMovement, ref Vector3 ____position, ref Vector3 ____prevPosition, ref NoteJump ____jump, ref Action ___didInitEvent) { if (!Plugin.active) { return(true); } moveStartPos += __instance.transform.forward * ____zOffset; moveEndPos += __instance.transform.forward * ____zOffset; jumpEndPos += __instance.transform.forward * ____zOffset; ____floorMovement.Init(moveStartPos, moveEndPos, moveDuration, startTime); ____position = ____floorMovement.SetToStart(); ____prevPosition = ____position; ____jump.Init(moveEndPos, jumpEndPos, jumpDuration, startTime + moveDuration, jumpGravity, flipYSide, cutDirection); ReflectionUtil.SetPrivateProperty(__instance, "movementPhase", NoteMovement.MovementPhase.MovingOnTheFloor); ___didInitEvent?.Invoke(); return(false); }
static bool Prefix(List <BeatmapSaveData.NoteData> notesSaveData, List <BeatmapSaveData.ObstacleData> obstaclesSaveData, List <BeatmapSaveData.EventData> eventsSaveData, float beatsPerMinute, float shuffle, float shufflePeriod, ref BeatmapData __result) { List <BeatmapObjectData>[] array = new List <BeatmapObjectData> [4]; List <BeatmapEventData> list = new List <BeatmapEventData>(eventsSaveData.Count); for (int i = 0; i < 4; i++) { array[i] = new List <BeatmapObjectData>(3000); } int num = 0; NoteData noteData = null; float num2 = -1f; List <NoteData> list2 = new List <NoteData>(4); float num3 = 0f; foreach (BeatmapSaveData.NoteData noteData2 in notesSaveData) { float realTimeFromBPMTime = GetRealTimeFromBPMTime(noteData2.time, beatsPerMinute, shuffle, shufflePeriod); if (num3 > realTimeFromBPMTime) { Debug.LogError("Notes are not ordered."); } num3 = realTimeFromBPMTime; int lineIndex = noteData2.lineIndex; NoteLineLayer lineLayer = noteData2.lineLayer; NoteLineLayer startNoteLineLayer = NoteLineLayer.Base; if (noteData != null && noteData.lineIndex == lineIndex && Mathf.Abs(noteData.time - realTimeFromBPMTime) < 0.0001f) { if (noteData.startNoteLineLayer == NoteLineLayer.Base) { startNoteLineLayer = NoteLineLayer.Upper; } else { startNoteLineLayer = NoteLineLayer.Top; } } NoteType type = noteData2.type; NoteCutDirection cutDirection = noteData2.cutDirection; if (list2.Count > 0 && list2[0].time < realTimeFromBPMTime - 0.001f && type.IsBasicNote()) { ProcessBasicNotesInTimeRow(list2, realTimeFromBPMTime); num2 = list2[0].time; list2.Clear(); } NoteData noteData3 = new NoteData(num++, realTimeFromBPMTime, lineIndex, lineLayer, startNoteLineLayer, type, cutDirection, float.MaxValue, realTimeFromBPMTime - num2); int number = lineIndex; if (number < 0) { number = 0; } if (number > 3) { number = 3; } array[number].Add(noteData3); noteData = noteData3; if (noteData3.noteType.IsBasicNote()) { list2.Add(noteData); } } ProcessBasicNotesInTimeRow(list2, float.MaxValue); foreach (BeatmapSaveData.ObstacleData obstacleData in obstaclesSaveData) { float realTimeFromBPMTime2 = GetRealTimeFromBPMTime(obstacleData.time, beatsPerMinute, shuffle, shufflePeriod); int lineIndex2 = obstacleData.lineIndex; ObstacleType type2 = obstacleData.type; float realTimeFromBPMTime3 = GetRealTimeFromBPMTime(obstacleData.duration, beatsPerMinute, shuffle, shufflePeriod); int width = obstacleData.width; ObstacleData item = new ObstacleData(num++, realTimeFromBPMTime2, lineIndex2, type2, realTimeFromBPMTime3, width); int number2 = lineIndex2; if (number2 < 0) { number2 = 0; } if (number2 > 3) { number2 = 3; } array[number2].Add(item); } foreach (BeatmapSaveData.EventData eventData in eventsSaveData) { float realTimeFromBPMTime4 = GetRealTimeFromBPMTime(eventData.time, beatsPerMinute, shuffle, shufflePeriod); BeatmapEventType type3 = eventData.type; int value = eventData.value; BeatmapEventData item2 = new BeatmapEventData(realTimeFromBPMTime4, type3, value); list.Add(item2); } if (list.Count == 0) { list.Add(new BeatmapEventData(0f, BeatmapEventType.Event0, 1)); list.Add(new BeatmapEventData(0f, BeatmapEventType.Event4, 1)); } BeatmapLineData[] array2 = new BeatmapLineData[4]; for (int j = 0; j < 4; j++) { array[j].Sort(delegate(BeatmapObjectData x, BeatmapObjectData y) { if (x.time == y.time) { return(0); } return((x.time <= y.time) ? -1 : 1); }); array2[j] = new BeatmapLineData(); array2[j].beatmapObjectsData = array[j].ToArray(); } __result = new BeatmapData(array2, list.ToArray()); return(false); }
public void OnNoteCut(NoteData noteData, ISaberSwingRatingCounter cutRating) { ColorType noteColor = noteData.colorType; NoteCutDirection cutDirection = noteData.cutDirection; bool cutDirectionIsUp = ( cutDirection == NoteCutDirection.UpLeft || cutDirection == NoteCutDirection.Up || cutDirection == NoteCutDirection.UpRight); bool cutDirectionIsDown = ( cutDirection == NoteCutDirection.DownLeft || cutDirection == NoteCutDirection.Down || cutDirection == NoteCutDirection.DownRight); if (noteColor == ColorType.ColorA) // Left { if (cutDirectionIsUp) { if (ShowPreSwing) { _leftBottom.SetScore(cutRating.beforeCutRating); } if (ShowPostSwing) { _leftTop.SetScore(cutRating.afterCutRating); } } else if (cutDirectionIsDown) { if (ShowPreSwing) { _leftTop.SetScore(cutRating.beforeCutRating); } if (ShowPostSwing) { _leftBottom.SetScore(cutRating.afterCutRating); } } } else if (noteColor == ColorType.ColorB) // Right { if (cutDirectionIsUp) { if (ShowPreSwing) { _rightBottom.SetScore(cutRating.beforeCutRating); } if (ShowPostSwing) { _rightTop.SetScore(cutRating.afterCutRating); } } else if (cutDirectionIsDown) { if (ShowPreSwing) { _rightTop.SetScore(cutRating.beforeCutRating); } if (ShowPostSwing) { _rightBottom.SetScore(cutRating.afterCutRating); } } } }