Esempio n. 1
0
    private void UpdateView()
    {
        GetUserByIdMsg msg = new GetUserByIdMsg(comment.comment_user);

        MsgManager.Instance.NetMsgCenter.NetGetUserById(msg, (respond) =>
        {
            User user        = JsonHelper.DeserializeObject <User>(respond.data);
            userNameTxt.text = user.username;
        });
        JudgeLikeMsg likeMsg = new JudgeLikeMsg(comment.comment_id, NetDataManager.Instance.user.user_id);

        MsgManager.Instance.NetMsgCenter.NetJudgeLike(likeMsg, (respond) =>
        {
            isLike = bool.Parse(respond.data);
            if (isLike)
            {
                likeBtn.image.color = new Color(255f, 255f, 255f);
            }
            else
            {
                likeBtn.image.color = new Color(0, 0, 0);
            }
        });
        commentDateTxt.text    = comment.create_time;
        commentContentTxt.text = comment.content;
        GetLikeCountMsg likeCountMsg = new GetLikeCountMsg(comment.comment_id);

        MsgManager.Instance.NetMsgCenter.NetGetLikeCount(likeCountMsg, (respond) =>
        {
            likeTxt.text = respond.data;
        });
    }
Esempio n. 2
0
    private void UpdateView()
    {
        GetUserByIdMsg userMsg = new GetUserByIdMsg(invitation.post_user);

        MsgManager.Instance.NetMsgCenter.NetGetUserById(userMsg, (respond) =>
        {
            var user     = JsonHelper.DeserializeObject <User>(respond.data);
            nameTxt.text = user.username;
        });
        titleTxt.text   = "标题 " + invitation.invitation_title;
        contentTxt.text = "内容 " + invitation.content;
        dateTxt.text    = invitation.create_time;
        if (isCommnuty)
        {
            GetSubjectByIdMsg sbjMsg = new GetSubjectByIdMsg(invitation.plate);
            MsgManager.Instance.NetMsgCenter.NetGetSubjectById(sbjMsg, (respond) =>
            {
                var sbj = JsonHelper.DeserializeObject <Subject>(respond.data);
                if (sbj == null)
                {
                    return;
                }
                tagTxt.text = "#" + sbj.subject_name;
            });
        }
        else
        {
            GetSchoolMsg schoolMsg = new GetSchoolMsg(invitation.school_id);
            MsgManager.Instance.NetMsgCenter.NetGetSchoolById(schoolMsg, (respond) =>
            {
                var school = JsonHelper.DeserializeObject <School>(respond.data);
                if (school == null)
                {
                    return;
                }
                tagTxt.text = "#" + school.school_name;
            });
        }
        GetCommentMsg msg = new GetCommentMsg(invitation.invitation_id);

        MsgManager.Instance.NetMsgCenter.NetGetComment(msg, (respond) =>
        {
            var list           = JsonHelper.DeserializeObject <List <Comment> >(respond.data);
            commentNumTxt.text = list.Count.ToString();
        });
    }