Exemplo n.º 1
0
    private void DrawIssue(int songDurationInMillis, SongIssue issue)
    {
        Color color = SongIssueUtils.GetColorForIssue(issue);

        int startMillis = (int)BpmUtils.BeatToMillisecondsInSong(songMeta, issue.StartBeat);
        int endMillis   = (int)BpmUtils.BeatToMillisecondsInSong(songMeta, issue.EndBeat);

        // Use a minimum width of 0.5% such that the issue is not overlooked
        int    lengthInMillis  = endMillis - startMillis;
        double lengthInPercent = (double)lengthInMillis / songDurationInMillis;

        if (lengthInPercent < 0.005)
        {
            endMillis = (int)(startMillis + songDurationInMillis * 0.005);
        }

        int xStart = (int)(dynImage.TextureWidth * startMillis / songDurationInMillis);
        int xEnd   = (int)(dynImage.TextureWidth * endMillis / songDurationInMillis);

        if (xEnd < xStart)
        {
            ObjectUtils.Swap(ref xStart, ref xEnd);
        }

        dynImage.DrawRectByCorners(xStart, 0, xEnd, dynImage.TextureHeight, color);
    }
    private void DrawIssue(SongIssue issue)
    {
        if (dynamicTexture == null)
        {
            return;
        }

        Color color = SongIssueUtils.GetColorForIssue(issue);

        int songDurationInMillis = (int)Math.Ceiling(songAudioPlayer.AudioClip.length * 1000);

        int startMillis = (int)BpmUtils.BeatToMillisecondsInSong(songMeta, issue.StartBeat);
        int endMillis   = (int)BpmUtils.BeatToMillisecondsInSong(songMeta, issue.EndBeat);

        // Use a minimum width of 0.5% such that the issue is not overlooked
        int    lengthInMillis  = endMillis - startMillis;
        double lengthInPercent = (double)lengthInMillis / songDurationInMillis;

        if (lengthInPercent < 0.005)
        {
            endMillis = (int)(startMillis + songDurationInMillis * 0.005);
        }

        int xStart = (int)(dynamicTexture.TextureWidth * startMillis / songDurationInMillis);
        int xEnd   = (int)(dynamicTexture.TextureWidth * endMillis / songDurationInMillis);

        if (xEnd < xStart)
        {
            ObjectUtils.Swap(ref xStart, ref xEnd);
        }

        dynamicTexture.DrawRectByCorners(xStart, 0, xEnd, (int)(dynamicTexture.TextureHeight * 0.5f), color);
    }
Exemplo n.º 3
0
 public void Init(SongIssue songIssue)
 {
     this.SongIssue = songIssue;
     uiText.text    = SongIssue.Message;
     SetTextVisible(false);
     backgroundImage.color = SongIssueUtils.GetColorForIssue(songIssue);
 }
Exemplo n.º 4
0
    public void OnInjectionFinished()
    {
        issueImage.style.unityBackgroundImageTintColor = SongIssueUtils.GetColorForIssue(SongIssue);

        tooltipControl = injector
                         .WithRootVisualElement(VisualElement)
                         .CreateAndInject <TooltipControl>();
        tooltipControl.TooltipText = SongIssue.Message;
    }
Exemplo n.º 5
0
 public void Init(SongIssue songIssue)
 {
     this.SongIssue             = songIssue;
     backgroundImage.color      = SongIssueUtils.GetColorForIssue(songIssue);
     tooltipHandler.tooltipText = songIssue.Message;
 }