Example #1
0
        /// <summary>
        /// コメントを表示リストに追加
        /// </summary>
        /// <param name="comment"></param>
        public void Add(Comment comment)
        {
            if (comment.Text == null)
            {
                return;
            }

            CommentElement c = new CommentElement();
            c.Comment = comment;

            c.Y = posY;

            c.Color = CommentViewer.commentColors["white"];
            c.Font = CommentViewer.commentFonts["medium"];
            c.Lane = -1;
            foreach (var cmd in comment.Commands)
            {
                if (CommentViewer.commentColors.ContainsKey(cmd))
                {
                    Utils.DebugLog("color=" + cmd);
                    c.Color = CommentViewer.commentColors[cmd];
                    continue;
                }
                if (CommentViewer.commentFonts.ContainsKey(cmd))
                {
                    Utils.DebugLog("size=" + cmd);
                    c.Font = CommentViewer.commentFonts[cmd];
                    continue;
                }
                if (c.Lane == -1)
                {
                    if (cmd == "ue")
                    {
                        c.Lane = SetUeShitaLane(c, 10);
                    }
                    else if (cmd == "shita")
                    {
                        c.Lane = SetUeShitaLane(c, 20);
                    }
                }
            }

            // レーン決定前にPixelsPerFrameを決めておく必要がある
            c.Render();
            c.CalcPPF(this.Width, this.fps);

            if (c.Lane == -1)
            {
                c.Lane = SetNakaLane(c);
            }

            lock (lockObject)
            {
                this.comments.Add(c);
            }

            Invalidate();

            posY = (posY + c.Height) % (this.Height - c.Height);
        }