Ejemplo n.º 1
0
        public static bool Prefix(FlyingScoreSpawner __instance, NoteCutInfo noteCutInfo, int noteLineIndex, int multiplier, Vector3 pos, Color color, ref float[,] ___lineSlotSpawnTimes, ref FlyingScoreEffect.Pool ____flyingScoreEffectPool)
        {
            if (!Plugin.active)
            {
                return(true);
            }

            if (noteLineIndex >= ___lineSlotSpawnTimes.GetLength(0))
            {
                float[,] array = new float[noteLineIndex, 1];
                for (int i = 0; i < ___lineSlotSpawnTimes.GetLength(0); i++)
                {
                    for (int j = 0; j < 1; j++)
                    {
                        array[i, j] = ___lineSlotSpawnTimes[i, j];
                    }
                }
                ___lineSlotSpawnTimes = array;
            }

            int num = 0;

            while (num < 0 && ___lineSlotSpawnTimes[noteLineIndex, num] + 0.4f >= Time.timeSinceLevelLoad)
            {
                num++;
            }

            ___lineSlotSpawnTimes[noteLineIndex, num] = Time.timeSinceLevelLoad;
            FlyingScoreEffect flyingScoreEffect = ____flyingScoreEffectPool.Spawn();

            flyingScoreEffect.didFinishEvent += __instance.HandleFlyingScoreEffectDidFinish;
            Vector3 targetPos = Vector3.zero;

            if (lastNoteRotationSet)
            {
                flyingScoreEffect.transform.SetPositionAndRotation(lastNoteRotation * pos, lastNoteRotation);
                pos.z     = 0f;
                pos.y     = -0.24f;
                targetPos = lastNoteRotation * (pos + new Vector3(0f, -0.23f * num, 7.55f));
            }
            else
            {
                flyingScoreEffect.transform.SetPositionAndRotation(pos, Quaternion.identity);
                pos.z     = 0f;
                pos.y     = -0.24f;
                targetPos = pos + new Vector3(0f, -0.23f * num, 7.55f);
            }

            flyingScoreEffect.InitAndPresent(noteCutInfo, multiplier, 0.7f, targetPos, color);

            return(false);
        }
Ejemplo n.º 2
0
        private static bool Prefix(FlyingScoreSpawner __instance, FlyingScoreEffect.Pool ____flyingScoreEffectPool, Vector3 pos, NoteCutInfo noteCutInfo, Quaternion rotation, Quaternion inverseRotation)
        {
            IEnumerator g__SpawnFlyingScoreEffectCoroutine(int index, Vector3 position)
            {
                yield return(new WaitForSecondsRealtime(FlyingObjectEffectParameters.timeShift * index));

                FlyingScoreEffect flyingScoreEffect = ____flyingScoreEffectPool.Spawn();

                flyingScoreEffect.didFinishEvent         += __instance.HandleFlyingScoreEffectDidFinish;
                flyingScoreEffect.transform.localPosition = position;
                position   = inverseRotation * position;
                position.z = 0f;
                if (PluginConfig.Instance.forward)
                {
                    float offsetY = (PluginConfig.Instance.scale - 0.5f) * FlyingObjectEffectParameters.scaleOffsetCoefY;
                    position = new Vector3(position.x, PluginConfig.Instance.forwardTargetY + offsetY, pos.z + PluginConfig.Instance.forwardTargetZ);
                    position = rotation * position;
                }
                flyingScoreEffect.InitAndPresent(noteCutInfo, index * -1, -0.7f, position, rotation, Color.white);
            }

            bool noScoreText = PluginConfig.Instance.noScoreText;
            bool result;

            if (noScoreText)
            {
                result = false;
            }
            else
            {
                bool flag = !PluginConfig.Instance.pro;
                if (flag)
                {
                    float offsetX = FlyingObjectEffectParameters.scoreNumberOffsetX * PluginConfig.Instance.scale;
                    bool  forward = PluginConfig.Instance.forward;
                    if (forward)
                    {
                        offsetX *= FlyingObjectEffectParameters.forwardScale;
                    }
                    Vector3 offset = new Vector3(offsetX, 0f, 0f);
                    Vector3 pos2   = rotation * (Quaternion.Inverse(rotation) * pos - offset);
                    Vector3 pos3   = rotation * (Quaternion.Inverse(rotation) * pos + offset);
                    PersistentSingleton <SharedCoroutineStarter> .instance.StartCoroutine(g__SpawnFlyingScoreEffectCoroutine(1, pos2));

                    PersistentSingleton <SharedCoroutineStarter> .instance.StartCoroutine(g__SpawnFlyingScoreEffectCoroutine(2, pos));

                    PersistentSingleton <SharedCoroutineStarter> .instance.StartCoroutine(g__SpawnFlyingScoreEffectCoroutine(3, pos3));
                }
                result = true;
            }
            return(result);
        }
 private static void ConditionedSpawnFlyingScore(
     FlyingScoreSpawner flyingScoreSpawner,
     NoteCutInfo noteCutInfo,
     int noteLineIndex,
     int multiplier,
     Vector3 pos,
     Quaternion rotation,
     Quaternion inverseRotation,
     Color color,
     INoteController noteController)
 {
     if (FakeNoteHelper.GetFakeNote(noteController))
     {
         flyingScoreSpawner.SpawnFlyingScore(noteCutInfo, noteLineIndex, multiplier, pos, rotation, inverseRotation, color);
     }
 }
Ejemplo n.º 4
0
        public static bool Prefix(Vector3 pos, NoteController noteController, NoteCutInfo noteCutInfo, ref ColorManager ____colorManager, ref NoteCutParticlesEffect ____noteCutParticlesEffect, ref bool ____spawnScores, ref ScoreController ____scoreController, ref FlyingScoreSpawner ____flyingScoreSpawner, ref ShockwaveEffect ____shockwaveEffect, ref FlyingSpriteSpawner ____failFlyingSpriteSpawner, ref NoteDebrisSpawner ____noteDebrisSpawner)
        {
            if (!Plugin.active)
            {
                return(true);
            }

            if (noteCutInfo.allIsOK)
            {
                NoteData noteData = noteController.noteData;
                Color    color    = ____colorManager.ColorForNoteType(noteData.noteType).ColorWithAlpha(0.5f);
                ____noteCutParticlesEffect.SpawnParticles(pos, noteCutInfo.cutNormal, noteCutInfo.saberDir, color, 150, 50, Mathf.Clamp(noteData.timeToNextBasicNote, 0.4f, 1f), noteCutInfo.saberType);

                if (____spawnScores)
                {
                    int multiplierWithFever = ____scoreController.multiplierWithFever;
                    FlyingScoreSpawnerPatch.lastNoteRotation    = noteController.transform.rotation;
                    FlyingScoreSpawnerPatch.lastNoteRotationSet = true;
                    Vector3 pos2 = Quaternion.Inverse(FlyingSpriteSpawnerPatch.lastNoteRotation) * pos;
                    ____flyingScoreSpawner.SpawnFlyingScore(noteCutInfo, noteData.lineIndex, multiplierWithFever, pos2, new Color(0.8f, 0.8f, 0.8f));
                }
                Vector3 pos3 = pos;
                pos3.y = 0.01f;
                ____shockwaveEffect.SpawnShockwave(pos3);
            }
            else
            {
                FlyingSpriteSpawnerPatch.lastNoteRotation    = noteController.transform.rotation;
                FlyingSpriteSpawnerPatch.lastNoteRotationSet = true;
                Vector3 pos4 = Quaternion.Inverse(FlyingSpriteSpawnerPatch.lastNoteRotation) * pos;
                ____failFlyingSpriteSpawner.SpawnFlyingSprite(pos4);
            }
            ____noteDebrisSpawner.SpawnDebris(noteCutInfo, noteController);

            return(false);
        }