Пример #1
0
    public void MakeChatText(Form form, CHAT_TYPE type, short colosseumGrade, string strText, ITEM linkItem)
    {
        if (type == CHAT_TYPE.SYSTEM)
        {
            type = CHAT_TYPE.NORMAL;
        }
        NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

        if (nrCharUser != null)
        {
            char c = TKString.StringChar("/")[0];
            if (!string.IsNullOrEmpty(strText))
            {
                char[] array = strText.ToCharArray(0, 1);
                if (c.CompareTo(array[0]) == 0)
                {
                    return;
                }
            }
            ChatLabel chatLabel  = null;
            ChatLabel chatLabel2 = null;
            if (TsPlatform.IsWeb)
            {
                MainChatDlg mainChatDlg = form as MainChatDlg;
                if (mainChatDlg != null)
                {
                    chatLabel  = mainChatDlg.GetChatLable(type);
                    chatLabel2 = mainChatDlg.GetChatLable(CHAT_TYPE.ALL);
                }
            }
            else
            {
                ChatMobile_Sub_Dlg chatMobile_Sub_Dlg = form as ChatMobile_Sub_Dlg;
                if (chatMobile_Sub_Dlg != null)
                {
                    chatLabel  = chatMobile_Sub_Dlg.GetChatLable(type);
                    chatLabel2 = chatMobile_Sub_Dlg.GetChatLable(CHAT_TYPE.ALL);
                }
            }
            string name = string.Empty;
            if (chatLabel2 != null)
            {
                name = ChatManager.GetChatFrontString(nrCharUser.GetCharName(), colosseumGrade, type, false);
                chatLabel2.PushText(name, strText, ChatManager.GetChatColorKey(type), linkItem);
                if (null != chatLabel && type != CHAT_TYPE.NORMAL)
                {
                    chatLabel.PushText(name, strText, ChatManager.GetChatColorKey(type), linkItem);
                }
            }
            if (TsPlatform.IsMobile)
            {
                ChatMobileDlg chatMobileDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.CHAT_MAIN_DLG) as ChatMobileDlg;

                if (chatMobileDlg != null)
                {
                    chatLabel2 = chatMobileDlg.GetChatLable(CHAT_TYPE.ALL);
                    if (chatLabel2 != null)
                    {
                        chatLabel2.PushText(name, strText, ChatManager.GetChatColorKey(type), linkItem);
                    }
                    if (80 <= this.ChatMsgList.Count)
                    {
                        this.ChatMsgList.Dequeue();
                    }
                    this.ChatMsgList.Enqueue(new MainChatMsg(type, ChatManager.GetChatNameStr(nrCharUser.GetCharName(), colosseumGrade, false), strText, linkItem, ChatManager.GetChatColorKey(type)));
                }
                TournamentLobbyDlg tournamentLobbyDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.TOURNAMENT_LOBBY_DLG) as TournamentLobbyDlg;

                if (tournamentLobbyDlg != null)
                {
                    chatLabel2 = tournamentLobbyDlg.GetChatLable(CHAT_TYPE.ALL);
                    if (chatLabel2 != null)
                    {
                        chatLabel2.PushText(name, strText, ChatManager.GetChatColorKey(type), linkItem);
                    }
                }
            }
            nrCharUser.MakeChatText(strText, true);
        }
    }