Exemple #1
0
        private void Init(CountersData data)
        {
            scoreController = data.ScoreController;
            Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);

            TextHelper.CreateText(out missedText, position - new Vector3(0, 0.4f, 0));
            missedText.text      = "0";
            missedText.fontSize  = 4;
            missedText.color     = Color.white;
            missedText.alignment = TextAlignmentOptions.Center;

            GameObject labelGO = new GameObject("Counters+ | Missed Label");

            labelGO.transform.parent = transform;
            TextHelper.CreateText(out label, position);
            label.text      = "Misses";
            label.fontSize  = 3;
            label.color     = Color.white;
            label.alignment = TextAlignmentOptions.Center;

            if (settings.CustomMissTextIntegration)
            {
                UpdateCustomMissText();
            }

            if (scoreController != null)
            {
                scoreController.noteWasCutEvent    += OnNoteCut;
                scoreController.noteWasMissedEvent += OnNoteMiss;
            }
        }
Exemple #2
0
 private void PreInit()
 {
     if (!(settings.Mode == ICounterMode.BaseGame || settings.Mode == ICounterMode.BaseWithOutPoints))
     {
         for (var i = 0; i < transform.childCount; i++)
         {
             Transform child = transform.GetChild(i);
             if (child.gameObject.name != "ScoreText")
             {
                 if (child.GetComponent <TextMeshProUGUI>() != null)
                 {
                     Destroy(child.GetComponent <TextMeshProUGUI>());
                 }
                 Destroy(child.gameObject);
             }
             else
             {
                 PointsText = child.GetComponent <TMP_Text>();
             }
         }
         if (settings.Mode == ICounterMode.ScoreOnly)
         {
             Destroy(GameObject.Find("ScoreText"));
         }
         CreateText();
     }
     else
     {
         transform.position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);
     }
 }
Exemple #3
0
        private void CreateText()
        {
            transform.localScale = Vector3.one;
            transform.Find("ScoreText").GetComponent <TextMeshProUGUI>().fontSize = 0.325f;
            GameObject scoreMesh = new GameObject("Counters+ | Score Percent");

            scoreMesh.transform.SetParent(transform, false);
            Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);

            TextHelper.CreateText(out ScoreMesh, position);
            ScoreMesh.text      = "100.0%";
            ScoreMesh.fontSize  = 3;
            ScoreMesh.color     = Color.white;
            ScoreMesh.alignment = TextAlignmentOptions.Center;

            //transform.Find("ScoreText").GetComponent<TextMeshProUGUI>().rectTransform.position = position + new Vector3(-6.425f, 7.67f, 0);
            transform.Find("ScoreText").GetComponent <TextMeshProUGUI>().rectTransform.position = position + new Vector3(-0.01f, 7.77f, 0);
            if (settings.DisplayRank)
            {
                _RankObject = new GameObject("Counters+ | Score Rank");
                _RankObject.transform.SetParent(transform, false);
                TextHelper.CreateText(out RankText, position);
                RankText.text      = "\nSS";
                RankText.fontSize  = 4;
                RankText.color     = Color.white;
                RankText.alignment = TextAlignmentOptions.Center;
            }
            if (settings.Mode == ICounterMode.LeavePoints || settings.Mode == ICounterMode.BaseWithOutPoints)
            {
                transform.Find("ScoreText").GetComponent <TextMeshProUGUI>().rectTransform.position = new Vector3(-3.2f,
                                                                                                                  0.35f + (settings.Mode == ICounterMode.LeavePoints ? 7.8f : 0), 7);
            }
            GetComponent <ImmediateRankUIPanel>().Start(); //BS way of getting Harmony patch to function but "if it works its not stupid" ~Caeden117
        }
Exemple #4
0
        private void Init(CountersData data)
        {
            SC = data.ScoreController;
            SC.noteWasCutEvent    += OnNoteCut;
            SC.noteWasMissedEvent += OnNoteMiss;
            notesLeft              = data.GCSSD.difficultyBeatmap.beatmapData.notesCount;
            Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);

            TextHelper.CreateText(out counter, position - new Vector3(0, 0.4f, 0));
            counter.text      = $"Notes Remaining {notesLeft}";
            counter.fontSize  = 3f;
            counter.color     = Color.white;
            counter.alignment = TextAlignmentOptions.Center;

            if (settings.LabelAboveCount)
            {
                counter.fontSize = 4;
                counter.text     = notesLeft.ToString();
                GameObject labelGO = new GameObject("Counters+ | Notes Left Label");
                labelGO.transform.parent = transform;
                TextHelper.CreateText(out TMP_Text label, position);
                label.text      = "Notes Remaining";
                label.fontSize  = 3;
                label.color     = Color.white;
                label.alignment = TextAlignmentOptions.Center;
            }
        }
        IEnumerator YeetToBaseCounter()
        {
            yield return(new WaitUntil(() => GameObject.Find("SongProgressCanvas") != null));

            GameObject.Find("SongProgressCanvas").transform.position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);
            Destroy(gameObject);
        }
Exemple #6
0
        private void Init(CountersData data)
        {
            scoreController = data.ScoreController;
            Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);

            TextHelper.CreateText(out counterText, position - new Vector3(0, 0.4f, 0));
            counterText.text      = settings.ShowPercentage ? "0 / 0 - (100%)" : "0 / 0";
            counterText.fontSize  = 4;
            counterText.color     = Color.white;
            counterText.alignment = TextAlignmentOptions.Center;

            GameObject labelGO = new GameObject("Counters+ | Notes Label");

            labelGO.transform.parent = transform;
            TextHelper.CreateText(out TMP_Text label, position);
            label.text      = "Notes";
            label.fontSize  = 3;
            label.color     = Color.white;
            label.alignment = TextAlignmentOptions.Center;

            if (scoreController != null)
            {
                scoreController.noteWasCutEvent    += OnNoteCut;
                scoreController.noteWasMissedEvent += OnNoteMiss;
            }
        }
Exemple #7
0
        private void Init(CountersData data)
        {
            _scoreController = data.ScoreController;
            PlayerDataModelSO player = data.PlayerData;

            gameplayModsModel = data.ModifiersData;
            gameplayMods      = data.PlayerData.playerData.gameplayModifiers;
            IDifficultyBeatmap beatmap = data.GCSSD.difficultyBeatmap;

            stats = player.playerData.GetPlayerLevelStatsData(
                beatmap.level.levelID, beatmap.difficulty, beatmap.parentDifficultyBeatmapSet.beatmapCharacteristic);
            int maxRawScore = ScoreController.MaxRawScoreForNumberOfNotes(beatmap.beatmapData.notesCount);

            _maxPossibleScore = Mathf.RoundToInt(maxRawScore * gameplayModsModel.GetTotalMultiplier(gameplayMods));
            beginningPB       = stats.highScore / (float)_maxPossibleScore;
            highScore         = stats.highScore;

            Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);

            TextHelper.CreateText(out _PbTrackerText, position);
            _PbTrackerText.fontSize  = settings.TextSize;
            _PbTrackerText.color     = Color.white;
            _PbTrackerText.alignment = TextAlignmentOptions.Center;

            _scoreController.scoreDidChangeEvent += UpdateScore;

            SetPersonalBest(beginningPB);

            if (settings.UnderScore)
            {
                StartCoroutine(WaitForScoreCounter());
            }
        }
Exemple #8
0
        private void Init(CountersData data)
        {
            //Because CountersController.ReadyToInit relies on finding other objects via Resources.FindObjectsOfTypeAll<>()
            //before invoking, it is safe to assume that the objects we find do indeed exist.
            energy = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().First();
            fails  = data.PlayerData.currentLocalPlayer.playerAllOverallStatsData.allOverallStatsData.failedLevelsCount;

            if (settings.ShowRestartsInstead)
            {
                bool SameLevel = false;
                if (CurrentLevel != null)
                {
                    SameLevel = data.GCSSD.difficultyBeatmap.level.songName == CurrentLevel.songName &&                              //I mean,
                                data.GCSSD.difficultyBeatmap.level.songSubName == CurrentLevel.songSubName &&                        //Probably not the best way to compare levels,
                                data.GCSSD.difficultyBeatmap.level.songAuthorName == CurrentLevel.songAuthorName &&                  //But that means I have more lines to spend
                                data.GCSSD.difficultyBeatmap.beatmapData.notesCount == BeatmapDiff.beatmapData.notesCount &&         //Making snarky comments like these
                                data.GCSSD.difficultyBeatmap.beatmapData.obstaclesCount == BeatmapDiff.beatmapData.obstaclesCount && //For you to find
                                data.GCSSD.difficultyBeatmap.beatmapData.bombsCount == BeatmapDiff.beatmapData.bombsCount;           //And to @ me on Discord.
                }
                if (SameLevel)
                {
                    Restarts++;
                }
                else
                {
                    CurrentLevel = data.GCSSD.difficultyBeatmap.level;
                    BeatmapDiff  = data.GCSSD.difficultyBeatmap;
                    Restarts     = 0;
                }
            }

            Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);

            TextHelper.CreateText(out failText, position - new Vector3(0, 0.4f, 0));
            failText.text      = settings.ShowRestartsInstead ? Restarts.ToString() : fails.ToString();
            failText.fontSize  = 4;
            failText.color     = Color.white;
            failText.alignment = TextAlignmentOptions.Center;

            GameObject labelGO = new GameObject("Counters+ | Fail Label");

            labelGO.transform.parent = transform;
            TextHelper.CreateText(out TMP_Text label, position);
            label.text      = settings.ShowRestartsInstead ? "Restarts" : "Fails";
            label.fontSize  = 3;
            label.color     = Color.white;
            label.alignment = TextAlignmentOptions.Center;

            if (!settings.ShowRestartsInstead)
            {
                energy.gameEnergyDidReach0Event += SlowlyAnnoyThePlayerBecauseTheyFailed;
            }
        }
 void Awake()
 {
     settings           = CountersController.settings.progressConfig;
     transform.position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);
     useTimeLeft        = settings.ProgressTimeLeft;
     if (settings.Mode == ICounterMode.BaseGame && gameObject.name != "SongProgressPanel")
     {
         StartCoroutine(YeetToBaseCounter());
     }
     else if (settings.Mode != ICounterMode.BaseGame)
     {
         CountersController.ReadyToInit += Init;
     }
 }
Exemple #10
0
 private void Init()
 {
     counter.transform.SetParent(transform, false);
     counter.transform.localPosition = Vector3.zero;
     Vector3 firstPosition = Vector3.zero;
     if (counter.GetComponentsInChildren<Canvas>().Any())
     {
         Canvas canvas = counter.GetComponentsInChildren<Canvas>().First();
         for (int i = 0; i < canvas.transform.childCount; i++)
         {
             Transform child = canvas.transform.GetChild(i);
             if (i == 0) firstPosition = child.transform.position;
             child.transform.localPosition = ((child.transform.position - firstPosition) * TextHelper.ScaleFactor) - new Vector3(0, 0.4f, 0);
         }
     }
     transform.position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);
 }
Exemple #11
0
        void Init()
        {
            Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);

            TextHelper.CreateText(out spinometer, position - new Vector3(0, 0.4f, 0));
            spinometer.text      = settings.Mode == ICounterMode.SplitAverage ? "0 | 0" : "0";
            spinometer.fontSize  = 4;
            spinometer.color     = Color.white;
            spinometer.alignment = TextAlignmentOptions.Center;

            GameObject labelGO = new GameObject("Counters+ | Spinometer Label");

            labelGO.transform.parent = transform;
            TextHelper.CreateText(out TMP_Text label, position);
            label.text      = "Spinometer";
            label.fontSize  = 3;
            label.color     = Color.white;
            label.alignment = TextAlignmentOptions.Center;
            StartCoroutine(SecondTick());
        }
Exemple #12
0
        public static void Create <T>(T settings, string counterName, string counterData, bool UseCounterPositioning = true) where T : ConfigModel
        {
            if (!settings.Enabled)
            {
                return;
            }
            GameObject counter  = new GameObject($"Counters+ | Mock {counterName} Counter");
            GameObject nameGO   = new GameObject($"Counters+ | Mock {counterName} Label");
            Vector3    position = (CountersController.DeterminePosition(counter, settings.Position, settings.Distance) - new Vector3(0, 0.4f, 0));

            nameGO.transform.parent = counter.transform;
            //TextMeshPro name = nameGO.AddComponent<TextMeshPro>();
            TextHelper.CreateText(out TMP_Text name, position);
            name.text      = counterName;
            name.fontSize  = 3;
            name.color     = Color.white;
            name.alignment = TextAlignmentOptions.Center;
            //name.rectTransform.localPosition = new Vector3(0, 0.4f, 0);

            //TextMeshPro data = counter.AddComponent<TextMeshPro>();
            TextHelper.CreateText(out TMP_Text data, position - new Vector3(0, 0.4f, 0));
            data.text      = counterData;
            data.fontSize  = 4;
            data.color     = Color.white;
            data.alignment = TextAlignmentOptions.Center;

            if (loadedMockCounters.Where((KeyValuePair <MockCounterGroup, ConfigModel> x) => x.Value == settings).Any())
            {
                MockCounterGroup group = loadedMockCounters.First((KeyValuePair <MockCounterGroup, ConfigModel> x) => x.Value == settings).Key;
                UnityEngine.Object.Destroy(group.CounterName);
                UnityEngine.Object.Destroy(group.CounterData);
                loadedMockCounters.Remove(group);
            }
            if (settings.DisplayName == HighlightedObject)
            {
                name.color = Color.yellow;
                data.color = Color.yellow;
            }
            loadedMockCounters.Add(new MockCounterGroup(name, data), settings);
        }
Exemple #13
0
        private void Init(CountersData data)
        {
            _scoreController = data.ScoreController;
            Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);

            TextHelper.CreateText(out cutLabel, position);
            cutLabel.text      = "Average Cut";
            cutLabel.fontSize  = 3;
            cutLabel.color     = Color.white;
            cutLabel.alignment = TextAlignmentOptions.Center;

            _RankObject = new GameObject("Counters+ | Cut Label");
            _RankObject.transform.parent = transform;
            TextHelper.CreateText(out cutCounter, position - new Vector3(0, 0.4f, 0));
            cutCounter.text      = settings.SeparateSaberCounts ? "0  0" : "0";
            cutCounter.fontSize  = 4;
            cutCounter.color     = Color.white;
            cutCounter.alignment = TextAlignmentOptions.Center;

            if (_scoreController != null)
            {
                _scoreController.noteWasCutEvent += UpdateScore;
            }
        }
Exemple #14
0
        private void Init(CountersData data)
        {
            Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);

            pc    = data.PlayerController;
            right = data.PlayerController.rightSaber;
            left  = data.PlayerController.leftSaber;
            if (settings.Mode == ICounterMode.Average || settings.Mode == ICounterMode.SplitAverage)
            {
                TextHelper.CreateText(out counterText, position - new Vector3(0, 0.4f, 0));
                counterText.text      = settings.Mode == ICounterMode.Average ? "0" : "0 | 0";
                counterText.fontSize  = 4;
                counterText.color     = Color.white;
                counterText.alignment = TextAlignmentOptions.Center;

                GameObject labelGO = new GameObject("Counters+ | Speed Label");
                labelGO.transform.parent = transform;
                TextHelper.CreateText(out TMP_Text label, position);
                label.text      = "Average Speed";
                label.fontSize  = 3;
                label.color     = Color.white;
                label.alignment = TextAlignmentOptions.Center;
            }
            else if (settings.Mode == ICounterMode.Top5Sec)
            {
                TextHelper.CreateText(out counterText, position - new Vector3(0, 0.4f, 0));
                counterText.text      = "00.00";
                counterText.fontSize  = 4;
                counterText.color     = Color.white;
                counterText.alignment = TextAlignmentOptions.Center;

                GameObject labelGO = new GameObject("Counters+ | Highest Speed Label");
                labelGO.transform.parent = transform;
                TextHelper.CreateText(out TMP_Text label, position);
                label.text      = "Top Speed (5 Sec.)";
                label.fontSize  = 3;
                label.color     = Color.white;
                label.alignment = TextAlignmentOptions.Center;

                StartCoroutine(FastestSpeed());
            }
            else if (settings.Mode == ICounterMode.Both || settings.Mode == ICounterMode.SplitBoth)
            {
                TextHelper.CreateText(out counterText, position - new Vector3(0, 0.4f, 0));
                counterText.text      = settings.Mode == ICounterMode.Both ? "0" : "0 | 0";
                counterText.fontSize  = 4;
                counterText.color     = Color.white;
                counterText.alignment = TextAlignmentOptions.Center;

                GameObject labelGO = new GameObject("Counters+ | Speed Label");
                labelGO.transform.parent = transform;
                TextHelper.CreateText(out TMP_Text label, position);
                label.text      = "Average Speed";
                label.fontSize  = 3;
                label.color     = Color.white;
                label.alignment = TextAlignmentOptions.Center;

                GameObject altGO = new GameObject("Counters+ | Highest Speed");
                altGO.transform.parent = transform;
                TextHelper.CreateText(out altCounterText, position - new Vector3(0, 1.1f, 0));
                altCounterText.text      = "00.00";
                altCounterText.fontSize  = 4;
                altCounterText.color     = Color.white;
                altCounterText.alignment = TextAlignmentOptions.Center;

                GameObject altLabelGO = new GameObject("Counters+ | Highest Speed Label");
                altLabelGO.transform.parent = altGO.transform;
                TextHelper.CreateText(out TMP_Text altLabel, position - new Vector3(0, 0.7f, 0));
                altLabel.text      = "Top Speed (5 Sec.)";
                altLabel.fontSize  = 3;
                altLabel.color     = Color.white;
                altLabel.alignment = TextAlignmentOptions.Center;

                if (settings.Position == ICounterPositions.AboveCombo || settings.Position == ICounterPositions.AboveHighway || settings.Position == ICounterPositions.AboveMultiplier)
                {
                    altGO.transform.position += new Vector3(0, 1f, 0);
                }
                else
                {
                    altGO.transform.position += new Vector3(0, -0.75f, 0);
                }
                StartCoroutine(FastestSpeed());
            }
        }
        void Init(CountersData data)
        {
            _audioTimeSync = data.AudioTimeSyncController;
            length         = _audioTimeSync.songLength;
            if (settings.Mode == ICounterMode.Original)
            {
                Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);
                TextHelper.CreateText(out _timeMesh, position + new Vector3(-0.25f, 0.25f, 0));
                _timeMesh.text     = settings.ProgressTimeLeft ? $"{Math.Floor(length / 60):N0}:{Math.Floor(length % 60):00}" : "0:00";
                _timeMesh.fontSize = 4;
                _timeMesh.color    = Color.white;
                _timeMesh.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 0);
                _timeMesh.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0);

                var image = ReflectionUtil.GetPrivateField <Image>(
                    Resources.FindObjectsOfTypeAll <ScoreMultiplierUIController>().First(), "_multiplierProgressImage");

                GameObject g      = new GameObject();
                Canvas     canvas = g.AddComponent <Canvas>();
                canvas.renderMode = RenderMode.WorldSpace;
                CanvasScaler cs = g.AddComponent <CanvasScaler>();
                cs.scaleFactor          = 10.0f;
                cs.dynamicPixelsPerUnit = 10f;
                GraphicRaycaster gr = g.AddComponent <GraphicRaycaster>();
                g.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 1f);
                g.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 1f);

                GameObject g2 = new GameObject();
                _image = g2.AddComponent <Image>();
                g2.transform.parent = g.transform;
                g2.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 0.5f);
                g2.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0.5f);
                g2.transform.localScale = new Vector3(2.3f, 2.3f, 2.3f);

                _image.sprite        = image.sprite;
                _image.type          = Image.Type.Filled;
                _image.fillMethod    = Image.FillMethod.Radial360;
                _image.fillOrigin    = (int)Image.Origin360.Top;
                _image.fillClockwise = true;


                GameObject g3 = new GameObject();
                var        bg = g3.AddComponent <Image>();
                g3.transform.parent = g.transform;
                g3.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 0.5f);
                g3.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0.5f);
                g3.transform.localScale = new Vector3(2.3f, 2.3f, 2.3f);

                bg.sprite = image.sprite;
                bg.CrossFadeAlpha(0.05f, 1f, false);

                g.GetComponent <RectTransform>().SetParent(this.transform, false);
                g.transform.localPosition = new Vector3(-0.25f, .25f, 0f);
                transform.position       += new Vector3(0.5f, 0, 0);
                _image.fillAmount         = (settings.ProgressTimeLeft && settings.IncludeRing) ? 1 : 0;
            }
            else if (settings.Mode == ICounterMode.Percent)
            {
                Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);
                TextHelper.CreateText(out _timeMesh, position);
                _timeMesh.text      = settings.ProgressTimeLeft ? "100%" : "0.00%";
                _timeMesh.fontSize  = 4;
                _timeMesh.color     = Color.white;
                _timeMesh.alignment = TextAlignmentOptions.Center;
            }
            transform.position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);
            if (GameObject.Find("SongProgressPanel") != null && settings.Mode != ICounterMode.BaseGame)
            {
                Destroy(GameObject.Find("SongProgressPanel"));
            }
            StartCoroutine(SecondTick());
        }