static void Postfix(NoteLineLayer lineLayer, ref float __result, ref float ____topLinesYPos, ref float ____upperLinesYPos)
        {
            if (!Plugin.active)
            {
                return;
            }
            float delta = (____topLinesYPos - ____upperLinesYPos);

            if ((int)lineLayer >= 1000 || (int)lineLayer <= -1000)
            {
                __result = ____upperLinesYPos - delta - delta + (((int)lineLayer) * (delta / 1000f));

                return;
            }

            if ((int)lineLayer > 2)
            {
                __result = ____upperLinesYPos - delta + ((int)lineLayer * delta);
                return;
            }

            if ((int)lineLayer < 0)
            {
                __result = ____upperLinesYPos - delta + ((int)lineLayer * delta);
                return;
            }
        }
 private static void Postfix(int lineLayer, ref NoteLineLayer __result)
 {
     if (lineLayer > 2)
     {
         __result = (NoteLineLayer)lineLayer;
     }
 }
Exemplo n.º 3
0
        static void Postfix(NoteLineLayer lineLayer, ref float __result, ref float ____topLinesHighestJumpPosY, ref float ____globalJumpOffsetY, ref float ____upperLinesHighestJumpPosY)
        {
            if (!Plugin.active)
            {
                return;
            }
            float delta = (____topLinesHighestJumpPosY - ____upperLinesHighestJumpPosY);

            if ((int)lineLayer >= 1000 || (int)lineLayer <= -1000)
            {
                __result = ____upperLinesHighestJumpPosY - delta - delta + ____globalJumpOffsetY + (((int)lineLayer) * (delta / 1000f));

                return;
            }

            if ((int)lineLayer > 2)
            {
                __result = ____upperLinesHighestJumpPosY - delta + ____globalJumpOffsetY + ((int)lineLayer * delta);
                return;
            }

            if ((int)lineLayer < 0)
            {
                __result = ____upperLinesHighestJumpPosY - delta + ____globalJumpOffsetY + ((int)lineLayer * delta);
                return;
            }
        }
 private static void Postfix(int layer, ref NoteLineLayer __result)
 {
     if (layer is > 2 or < 0)
     {
         __result = (NoteLineLayer)layer;
     }
 }
Exemplo n.º 5
0
 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;
 }
Exemplo n.º 6
0
        public override Vector3 GetNoteOffset(int noteLineIndex, NoteLineLayer noteLineLayer)
        {
            float num = -(_noteLinesCount - 1f) * 0.5f;

            num = (num + noteLineIndex) * _noteLinesDistance;
            if (owner != null)
            {
                num += owner.avatarOffset;
            }
            return(transform.right * num + new Vector3(0f, LineYPosForLineLayer(noteLineLayer), 0f));
        }
Exemplo n.º 7
0
 private static void Postfix(int noteLineIndex, NoteLineLayer noteLineLayer, ref Vector3 __result, int ____noteLinesCount, Vector3 ____rightVec)
 {
     if (!Plugin.active)
     {
         return;
     }
     if (noteLineIndex is >= 1000 or <= -1000)
     {
         if (noteLineIndex <= -1000)
         {
             noteLineIndex += 2000;
         }
         float num = -(____noteLinesCount - 1f) * 0.5f;
         num     += noteLineIndex * (StaticBeatmapObjectSpawnMovementData.kNoteLinesDistance / 1000);
         __result = ____rightVec * num + new Vector3(0f, StaticBeatmapObjectSpawnMovementData.LineYPosForLineLayer(noteLineLayer), 0f);
     }
 }
Exemplo n.º 8
0
 private static void Postfix(int noteLineIndex, NoteLineLayer noteLineLayer, ref Vector2 __result, int ____noteLinesCount)
 {
     if (!Plugin.active)
     {
         return;
     }
     if (noteLineIndex is >= 1000 or <= -1000)
     {
         if (noteLineIndex <= -1000)
         {
             noteLineIndex += 2000;
         }
         float num = -(____noteLinesCount - 1f) * 0.5f;
         float x   = num + noteLineIndex * (StaticBeatmapObjectSpawnMovementData.kNoteLinesDistance / 1000);
         float y   = StaticBeatmapObjectSpawnMovementData.LineYPosForLineLayer(noteLineLayer);
         __result = new Vector2(x, y);
     }
 }
        private static void Postfix(NoteLineLayer lineLayer, ref float __result)
        {
            if (!Plugin.active)
            {
                return;
            }
            const float delta = StaticBeatmapObjectSpawnMovementData.kTopLinesYPos - StaticBeatmapObjectSpawnMovementData.kUpperLinesYPos;

            switch ((int)lineLayer)
            {
            case >= 1000 or <= -1000:
                __result = StaticBeatmapObjectSpawnMovementData.kUpperLinesYPos - delta - delta + (int)lineLayer * (delta / 1000);
                break;

            case > 2 or < 0:
                __result = StaticBeatmapObjectSpawnMovementData.kUpperLinesYPos - delta + (int)lineLayer * delta;
                break;
            }
        }
Exemplo n.º 10
0
        private static void Postfix(NoteLineLayer lineLayer, ref float __result, float ____upperLinesHighestJumpPosY, float ____topLinesHighestJumpPosY, IJumpOffsetYProvider ____jumpOffsetYProvider)
        {
            if (!Plugin.active)
            {
                return;
            }
            float delta = ____topLinesHighestJumpPosY - ____upperLinesHighestJumpPosY;

            switch ((int)lineLayer)
            {
            case >= 1000 or <= -1000:
                __result = ____upperLinesHighestJumpPosY - delta - delta + ____jumpOffsetYProvider.jumpOffsetY + (int)lineLayer * (delta / 1000);
                break;

            case > 2 or < 0:
                __result = ____upperLinesHighestJumpPosY - delta + ____jumpOffsetYProvider.jumpOffsetY + (int)lineLayer * delta;
                break;
            }
        }
Exemplo n.º 11
0
        static void Postfix(int noteLineIndex, NoteLineLayer noteLineLayer, ref Vector2 __result, ref BeatmapObjectSpawnMovementData __instance, float ____noteLinesCount, float ____noteLinesDistance)
        {
            if (!Plugin.active)
            {
                return;
            }
            float x, y = 0;

            if (noteLineIndex >= 1000 || noteLineIndex <= -1000)
            {
                if (noteLineIndex <= -1000)
                {
                    noteLineIndex += 2000;
                }
                float num = -(____noteLinesCount - 1f) * 0.5f;
                x        = (num + (((float)noteLineIndex) * (____noteLinesDistance / 1000)));
                y        = __instance.LineYPosForLineLayer(noteLineLayer);
                __result = new Vector2(x, y);
            }
        }
Exemplo n.º 12
0
        static void Postfix(NoteLineLayer lineLayer, ref float __result, ref float ____topLinesYPos, ref float ____upperLinesYPos)
        {
            if (!Plugin.active)
            {
                return;
            }
            float delta = (____topLinesYPos - ____upperLinesYPos);

            if ((int)lineLayer >= 1000 || (int)lineLayer <= -1000)
            {
                __result = ____upperLinesYPos - delta - delta + (((int)lineLayer) * (delta / 1000f));
            }
            else if ((int)lineLayer > 2)
            {
                __result = ____upperLinesYPos - delta + ((int)lineLayer * delta);
            }
            else if ((int)lineLayer < 0)
            {
                __result = ____upperLinesYPos - delta + ((int)lineLayer * delta);
            }
            //     Plugin.log.Info($"LineYPos Layer {(int)lineLayer} Final Result {__result}");
        }
Exemplo n.º 13
0
        // 7 lane lanes
        //  -3500 |   -2500 -1500  1500   2500    3500 4500 5500 | 6500
        public static List <BeatmapObjectData> GetTurnSelectionBeatmapObjects(float time, List <int> spaces, PlayerType playerType, GameType game)
        {
            List <BeatmapObjectData> result = new List <BeatmapObjectData>();

            foreach (int i in spaces)
            {
                if (game == GameType.TicTacToe)
                {
                    ColorType     type  = playerType == PlayerType.First ? ColorType.ColorA : ColorType.ColorB;
                    int           index = ColForNum(i, playerType);
                    NoteLineLayer layer = RowForNum(i, playerType);
                    result.Add(new GameNote(playerType, i, time, index, layer, layer, type, NoteCutDirection.Any, 0f, 0f));
                }
                else if (game == GameType.ConnectFour)
                {
                    ColorType type = i < 4 ? ColorType.ColorA : i > 4 ? ColorType.ColorB : playerType == PlayerType.First ? ColorType.ColorA : ColorType.ColorB;
                    result.Add(new GameNote(playerType, i, time, IndexForColumn(i), NoteLineLayer.Base, NoteLineLayer.Base, type, NoteCutDirection.Any, 0f, 0f));
                }
            }


            return(result);
        }
Exemplo n.º 14
0
        static void Postfix(NoteLineLayer lineLayer, ref float __result, ref float ____topLinesHighestJumpPosY, ref float ____jumpOffsetY, ref float ____upperLinesHighestJumpPosY, ref float ____baseLinesHighestJumpPosY)
        {
            if (!Plugin.active)
            {
                return;
            }
            float delta = (____topLinesHighestJumpPosY - ____upperLinesHighestJumpPosY);

            if ((int)lineLayer >= 1000 || (int)lineLayer <= -1000)
            {
                __result = ____upperLinesHighestJumpPosY - delta - delta + ____jumpOffsetY + (((int)lineLayer) * (delta / 1000f));
            }

            else if ((int)lineLayer > 2)
            {
                __result = ____upperLinesHighestJumpPosY - delta + ____jumpOffsetY + ((int)lineLayer * delta);
            }

            else if ((int)lineLayer < 0)
            {
                __result = ____upperLinesHighestJumpPosY - delta + ____jumpOffsetY + ((int)lineLayer * delta);
            }
            //  Plugin.log.Info($"HighestJumpPosY Layer {(int)lineLayer} Final Result {__result}");
        }
        // 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;
            }
        }
Exemplo n.º 16
0
 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;
 }
 // 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 beatsPerMinute, float shuffle, float shufflePeriod,
                                                                   List <CustomBeatmapSaveData.CustomEventData> customEventsSaveData, dynamic customData, dynamic customLevelData)
 {
     try
     {
         // 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);
         for (int i = 0; i < 4; i++)
         {
             array[i] = new List <BeatmapObjectData>(3000);
         }
         int                   num      = 0;
         CustomNoteData        noteData = null;
         float                 num2     = -1f;
         List <CustomNoteData> list2    = new List <CustomNoteData>(4);
         float                 num3     = 0f;
         foreach (CustomBeatmapSaveData.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();
             }
             CustomNoteData noteData3 = new CustomNoteData(num++, realTimeFromBPMTime, lineIndex, lineLayer, startNoteLineLayer, type, cutDirection, float.MaxValue, realTimeFromBPMTime - num2, noteData2._customData ?? Tree());
             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 (CustomBeatmapSaveData.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;
             CustomObstacleData item    = new CustomObstacleData(num++, realTimeFromBPMTime2, lineIndex2, type2, realTimeFromBPMTime3, width, obstacleData._customData ?? Tree());
             int                number2 = lineIndex2;
             if (number2 < 0)
             {
                 number2 = 0;
             }
             if (number2 > 3)
             {
                 number2 = 3;
             }
             array[number2].Add(item);
         }
         foreach (CustomBeatmapSaveData.EventData eventData in eventsSaveData)
         {
             float            realTimeFromBPMTime4 = GetRealTimeFromBPMTime(eventData.time, beatsPerMinute, shuffle, shufflePeriod);
             BeatmapEventType type3 = eventData.type;
             int value = eventData.value;
             CustomBeatmapEventData item2 = new CustomBeatmapEventData(realTimeFromBPMTime4, type3, value, eventData.customData ?? Tree());
             list.Add(item2);
         }
         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>();
             }
             customEvents[customEventData.type].Add(new CustomEventData(GetRealTimeFromBPMTime(customEventData.time, beatsPerMinute, shuffle, shufflePeriod), 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;
     }
 }
 static void Postfix(BeatmapObjectSpawnMovementData __instance, int noteLineIndex, NoteLineLayer noteLineLayer, ref Vector3 __result, ref float ____noteLinesCount, ref float ____noteLinesDistance, Vector3 ____rightVec)
 {
     if (!Plugin.active)
     {
         return;
     }
     if (noteLineIndex >= 1000 || noteLineIndex <= -1000)
     {
         if (noteLineIndex <= -1000)
         {
             noteLineIndex += 2000;
         }
         float num = -(____noteLinesCount - 1f) * 0.5f;
         num      = (num + (((float)noteLineIndex) * (____noteLinesDistance / 1000)));
         __result = ____rightVec * num + new Vector3(0f, __instance.LineYPosForLineLayer(noteLineLayer), 0f);
     }
     //  Plugin.log.Info($"NoteOffset Index {noteLineIndex} Layer {(int)noteLineLayer} Final Result {__result}");
 }
Exemplo n.º 19
0
 static void Postfix(BeatmapObjectSpawnController __instance, int noteLineIndex, NoteLineLayer noteLineLayer, ref Vector3 __result, ref float ____noteLinesCount, ref float ____noteLinesDistance)
 {
     if (noteLineIndex >= 1000 || noteLineIndex <= -1000)
     {
         if (noteLineIndex <= -1000)
         {
             noteLineIndex += 2000;
         }
         float num = -(____noteLinesCount - 1f) * 0.5f;
         num      = (num + (((float)noteLineIndex) * (____noteLinesDistance / 1000)));
         __result = __instance.transform.right * num + new Vector3(0f, __instance.LineYPosForLineLayer(noteLineLayer), 0f);
         return;
     }
 }
Exemplo n.º 20
0
 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;
 }
        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);
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
 public GameObstacle(float time, int lineIndex, NoteLineLayer layer, float duration, int width, int height) : base(time, lineIndex, layer, duration, width, height)
 {
 }
Exemplo n.º 24
0
        /*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;
        }