Exemplo n.º 1
0
 private void InitializeUIComp()
 {
     this.mViewPanel     = this.mScrollView.GetComponent <UIPanel>();
     this.queueChat      = new Queue <ChatItem>();
     this.selfChatItem   = Resources.Load <ChatItem>("Prefab/UI/HomeChat/MyChatText");
     this.normalChatItem = Resources.Load <ChatItem>("Prefab/UI/HomeChat/OthersChatText");
     UIEventListener.Get(this.mSendChat).onClick = new UIEventListener.VoidDelegate(this.OnClick_Send);
     UIEventListener.Get(this.mEmojiBtn).onClick = new UIEventListener.VoidDelegate(this.OnClick_Emoji);
 }
Exemplo n.º 2
0
        private void DisplayData(ChatMessageNew chatMessage, bool isSelf)
        {
            string        str = chatMessage.Message;
            AgentBaseInfo abi = chatMessage.Client;

            GridHelper.AddToGrid <ChatItem>(this.mChatGrid, (!isSelf) ? this.normalChatItem : this.selfChatItem, isSelf, delegate(int idx, ChatItem comp)
            {
                comp.Init(abi, str, idx, isSelf, (ChatType)chatMessage.ChatType);
                comp.name = idx.ToString();
                this.queueChat.Enqueue(comp);
            });
            if (this.queueChat.Count > 99)
            {
                ChatItem chatItem = this.queueChat.Dequeue();
                UnityEngine.Object.Destroy(chatItem.gameObject);
            }
        }
Exemplo n.º 3
0
 private void Initialize()
 {
     this.transFriendChat = base.transform.Find("FriendChat");
     this.mFriendChat     = this.transFriendChat.Find("Chat");
     this.mFriendLst      = this.transFriendChat.Find("FriendLst");
     this.mFriendList     = this.transFriendChat.Find("FriendLst/Grid").GetComponent <UIGrid>();
     this.EmojiBtn        = this.transFriendChat.Find("Chat/Normal/Emoj");
     this.returnBtn       = this.transFriendChat.Find("Chat/ReturnToFriendList");
     this.sendBtn         = this.transFriendChat.Find("Chat/Normal/SendBtn");
     this.myChatItem      = Resources.Load <ChatItem>("Prefab/UI/HomeChat/MyChatText");
     this.otherChatItem   = Resources.Load <ChatItem>("Prefab/UI/HomeChat/OthersChatText");
     this.usv             = this.transFriendChat.Find("Chat/MessageBox").GetComponent <UIScrollView>();
     this.usvPanel        = this.usv.GetComponent <UIPanel>();
     this.transGrid       = this.transFriendChat.Find("Chat/MessageBox/Grid").GetComponent <UIGrid>();
     this.InputStr        = this.transFriendChat.Find("Chat/InputField").GetComponent <UIInput>();
     UIEventListener.Get(this.returnBtn.gameObject).onClick = new UIEventListener.VoidDelegate(this.ReturnToFriendLst);
     UIEventListener.Get(this.sendBtn.gameObject).onClick   = new UIEventListener.VoidDelegate(this.SendFriendMsg);
     UIEventListener.Get(this.EmojiBtn.gameObject).onClick  = new UIEventListener.VoidDelegate(this.ClickEmojiBtn);
     EventDelegate.Add(this.InputStr.onChange, new EventDelegate.Callback(this.LimitTextLength));
     this.queueChat = new Queue <ChatItem>();
 }
Exemplo n.º 4
0
 private void OnMsg_chatviewFillChatHistory(MobaMessage msg)
 {
     if (msg.Param != null)
     {
         bool flag = (bool)msg.Param;
         long num  = long.Parse(ModelManager.Instance.Get_userData_X().UserId);
         Queue <ChatMessageNew> source = new Queue <ChatMessageNew>();
         source = ModelManager.Instance.Get_TempHallChatView();
         List <ChatMessageNew> chatMessageArray = (!flag) ? source.ToList <ChatMessageNew>() : ModelManager.Instance.Get_Hall_Chat_DataX().ToList <ChatMessageNew>();
         int i;
         for (i = 0; i != chatMessageArray.Count; i++)
         {
             string        str = chatMessageArray[i].Message;
             AgentBaseInfo abi = chatMessageArray[i].Client;
             if (chatMessageArray[i].ChatType == 8)
             {
                 str = "#e062" + str;
             }
             bool isSelf = chatMessageArray[i].Client.UserId == num;
             GridHelper.AddToGrid <ChatItem>(this.transGrid, (!isSelf) ? this.otherChatItem : this.myChatItem, isSelf, delegate(int idx, ChatItem comp)
             {
                 comp.Init(abi, str, idx, isSelf, (ChatType)chatMessageArray[i].ChatType);
                 comp.name = idx.ToString();
                 this.queueChat.Enqueue(comp);
             });
             if (this.queueChat.Count > 40)
             {
                 ChatItem chatItem = this.queueChat.Dequeue();
                 UnityEngine.Object.Destroy(chatItem.gameObject);
             }
         }
         this.usv.contentPivot = UIWidget.Pivot.Bottom;
         this.usv.ResetPosition();
         this.JudgePosition();
         ModelManager.Instance.Set_ReSetTempHallChatView();
         HomeChatCtrl.GetInstance().sendState = SendState.Nothing;
     }
 }