Example #1
0
    protected void UpdateView()
    {
        //更新TagTxt
        GetAllMsg msg = new GetAllMsg();

        MsgManager.Instance.NetMsgCenter.NetGetAllSbj(msg, (respond) =>
        {
            var list = JsonHelper.DeserializeObject <List <POJO.Subject> >(respond.data);
            foreach (var sbj in list)
            {
                if (sbj.subject_id == plan.plan_type)
                {
                    tagTxt.text = sbj.subject_name;
                }
            }
        });
        contentTxt.text = plan.plan_content;
        if (plan.plan_status == 0)
        {
            finishTxt.text = "";
        }
        else
        {
            finishTxt.text = "√";
        }
    }
Example #2
0
    private void Awake()
    {
        GetAllMsg msg = new GetAllMsg();

        MsgManager.Instance.NetMsgCenter.NetGetAllSbj(msg, (respond) =>
        {
            allSubject = JsonHelper.DeserializeObject <List <Subject> >(respond.data);
            if (allSubject == null || allSubject.Count == 0)
            {
                return;
            }
            foreach (var subject in allSubject)
            {
                GameObject go = Instantiate(prefab, group);
                go.GetComponent <SubjectSearchPrefab>().Init(subject);
            }
            var line        = allSubject.Count;
            var size        = groupLayout.cellSize.y;
            group.sizeDelta = new Vector2(group.sizeDelta.x, line * size);
        });
        backBtn.onClick.AddListener(() =>
        {
            UIMgr.Instance.RemoveFrame();
        });
        confirmBtn.onClick.AddListener(() =>
        {
            for (int i = 0; i < group.childCount; i++)
            {
                Destroy(group.transform.GetChild(i));
            }
            List <Subject> searchSchool = new List <Subject>();
            foreach (var subject in allSubject)
            {
                if (subject.subject_name.Contains(searchIfd.text))
                {
                    searchSchool.Add(subject);
                }
            }
            //显示学校
            foreach (var subject in searchSchool)
            {
                GameObject go = Instantiate(prefab, group);
                go.GetComponent <SubjectSearchPrefab>().Init(subject);
            }
            var line        = searchSchool.Count;
            var size        = groupLayout.cellSize.y;
            group.sizeDelta = new Vector2(group.sizeDelta.x, line * size);
        });
    }
Example #3
0
    private void UpdateView()
    {
        GetAllMsg msg = new GetAllMsg();

        MsgManager.Instance.NetMsgCenter.NetGetAllSbj(msg, (respond) =>
        {
            var list = JsonHelper.DeserializeObject <List <POJO.Subject> >(respond.data);
            List <string> optionList = new List <string>();
            foreach (var sbj in list)
            {
                optionList.Add(sbj.subject_name);
            }
            dropDown.options.Clear();
            dropDown.AddOptions(optionList);
        });
    }
Example #4
0
    protected void UpdateView()
    {
        ClearView();
        GetAllMsg msg = new GetAllMsg();

        MsgManager.Instance.NetMsgCenter.NetGetAllSbj(msg, (respond) =>
        {
            var list  = JsonHelper.DeserializeObject <List <POJO.Subject> >(respond.data);
            int count = list.Count > 3 ? 3 : list.Count;
            for (int i = 0; i < count; i++)
            {
                var go     = Instantiate(UIResourceMgr.Instance.Get("ModulePrefab"), group);
                var prefab = go.GetComponent <ModulePrefab>();
                prefab.Init(list[i]);
            }
        });
    }
Example #5
0
    private void Awake()
    {
        GetAllMsg msg = new GetAllMsg();

        MsgManager.Instance.NetMsgCenter.NetGetAllSbj(msg, (respond) =>
        {
            var sbjList = JsonHelper.DeserializeObject <List <Subject> >(respond.data);
            foreach (var sbj in sbjList)
            {
                var go = Instantiate(prefab, content);
                go.GetComponent <ModulePrefab>().Init(sbj);
            }
            var x             = 1064f;
            var y             = prefab.GetComponent <RectTransform>().rect.height;
            var line          = (sbjList.Count / 2) + 1;
            var allY          = line * (y + 48.57f);
            content.sizeDelta = new Vector2(x, allY);
        });
    }
Example #6
0
    private void UpdateView()
    {
        ClearView();
        titleTxt.text      = post.invitation_title;
        postContent.text   = post.content;
        commentNumTxt.text = post.scan_number.ToString();
        GetAllMsg msg = new GetAllMsg();

        MsgManager.Instance.NetMsgCenter.NetGetAllSbj(msg, (respond) =>
        {
            var list = JsonHelper.DeserializeObject <List <Subject> >(respond.data);
            foreach (var sbj in list)
            {
                if (sbj.subject_id == post.plate)
                {
                    moduleTxt.text = sbj.subject_name;
                }
            }
        });
        //Comment
        GetCommentMsg commentMsg = new GetCommentMsg(post.invitation_id);

        MsgManager.Instance.NetMsgCenter.NetGetComment(commentMsg, (respond) =>
        {
            allComment = JsonHelper.DeserializeObject <List <Comment> >(respond.data);
            foreach (var comment in allComment)
            {
                var go     = Instantiate(UIResourceMgr.Instance.Get("CommentPrefab"), CommentContentPanel);
                var prefab = go.GetComponent <CommentPrefab>();
                prefab.Init(comment);
                allCommentPrefab.Add(prefab);
            }
            var postY    = 257.8f;
            var commentY = 1336.2f * allCommentPrefab.Count;
            CommentContentPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(1080, postY + commentY);
        });
    }
Example #7
0
    private void AddListener()
    {
        GetAllMsg msg = new GetAllMsg();

        MsgManager.Instance.NetMsgCenter.NetGetAllSbj(msg, (respond) =>
        {
            var list = JsonHelper.DeserializeObject <List <POJO.Subject> >(respond.data);
            List <string> optionList = new List <string>();
            foreach (var sbj in list)
            {
                optionList.Add(sbj.subject_name);
            }
            dropDown.AddOptions(optionList);
        });
        dropDown.onValueChanged.AddListener((index) =>
        {
            isSelect = index;
        });
        backBtn.onClick.AddListener(() =>
        {
            UIMgr.Instance.RemoveFrame();
        });
        confirmBtn.onClick.AddListener(() =>
        {
            if (dropDown.options.Count == 0 || titleIfd.text == "" || contentIfd.text == "")
            {
                MsgManager.Instance.GlobalMsgManager.ShowErrorPanel("标签、标题、内容请勿为空");
                return;
            }
            AddPostMsg postMsg = new AddPostMsg(contentIfd.text, titleIfd.text, isSelect, NetDataManager.Instance.user.user_id, (int)InvitationType.Invitation, NetDataManager.Instance.user.school_id);
            MsgManager.Instance.NetMsgCenter.NetAddPost(postMsg, (respond) =>
            {
                UIMgr.Instance.RemoveFrame();
            });
        });
    }