Esempio n. 1
0
        public static SnsCommentNeedSend creatSnsCommentNeedSend(SnsInfo snsObj, string strContent, CommentType type, AddContactScene source, CommentArg replyInfo = null, int referCommetID = -1)
        {
            SnsCommentNeedSend send = new SnsCommentNeedSend {
                objectID       = snsObj.nObjectID,
                parentID       = 0L,
                referComment   = null,
                strClientID    = MD5Core.GetHashString(Util.getNowMilliseconds().ToString()),
                currentComment = new SnsComment()
            };

            send.currentComment.strContent  = strContent;
            send.currentComment.strNickName = snsObj.strNickName;
            send.currentComment.strUserName = snsObj.strUserName;
            if (replyInfo != null)
            {
                send.currentComment.strNickName     = replyInfo.strNickName;
                send.currentComment.strUserName     = replyInfo.strUserName;
                send.currentComment.nReplyCommentId = replyInfo.commentID;
            }
            send.currentComment.nType       = (uint)type;
            send.currentComment.nCreateTime = (uint)Util.getNowSeconds();
            send.currentComment.nSource     = (uint)source;
            if (referCommetID >= 0)
            {
                foreach (SnsComment comment in snsObj.commentList.list)
                {
                    if (comment.nCommentId == referCommetID)
                    {
                        send.referComment                 = new SnsComment();
                        send.referComment.strContent      = comment.strContent;
                        send.referComment.strNickName     = comment.strNickName;
                        send.referComment.strUserName     = comment.strUserName;
                        send.refFromUserName              = snsObj.strUserName;
                        send.refFromNickName              = snsObj.strNickName;
                        send.referComment.nType           = comment.nType;
                        send.referComment.nCreateTime     = comment.nCreateTime;
                        send.referComment.nSource         = comment.nSource;
                        send.referComment.nReplyCommentId = comment.nReplyCommentId;
                    }
                }
            }
            return(send);
        }
Esempio n. 2
0
        public bool doSendComment(SnsInfo snsObj, string strContent, CommentType type, AddContactScene source, CommentArg replyInfo = null, int refCommentID = -1)
        {
            if (snsObj == null)
            {
                return(false);
            }
            SnsComment item = new SnsComment
            {
                strContent  = strContent,
                strNickName = AccountMgr.getCurAccount().strNickName,
                strUserName = AccountMgr.getCurAccount().strUsrName,
                nType       = (uint)type,
                nCreateTime = (uint)Util.getNowSeconds(),
                nSource     = (uint)source
            };

            if (replyInfo != null)
            {
                item.nReplyCommentId  = replyInfo.commentID;
                item.strReplyUsername = replyInfo.strUserName;
            }

            if ((type == CommentType.MMSNS_COMMENT_LIKE) || (type == CommentType.MMSNS_COMMENT_STRANGER_LIKE))
            {
                snsObj.likeList.list.Add(item);
                snsObj.likeList.list = snsObj.likeList.list;
                snsObj.likeList      = snsObj.likeList;
                snsObj.nLikeFlag     = 1;
                snsObj.nLikeCount++;
            }
            else
            {
                snsObj.commentList.list.Add(item);
                snsObj.commentList.list = snsObj.commentList.list;
                snsObj.commentList      = snsObj.commentList;
                snsObj.nCommentCount++;
            }
            //if (StorageMgr.snsInfo.getByObjectID(snsObj.strObjectID) != null)
            //{
            //    StorageMgr.snsInfo.updateByObjectID(snsObj);
            //}
            SnsCommentNeedSend comment = NetSceneSnsComment.creatSnsCommentNeedSend(snsObj, strContent, type, source, replyInfo, refCommentID);

            new NetSceneSnsComment().doScene(comment);

            return(true);
        }