Пример #1
0
    private void UpdateView()
    {
        GetInvitationMsg msg = new GetInvitationMsg();

        MsgManager.Instance.NetMsgCenter.NetGetInvitation(msg, (respond) =>
        {
            var list = JsonHelper.DeserializeObject <List <Invitation> >(respond.data);
            foreach (var post in list)
            {
                if (post.invitation_id == comment.comment_invitation)
                {
                    this.post                = post;
                    titleTxt.text            = post.invitation_title;
                    postContentTxt.text      = post.content;
                    GetCommentMsg commentMsg = new GetCommentMsg(comment.comment_invitation);
                    MsgManager.Instance.NetMsgCenter.NetGetComment(commentMsg, (responds) =>
                    {
                        var commentList    = JsonHelper.DeserializeObject <List <Comment> >(responds.data);
                        commentNumTxt.text = commentList.Count.ToString();
                    });
                    break;
                }
            }
        });
        dateTxt.text           = comment.create_time;
        commentContentTxt.text = comment.content;
    }
Пример #2
0
    private void UpdateView()
    {
        switch (type)
        {
        case PostFrameType.Hot:
            GetInvitationMsg msg1 = new GetInvitationMsg();
            MsgManager.Instance.NetMsgCenter.NetGetInvitation(msg1, (respond) =>
            {
                var list = JsonHelper.DeserializeObject <List <POJO.Invitation> >(respond.data);
                foreach (var post in list)
                {
                    if (post.invitation_type == (int)InvitationType.Invitation)
                    {
                        var go     = Instantiate(UIResourceMgr.Instance.Get("PostPrefab"), group);
                        var prefab = go.GetComponent <PostPrefab>();
                        prefab.Init(post);
                        allPost.Add(prefab);
                        group.GetComponent <RectTransform>().sizeDelta = new Vector2(1063, 433.59f * allPost.Count);
                    }
                }
            });
            break;

        case PostFrameType.Essential:
            GetInvitationMsg msg2 = new GetInvitationMsg();
            MsgManager.Instance.NetMsgCenter.NetGetInvitation(msg2, (respond) =>
            {
                var list = JsonHelper.DeserializeObject <List <POJO.Invitation> >(respond.data);
                foreach (var post in list)
                {
                    if (post.invitation_type == (int)InvitationType.Invitation)
                    {
                        var go     = Instantiate(UIResourceMgr.Instance.Get("PostPrefab"), group);
                        var prefab = go.GetComponent <PostPrefab>();
                        prefab.Init(post);
                        allPost.Add(prefab);
                        group.GetComponent <RectTransform>().sizeDelta = new Vector2(1063, 433.59f * allPost.Count);
                    }
                }
            });
            break;

        case PostFrameType.Module:
            GetPlateInvitationMsg msg3 = new GetPlateInvitationMsg(module.subject_id);
            MsgManager.Instance.NetMsgCenter.NetGetPlateInvitation(msg3, (respond) =>
            {
                var list = JsonHelper.DeserializeObject <List <POJO.Invitation> >(respond.data);
                foreach (var post in list)
                {
                    if (post.invitation_type == (int)InvitationType.Invitation)
                    {
                        var go     = Instantiate(UIResourceMgr.Instance.Get("PostPrefab"), group);
                        var prefab = go.GetComponent <PostPrefab>();
                        prefab.Init(post);
                        allPost.Add(prefab);
                        group.GetComponent <RectTransform>().sizeDelta = new Vector2(1063, 433.59f * allPost.Count);
                    }
                }
            });
            break;
        }
    }