コード例 #1
0
        /// <summary>
        /// コメントをGUIに登録する
        /// </summary>
        /// <param name="workCommentList"></param>
        private void SetCmntToGui(IList <CommentStruct> workCommentList)
        {
            // 登録済みの最新コメントを取得
            for (int iComment = 0; iComment < workCommentList.Count; iComment++)
            {
                CommentStruct tagtComment = workCommentList[iComment];

                // 新規のコメントの場合、リストに追加する
                CommentList.Add(tagtComment);
                System.Diagnostics.Debug.WriteLine("■{0} {1}", tagtComment.UserName, tagtComment.Text);

                // 最大コメント数チェック
                if (CommentList.Count > MaxStoredCommentCnt)
                {
                    CommentList.RemoveAt(0);
                    System.Diagnostics.Debug.Assert(CommentList.Count == MaxStoredCommentCnt);
                }

                if (OnCommentReceiveEach != null)
                {
                    OnCommentReceiveEach(this, tagtComment);
                }
            }

            if (OnCommentReceiveDone != null)
            {
                OnCommentReceiveDone(this);
            }
        }
コード例 #2
0
        /// <summary>
        /// コメントをGUIに登録する
        /// </summary>
        /// <param name="workCommentList"></param>
        private void setCmntToGui(IList <CommentStruct> workCommentList)
        {
            // 登録済みの最新コメントを取得
            CommentStruct prevComment = new CommentStruct();

            if (CommentList.Count > 0)
            {
                prevComment = CommentList[CommentList.Count - 1];
            }
            // 新しいコメントから順にチェック
            int iStPos = 0; // 未登録のコメントの開始位置

            for (int iComment = workCommentList.Count - 1; iComment >= 0; iComment--)
            {
                CommentStruct tagtComment = workCommentList[iComment];

                // 登録済みかチェック
                if (tagtComment.Id == prevComment.Id)
                {
                    iStPos = iComment + 1; // 登録済みのコメントの次のコメントが未登録の開始位置
                    System.Diagnostics.Debug.WriteLine("found stored comment.");
                    break;
                }
            }
            if (iStPos == workCommentList.Count)
            {
                // すべて登録済み
                return;
            }

            // 新規分だけ登録
            for (int iComment = iStPos; iComment < workCommentList.Count; iComment++)
            {
                CommentStruct tagtComment = workCommentList[iComment];

                // 新規のコメントの場合、リストに追加する
                CommentList.Add(tagtComment);
                System.Diagnostics.Debug.WriteLine("■{0} {1} {2}", tagtComment.UserName, tagtComment.Text, tagtComment.TimeStr);
                System.Diagnostics.Debug.WriteLine("■ThumbUrl " + tagtComment.UserThumbUrl);

                // 最大コメント数チェック
                if (CommentList.Count > MaxStoredCommentCnt)
                {
                    CommentList.RemoveAt(0);
                    System.Diagnostics.Debug.Assert(CommentList.Count == MaxStoredCommentCnt);
                }

                if (OnCommentReceiveEach != null)
                {
                    OnCommentReceiveEach(this, tagtComment);
                }
            }

            if (OnCommentReceiveDone != null)
            {
                OnCommentReceiveDone(this);
            }
        }
コード例 #3
0
        /// <summary>
        /// コメントからPVを探します。
        /// </summary>
        public void SetupPVInfo(Board board)
        {
            Move move = null;

            if (VariationNode != null)
            {
                VariationNode.SetupPVInfo(board);
            }

            // このノードの手を指して、変化の基準局面を進めます。
            if (LiteralMove != null && LiteralMove.Validate())
            {
                move = MakeMove(board, new List <Exception>());
                if (move == null || !move.Validate())
                {
                    Log.Error("'{0}'が正しく着手できません。", move);
                    return;
                }
            }

            for (var i = 0; i < CommentList.Count();)
            {
                var pvInfo = ParsePVInfo(CommentList[i], board);
                if (pvInfo != null)
                {
                    PVInfoList.Add(pvInfo);
                    CommentList.RemoveAt(i);
                }
                else
                {
                    ++i;
                }
            }

            if (NextNode != null)
            {
                NextNode.SetupPVInfo(board);
            }

            if (move != null)
            {
                board.Undo();
            }
        }