private static void Postfix(Vector3 ____centerPos, ObstacleData obstacleData, ref BeatmapObjectSpawnMovementData.ObstacleSpawnData __result)
        {
            if (!NoodleObjectDatas.TryGetValue(obstacleData, out NoodleObjectData noodleObjectData))
            {
                return;
            }

            NoodleObstacleData noodleData = (NoodleObstacleData)noodleObjectData;

            float?njs         = noodleData.NJS;
            float?spawnoffset = noodleData.SpawnOffset;

            float?startX = noodleData.StartX;
            float?startY = noodleData.StartY;

            float?height = noodleData.Height;

            Vector3?finalNoteOffset = null;

            Vector3 moveStartPos   = __result.moveStartPos;
            Vector3 moveEndPos     = __result.moveEndPos;
            Vector3 jumpEndPos     = __result.jumpEndPos;
            float   obstacleHeight = __result.obstacleHeight;

            GetNoteJumpValues(njs, spawnoffset, out float jumpDuration, out float _, out Vector3 localMoveStartPos, out Vector3 localMoveEndPos, out Vector3 localJumpEndPos);

            // Actual wall stuff
            if (startX.HasValue || startY.HasValue || njs.HasValue || spawnoffset.HasValue)
            {
                // Ripped from base game
                Vector3 noteOffset = GetNoteOffset(obstacleData, startX, null);
                noteOffset.y = startY.HasValue ? VerticalObstaclePosY + (startY.GetValueOrDefault(0) * NoteLinesDistance) : ((obstacleData.obstacleType == ObstacleType.Top)
                    ? (TopObstaclePosY + JumpOffsetY) : VerticalObstaclePosY);

                finalNoteOffset = noteOffset;

                moveStartPos = localMoveStartPos + noteOffset;
                moveEndPos   = localMoveEndPos + noteOffset;
                jumpEndPos   = localJumpEndPos + noteOffset;
            }

            if (height.HasValue)
            {
                obstacleHeight = height.Value * NoteLinesDistance;
            }

            __result = new BeatmapObjectSpawnMovementData.ObstacleSpawnData(moveStartPos, moveEndPos, jumpEndPos, obstacleHeight, __result.moveDuration, jumpDuration, __result.noteLinesDistance);

            if (!finalNoteOffset.HasValue)
            {
                Vector3 noteOffset = GetNoteOffset(obstacleData, startX, null);
                noteOffset.y    = (obstacleData.obstacleType == ObstacleType.Top) ? (TopObstaclePosY + JumpOffsetY) : VerticalObstaclePosY;
                finalNoteOffset = noteOffset;
            }

            noodleData.NoteOffset = ____centerPos + finalNoteOffset.Value;
            float?width = noodleData.Width;

            noodleData.XOffset = ((width.GetValueOrDefault(obstacleData.lineIndex) / 2f) - 0.5f) * NoteLinesDistance;
        }
Exemplo n.º 2
0
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
        private static void Postfix(Vector3 ____centerPos, ObstacleData obstacleData, ref BeatmapObjectSpawnMovementData.ObstacleSpawnData __result)
#pragma warning restore SA1313 // Parameter names should begin with lower-case letter
        {
            if (obstacleData is CustomObstacleData customData)
            {
                dynamic dynData = customData.customData;
                IEnumerable <float?> position = ((List <object>)Trees.at(dynData, POSITION))?.Select(n => n.ToNullableFloat());
                IEnumerable <float?> scale    = ((List <object>)Trees.at(dynData, SCALE))?.Select(n => n.ToNullableFloat());
                float?njs         = (float?)Trees.at(dynData, NOTEJUMPSPEED);
                float?spawnoffset = (float?)Trees.at(dynData, NOTESPAWNOFFSET);

                float?startX = position?.ElementAtOrDefault(0);
                float?startY = position?.ElementAtOrDefault(1);

                float?height = scale?.ElementAtOrDefault(1);

                Vector3?finalNoteOffset = null;

                Vector3 moveStartPos   = __result.moveStartPos;
                Vector3 moveEndPos     = __result.moveEndPos;
                Vector3 jumpEndPos     = __result.jumpEndPos;
                float   obstacleHeight = __result.obstacleHeight;
                GetNoteJumpValues(njs, spawnoffset, out float jumpDuration, out float _, out Vector3 _, out Vector3 _, out Vector3 _);

                // Actual wall stuff
                if (startX.HasValue || startY.HasValue || njs.HasValue || spawnoffset.HasValue)
                {
                    GetNoteJumpValues(njs, spawnoffset, out float _, out float _, out Vector3 localMoveStartPos, out Vector3 localMoveEndPos, out Vector3 localJumpEndPos);

                    // Ripped from base game
                    Vector3 noteOffset = GetNoteOffset(obstacleData, startX, null);
                    noteOffset.y = startY.HasValue ? VerticalObstaclePosY + (startY.GetValueOrDefault(0) * NoteLinesDistance) : ((obstacleData.obstacleType == ObstacleType.Top)
                        ? (TopObstaclePosY + JumpOffsetY) : VerticalObstaclePosY);

                    finalNoteOffset = noteOffset;

                    moveStartPos = localMoveStartPos + noteOffset;
                    moveEndPos   = localMoveEndPos + noteOffset;
                    jumpEndPos   = localJumpEndPos + noteOffset;
                }

                if (height.HasValue)
                {
                    obstacleHeight = height.Value * NoteLinesDistance;
                }

                __result = new BeatmapObjectSpawnMovementData.ObstacleSpawnData(moveStartPos, moveEndPos, jumpEndPos, obstacleHeight, __result.moveDuration, jumpDuration, __result.noteLinesDistance);

                if (!finalNoteOffset.HasValue)
                {
                    Vector3 noteOffset = GetNoteOffset(obstacleData, startX, null);
                    noteOffset.y    = (obstacleData.obstacleType == ObstacleType.Top) ? (TopObstaclePosY + JumpOffsetY) : VerticalObstaclePosY;
                    finalNoteOffset = noteOffset;
                }

                dynData.noteOffset = ____centerPos + finalNoteOffset.Value;
                float?width = scale?.ElementAtOrDefault(0);
                dynData.xOffset = ((width.GetValueOrDefault(obstacleData.lineIndex) / 2f) - 0.5f) * NoteLinesDistance;
            }
        }