Exemplo n.º 1
0
    protected override void UpdateComponentStates()
    {
        base.UpdateComponentStates();
        if (!Note.IsCleared && Game.Time >= Note.Model.intro_time + Note.JudgmentOffset && Game.Time <= Note.Model.end_time + Note.MissThreshold + Note.JudgmentOffset)
        {
            Line.enabled          = true;
            CompletedLine.enabled = true;
            CompletedLine.transform.SetLocalScaleX(Line.transform.localScale.x);
            ProgressRing.enabled = true;
            switch (Note.Model.style)
            {
            case 1:
                Triangle.enabled = true;
                break;

            case 2:
                Triangle.enabled = false;
                break;
            }
            SpriteMask.enabled = true;
            if (HoldNote.IsHolding && Game.Time >= Note.Model.start_time)
            {
                ProgressRing.OnUpdate();
                Triangle.OnUpdate();
            }
            if (Game.State.Mods.Contains(Mod.HideNotes))
            {
                Line.enabled          = false;
                CompletedLine.enabled = false;
                Triangle.enabled      = false;
            }
            if (!Note.IsCleared)
            {
                Line.flipY          = Note.Model.direction == -1;
                CompletedLine.flipY = Line.flipY;
                CompletedLine.color = Fill.color;
                var ringSortingOrder = Ring.sortingOrder;
                Line.sortingOrder            = ringSortingOrder;
                CompletedLine.sortingOrder   = ringSortingOrder + 1;
                SpriteMask.frontSortingOrder = CompletedLine.sortingOrder + 1;
                SpriteMask.backSortingOrder  = Line.sortingOrder - 1;

                SpriteMask.enabled = Game.Time >= Note.Model.intro_time;

                if (HoldNote.IsHolding)
                {
                    if (Note.Game.Time > Note.Model.start_time + Note.JudgmentOffset)
                    {
                        ProgressRing.fillColor  = Fill.color;
                        ProgressRing.maxCutoff  = Mathf.Min(1, 1.333f * HoldNote.HoldProgress);
                        ProgressRing.fillCutoff = Mathf.Min(1, HoldNote.HoldProgress);

                        if (UseExperimentalAnimations)
                        {
                            Ring.transform.DOScale(BaseTransformSize * 0.85f, 0.2f);
                            Fill.transform.DOScale(BaseTransformSize * 0.85f, 0.2f);
                            SpriteMask.transform.DOScale(BaseTransformSize * 0.85f, 0.2f);
                        }

                        if (Game.State.IsPlaying && !HoldFx.isPlaying)
                        {
                            var emission = HoldFx.emission;
                            emission.enabled = true;
                            HoldFx.Play();
                        }
                    }
                }

                switch (Note.Model.style)
                {
                case 1:
                {
                    if (HoldNote.IsHolding)
                    {
                        if (Note.Game.Time > Note.Model.start_time + Note.JudgmentOffset)
                        {
                            CompletedLine.size = new Vector2(1, Note.Model.holdlength * HoldNote.HoldProgress);
                        }
                    }
                    break;
                }

                case 2:
                    Line.size = new Vector2(1, Note.Model.holdlength * (1 - HoldNote.HoldProgress));
                    break;
                }
            }
        }
        else
        {
            Line.enabled          = false;
            CompletedLine.enabled = false;
            CompletedLine.size    = new Vector2(1, 0);
            ProgressRing.enabled  = false;
            ProgressRing.Reset();
            Triangle.enabled = false;
            Triangle.Reset();
            SpriteMask.enabled = false;
            if (HoldFx.isPlaying)
            {
                var emission = HoldFx.emission;
                emission.enabled = false;
            }
        }
    }