Example #1
0
 void OnReceiveMessage()
 {
     Message_Service.ListMyTips(t =>
     {
         TipsList = t.GetData() as List <ENewTips>;
         if (TipsList != null && TipsList.Count > 0)
         {
             PageTitle.BtnMenu.transform.Find("tips").gameObject.SetActive(true);
         }
         else
         {
             PageTitle.BtnMenu.transform.Find("tips").gameObject.SetActive(false);
         }
         ReBindTips();
         if (PageContent1.activeSelf)
         {
             BindProjectList();
         }
         else if (PageContent2.activeSelf)
         {
             BindPeopleList();
         }
         //else if(PageContent3.activeSelf)
         //    BindSystemMessageList();
     });
 }
Example #2
0
 void BindSystemMessageList()
 {
     Message_Service.ListByTargetID(MessageType.System, 0, t =>
     {
         SystemMessageView.BindData <EMessage>("MessageItem", t.GetData() as List <EMessage>, (i, e) =>
         {
             i.name = "MessageItem_" + e.ID.ToString();
             i.transform.Find("Text (1)").GetComponent <Text>().text = e.CreateTime.ToString("yyyy-MM-dd hh:mm:ss");
             i.transform.Find("Text").GetComponent <Text>().text     = "系统";
             Transform bg = i.transform.Find("Image (1)");
             Text content = bg.Find("Text").GetComponent <Text>();
             content.text = e.Content;
             float textH  = content.preferredHeight + 20;
             if (e.SenderID == Session.UserID)
             {
                 i.transform.Find("Image (2)").GetComponent <Image>().color = new Color(178 / 255.0f, 255 / 255.0f, 195 / 255.0f);
                 bg.GetComponent <Image>().color = new Color(178 / 255.0f, 255 / 255.0f, 195 / 255.0f);
             }
             else
             {
                 bg.GetComponent <Image>().color = Color.white;
                 i.transform.Find("Image (2)").GetComponent <Image>().color = Color.white;
             }
             i.GetComponent <LayoutElement>().preferredHeight = textH + 32;
         }, true);
     });
 }
Example #3
0
    protected override void Init()
    {
        base.Init();
        PageTitle.Init("消息", App.Instance.Theme.TitleBgColor, App.Instance.Theme.TitleFontColor, null, MenuClicked);

        ProjectTips.gameObject.SetActive(false);
        PeopleTips.gameObject.SetActive(false);
        SystemTips.gameObject.SetActive(false);
        PageTitle.BtnMenu.transform.Find("tips").gameObject.SetActive(false);
        Message_Service.ListMyTips(t =>
        {
            TipsList = t.GetData() as List <ENewTips>;
            if (TipsList != null && TipsList.Count > 0)
            {
                PageTitle.BtnMenu.transform.Find("tips").gameObject.SetActive(true);
            }
            else
            {
                PageTitle.BtnMenu.transform.Find("tips").gameObject.SetActive(false);
            }

            ReBindTips();
            Tab.Init(OnTabClicked, App.Instance.Theme.SelectedItemBgColor);
        });
        PlatformCallBackListener.Instance.OnReceiveMessage = OnReceiveMessage;
    }
Example #4
0
    void BindMessageList()
    {
        Message_Service.ListByTargetID(MessageType, TargetId, t =>
        {
            List <EMessage> mlist = t.GetData() as List <EMessage>;
            mlist = mlist.OrderBy(c => c.ID).ToList();
            MessageListView.BindData <EMessage>("MessageItem", mlist, (i, e) =>
            {
                i.name = "MessageItem_" + e.ID.ToString();
                i.transform.Find("Text (1)").GetComponent <Text>().text = e.CreateTime.ToString("yyyy-MM-dd hh:mm:ss");
                i.transform.Find("Text").GetComponent <Text>().text     = e.SenderName;
                Transform bg = i.transform.Find("Image (1)");
                Text content = bg.Find("Text").GetComponent <Text>();
                content.text = e.Content;
                float textH  = content.preferredHeight + 20;
                if (e.SenderID == Session.UserID)
                {
                    i.transform.Find("Image (2)").GetComponent <Image>().color = new Color(178 / 255.0f, 223 / 255.0f, 255 / 255.0f);
                    bg.GetComponent <Image>().color = new Color(178 / 255.0f, 223 / 255.0f, 255 / 255.0f);
                }
                else
                {
                    bg.GetComponent <Image>().color = Color.white;
                    i.transform.Find("Image (2)").GetComponent <Image>().color = Color.white;
                }
                i.GetComponent <LayoutElement>().preferredHeight = textH + 32;

                App.Instance.ShowImage(i.transform.Find("Image").GetComponent <RawImage>(), e.SenderFace, 11);
            }, true);
        });
    }
Example #5
0
    void OnPeopleClicked(GameObject g)
    {
        int    peopleID = int.Parse(g.name.Split('_')[1]);
        string pname    = g.transform.Find("Name").GetComponent <Text>().text;

        App.Instance.PageGroup.ShowPage("Page_Message_Info", false, MessageType.OneToOne, peopleID, pname);

        Message_Service.ClearMyTips(MessageType.OneToOne, peopleID, t =>
        {
            TipsList = t.GetData() as List <ENewTips>;
            ReBindTips();
        });
    }
Example #6
0
 void OnReceiveMessageRefreshTips()
 {
     PageTitle.BtnMenu.transform.Find("tips").gameObject.SetActive(false);
     Message_Service.ListMyTips(t =>
     {
         TipsList = t.GetData() as List <ENewTips>;
         if (TipsList != null && TipsList.Count > 0)
         {
             PageTitle.BtnMenu.transform.Find("tips").gameObject.SetActive(true);
         }
         else
         {
             PageTitle.BtnMenu.transform.Find("tips").gameObject.SetActive(false);
         }
     });
 }
Example #7
0
    void OnAddMsgClicked(GameObject g)
    {
        EMessage msg = new EMessage();

        msg.Content    = MsgContent.text;
        msg.CreateTime = System.DateTime.Now;
        msg.IsRead     = false;
        msg.SenderID   = Session.UserID;
        msg.ReceiverID = TargetId;
        msg.Type       = MessageType;

        Message_Service.SendMessage(msg, t =>
        {
            App.Instance.HintBox.Show("操作成功!");
            BindMessageList();
        });
    }
Example #8
0
    protected override void Init()
    {
        base.Init();
        UserName.text = Session.CurrentUser.Name;
        App.Instance.ShowImage(UserFace, Session.CurrentUser.Face, 11);
        for (int i = 0; i < ItemList.Count; i++)
        {
            GameObject menuItem = ItemList[i].gameObject;
            EventListener.Get(menuItem).onClick = MenuItem_OnClicked;
            if (SelectedItem == menuItem.name)
            {
                menuItem.GetComponentInChildren <RawImage>().color = App.Instance.Theme.SelectedItemBgColor;
                menuItem.GetComponentInChildren <Text>().color     = App.Instance.Theme.SelectedItemBgColor;
            }
            else
            {
                menuItem.GetComponentInChildren <RawImage>().color = Color.white;
                menuItem.GetComponentInChildren <Text>().color     = new Color(124 / 255f, 124 / 255f, 124 / 255f);
            }
        }


        TotalTips.gameObject.SetActive(false);
        Message_Service.ListMyTips(t =>
        {
            List <ENewTips> tipsList = t.GetData() as List <ENewTips>;
            if (tipsList.Count > 0)
            {
                TotalTips.gameObject.SetActive(true);
            }
            else
            {
                TotalTips.gameObject.SetActive(false);
            }
        });
    }