Ejemplo n.º 1
0
        //Types: 0 = Normal Note (On top of and hit) 1 = Touch Note (Just on top of) 2 = Hold Note (On top of and hold)
        protected Note CreateNote(float time, int lane, float speed, char type, float holdtime, int specialnum)
        {
            Note note = new Note
            {
                Time             = time,
                Lane             = lane,
                Speed            = speed,
                Currtime         = time,
                SpecialNum       = specialnum,
                HitTimeThreshold = HitTimeThreshold
            };

            note.setType(type);
            GameObject noteObject = null;

            if (note.isTouchNote)
            {
                noteObject = Instantiate(TouchNotePrefab);
            }
            else if (note.isHoldNote)
            {
                noteObject = Instantiate(HoldNotePrefab);
                noteObject.GetComponent <HoldNoteScript>().speed  = speed;
                noteObject.GetComponent <HoldNoteScript>().length = -speed * holdtime;
                note.setHoldLength(noteObject.GetComponent <HoldNoteScript>().length);
                //Debug.Log(1 / (BMReader.GetBps() * 2));
                noteObject.GetComponent <HoldNoteScript>().interval = 1 / (BMReader.GetBps() * 2);

                HoldNoteScript holdscript = noteObject.GetComponent <HoldNoteScript>();
                holdscript.NoteManager = this;
                holdscript.Note        = note;
            }
            else if (note.isHitNote)
            {
                noteObject = Instantiate(NotePrefab);
            }
            else
            {
                //Do nothing
            }

            //Debug.Log("Lane:"+lane);
            if (noteObject)
            {
                noteObject.transform.position = new Vector2(LanePositions[lane], transform.position.y);

                NoteMovement noteMovement = noteObject.GetComponent <NoteMovement>();
                noteMovement.NoteManager = this;
                noteMovement.Note        = note;

                NoteJudgement noteJudgement = noteObject.GetComponent <NoteJudgement>();
                noteJudgement.NoteManager = this;
                noteJudgement.Note        = note;

                return(note);
            }

            return(null);
        }
Ejemplo n.º 2
0
        private void _BMSpawnController_noteDidStartJumpEvent(BeatmapObjectSpawnController arg1, NoteController arg2)
        {
            NoteMovement nm = arg2.GetComponent <NoteMovement>();

            if (nm != null && (arg2.noteData.noteType == NoteType.NoteA || arg2.noteData.noteType == NoteType.NoteB))
            {
                nm.noteDidPassMissedMarkerEvent += Nm_noteDidPassMissedMarkerEvent;
            }
        }
Ejemplo n.º 3
0
        public static bool Prefix(DisappearingArrowController __instance, ref NoteMovement ____noteMovement, ref float ____minDistance, ref float ____maxDistance, ref bool ____ghostNote, ref float ____disappearingGhostStart, ref float ____disappearingGhostEnd, ref float ____disappearingNormalStart, ref float ____disappearingNormalEnd)
        {
            if (!Plugin.active)
            {
                return(true);
            }

            ____maxDistance = Mathf.Min(____noteMovement.moveEndPos.magnitude * 0.8f, ____ghostNote ? ____disappearingGhostStart : ____disappearingNormalStart);
            ____minDistance = Mathf.Min(____noteMovement.moveEndPos.magnitude * 0.5f, ____ghostNote ? ____disappearingGhostEnd : ____disappearingNormalEnd);

            return(false);
        }
Ejemplo n.º 4
0
        public static bool Prefix(DisappearingArrowController __instance, ref NoteMovement ____noteMovement, ref float ____minDistance, ref float ____maxDistance)
        {
            if (!Plugin.active)
            {
                return(true);
            }

            PlayerController privateField      = ReflectionUtil.GetPrivateField <PlayerController>(ReflectionUtil.GetPrivateField <NoteJump>(____noteMovement, "_jump"), "_playerController");
            float            arrowTransparency = Mathf.Clamp01(((____noteMovement.position - privateField.headPos).magnitude - ____minDistance) / (____maxDistance - ____minDistance));

            __instance.SetArrowTransparency(arrowTransparency);

            return(false);
        }
Ejemplo n.º 5
0
        internal void Init(PluginConfig pluginConfig, NoteAssetLoader noteAssetLoader, [Inject(Id = "cn.bomb")] SiraPrefabContainer.Pool bombContainerPool)
        {
            _pluginConfig = pluginConfig;

            _customNote         = noteAssetLoader.CustomNoteObjects[noteAssetLoader.SelectedNote];
            _bombNoteController = GetComponent <BombNoteController>();
            _noteMovement       = GetComponent <NoteMovement>();
            _bombNoteController.didInitEvent     += Controller_Init;
            _noteMovement.noteDidFinishJumpEvent += DidFinish;
            bombMesh = gameObject.transform.Find("Mesh");
            bombPool = bombContainerPool;

            MeshRenderer bm = GetComponentInChildren <MeshRenderer>();

            bm.enabled = false;
        }
Ejemplo n.º 6
0
        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);
        }
        internal void Init(PluginConfig pluginConfig, NoteAssetLoader noteAssetLoader, [InjectOptional(Id = "cn.bomb")] SiraPrefabContainer.Pool bombContainerPool)
        {
            _pluginConfig = pluginConfig;

            _customNote = noteAssetLoader.CustomNoteObjects[noteAssetLoader.SelectedNote];
            bombPool    = bombContainerPool;

            _bombNoteController = GetComponent <BombNoteController>();
            _noteMovement       = GetComponent <NoteMovement>();

            if (bombPool != null)
            {
                _bombNoteController.didInitEvent.Add(this);
                _noteMovement.noteDidFinishJumpEvent += DidFinish;
            }

            bombMesh = gameObject.transform.Find("Mesh");


            MeshRenderer bm = GetComponentInChildren <MeshRenderer>();

            if ((_pluginConfig.HMDOnly || LayerUtils.HMDOverride))
            {
                if (bombPool == null)
                {
                    // create fake bombs for Custom Notes without Custom Bombs
                    fakeFirstPersonBombMesh                  = UnityEngine.Object.Instantiate(bombMesh.gameObject);
                    fakeFirstPersonBombMesh.name             = "FakeFirstPersonBomb";
                    fakeFirstPersonBombMesh.transform.parent = bombMesh;

                    fakeFirstPersonBombMesh.transform.localScale    = Vector3.one;
                    fakeFirstPersonBombMesh.transform.localPosition = Vector3.zero;
                    fakeFirstPersonBombMesh.transform.rotation      = Quaternion.identity;
                    fakeFirstPersonBombMesh.layer = (int)LayerUtils.NoteLayer.FirstPerson;
                }
            }
            else if (bombPool != null)
            {
                bm.enabled = false;
            }
        }
Ejemplo n.º 8
0
        private static void Postfix(NoteController __instance, NoteData noteData, NoteMovement ____noteMovement)
        {
            if (noteData is CustomNoteData customData)
            {
                dynamic dynData = customData.customData;

                float?cutDir = (float?)Trees.at(dynData, CUTDIRECTION);

                NoteJump          noteJump      = _noteJumpAccessor(ref ____noteMovement);
                NoteFloorMovement floorMovement = _noteFloorMovementAccessor(ref ____noteMovement);

                if (cutDir.HasValue)
                {
                    Quaternion rotation = Quaternion.Euler(0, 0, cutDir.Value);
                    _endRotationAccessor(ref noteJump) = rotation;
                    Vector3 vector = rotation.eulerAngles;
                    vector += _randomRotationsAccessor(ref noteJump)[_randomRotationIdxAccessor(ref noteJump)] * 20;
                    Quaternion midrotation = Quaternion.Euler(vector);
                    _middleRotationAccessor(ref noteJump) = midrotation;
                }
            }
        }
Ejemplo n.º 9
0
        private static void TrackColorize(NoteController instance, NoteData noteData, NoteMovement noteMovement)
        {
            if (NoodleExtensions.NoodleController.NoodleExtensionsActive && noteData is CustomNoteData customData)
            {
                dynamic dynData         = customData.customData;
                Track   track           = AnimationHelper.GetTrack(dynData);
                dynamic animationObject = Trees.at(dynData, ANIMATION);

                if (track != null || animationObject != null)
                {
                    NoteJump noteJump = _noteJumpAccessor(ref noteMovement);

                    float jumpDuration = _jumpDurationAccessor(ref noteJump);
                    float elapsedTime  = _audioTimeSyncControllerAccessor(ref noteJump).songTime - (noteData.time - (jumpDuration * 0.5f));
                    float normalTime   = elapsedTime / jumpDuration;

                    Chroma.AnimationHelper.GetColorOffset(animationObject, track, normalTime, out Color? colorOffset);

                    if (colorOffset.HasValue)
                    {
                        Color color = colorOffset.Value;
                        if (instance is BombNoteController bnc)
                        {
                            bnc.SetBombColor(color);
                        }
                        else
                        {
                            instance.SetNoteColors(color, color);
                            dynData.color0 = color;
                            dynData.color1 = color;
                            instance.SetActiveColors();
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
        private static void Postfix(NoteController __instance, NoteData ____noteData, NoteMovement ____noteMovement)
#pragma warning restore SA1313 // Parameter names should begin with lower-case letter
        {
            if (Chroma.Plugin.NoodleExtensionsInstalled)
            {
                TrackColorize(__instance, ____noteData, ____noteMovement);
            }
        }
Ejemplo n.º 11
0
 static void Prefix(ref NoteData noteData, ref Vector3 moveStartPos, ref Vector3 moveEndPos, Vector3 jumpEndPos, float moveDuration, float jumpDuration, float startTime, float jumpGravity, ref NoteController __instance, ref NoteData ____noteData, ref NoteMovement ____noteMovement, ref Action <NoteController> ___didInitEvent)
 {
     if (FuckeryUI.MegaJump.Enabled)
     {
         moveStartPos.x *= FuckeryUI.Mirror.Enabled ? -2 : 2;
         moveStartPos.y *= 100;
         moveStartPos.y += UnityEngine.Random.Range(-4, 4);
         moveEndPos.x   *= FuckeryUI.Mirror.Enabled ? -10 : 10;
     }
 }
Ejemplo n.º 12
0
        private static void Postfix(NoteController __instance, NoteData noteData, NoteMovement ____noteMovement, Vector3 moveStartPos, Vector3 moveEndPos, Vector3 jumpEndPos, float endRotation)
        {
            if (__instance is MultiplayerConnectedPlayerNoteController)
            {
                return;
            }

            NoodleNoteData noodleData = (NoodleNoteData)NoodleObjectDatas[noteData];

            Quaternion?cutQuaternion = noodleData.CutQuaternion;

            NoteJump          noteJump      = _noteJumpAccessor(ref ____noteMovement);
            NoteFloorMovement floorMovement = _noteFloorMovementAccessor(ref ____noteMovement);

            if (cutQuaternion.HasValue)
            {
                Quaternion quatVal = cutQuaternion.Value;
                _endRotationAccessor(ref noteJump) = quatVal;
                Vector3 vector = quatVal.eulerAngles;
                vector += _randomRotationsAccessor(ref noteJump)[_randomRotationIdxAccessor(ref noteJump)] * 20;
                Quaternion midrotation = Quaternion.Euler(vector);
                _middleRotationAccessor(ref noteJump) = midrotation;
            }

            Quaternion?worldRotationQuaternion = noodleData.WorldRotationQuaternion;
            Quaternion?localRotationQuaternion = noodleData.LocalRotationQuaternion;

            Transform transform = __instance.transform;

            Quaternion localRotation = _quaternionIdentity;

            if (worldRotationQuaternion.HasValue || localRotationQuaternion.HasValue)
            {
                if (localRotationQuaternion.HasValue)
                {
                    localRotation = localRotationQuaternion.Value;
                }

                if (worldRotationQuaternion.HasValue)
                {
                    Quaternion quatVal = worldRotationQuaternion.Value;
                    Quaternion inverseWorldRotation = Quaternion.Inverse(quatVal);
                    _worldRotationJumpAccessor(ref noteJump)              = quatVal;
                    _inverseWorldRotationJumpAccessor(ref noteJump)       = inverseWorldRotation;
                    _worldRotationFloorAccessor(ref floorMovement)        = quatVal;
                    _inverseWorldRotationFloorAccessor(ref floorMovement) = inverseWorldRotation;

                    quatVal *= localRotation;

                    transform.localRotation = quatVal;
                }
                else
                {
                    transform.localRotation *= localRotation;
                }
            }

            if (transform.localScale != Vector3.one)
            {
                transform.localScale = Vector3.one; // This is a fix for animation due to notes being recycled
            }

            Track track = noodleData.Track;

            if (track != null && ParentObject.Controller != null)
            {
                ParentObject parentObject = ParentObject.Controller.GetParentObjectTrack(track);
                if (parentObject != null)
                {
                    parentObject.ParentToObject(transform);
                }
                else
                {
                    ParentObject.ResetTransformParent(transform);
                }
            }
            else
            {
                ParentObject.ResetTransformParent(transform);
            }

            noodleData.EndRotation   = endRotation;
            noodleData.MoveStartPos  = moveStartPos;
            noodleData.MoveEndPos    = moveEndPos;
            noodleData.JumpEndPos    = jumpEndPos;
            noodleData.WorldRotation = __instance.worldRotation;
            noodleData.LocalRotation = localRotation;
        }
Ejemplo n.º 13
0
        private static void Prefix(NoteController __instance, NoteData ____noteData, NoteMovement ____noteMovement)
        {
            if (__instance is MultiplayerConnectedPlayerNoteController)
            {
                NoodleData = null;
                return;
            }

            NoodleData = NoodleObjectDatas[____noteData];
            NoodleNoteData noodleData = (NoodleNoteData)NoodleData;

            Track track = noodleData.Track;

            NoodleObjectData.AnimationObjectData animationObject = noodleData.AnimationObject;
            if (track != null || animationObject != null)
            {
                NoteJump          noteJump      = NoteControllerInit._noteJumpAccessor(ref ____noteMovement);
                NoteFloorMovement floorMovement = NoteControllerInit._noteFloorMovementAccessor(ref ____noteMovement);

                // idk i just copied base game time
                float jumpDuration = _jumpDurationAccessor(ref noteJump);
                float elapsedTime  = _audioTimeSyncControllerAccessor(ref noteJump).songTime - (____noteData.time - (jumpDuration * 0.5f));
                elapsedTime = NoteJumpManualUpdate.NoteJumpTimeAdjust(elapsedTime, jumpDuration);
                float normalTime = elapsedTime / jumpDuration;

                AnimationHelper.GetObjectOffset(animationObject, track, normalTime, out Vector3? positionOffset, out Quaternion? rotationOffset, out Vector3? scaleOffset, out Quaternion? localRotationOffset, out float?dissolve, out float?dissolveArrow, out float?cuttable);

                if (positionOffset.HasValue)
                {
                    Vector3 moveStartPos = noodleData.MoveStartPos;
                    Vector3 moveEndPos   = noodleData.MoveEndPos;
                    Vector3 jumpEndPos   = noodleData.JumpEndPos;

                    Vector3 offset = positionOffset.Value;
                    _floorStartPosAccessor(ref floorMovement) = moveStartPos + offset;
                    _floorEndPosAccessor(ref floorMovement)   = moveEndPos + offset;
                    _jumpStartPosAccessor(ref noteJump)       = moveEndPos + offset;
                    _jumpEndPosAccessor(ref noteJump)         = jumpEndPos + offset;
                }

                Transform transform = __instance.transform;

                if (rotationOffset.HasValue || localRotationOffset.HasValue)
                {
                    Quaternion worldRotation = noodleData.WorldRotation;
                    Quaternion localRotation = noodleData.LocalRotation;

                    Quaternion worldRotationQuatnerion = worldRotation;
                    if (rotationOffset.HasValue)
                    {
                        worldRotationQuatnerion *= rotationOffset.Value;
                        Quaternion inverseWorldRotation = Quaternion.Inverse(worldRotationQuatnerion);
                        NoteControllerInit._worldRotationJumpAccessor(ref noteJump)              = worldRotationQuatnerion;
                        NoteControllerInit._inverseWorldRotationJumpAccessor(ref noteJump)       = inverseWorldRotation;
                        NoteControllerInit._worldRotationFloorAccessor(ref floorMovement)        = worldRotationQuatnerion;
                        NoteControllerInit._inverseWorldRotationFloorAccessor(ref floorMovement) = inverseWorldRotation;
                    }

                    worldRotationQuatnerion *= localRotation;

                    if (localRotationOffset.HasValue)
                    {
                        worldRotationQuatnerion *= localRotationOffset.Value;
                    }

                    transform.localRotation = worldRotationQuatnerion;
                }

                if (scaleOffset.HasValue)
                {
                    transform.localScale = scaleOffset.Value;
                }

                if (dissolve.HasValue)
                {
                    CutoutEffect cutoutEffect = noodleData.CutoutEffect;
                    if (cutoutEffect == null)
                    {
                        BaseNoteVisuals     baseNoteVisuals     = __instance.gameObject.GetComponent <BaseNoteVisuals>();
                        CutoutAnimateEffect cutoutAnimateEffect = _noteCutoutAnimateEffectAccessor(ref baseNoteVisuals);
                        CutoutEffect[]      cutoutEffects       = _cutoutEffectAccessor(ref cutoutAnimateEffect);
                        cutoutEffect            = cutoutEffects.First(n => n.name != "NoteArrow"); // 1.11 NoteArrow has been added to the CutoutAnimateEffect and we don't want that
                        noodleData.CutoutEffect = cutoutEffect;
                    }

                    cutoutEffect.SetCutout(1 - dissolve.Value);
                }

                if (dissolveArrow.HasValue && __instance.noteData.colorType != ColorType.None)
                {
                    MonoBehaviour disappearingArrowController = noodleData.DisappearingArrowController;
                    if (disappearingArrowController == null)
                    {
                        disappearingArrowController = __instance.gameObject.GetComponent <DisappearingArrowControllerBase <GameNoteController> >();
                        if (disappearingArrowController == null)
                        {
                            disappearingArrowController = __instance.gameObject.GetComponent <DisappearingArrowControllerBase <MultiplayerConnectedPlayerGameNoteController> >();
                        }

                        noodleData.DisappearingArrowController = disappearingArrowController;
                        noodleData.DisappearingArrowMethod     = GetSetArrowTransparency(disappearingArrowController.GetType());
                    }

                    // gross nasty reflection
                    noodleData.DisappearingArrowMethod.Invoke(disappearingArrowController, new object[] { dissolveArrow.Value });
                }

                if (cuttable.HasValue)
                {
                    bool enabled = cuttable.Value >= 1;

                    switch (__instance)
                    {
                    case GameNoteController gameNoteController:
                        BoxCuttableBySaber[] bigCuttableBySaberList = _gameNoteBigCuttableAccessor(ref gameNoteController);
                        foreach (BoxCuttableBySaber bigCuttableBySaber in bigCuttableBySaberList)
                        {
                            if (bigCuttableBySaber.canBeCut != enabled)
                            {
                                bigCuttableBySaber.canBeCut = enabled;
                            }
                        }

                        BoxCuttableBySaber[] smallCuttableBySaberList = _gameNoteSmallCuttableAccessor(ref gameNoteController);
                        foreach (BoxCuttableBySaber smallCuttableBySaber in smallCuttableBySaberList)
                        {
                            if (smallCuttableBySaber.canBeCut != enabled)
                            {
                                smallCuttableBySaber.canBeCut = enabled;
                            }
                        }

                        break;

                    case BombNoteController bombNoteController:
                        CuttableBySaber boxCuttableBySaber = _bombNoteCuttableAccessor(ref bombNoteController);
                        if (boxCuttableBySaber.canBeCut != enabled)
                        {
                            boxCuttableBySaber.canBeCut = enabled;
                        }

                        break;
                    }
                }
            }
        }
Ejemplo n.º 14
0
        private static void Postfix(NoteController __instance, NoteData noteData, NoteMovement ____noteMovement, Vector3 moveStartPos, Vector3 moveEndPos, Vector3 jumpEndPos, float endRotation)
        {
            NoodleNoteData?noodleData = TryGetObjectData <NoodleNoteData>(noteData);

            if (noodleData == null)
            {
                return;
            }

            Quaternion?cutQuaternion = noodleData.CutQuaternion;

            NoteJump          noteJump      = _noteJumpAccessor(ref ____noteMovement);
            NoteFloorMovement floorMovement = _noteFloorMovementAccessor(ref ____noteMovement);

            if (cutQuaternion.HasValue)
            {
                Quaternion quatVal = cutQuaternion.Value;
                _endRotationAccessor(ref noteJump) = quatVal;
                Vector3 vector = quatVal.eulerAngles;
                vector += _randomRotationsAccessor(ref noteJump)[_randomRotationIdxAccessor(ref noteJump)] * 20;
                Quaternion midrotation = Quaternion.Euler(vector);
                _middleRotationAccessor(ref noteJump) = midrotation;
            }

            Quaternion?worldRotationQuaternion = noodleData.WorldRotationQuaternion;
            Quaternion?localRotationQuaternion = noodleData.LocalRotationQuaternion;

            Transform transform = __instance.transform;

            Quaternion localRotation = Quaternion.identity;

            if (worldRotationQuaternion.HasValue || localRotationQuaternion.HasValue)
            {
                if (localRotationQuaternion.HasValue)
                {
                    localRotation = localRotationQuaternion.Value;
                }

                if (worldRotationQuaternion.HasValue)
                {
                    Quaternion quatVal = worldRotationQuaternion.Value;
                    Quaternion inverseWorldRotation = Quaternion.Inverse(quatVal);
                    _worldRotationJumpAccessor(ref noteJump)              = quatVal;
                    _inverseWorldRotationJumpAccessor(ref noteJump)       = inverseWorldRotation;
                    _worldRotationFloorAccessor(ref floorMovement)        = quatVal;
                    _inverseWorldRotationFloorAccessor(ref floorMovement) = inverseWorldRotation;

                    quatVal *= localRotation;

                    transform.localRotation = quatVal;
                }
                else
                {
                    transform.localRotation *= localRotation;
                }
            }

            if (transform.localScale != Vector3.one)
            {
                transform.localScale = Vector3.one; // This is a fix for animation due to notes being recycled
            }

            IEnumerable <Track>?tracks = noodleData.Track;

            if (tracks != null)
            {
                foreach (Track track in tracks)
                {
                    // add to gameobjects
                    track.AddGameObject(__instance.gameObject);
                }
            }

            // how f*****g long has _zOffset existed???!??
            float zOffset = _zOffsetAccessor(ref ____noteMovement);

            moveStartPos.z += zOffset;
            moveEndPos.z   += zOffset;
            jumpEndPos.z   += zOffset;

            noodleData.EndRotation   = endRotation;
            noodleData.MoveStartPos  = moveStartPos;
            noodleData.MoveEndPos    = moveEndPos;
            noodleData.JumpEndPos    = jumpEndPos;
            noodleData.WorldRotation = __instance.worldRotation;
            noodleData.LocalRotation = localRotation;
        }
Ejemplo n.º 15
0
        private static void Prefix(NoteController __instance, NoteData ____noteData, NoteMovement ____noteMovement)
        {
            NoodleData = TryGetObjectData <NoodleObjectData>(____noteData);
            if (NoodleData == null)
            {
                return;
            }

            NoodleNoteData noodleData = (NoodleNoteData)NoodleData;

            IEnumerable <Track>?tracks = noodleData.Track;

            NoodleObjectData.AnimationObjectData?animationObject = noodleData.AnimationObject;
            if (tracks != null || animationObject != null)
            {
                NoteJump          noteJump      = NoteControllerInit._noteJumpAccessor(ref ____noteMovement);
                NoteFloorMovement floorMovement = NoteControllerInit._noteFloorMovementAccessor(ref ____noteMovement);

                // idk i just copied base game time
                float jumpDuration = _jumpDurationAccessor(ref noteJump);
                float elapsedTime  = _audioTimeSyncControllerAccessor(ref noteJump).songTime - (____noteData.time - (jumpDuration * 0.5f));
                elapsedTime = NoteJumpManualUpdate.NoteJumpTimeAdjust(elapsedTime, jumpDuration);
                float normalTime = elapsedTime / jumpDuration;

                Animation.AnimationHelper.GetObjectOffset(animationObject, tracks, normalTime, out Vector3? positionOffset, out Quaternion? rotationOffset, out Vector3? scaleOffset, out Quaternion? localRotationOffset, out float?dissolve, out float?dissolveArrow, out float?cuttable);

                if (positionOffset.HasValue)
                {
                    Vector3 moveStartPos = noodleData.MoveStartPos;
                    Vector3 moveEndPos   = noodleData.MoveEndPos;
                    Vector3 jumpEndPos   = noodleData.JumpEndPos;

                    Vector3 offset = positionOffset.Value;
                    _floorStartPosAccessor(ref floorMovement) = moveStartPos + offset;
                    _floorEndPosAccessor(ref floorMovement)   = moveEndPos + offset;
                    _jumpStartPosAccessor(ref noteJump)       = moveEndPos + offset;
                    _jumpEndPosAccessor(ref noteJump)         = jumpEndPos + offset;
                }

                Transform transform = __instance.transform;

                if (rotationOffset.HasValue || localRotationOffset.HasValue)
                {
                    Quaternion worldRotation = noodleData.WorldRotation;
                    Quaternion localRotation = noodleData.LocalRotation;

                    Quaternion worldRotationQuatnerion = worldRotation;
                    if (rotationOffset.HasValue)
                    {
                        worldRotationQuatnerion *= rotationOffset.Value;
                        Quaternion inverseWorldRotation = Quaternion.Inverse(worldRotationQuatnerion);
                        NoteControllerInit._worldRotationJumpAccessor(ref noteJump)              = worldRotationQuatnerion;
                        NoteControllerInit._inverseWorldRotationJumpAccessor(ref noteJump)       = inverseWorldRotation;
                        NoteControllerInit._worldRotationFloorAccessor(ref floorMovement)        = worldRotationQuatnerion;
                        NoteControllerInit._inverseWorldRotationFloorAccessor(ref floorMovement) = inverseWorldRotation;
                    }

                    worldRotationQuatnerion *= localRotation;

                    if (localRotationOffset.HasValue)
                    {
                        worldRotationQuatnerion *= localRotationOffset.Value;
                    }

                    transform.localRotation = worldRotationQuatnerion;
                }

                if (scaleOffset.HasValue)
                {
                    transform.localScale = scaleOffset.Value;
                }

                if (dissolve.HasValue)
                {
                    if (CutoutManager.NoteCutoutEffects.TryGetValue(__instance, out CutoutEffectWrapper cutoutEffect))
                    {
                        cutoutEffect.SetCutout(dissolve.Value);
                    }
                }

                if (dissolveArrow.HasValue && __instance.noteData.colorType != ColorType.None)
                {
                    if (CutoutManager.NoteDisappearingArrowWrappers.TryGetValue(__instance, out DisappearingArrowWrapper disappearingArrowWrapper))
                    {
                        disappearingArrowWrapper.SetCutout(dissolveArrow.Value);
                    }
                }

                if (cuttable.HasValue)
                {
                    bool enabled = cuttable.Value >= 1;

                    switch (__instance)
                    {
                    case GameNoteController gameNoteController:
                        BoxCuttableBySaber[] bigCuttableBySaberList = _gameNoteBigCuttableAccessor(ref gameNoteController);
                        foreach (BoxCuttableBySaber bigCuttableBySaber in bigCuttableBySaberList)
                        {
                            if (bigCuttableBySaber.canBeCut != enabled)
                            {
                                bigCuttableBySaber.canBeCut = enabled;
                            }
                        }

                        BoxCuttableBySaber[] smallCuttableBySaberList = _gameNoteSmallCuttableAccessor(ref gameNoteController);
                        foreach (BoxCuttableBySaber smallCuttableBySaber in smallCuttableBySaberList)
                        {
                            if (smallCuttableBySaber.canBeCut != enabled)
                            {
                                smallCuttableBySaber.canBeCut = enabled;
                            }
                        }

                        break;

                    case BombNoteController bombNoteController:
                        CuttableBySaber boxCuttableBySaber = _bombNoteCuttableAccessor(ref bombNoteController);
                        if (boxCuttableBySaber.canBeCut != enabled)
                        {
                            boxCuttableBySaber.canBeCut = enabled;
                        }

                        break;
                    }
                }
            }
        }
Ejemplo n.º 16
0
        private static void Postfix(NoteController __instance, NoteData ____noteData, NoteMovement ____noteMovement)
        {
            ChromaObjectData?chromaData = TryGetObjectData <ChromaObjectData>(____noteData);

            if (chromaData == null)
            {
                return;
            }

            Track?          track = chromaData.Track;
            PointDefinition?pathPointDefinition = chromaData.LocalPathColor;

            if (track != null || pathPointDefinition != null)
            {
                NoteJump noteJump = _noteJumpAccessor(ref ____noteMovement);

                float jumpDuration = _jumpDurationAccessor(ref noteJump);
                float elapsedTime  = _audioTimeSyncControllerAccessor(ref noteJump).songTime - (____noteData.time - (jumpDuration * 0.5f));
                float normalTime   = elapsedTime / jumpDuration;

                Chroma.AnimationHelper.GetColorOffset(pathPointDefinition, track, normalTime, out Color? colorOffset);

                if (colorOffset.HasValue)
                {
                    Color color = colorOffset.Value;
                    if (__instance is BombNoteController)
                    {
                        __instance.ColorizeBomb(color);
                    }
                    else
                    {
                        __instance.ColorizeNote(color);
                    }
                }
            }
        }
Ejemplo n.º 17
0
 static void Prefix(ref NoteData noteData, ref Vector3 moveStartPos, ref Vector3 moveEndPos, Vector3 jumpEndPos, float moveDuration, float jumpDuration, float startTime, float jumpGravity, ref NoteController __instance, ref NoteData ____noteData, ref NoteMovement ____noteMovement, ref Action <NoteController> ___didInitEvent)
 {
     if (noraUI.CursedJump.Enabled)
     {
         moveStartPos.y *= 100;
         moveStartPos.y += UnityEngine.Random.Range(-4, 4);
     }
 }
Ejemplo n.º 18
0
 private static void Postfix(NoteController __instance, NoteData ____noteData, NoteMovement ____noteMovement)
 {
     if (NoodleExtensionsInstalled)
     {
         TrackColorize(__instance, ____noteData, ____noteMovement);
     }
 }