Пример #1
0
        private void InitDelayed()
        {
            if (Plugin.NoFail)
            {
                var seekerObj = new GameObject("Song Seeker");
                seekerObj.transform.SetParent(transform, false);
                seekerObj.AddComponent <RectTransform>();
                SongSeeker = seekerObj.AddComponent <SongSeeker>();
                SongSeeker.Init();

                new GameObject("No Fail Game Energy").AddComponent <NoFailGameEnergy>();
            }
            else
            {
                if (Plugin.NoFail)
                {
                    return;
                }
                _leaderboardText = new GameObject("Leaderboard Text").AddComponent <TextMeshProUGUI>();
                var rectTransform = (RectTransform)_leaderboardText.transform;
                rectTransform.SetParent(transform, false);
                rectTransform.anchorMin        = Vector2.right * 0.5f;
                rectTransform.anchorMax        = Vector2.right * 0.5f;
                rectTransform.sizeDelta        = new Vector2(100, 10);
                rectTransform.anchoredPosition = new Vector2(0, 15);
                _leaderboardText.fontSize      = 4f;
                _leaderboardText.alignment     = TextAlignmentOptions.Center;

                if (Plugin.HasTimeScaleChanged)
                {
                    _leaderboardText.text = "Leaderboard has been disabled\nSet speed to 100% and restart to enable again";
                }
            }
        }
        public void Init(SongSeeker songSeeker)
        {
            _songSeeker = songSeeker;

            if (Plugin.PlayingNewSong)
            {
                _prevStartTime = 0;
                _prevEndTime   = 1;
            }

            _lineDuration = new GameObject("Line Duration").AddComponent <Image>();
            var rectTransform = _lineDuration.rectTransform;

            rectTransform.SetParent(transform, false);
            rectTransform.anchorMin = Vector2.up * 0.5f;
            rectTransform.anchorMax = Vector2.up * 0.5f;
            rectTransform.sizeDelta = Vector2.zero;
            _lineDuration.color     = LineDurationColor;

            var startCursorImage = new GameObject("Start Cursor").AddComponent <Image>();

            rectTransform = startCursorImage.rectTransform;
            rectTransform.SetParent(transform, false);
            rectTransform.anchorMin        = Vector2.up * 0.5f;
            rectTransform.anchorMax        = Vector2.up * 0.5f;
            rectTransform.sizeDelta        = CursorSize;
            rectTransform.localEulerAngles = new Vector3(0, 0, 45);
            startCursorImage.color         = StartColor;

            _startCursor = startCursorImage.gameObject.AddComponent <LooperCursor>();
            _startCursor.BeginDragEvent += CursorOnBeginDragEvent;
            _startCursor.EndDragEvent   += CursorOnEndDragEvent;
            _startCursor.Position        = Mathf.Lerp(0, SongSeeker.SeekBarSize.x, _prevStartTime);

            var endCursorImage = new GameObject("End Cursor").AddComponent <Image>();

            rectTransform = endCursorImage.rectTransform;
            rectTransform.SetParent(transform, false);
            rectTransform.anchorMin        = Vector2.up * 0.5f;
            rectTransform.anchorMax        = Vector2.up * 0.5f;
            rectTransform.sizeDelta        = CursorSize;
            rectTransform.localEulerAngles = new Vector3(0, 0, 45);
            endCursorImage.color           = EndColor;

            _endCursor = endCursorImage.gameObject.AddComponent <LooperCursor>();
            _endCursor.BeginDragEvent += CursorOnBeginDragEvent;
            _endCursor.EndDragEvent   += CursorOnEndDragEvent;
            _endCursor.Position        = Mathf.Lerp(0, SongSeeker.SeekBarSize.x, _prevEndTime);

            _startCursor.Init(LooperCursor.Type.Start);
            _endCursor.Init(LooperCursor.Type.End);

            _mainCamera = Camera.main;
        }
        private void InitDelayed()
        {
            if (Plugin.PracticeMode)
            {
                var seekerObj = new GameObject("Song Seeker");
                seekerObj.transform.SetParent(transform, false);
                seekerObj.AddComponent <RectTransform>();
                SongSeeker = seekerObj.AddComponent <SongSeeker>();
                SongSeeker.Init();

                new GameObject("No Fail Game Energy").AddComponent <NoFailGameEnergy>();
            }
        }
Пример #4
0
        private void OnDisable()
        {
            if (ValueChangedEvent != null)
            {
                ValueChangedEvent(_newTimeScale);
            }
            if (SongSeeker._songAudioSource.time > 0)
            {
                SongSeeker._startTimeSamples = SongSeeker._songAudioSource.timeSamples - 1;
                SongSeeker.ApplyPlaybackPosition();
                Plugin.TimeScale = practiceUI.speed;
            }

            //      Destroy(_speedSettings);
        }
Пример #5
0
 private void InitDelayed()
 {
     if (Plugin.PracticeMode)
     {
         var seekerObj = new GameObject("Song Seeker");
         seekerObj.transform.SetParent(transform, false);
         seekerObj.AddComponent <RectTransform>();
         SongSeeker = seekerObj.AddComponent <SongSeeker>();
         SongSeeker.Init();
         new GameObject("No Fail Game Energy").AddComponent <NoFailGameEnergy>();
         defaultNJS = Plugin._spawnController.GetPrivateField <BeatmapObjectSpawnController.InitData>("_initData").noteJumpMovementSpeed;
         //     PracticeUI.instance.njs = defaultNJS;
         //        Console.WriteLine("NJS: " + UIElementsCreator.defaultNJS);
         defaultOffset = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.difficultyBeatmap.noteJumpStartBeatOffset;
         //      PracticeUI.instance.offset = defaultOffset;
         //        Console.WriteLine("Offset: " + UIElementsCreator.defaultOffset);
     }
 }
Пример #6
0
        public void Init(SongSeeker songSeeker)
        {
            _songSeeker = songSeeker;

            if (Plugin.PlayingNewSong)
            {
                _prevStartTime = 0;
                _prevEndTime   = 1;
            }

            var tex    = Texture2D.whiteTexture;
            var sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.one * 0.5f, 100, 1);

            var bg            = new GameObject("Background").AddComponent <ImageView>();
            var rectTransform = bg.rectTransform;

            rectTransform.SetParent(transform, false);
            rectTransform.sizeDelta        = SongSeeker.SeekBarSize + new Vector2(0, 4);
            rectTransform.anchoredPosition = new Vector2(0, -1);
            bg.sprite   = sprite;
            bg.type     = Image.Type.Simple;
            bg.color    = new Color(0, 0, 0, 0);
            bg.material = Utilities.ImageResources.NoGlowMat;

            _lineDuration = new GameObject("Line Duration").AddComponent <ImageView>();
            rectTransform = _lineDuration.rectTransform;
            rectTransform.SetParent(transform, false);
            rectTransform.anchorMin = Vector2.up * 0.5f;
            rectTransform.anchorMax = Vector2.up * 0.5f;
            rectTransform.sizeDelta = Vector2.zero;
            _lineDuration.sprite    = sprite;
            _lineDuration.type      = Image.Type.Simple;
            _lineDuration.color     = LineDurationColor;
            _lineDuration.material  = Utilities.ImageResources.NoGlowMat;

            var startCursorImage = new GameObject("Start Cursor").AddComponent <ImageView>();

            rectTransform = startCursorImage.rectTransform;
            rectTransform.SetParent(transform, false);
            rectTransform.anchorMin        = Vector2.up * 0.5f;
            rectTransform.anchorMax        = Vector2.up * 0.5f;
            rectTransform.sizeDelta        = CursorSize;
            rectTransform.localEulerAngles = new Vector3(0, 0, 45);
            startCursorImage.sprite        = sprite;
            startCursorImage.type          = Image.Type.Simple;
            startCursorImage.color         = StartColor;
            startCursorImage.material      = Utilities.ImageResources.NoGlowMat;

            _startCursor = startCursorImage.gameObject.AddComponent <LooperCursor>();
            _startCursor.BeginDragEvent += CursorOnBeginDragEvent;
            _startCursor.EndDragEvent   += CursorOnEndDragEvent;
            _startCursor.Position        = Mathf.Lerp(0, SongSeeker.SeekBarSize.x, _prevStartTime);

            var endCursorImage = new GameObject("End Cursor").AddComponent <ImageView>();

            rectTransform = endCursorImage.rectTransform;
            rectTransform.SetParent(transform, false);
            rectTransform.anchorMin        = Vector2.up * 0.5f;
            rectTransform.anchorMax        = Vector2.up * 0.5f;
            rectTransform.sizeDelta        = CursorSize;
            rectTransform.localEulerAngles = new Vector3(0, 0, 45);
            endCursorImage.sprite          = sprite;
            endCursorImage.type            = Image.Type.Simple;
            endCursorImage.color           = EndColor;
            endCursorImage.material        = Utilities.ImageResources.NoGlowMat;

            _endCursor = endCursorImage.gameObject.AddComponent <LooperCursor>();
            _endCursor.BeginDragEvent += CursorOnBeginDragEvent;
            _endCursor.EndDragEvent   += CursorOnEndDragEvent;
            _endCursor.Position        = Mathf.Lerp(0, SongSeeker.SeekBarSize.x, _prevEndTime);

            _startCursor.Init(LooperCursor.Type.Start);
            _endCursor.Init(LooperCursor.Type.End);

            _mainCamera = Camera.main;
        }