Example #1
0
 private void OnNoteCut(NoteData data, NoteCutInfo nci, int c)
 {
     if (data.noteType == NoteType.Bomb || !nci.allIsOK)
     {
         StartCoroutine(Missed());
     }
 }
        public HitData(NoteData data, bool noteWasCut, NoteCutInfo info = null)
        {
            objectTime = data.time;

            this.noteWasCut = noteWasCut;

            if (noteWasCut)
            {
                isSaberA      = info.saberType == Saber.SaberType.SaberA;
                speedOK       = info.speedOK;
                directionOK   = info.directionOK;
                saberTypeOK   = info.saberTypeOK;
                wasCutTooSoon = info.wasCutTooSoon;
            }
            else
            {
                isSaberA      = false;
                speedOK       = false;
                directionOK   = false;
                saberTypeOK   = false;
                wasCutTooSoon = false;
            }

            reserved1 = reserved2 = false;
        }
Example #3
0
        private void OnNoteWasCut(NoteData noteData, NoteCutInfo noteCutInfo, int multiplier)
        {
            if (noteData.noteType == NoteType.Bomb)
            {
                OnBombCut();
                return;
            }

            if (!noteCutInfo.allIsOK)
            {
                OnNoteWasMissed(noteData, 0);
            }
            else
            {
                var acsbList = _scoreController.GetPrivateField <List <CutScoreBuffer> >("_cutScoreBuffers");

                foreach (CutScoreBuffer csb in acsbList)
                {
                    if (csb.GetPrivateField <NoteCutInfo>("_noteCutInfo") == noteCutInfo)
                    {
                        csb.didFinishEvent += OnNoteWasFullyCut;
                        break;
                    }
                }
                OnNoteCut();
            }
        }
 private void OnNoteCut(INoteController data, NoteCutInfo info)
 {
     if (data.noteData.noteType != NoteType.Bomb)
     {
         DecrementCounter();
     }
 }
Example #5
0
 private void OnNoteCute(NoteData data, NoteCutInfo info, int c)
 {
     if (data.noteType == NoteType.Bomb || !info.allIsOK)
     {
         AmplifyBloom();
     }
 }
Example #6
0
 private void OnNoteCut(NoteData data, NoteCutInfo info, int cutScore)
 {
     if (data.noteType != NoteType.Bomb)
     {
         DecrementCounter();
     }
 }
Example #7
0
        private void NoteWasCut(NoteController noteController, NoteCutInfo noteCutInfo)
        {
            if (noteController.noteData.colorType == ColorType.None || noteController.noteData.beatmapObjectType != BeatmapObjectType.Note)
            {
                return;
            }

            AllNotesCountDidChangeEvent(allNotesCount++, cuttableNotes);
            if (noteCutInfo.allIsOK)
            {
                NoteWasCutEvent((int)noteCutInfo.saberType);
                GoodCutCountDidChangeEvent(goodCutCount++);
            }
            else
            {
                BadCutCountDidChangeEvent(badCutCount++);
            }
            if (Mathf.Approximately(noteController.noteData.time, _lastNoteTime))
            {
                _lastNoteTime = 0f;
                LevelFinishedEvent();
                LevelCompletionResults results = _prepareLevelCompletionResults.FillLevelCompletionResults(LevelCompletionResults.LevelEndStateType.Cleared, LevelCompletionResults.LevelEndAction.None);
                if (results.modifiedScore > highScore)
                {
                    NewHighscore();
                }
            }
        }
Example #8
0
 private void OnNoteCut(NoteData data, NoteCutInfo info, int c)
 {
     if (data.id < notesCount && data.noteType != NoteType.Bomb && !info.allIsOK)
     {
         Oops(data);
     }
 }
Example #9
0
        static void Postfix(FlyingScoreEffect __instance, ref Color ____color, NoteCutInfo noteCutInfo)
        {
            float score = RageSaber.RageScore.calculateFromSpeed(noteCutInfo.saberSpeed);

            RageSaber.RageScore.instance.curScore += score;
            RageSaber.RageScore.instance.hitCount++;

            void judge(SaberSwingRatingCounter counter)
            {
                TextMeshPro text = __instance.getPrivateField <TextMeshPro>("_text");

                // enable rich text
                text.richText = true;
                // disable word wrap, make sure full text displays
                text.enableWordWrapping = false;
                text.overflowMode       = TextOverflowModes.Overflow;
                text.text = score.ToString("n0");

                // If the counter is finished, remove our event from it
                counter.didFinishEvent -= judge;
            }

            // Apply judgments a total of twice - once when the effect is created, once when it finishes.
            judge(noteCutInfo.swingRatingCounter);
            noteCutInfo.swingRatingCounter.didFinishEvent += judge;
        }
Example #10
0
 static bool Prefix(GameNoteController __instance, Saber saber, Vector3 cutPoint, Quaternion orientation, Vector3 cutDirVec, bool allowBadCut,
                    ref AudioTimeSyncController ____audioTimeSyncController, ref BoxCuttableBySaber ____bigCuttableBySaber, ref BoxCuttableBySaber ____smallCuttableBySaber, NoteBasicCutInfoSO ____noteBasicCutInfo)
 {
     if ((int)__instance.noteData.cutDirection >= 2000)
     {
         float timeDeviation = __instance.noteData.time - ____audioTimeSyncController.songTime;
         bool  flag;
         bool  flag2;
         bool  flag3;
         float cutDirDeviation;
         ____noteBasicCutInfo.GetBasicCutInfo(__instance.noteTransform, __instance.noteData.noteType, NoteCutDirection.Any, saber.saberType, saber.bladeSpeed, cutDirVec, out flag, out flag2, out flag3, out cutDirDeviation);
         float swingRating = 0f;
         SaberAfterCutSwingRatingCounter afterCutSwingRatingCounter = null;
         if (flag && flag2 && flag3)
         {
             swingRating = saber.ComputeSwingRating();
             afterCutSwingRatingCounter = saber.CreateAfterCutSwingRatingCounter();
         }
         else if (!allowBadCut)
         {
             return(false);
         }
         Vector3     vector = orientation * Vector3.up;
         Plane       plane  = new Plane(vector, cutPoint);
         float       cutDistanceToCenter = Mathf.Abs(plane.GetDistanceToPoint(__instance.noteTransform.position));
         NoteCutInfo noteCutInfo         = new NoteCutInfo(flag2, flag, flag3, false, saber.bladeSpeed, cutDirVec, saber.saberType, swingRating, timeDeviation, cutDirDeviation, plane.ClosestPointOnPlane(__instance.transform.position), vector, afterCutSwingRatingCounter, cutDistanceToCenter);
         ____bigCuttableBySaber.canBeCut   = false;
         ____smallCuttableBySaber.canBeCut = false;
         __instance.SendNoteWasCutEvent(noteCutInfo);
         return(false);
     }
     return(true);
 }
Example #11
0
        public void Notehit(NoteData data, NoteCutInfo notecut, int h)
        {
            Color a    = new Color(UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f));
            bool  flag = data.noteType == NoteData.NoteType.NoteA;

            if (flag)
            {
                this._redSaberMat.SetColor("_Color", a * (notecut.swingRating * 4f));
                this._redSaberMat.SetColor("_EmissionColor", a * (notecut.swingRating * 4f));
                bool flag2 = !notecut.allIsOK;
                if (flag2)
                {
                    this._redSaberMat.SetColor("_Color", new Color(0f, 0f, 0f, 0f));
                    this._redSaberMat.SetColor("_EmissionColor", new Color(0f, 0f, 0f, 0f));
                }
            }
            else
            {
                bool flag3 = data.noteType == NoteData.NoteType.NoteB;
                if (flag3)
                {
                    this._blueSaberMat.SetColor("_Color", a * (notecut.swingRating * 4f));
                    this._blueSaberMat.SetColor("_EmissionColor", a * (notecut.swingRating * 4f));
                    bool flag4 = !notecut.allIsOK;
                    if (flag4)
                    {
                        this._blueSaberMat.SetColor("_Color", new Color(0f, 0f, 0f, 0f));
                        this._blueSaberMat.SetColor("_EmissionColor", new Color(0f, 0f, 0f, 0f));
                    }
                }
            }
        }
 public static void NoteDebrisSpawner_SpawnDebris(NoteDebrisSpawner t, NoteCutInfo noteCutInfo, NoteController noteController)
 {
     if (!Plugin.Instance.Enabled)
     {
         _noteDebrisSpawner_SpawnDebris.InvokeOriginal(t, new object[] { noteCutInfo, noteController });
     }
 }
Example #13
0
 private void NoteWasCutEvent(NoteController data, NoteCutInfo noteCutInfo)
 {
     foreach (INoteEventHandler noteEventHandler in EventHandlers)
     {
         noteEventHandler?.OnNoteCut(data.noteData, noteCutInfo);
     }
 }
Example #14
0
 private void OnNoteCut(INoteController data, NoteCutInfo info)
 {
     if (data.noteData.noteType != NoteType.Bomb)
     {
         _totalNotes++;
     }
 }
 public void OnNoteCut(NoteData data, NoteCutInfo info)
 {
     if (data.colorType != ColorType.None && !noteCountProcessor.ShouldIgnoreNote(data))
     {
         DecrementCounter();
     }
 }
Example #16
0
        void OnNoteHit(NoteData data, NoteCutInfo info, int score)
        {
            bool done = false;

            void addScore(SaberSwingRatingCounter counter)
            {
                ScoreController.RawScoreWithoutMultiplier(info, out int beforeCutRawScore, out int afterCutRawScore, out int cutDistanceRawScore);
                numNotes++;
                int newScore = beforeCutRawScore + afterCutRawScore + cutDistanceRawScore;

                totalScore += newScore;
                if (UI.Settings.instance.isListEnabled)
                {
                    scoreList[newScore]++;
                }
                done = true;
                info.swingRatingCounter.didFinishEvent -= addScore;
            }

            if (done)
            {
                return;
            }
            else
            {
                noteCutInfo = info;
                info.swingRatingCounter.didFinishEvent += addScore;
            }
        }
Example #17
0
 public void OnNoteCut(NoteData data, NoteCutInfo info)
 {
     if (!info.allIsOK)
     {
         t += 30;
     }
 }
Example #18
0
 private void noteWasCutEvent(NoteData arg1, NoteCutInfo arg2, int score)
 {
     if (arg2.allIsOK)
     {
         localPlayerInfo.playerCutBlocks++;
     }
 }
Example #19
0
 public void OnNoteCut(NoteData data, NoteCutInfo info)
 {
     if (Settings.CountBadCuts && !info.allIsOK && data.colorType != ColorType.None)
     {
         counter.text = (++notesMissed).ToString();
     }
 }
        public static void HandleControlelrNoteWasCut(NoteData noteData, NoteCutInfo noteCutInfo, int multiplayer)
        {
            if (player == null)
            {
                return;
            }

            NoteInfo noteInfo = new NoteInfo(noteData.time, (int)noteData.noteType, (int)noteData.cutDirection);

            noteInfo.ConvertTime2Measure(180f);


            AudioTimeSyncController audioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();

            float diffTime = 0;

            if (audioTimeSync != null)
            {
                diffTime = noteData.time - audioTimeSync.songTime;
            }

            if (diffTime > 0)
            {
                player.PlayScheduled(noteInfo, diffTime);
            }
            else
            {
                player.Play(noteInfo);
            }

            Logger.Write("NoteCut");
            Logger.Write(diffTime.ToString());
            Logger.Write(noteData.time.ToString());
            Logger.Write(noteInfo.time.ToString());
        }
        public void Cut(NoteData data, NoteCutInfo info, int combo)
        {
            notes++;
            if (!info.allIsOK)
            {
                misses++;
                UpdateText();
                return;
            }
            bool didDone = false;

            info.afterCutSwingRatingCounter.didFinishEvent += e =>
            {
                if (didDone)
                {
                    return;
                }
                didDone = true;
                ScoreController.RawScoreWithoutMultiplier(info, info.afterCutSwingRatingCounter, out int before, out int after, out int distScore);
                int total = before + after;
                for (int i = 0; i < scoreRanges.Length; i++)
                {
                    if (scoreRanges[i] < total)
                    {
                        scoreCount[i]++;
                        UpdateText();
                        return;
                    }
                }
                scoreCount[scoreRanges.Length]++;
                UpdateText();
            };
        }
Example #22
0
        static void Postfix(FlyingScoreEffect __instance, ref Color ____color, NoteCutInfo noteCutInfo)
        {
            void earlyJudge(SaberSwingRatingCounter counter)
            {
                ScoreController.RawScoreWithoutMultiplier(noteCutInfo, out int before, out int after, out int accuracy);
                int total = before + 30 + accuracy;

                Config.judge(__instance, noteCutInfo, counter, total, before, 30, accuracy);

                // If the counter is finished, remove our event from it
                counter.didFinishEvent -= judge;
            }

            void judge(SaberSwingRatingCounter counter)
            {
                ScoreController.RawScoreWithoutMultiplier(noteCutInfo, out int before, out int after, out int accuracy);
                int total = before + after + accuracy;

                Config.judge(__instance, noteCutInfo, counter, total, before, after, accuracy);

                // If the counter is finished, remove our event from it
                counter.didFinishEvent -= judge;
            }

            // Apply judgments a total of twice - once when the effect is created, once when it finishes.
            earlyJudge(noteCutInfo.swingRatingCounter);
            noteCutInfo.swingRatingCounter.didFinishEvent += judge;
        }
Example #23
0
 private void OnNoteCut(NoteData data, NoteCutInfo info, int c)
 {
     if (data.noteType == NoteType.Bomb || !info.allIsOK)
     {
         IncrementCounter();
     }
 }
Example #24
0
        private void SetNoteCutStatus(NoteData noteData, NoteCutInfo noteCutInfo)
        {
            GameStatus gameStatus = statusManager.gameStatus;

            gameStatus.noteID                = noteData.id;
            gameStatus.noteType              = noteData.noteType.ToString();
            gameStatus.noteCutDirection      = noteData.cutDirection.ToString();
            gameStatus.noteLine              = noteData.lineIndex;
            gameStatus.noteLayer             = (int)noteData.noteLineLayer;
            gameStatus.speedOK               = noteCutInfo.speedOK;
            gameStatus.directionOK           = noteCutInfo.directionOK;
            gameStatus.saberTypeOK           = noteCutInfo.saberTypeOK;
            gameStatus.wasCutTooSoon         = noteCutInfo.wasCutTooSoon;
            gameStatus.saberSpeed            = noteCutInfo.saberSpeed;
            gameStatus.saberDirX             = noteCutInfo.saberDir[0];
            gameStatus.saberDirY             = noteCutInfo.saberDir[1];
            gameStatus.saberDirZ             = noteCutInfo.saberDir[2];
            gameStatus.saberType             = noteCutInfo.saberType.ToString();
            gameStatus.swingRating           = noteCutInfo.swingRating;
            gameStatus.timeDeviation         = noteCutInfo.timeDeviation;
            gameStatus.cutDirectionDeviation = noteCutInfo.cutDirDeviation;
            gameStatus.cutPointX             = noteCutInfo.cutPoint[0];
            gameStatus.cutPointY             = noteCutInfo.cutPoint[1];
            gameStatus.cutPointZ             = noteCutInfo.cutPoint[2];
            gameStatus.cutNormalX            = noteCutInfo.cutNormal[0];
            gameStatus.cutNormalY            = noteCutInfo.cutNormal[1];
            gameStatus.cutNormalZ            = noteCutInfo.cutNormal[2];
            gameStatus.cutDistanceToCenter   = noteCutInfo.cutDistanceToCenter;
        }
 private async void OnNoteCut(NoteData data, NoteCutInfo info, int c)
 {
     if (data.noteType == NoteType.Bomb || !info.allIsOK)
     {
         await TiltScene();
     }
 }
Example #26
0
        public void OnNoteWasFullyCut(AfterCutScoreBuffer acsb)
        {
            int score;
            int afterScore;
            int cutDistanceScore;

            NoteCutInfo noteCutInfo = (NoteCutInfo)noteCutInfoField.GetValue(acsb);
            NoteData    noteData    = noteCutMapping[noteCutInfo];

            noteCutMapping.Remove(noteCutInfo);

            SetNoteCutStatus(noteData, noteCutInfo);

            // public ScoreController.RawScoreWithoutMultiplier(NoteCutInfo, SaberAfterCutSwingRatingCounter, out int beforeCutScore, out int afterCutScore, out int cutDistanceScore)
            ScoreController.RawScoreWithoutMultiplier(noteCutInfo, null, out score, out afterScore, out cutDistanceScore);

            int multiplier = (int)afterCutScoreBufferMultiplierField.GetValue(acsb);

            afterScore = (int)afterCutScoreWithMultiplierField.GetValue(acsb) / multiplier;

            statusManager.gameStatus.initialScore  = score;
            statusManager.gameStatus.finalScore    = score + afterScore;
            statusManager.gameStatus.cutMultiplier = multiplier;

            statusManager.EmitStatusUpdate(ChangedProperties.PerformanceAndNoteCut, "noteFullyCut");

            acsb.didFinishEvent -= OnNoteWasFullyCut;
        }
Example #27
0
        public void OnNoteWasFullyCut(CutScoreBuffer acsb)
        {
            int beforeCutScore;
            int afterCutScore;
            int cutDistanceScore;

            NoteCutInfo noteCutInfo = (NoteCutInfo)noteCutInfoField.GetValue(acsb);
            NoteData    noteData    = noteCutMapping[noteCutInfo];

            noteCutMapping.Remove(noteCutInfo);

            SetNoteCutStatus(noteData, noteCutInfo, false);

            // public static ScoreModel.RawScoreWithoutMultiplier(NoteCutInfo, out int beforeCutRawScore, out int afterCutRawScore, out int cutDistanceRawScore)
            ScoreModel.RawScoreWithoutMultiplier(noteCutInfo, out beforeCutScore, out afterCutScore, out cutDistanceScore);

            int multiplier = (int)cutScoreBufferMultiplierField.GetValue(acsb);

            statusManager.gameStatus.initialScore     = beforeCutScore + cutDistanceScore;
            statusManager.gameStatus.finalScore       = beforeCutScore + afterCutScore + cutDistanceScore;
            statusManager.gameStatus.cutDistanceScore = cutDistanceScore;
            statusManager.gameStatus.cutMultiplier    = multiplier;

            statusManager.EmitStatusUpdate(ChangedProperties.PerformanceAndNoteCut, "noteFullyCut");

            acsb.didFinishEvent -= OnNoteWasFullyCut;
        }
Example #28
0
 static bool Prefix(ref NoteCutInfo noteCutInfo)
 {
     if (Quest_SpectatorController.instance.spectating && !noteCutInfo.allIsOK && Quest_SpectatorController.instance.hasFakeMiss())
     {
         return(false);
     }
     return(true);
 }
Example #29
0
 private static void Prefix(NoteController noteController, NoteCutInfo noteCutInfo)
 {
     if (!noteCutInfo.allIsOK || noteController.noteData.colorType == ColorType.None)
     {
         return;
     }
     NoteCutScoreSpawnerHandleNoteWasCut.isNoteCutEffect = true;
 }
Example #30
0
 private void NoteWasCutEvent(NoteData note, NoteCutInfo cut, int score)
 {
     if (cut.allIsOK)
     {
         PlayerController.Instance.UpdatePlayerScoring("playerCutBlocks", 1);
     }
     PlayerController.Instance.UpdatePlayerScoring("playerTotalBlocks", 1);
 }