Ejemplo n.º 1
0
    void OnReciveCommunityMessage(CommunityMessageData data)
    {
        if (data == null)
        {
            Debug.Log("Message Is NULL");
            return;
        }

        ChannelId channel  = data.Channel;
        ulong     senderId = data.DBid;
        //Debug.LogError(senderId + "!!!!!!!!!");
        //int senderNameLength = int.Parse(data.SenderName);
        string sendName  = data.SenderName;
        byte   sendLevel = data.SenderLevel;
        string mess      = data.Message;

        m_dictIDToName[senderId]  = sendName;
        m_dictIDToLevel[senderId] = sendLevel;

        string LvAndNameString = "";
        string underLineColor  = NAME_COLOR;

        if (sendName.Equals(MogoWorld.thePlayer.name))
        {
            if (MogoUIManager.IsShowLevel && channel != ChannelId.TOWER_DEFENCE && channel != ChannelId.OCCUPY_TOWER)
            {
                LvAndNameString = string.Concat("[", MYNAME_COLOR, "]", "LV", sendLevel, " ", sendName, ":", "[-]");
            }
            else
            {
                LvAndNameString = string.Concat("[", MYNAME_COLOR, "]", sendName, ":", "[-]");
            }

            underLineColor = MYNAME_COLOR;
        }
        else
        {
            if (MogoUIManager.IsShowLevel && channel != ChannelId.TOWER_DEFENCE && channel != ChannelId.OCCUPY_TOWER)
            {
                LvAndNameString = string.Concat("[", NAME_COLOR, "]", "LV", sendLevel, " ", sendName, ":", "[-]");
            }
            else
            {
                LvAndNameString = string.Concat("[", NAME_COLOR, "]", sendName, ":", "[-]");
            }

            underLineColor = NAME_COLOR;
        }

        switch (channel)
        {
        // 世界
        case ChannelId.WORLD:
        {
            //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + WORLD_COLOR + "][" + LanguageData.GetContent(47300) + "]" +
            //  LvAndNameString + mess + "[-]", ChannelId.WORLD, senderId);

            CommunityUIViewManager.Instance.AddChatUIDialogText("[" + WORLD_COLOR + "]" + CHANNEL_BLANK +
                                                                LvAndNameString + mess + "[-]", ChannelId.WORLD, senderId, ChannelId.WORLD, LvAndNameString, underLineColor);
            NormalMainUIViewManager.Instance.SetNewChatLabel(string.Concat(sendName, " : ", mess));
        }
        break;

        // 公会
        case ChannelId.UNION:
        {
            //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + UNION_COLOR + "][" + LanguageData.GetContent(47301) + "]" +
            //    LvAndNameString + mess + "[-]", ChannelId.UNION, senderId);
            //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + UNION_COLOR + "][" + LanguageData.GetContent(47301) + "]" +
            //    LvAndNameString + mess + "[-]", ChannelId.WORLD, senderId);

            CommunityUIViewManager.Instance.AddChatUIDialogText("[" + UNION_COLOR + "]" + CHANNEL_BLANK +
                                                                LvAndNameString + mess + "[-]", ChannelId.UNION, senderId, ChannelId.UNION, LvAndNameString, underLineColor);
            CommunityUIViewManager.Instance.AddChatUIDialogText("[" + UNION_COLOR + "]" + CHANNEL_BLANK +
                                                                LvAndNameString + mess + "[-]", ChannelId.WORLD, senderId, ChannelId.UNION, LvAndNameString, underLineColor);
            NormalMainUIViewManager.Instance.SetNewChatLabel(string.Concat(sendName, " : ", mess));
        }
        break;

        // 私聊
        case ChannelId.PERSONAL:
        {
            //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + PERSONAL_COLOR + "][" + LanguageData.GetContent(47302) + "]" +
            //    LvAndNameString + mess + "[-]", ChannelId.PERSONAL, senderId);
            //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + PERSONAL_COLOR + "][" + LanguageData.GetContent(47302) + "]" +
            //    LvAndNameString + mess + "[-]", ChannelId.WORLD, senderId);

            CommunityUIViewManager.Instance.AddChatUIDialogText("[" + PERSONAL_COLOR + "]" + CHANNEL_BLANK +
                                                                LvAndNameString + mess + "[-]", ChannelId.PERSONAL, senderId, ChannelId.PERSONAL, LvAndNameString, underLineColor);
            CommunityUIViewManager.Instance.AddChatUIDialogText("[" + PERSONAL_COLOR + "]" + CHANNEL_BLANK +
                                                                LvAndNameString + mess + "[-]", ChannelId.WORLD, senderId, ChannelId.PERSONAL, LvAndNameString, underLineColor);
            NormalMainUIViewManager.Instance.SetNewChatLabel(string.Concat(sendName, " : ", mess));
        }
        break;

        // 系统
        case ChannelId.SYSTEM:
        {
            //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + SYSTEM_COLOR + "][" + LanguageData.GetContent(47303) + "]" +
            //    sendName + ": " + mess + "[-]", ChannelId.SYSTEM, senderId);
            //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + SYSTEM_COLOR + "][" + LanguageData.GetContent(47303) + "]" +
            //    sendName + ": " + mess + "[-]", ChannelId.WORLD, senderId);

            //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + SYSTEM_COLOR + "]" + CHANNEL_BLANK +
            //    sendName + ": " + mess + "[-]", ChannelId.SYSTEM, senderId);
            CommunityUIViewManager.Instance.AddChatUIDialogText("[" + SYSTEM_COLOR + "]" + CHANNEL_BLANK +
                                                                sendName + ": " + mess + "[-]", ChannelId.WORLD, senderId, ChannelId.SYSTEM);
            NormalMainUIViewManager.Instance.SetNewChatLabel(string.Concat(sendName, " : ", mess));
        }
        break;

        case ChannelId.TOWER_DEFENCE:
        {
            int td_messageCode = Convert.ToInt32(mess);
            MainUIViewManager.Instance.AddShortCutMessage(LvAndNameString, td_messageCode);
        }
        break;

        case ChannelId.OCCUPY_TOWER:
        {
            int ot_messageCode = Convert.ToInt32(mess);
            MainUIViewManager.Instance.AddShortCutMessage(LvAndNameString, ot_messageCode);
        }
        break;
        }

        // NormalMainUIViewManager.Instance.SetNewChatLabel(string.Concat(sendName," : ",mess));
        NormalMainUIViewManager.Instance.SetCommunityIconBG(true);
    }
Ejemplo n.º 2
0
        private void ChatResp(byte channel, ulong dbid, String name, byte level, String message)
        {
            LoggerHelper.Debug("dbid = " + dbid + " name = " + name + "level = " + level);
            CommunityMessageData data = new CommunityMessageData();

            data.Channel = (ChannelId)channel;
            data.DBid = dbid;
            data.SenderName = name;
            data.SenderLevel = level;
            data.Message = message;

            EventDispatcher.TriggerEvent<CommunityMessageData>("ReciveCommunityMessage", data);
        }
Ejemplo n.º 3
0
    void OnReciveCommunityMessage(CommunityMessageData data)
    {
        if (data == null)
        {
            LoggerHelper.Debug("Message Is NULL");
            return;
        }

        ChannelId channel = data.Channel;
        ulong senderId = data.DBid;
        //Debug.LogError(senderId + "!!!!!!!!!");
        //int senderNameLength = int.Parse(data.SenderName);
        string sendName = data.SenderName;
        byte sendLevel = data.SenderLevel;
        string mess = data.Message;

        m_dictIDToName[senderId] = sendName;
        m_dictIDToLevel[senderId] = sendLevel;

        string LvAndNameString = "";
        string underLineColor = NAME_COLOR;
        if (sendName.Equals(MogoWorld.thePlayer.name))
        {
            if (MogoUIManager.IsShowLevel && channel != ChannelId.TOWER_DEFENCE && channel != ChannelId.OCCUPY_TOWER)
            {
                LvAndNameString = string.Concat("[", MYNAME_COLOR, "]", "LV", sendLevel, " ", sendName, ":", "[-]");
            }
            else
            {
                LvAndNameString = string.Concat("[", MYNAME_COLOR, "]", sendName, ":", "[-]");
            }

            underLineColor = MYNAME_COLOR;
        }
        else
        {
            if (MogoUIManager.IsShowLevel && channel != ChannelId.TOWER_DEFENCE && channel != ChannelId.OCCUPY_TOWER)
            {
                LvAndNameString = string.Concat("[", NAME_COLOR, "]", "LV", sendLevel, " ", sendName, ":", "[-]");
            }
            else
            {
                LvAndNameString = string.Concat("[", NAME_COLOR, "]", sendName, ":", "[-]");
            }

            underLineColor = NAME_COLOR;
        }

        switch (channel)
        {
            // 世界
            case ChannelId.WORLD:
                {
                    //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + WORLD_COLOR + "][" + LanguageData.GetContent(47300) + "]" +
                    //  LvAndNameString + mess + "[-]", ChannelId.WORLD, senderId);

                    CommunityUIViewManager.Instance.AddChatUIDialogText("[" + WORLD_COLOR + "]" + CHANNEL_BLANK +
                        LvAndNameString + mess + "[-]", ChannelId.WORLD, senderId, ChannelId.WORLD, LvAndNameString, underLineColor);
                    NormalMainUIViewManager.Instance.SetNewChatLabel(string.Concat(sendName, " : ", mess));
                }
                break;

            // 公会
            case ChannelId.UNION:
                {
                    //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + UNION_COLOR + "][" + LanguageData.GetContent(47301) + "]" +
                    //    LvAndNameString + mess + "[-]", ChannelId.UNION, senderId);
                    //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + UNION_COLOR + "][" + LanguageData.GetContent(47301) + "]" +
                    //    LvAndNameString + mess + "[-]", ChannelId.WORLD, senderId);

                    CommunityUIViewManager.Instance.AddChatUIDialogText("[" + UNION_COLOR + "]" + CHANNEL_BLANK +
                        LvAndNameString + mess + "[-]", ChannelId.UNION, senderId, ChannelId.UNION, LvAndNameString, underLineColor);
                    CommunityUIViewManager.Instance.AddChatUIDialogText("[" + UNION_COLOR + "]" + CHANNEL_BLANK +
                        LvAndNameString + mess + "[-]", ChannelId.WORLD, senderId, ChannelId.UNION, LvAndNameString, underLineColor);
                    NormalMainUIViewManager.Instance.SetNewChatLabel(string.Concat(sendName, " : ", mess));
                }
                break;

            // 私聊
            case ChannelId.PERSONAL:
                {
                    //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + PERSONAL_COLOR + "][" + LanguageData.GetContent(47302) + "]" +
                    //    LvAndNameString + mess + "[-]", ChannelId.PERSONAL, senderId);
                    //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + PERSONAL_COLOR + "][" + LanguageData.GetContent(47302) + "]" +
                    //    LvAndNameString + mess + "[-]", ChannelId.WORLD, senderId);

                    CommunityUIViewManager.Instance.AddChatUIDialogText("[" + PERSONAL_COLOR + "]" + CHANNEL_BLANK +
                        LvAndNameString + mess + "[-]", ChannelId.PERSONAL, senderId, ChannelId.PERSONAL, LvAndNameString, underLineColor);
                    CommunityUIViewManager.Instance.AddChatUIDialogText("[" + PERSONAL_COLOR + "]" + CHANNEL_BLANK +
                        LvAndNameString + mess + "[-]", ChannelId.WORLD, senderId, ChannelId.PERSONAL, LvAndNameString, underLineColor);
                    NormalMainUIViewManager.Instance.SetNewChatLabel(string.Concat(sendName, " : ", mess));
                }
                break;

            // 系统
            case ChannelId.SYSTEM:
                {
                    //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + SYSTEM_COLOR + "][" + LanguageData.GetContent(47303) + "]" +
                    //    sendName + ": " + mess + "[-]", ChannelId.SYSTEM, senderId);
                    //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + SYSTEM_COLOR + "][" + LanguageData.GetContent(47303) + "]" +
                    //    sendName + ": " + mess + "[-]", ChannelId.WORLD, senderId);

                    //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + SYSTEM_COLOR + "]" + CHANNEL_BLANK +
                    //    sendName + ": " + mess + "[-]", ChannelId.SYSTEM, senderId);
                    CommunityUIViewManager.Instance.AddChatUIDialogText("[" + SYSTEM_COLOR + "]" + CHANNEL_BLANK +
                        sendName + ": " + mess + "[-]", ChannelId.WORLD, senderId, ChannelId.SYSTEM);
                    NormalMainUIViewManager.Instance.SetNewChatLabel(string.Concat(sendName, " : ", mess));
                }
                break;

            case ChannelId.TOWER_DEFENCE:
                {
                    int td_messageCode = Convert.ToInt32(mess);
                    MainUIViewManager.Instance.AddShortCutMessage(LvAndNameString, td_messageCode);
                }
                break;

            case ChannelId.OCCUPY_TOWER:
                {
                    int ot_messageCode = Convert.ToInt32(mess);
                    MainUIViewManager.Instance.AddShortCutMessage(LvAndNameString, ot_messageCode);
                }
                break;
        }

        // NormalMainUIViewManager.Instance.SetNewChatLabel(string.Concat(sendName," : ",mess));
        NormalMainUIViewManager.Instance.SetCommunityIconBG(true);
    }