示例#1
0
    public static void NPCTellChat(string name)
    {
        if (TsPlatform.IsWeb)
        {
            MainChatDlg mainChatDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.CHAT_MAIN_DLG) as MainChatDlg;

            if (mainChatDlg != null)
            {
                mainChatDlg.NPCTellChat(name);
            }
        }
        else if (TsPlatform.IsMobile)
        {
            ChatMobileDlg chatMobileDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.CHAT_MAIN_DLG) as ChatMobileDlg;

            if (chatMobileDlg != null)
            {
                chatMobileDlg.NPCTellChat(name);
            }
            ChatMobile_Sub_Dlg chatMobile_Sub_Dlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.CHAT_MOBILE_SUB_DLG) as ChatMobile_Sub_Dlg;

            if (chatMobile_Sub_Dlg != null)
            {
                chatMobile_Sub_Dlg.NPCTellChat(name);
            }
            TournamentLobbyDlg tournamentLobbyDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.TOURNAMENT_LOBBY_DLG) as TournamentLobbyDlg;

            if (tournamentLobbyDlg != null)
            {
                tournamentLobbyDlg.NPCTellChat(name);
            }
        }
    }
示例#2
0
    public override void Update()
    {
        if (this.IsChatFocused() != this.bOldTextFieldFocus)
        {
            this.bOldTextFieldFocus = this.IsChatFocused();
        }
        if (0 < this._Manager.GetChatMsgCount())
        {
            MainChatMsg mainChatMsg = this._Manager.ChatMsgDequeue();
            if (string.Empty == mainChatMsg.color)
            {
                mainChatMsg.color = ChatManager.GetChatColorKey(mainChatMsg.type);
            }
            this._clChat.PushText(mainChatMsg.name, mainChatMsg.msg, mainChatMsg.color, mainChatMsg.linkItem);
            if (mainChatMsg.type == CHAT_TYPE.GUILD)
            {
                this._clChatGuild.PushText(mainChatMsg.name, mainChatMsg.msg, mainChatMsg.color, mainChatMsg.linkItem);
            }
            if (this.m_MainChat != null)
            {
                ChatLabel chatLable = this.m_MainChat.GetChatLable(CHAT_TYPE.ALL);
                if (chatLable != null)
                {
                    chatLable.PushText(mainChatMsg.name, mainChatMsg.msg, mainChatMsg.color, mainChatMsg.linkItem);
                }
            }
            TournamentLobbyDlg tournamentLobbyDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.TOURNAMENT_LOBBY_DLG) as TournamentLobbyDlg;

            if (tournamentLobbyDlg != null)
            {
                ChatLabel chatLable2 = tournamentLobbyDlg.GetChatLable(CHAT_TYPE.ALL);
                if (chatLable2 != null)
                {
                    chatLable2.PushText(mainChatMsg.name, mainChatMsg.msg, mainChatMsg.color, mainChatMsg.linkItem);
                }
            }
        }
        if (0 < this._Manager.GetCharChatCount())
        {
            CharChat charChat = this._Manager.CharChatDequeue();
            if (charChat.Character != null)
            {
                charChat.Character.MakeChatText(charChat.msg, true);
            }
        }
    }
示例#3
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);
        }
    }