예제 #1
0
        public static BeatmapData CreateTransformedBeatmapData(BeatmapData beatmapData, GameplayOptions gameplayOptions, GameplayMode gameplayMode)
        {
            BeatmapData beatmapData2 = beatmapData;

            if (gameplayOptions.mirror)
            {
                beatmapData2 = BeatDataMirrorTransform.CreateTransformedData(beatmapData2);
            }
            if (gameplayMode == GameplayMode.SoloNoArrows)
            {
                beatmapData2 = BeatmapDataNoArrowsTransform.CreateTransformedData(beatmapData2);
            }
            if (gameplayOptions.obstaclesOption != GameplayOptions.ObstaclesOption.All)
            {
                beatmapData2 = BeatmapDataObstaclesTransform.CreateTransformedData(beatmapData2, gameplayOptions.obstaclesOption);
            }
            if (beatmapData2 == beatmapData)
            {
                beatmapData2 = beatmapData.GetCopy();
            }
            if (gameplayOptions.staticLights)
            {
                BeatmapEventData[] beatmapEventData = new BeatmapEventData[]
                {
                    new BeatmapEventData(0f, BeatmapEventType.Event0, 1),
                    new BeatmapEventData(0f, BeatmapEventType.Event4, 1)
                };
                beatmapData2 = new BeatmapData(beatmapData2.beatmapLinesData, beatmapEventData);
            }
            return(beatmapData2);
        }
        public static BeatmapData CreateTransformedBeatmapData(BeatmapData beatmapData, BS_Utils.Gameplay.LevelData levelSetup)
        {
            BeatmapData beatmapData2 = beatmapData;

            if (BS_Utils.Gameplay.Gamemode.GameMode == "No Arrows")
            {
                beatmapData2 = BeatmapDataNoArrowsTransform.CreateTransformedData(beatmapData2);
            }
            //This covers all of the modifiers and player settings that were here previously
            beatmapData2 = BeatDataTransformHelper.CreateTransformedBeatmapData(beatmapData2, levelSetup.GameplayCoreSceneSetupData.gameplayModifiers, levelSetup.GameplayCoreSceneSetupData.practiceSettings, levelSetup.GameplayCoreSceneSetupData.playerSpecificSettings);

            if (beatmapData2 == beatmapData)
            {
                beatmapData2 = beatmapData.GetCopy();
            }

            return(beatmapData2);
        }
예제 #3
0
        public static BeatmapData CreateTransformedBeatmapData(BeatmapData beatmapData, StandardLevelSceneSetupDataSO levelSetup)
        {
            BeatmapData beatmapData2 = beatmapData;

            if (selectedCharacteristic == "No Arrows")
            {
                beatmapData2 = BeatmapDataNoArrowsTransform.CreateTransformedData(beatmapData2);
            }
            //This covers all of the modifiers and player settings that were here previously
            beatmapData2 = BeatDataTransformHelper.CreateTransformedBeatmapData(beatmapData2, levelSetup.gameplayCoreSetupData.gameplayModifiers, levelSetup.gameplayCoreSetupData.practiceSettings, levelSetup.gameplayCoreSetupData.playerSpecificSettings);

            if (beatmapData2 == beatmapData)
            {
                beatmapData2 = beatmapData.GetCopy();
            }

            return(beatmapData2);
        }
예제 #4
0
        public static BeatmapData CreateTransformedData(BeatmapData beatmapData)
        {
            bool isDarthModeOn = Plugin.IsDarthModeOn;

            beatmapData = beatmapData.GetCopy();
            BeatmapLineData[] beatmapLinesData = beatmapData.beatmapLinesData;
            int[]             array            = new int[beatmapLinesData.Length];
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = 0;
            }
            UnityEngine.Random.InitState(0);
            bool flag;

            do
            {
                flag = false;
                float num  = 999999f;
                int   num2 = 0;
                for (int j = 0; j < beatmapLinesData.Length; j++)
                {
                    BeatmapObjectData[] beatmapObjectsData = beatmapLinesData[j].beatmapObjectsData;
                    int num3 = array[j];
                    while (num3 < beatmapObjectsData.Length && beatmapObjectsData[num3].time < num + 0.001f)
                    {
                        flag = true;
                        BeatmapObjectData beatmapObjectData = beatmapObjectsData[num3];
                        float             time = beatmapObjectData.time;
                        if (Mathf.Abs(time - num) < 0.001f)
                        {
                            if (beatmapObjectData.beatmapObjectType == BeatmapObjectType.Note)
                            {
                                num2++;
                            }
                        }
                        else if (time < num)
                        {
                            num = time;
                            if (beatmapObjectData.beatmapObjectType == BeatmapObjectType.Note)
                            {
                                num2 = 1;
                            }
                            else
                            {
                                num2 = 0;
                            }
                        }
                        num3++;
                    }
                }
                for (int k = 0; k < beatmapLinesData.Length; k++)
                {
                    BeatmapObjectData[] beatmapObjectsData2 = beatmapLinesData[k].beatmapObjectsData;
                    int num4 = array[k];
                    while (num4 < beatmapObjectsData2.Length && beatmapObjectsData2[num4].time < num + 0.001f)
                    {
                        BeatmapObjectData beatmapObjectData2 = beatmapObjectsData2[num4];
                        if (beatmapObjectData2.beatmapObjectType == BeatmapObjectType.Note)
                        {
                            NoteData noteData = beatmapObjectData2 as NoteData;
                            if (noteData != null)
                            {
                                noteData.SetNoteToAnyCutDirection();
                                if (!isDarthModeOn && num2 <= 2)
                                {
                                    noteData.TransformNoteAOrBToRandomType();
                                }
                            }
                        }
                        array[k]++;
                        num4++;
                    }
                }
            }while (flag);
            return(beatmapData);
        }
예제 #5
0
        public static CustomBeatmap CreateTransformedData(BeatmapData beatmapData, ref ChromaBehaviour chromaBehaviour, ref PlayerSpecificSettings playerSettings, ref BaseGameModeType baseGameMode, ref float bpm)
        {
            ColourManager.TechnicolourLightsForceDisabled = false;

            ChromaLogger.Log("Checking for registered JSONBeatmap for " + beatmapData.ToString() + " (" + ChromaJSONBeatmap.chromaBeatmaps.Count + " registered maps total)");
            ChromaJSONBeatmap chromaInjectmap = ChromaJSONBeatmap.GetChromaBeatmap(beatmapData);

            if (beatmapData == null)
            {
                ChromaLogger.Log("Null beatmapData", ChromaLogger.Level.ERROR);
            }
            if (playerSettings == null)
            {
                ChromaLogger.Log("Null playerSettings", ChromaLogger.Level.ERROR);
            }

            List <CustomBeatmapObject> customBeatmapData = new List <CustomBeatmapObject>();

            beatmapData = beatmapData.GetCopy();
            BeatmapLineData[] beatmapLinesData = beatmapData.beatmapLinesData;
            int[]             array            = new int[beatmapLinesData.Length];
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = 0;
            }
            UnityEngine.Random.InitState(0);
            bool flag;

            do
            {
                flag = false;
                float num  = 999999f;
                int   num2 = 0;
                for (int j = 0; j < beatmapLinesData.Length; j++)
                {
                    BeatmapObjectData[] beatmapObjectsData = beatmapLinesData[j].beatmapObjectsData;
                    int num3 = array[j];
                    while (num3 < beatmapObjectsData.Length && beatmapObjectsData[num3].time < num + 0.001f)
                    {
                        flag = true;
                        BeatmapObjectData beatmapObjectData = beatmapObjectsData[num3];
                        float             time = beatmapObjectData.time;
                        if (Mathf.Abs(time - num) < 0.001f)
                        {
                            if (beatmapObjectData.beatmapObjectType == BeatmapObjectType.Note)
                            {
                                num2++;
                            }
                        }
                        else if (time < num)
                        {
                            num = time;
                            if (beatmapObjectData.beatmapObjectType == BeatmapObjectType.Note)
                            {
                                num2 = 1;
                            }
                            else
                            {
                                num2 = 0;
                            }
                        }
                        num3++;
                    }
                }

                CustomBeatmapObject customBeatmapObject = null;
                for (int k = 0; k < beatmapLinesData.Length; k++)
                {
                    BeatmapObjectData[] beatmapObjectsData2 = beatmapLinesData[k].beatmapObjectsData;
                    int num4 = array[k];
                    while (num4 < beatmapObjectsData2.Length && beatmapObjectsData2[num4].time < num + 0.001f)
                    {
                        BeatmapObjectData beatmapObjectData2 = beatmapObjectsData2[num4];
                        if (beatmapObjectData2.beatmapObjectType == BeatmapObjectType.Note)
                        {
                            NoteData noteData = beatmapObjectData2 as NoteData;
                            if (noteData != null)
                            {
                                if (noteData.noteType == NoteType.NoteA || noteData.noteType == NoteType.NoteB)
                                {
                                    customBeatmapObject = new CustomBeatmapNote(beatmapObjectData2 as NoteData);
                                }
                                else if (noteData.noteType == NoteType.Bomb)
                                {
                                    customBeatmapObject = new CustomBeatmapBomb(beatmapObjectData2 as NoteData);
                                }
                            }
                        }
                        else if (beatmapObjectData2.beatmapObjectType == BeatmapObjectType.Obstacle)
                        {
                            ObstacleData obstacle = beatmapObjectData2 as ObstacleData;
                            if (obstacle != null)
                            {
                                customBeatmapObject = new CustomBeatmapBarrier(obstacle);
                            }
                        }
                        array[k]++;
                        num4++;
                        if (customBeatmapObject == null)
                        {
                            ChromaLogger.Log("Null beatmap object! ID:" + beatmapObjectData2.id + " LI:" + beatmapObjectData2.lineIndex + " T:" + beatmapObjectData2.time, ChromaLogger.Level.WARNING);
                        }
                        else
                        {
                            customBeatmapData.Add(customBeatmapObject);                                                                                                                                                                                                                   //CT Added
                        }
                    }
                }
            }while (flag);

            CustomBeatmap customBeatmap = new CustomBeatmap(customBeatmapData);

            try {
                ChromaLogger.Log("Modifying map data...");
                if (beatmapData == null)
                {
                    ChromaLogger.Log("Null beatmapData", ChromaLogger.Level.ERROR);
                }
                if (beatmapData.beatmapEventData == null)
                {
                    ChromaLogger.Log("Null beatmapData.beatmapEventData", ChromaLogger.Level.ERROR);
                }
                ModifyCustomBeatmapEvent?.Invoke(beatmapData.notesCount * beatmapData.beatmapEventData.Length, ref customBeatmap, ref beatmapData, ref playerSettings, ref baseGameMode, ref bpm);
                //ModifyCustomBeatmap(beatmapData.notesCount * beatmapData.beatmapEventData.Length, ref customBeatmap, ref beatmapData, ref playerSettings, ref baseGameMode, ref bpm);
            } catch (Exception e) {
                ChromaLogger.Log("Exception modifying map data...", ChromaLogger.Level.ERROR);
                ChromaLogger.Log(e);
            }

            customBeatmapData = customBeatmap.CustomBeatmapObjects;

            //from Tweaks
            int[] array2 = new int[beatmapLinesData.Length];
            for (int l = 0; l < customBeatmapData.Count; l++)
            {
                BeatmapObjectData beatmapObjectData2 = customBeatmapData[l].Data;
                array2[Mathf.Clamp(beatmapObjectData2.lineIndex, 0, 3)]++; //array2[beatmapObjectData2.lineIndex]++;
            }
            BeatmapLineData[] linesData = new BeatmapLineData[beatmapLinesData.Length];
            for (int m = 0; m < beatmapLinesData.Length; m++)
            {
                linesData[m] = new BeatmapLineData();
                linesData[m].beatmapObjectsData = new BeatmapObjectData[array2[m]];
                array[m] = 0;
            }
            for (int n = 0; n < customBeatmapData.Count; n++)
            {
                BeatmapObjectData beatmapObjectData3 = customBeatmapData[n].Data;
                int lineIndex = Mathf.Clamp(beatmapObjectData3.lineIndex, 0, 3); //beatmapObjectData3.lineIndex;
                linesData[lineIndex].beatmapObjectsData[array[lineIndex]] = beatmapObjectData3;
                array[lineIndex]++;
            }
            BeatmapEventData[] eventsData = new BeatmapEventData[beatmapData.beatmapEventData.Length];
            for (int num5 = 0; num5 < beatmapData.beatmapEventData.Length; num5++)
            {
                BeatmapEventData beatmapEventData = beatmapData.beatmapEventData[num5];
                eventsData[num5] = beatmapEventData.GetCopy();
            }

            if (ChromaConfig.LightshowModifier)
            {
                linesData = new BeatmapLineData[0];
            }

            beatmapData = new BeatmapData(linesData, eventsData);

            if (chromaInjectmap != null)
            {
                chromaInjectmap.Inject(beatmapData);
            }

            customBeatmap.BeatmapData = beatmapData;


            /*
             * LIGHTING EVENTS
             */

            if (ChromaConfig.CustomColourEventsEnabled || ChromaConfig.CustomSpecialEventsEnabled)
            {
                BeatmapEventData[] bevData       = beatmapData.beatmapEventData;
                ChromaColourEvent  unfilledEvent = null;
                for (int i = bevData.Length - 1; i >= 0; i--)
                {
                    //Forcing lane change
                    switch (bevData[i].value)
                    {
                    case ChromaEvent.CHROMA_EVENT_RING_ROTATE_LEFT:
                        bevData[i].SetProperty("type", BeatmapEventType.Event8);
                        break;

                    case ChromaEvent.CHROMA_EVENT_RING_ROTATE_RIGHT:
                        bevData[i].SetProperty("type", BeatmapEventType.Event8);
                        break;

                    case ChromaEvent.CHROMA_EVENT_RING_ROTATE_RESET:
                        bevData[i].SetProperty("type", BeatmapEventType.Event8);
                        break;
                    }

                    ChromaEvent cLight = ApplyCustomEvent(bevData[i], ref unfilledEvent);
                    if (cLight != null)
                    {
                        ColourManager.TechnicolourLightsForceDisabled = true;
                    }
                }
            }

            return(customBeatmap);
        }