示例#1
0
        public virtual void ReceiveChatText(CChatData chat)
        {
            this.m_CurrentChatList.Add(chat);
            var min = this.m_CurrentChatList.Count - 20 < 0 ? 0 : this.m_CurrentChatList.Count - 20;
            var max = this.m_CurrentChatList.Count;

            for (int i = 0; i < this.m_ChatItems.Length; i++)
            {
                var index   = i + min;
                var chatStr = this.m_CurrentChatList[index].chatStr;
                var isMine  = this.m_CurrentChatList [index].isMine;
                this.m_ChatItems [i].SetChatText(chatStr, isMine);
                this.m_ChatItems [i].gameObject.SetActive(true);
            }
            // NOTICE SHOW
            this.m_ChatNotice.gameObject.SetActive(true);
            this.m_NoticeText.text = this.m_CurrentChatList.Count.ToString();
        }
示例#2
0
        public virtual void OnClientReceiveChat(SocketIOEvent obj)
        {
            Debug.LogWarning("clientReceiveChat " + obj.ToString());
            var isHasChat = obj.data.HasField("chatStr");

            if (isHasChat)
            {
                // WARNING
                if (CSceneManager.Instance.GetActiveSceneName() != this.taskName)
                {
                    return;
                }
                var chatOwner = obj.data.GetField("chatOwner").ToString().Replace("\"", string.Empty);
                var chatStr   = obj.data.GetField("chatStr").ToString().Replace("\"", string.Empty);
                var chat      = chatOwner + ": " + chatStr;
                var chatData  = new CChatData()
                {
                    chatOwner = chatOwner,
                    chatStr   = chat,
                    isMine    = chatOwner == this.m_UserManager.currentHero.objectName
                };
                CUILobbyManager.Instance.ReceiveChatText(chatData);
            }
        }