Ejemplo n.º 1
0
        private void GameSceneLoaded()
        {
            PlayerDataModel dataModel = UnityEngine.Resources.FindObjectsOfTypeAll <PlayerDataModel>().FirstOrDefault();

            if (!ConfigHelper.Config.Enabled || (dataModel?.playerData.playerSpecificSettings.noTextsAndHuds ?? false))
            {
                return;
            }
            _colorManager    = GameObject.FindObjectOfType <ColorManager>();
            _spawnController = GameObject.FindObjectOfType <BeatmapObjectManager>();
            _spawnController.noteWasCutEvent += OnNoteCut;
            _parentCanvas = GameObject.Instantiate(AssetBundleHelper.Canvas).transform;

            if (TwoNoteMode)
            {
                _sliceControllers = new SliceController[2];
                float minX = -Separation * 0.5f;
                for (int x = 0; x < 2; ++x)
                {
                    int   index = x;
                    float posX  = minX + (Separation * x);
                    float posY  = 0f;

                    SliceController controller = CreateSliceController(posX, posY);
                    Color           color      = UseCustomNoteColors ? _colorManager.ColorForNoteType((NoteType)index) : _defaultColors[index];
                    controller.UpdateBlockColor(color);
                    _sliceControllers[index] = controller;
                }
            }
            else
            {
                _sliceControllers = new SliceController[12];
                float minX = -Separation * 1.5f;
                for (int x = 0; x < 4; ++x)
                {
                    for (int y = 0; y < 3; ++y)
                    {
                        int   index = 3 * x + y;
                        float posX  = minX + (Separation * x);
                        float posY  = (Separation * y);

                        _sliceControllers[index] = CreateSliceController(posX, posY);
                    }
                }
            }

            _parentCanvas.localPosition = Position;
            _parentCanvas.eulerAngles   = Rotation;
            _parentCanvas.localScale   *= Scale;
        }
Ejemplo n.º 2
0
        private void OnNoteCut(INoteController noteController, NoteCutInfo info)
        {
            NoteData data = noteController.noteData;

            if (ShouldDisplayNote(data, info))
            {
                Vector3          center        = noteController.noteTransform.position;
                Vector3          localCutPoint = info.cutPoint - center;
                NoteCutDirection directionType = data.cutDirection;

                if (TwoNoteMode)
                {
                    int             index           = (int)info.saberType;
                    SliceController sliceController = _sliceControllers[index];
                    sliceController.UpdateSlice(localCutPoint, info.cutNormal, directionType);
                }
                else
                {
                    int             index           = 3 * data.lineIndex + (int)data.noteLineLayer;
                    SliceController sliceController = _sliceControllers[index];

                    Color color = UseCustomNoteColors ? _colorManager.ColorForSaberType(info.saberType) : _defaultColors[(int)info.saberType];
                    sliceController.UpdateBlockColor(color);
                    sliceController.UpdateSlice(localCutPoint, info.cutNormal, directionType);
                }

                if (_logNotesCut)
                {
                    Console.WriteLine($"[CutVisualizer] OnNoteCut -------------------------------");
                    Console.WriteLine($"[CutVisualizer] Center: ({center.x} {center.y})");
                    Console.WriteLine($"[CutVisualizer] Cut Normal: ({info.cutNormal.x} {info.cutNormal.y})");
                    Console.WriteLine($"[CutVisualizer] Cut Point: ({info.cutPoint.x} {info.cutPoint.y})");
                    Console.WriteLine($"[CutVisualizer] Cut Local: ({localCutPoint.x} {localCutPoint.y})");
                }
            }
        }