示例#1
0
        /// <summary>
        /// 获取频道的名称
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        static public string getChannelName(EMChatChannelType type)
        {
            string name = "";

            if (!m_dicChannnelName.TryGetValue(type, out name))
            {
                return("");
            }

            return(name);
        }
示例#2
0
        public void ChangeChannel(int channel)
        {
            EMChatChannelType target = (EMChatChannelType)channel;

            for (int i = 0; i < m_dropDownIndexToChannel.Length; ++i)
            {
                if (m_dropDownIndexToChannel[i] == target)
                {
                    channelDropdown.value = i;
                    break;
                }
            }
        }
示例#3
0
        /// <summary>
        /// 清空频道聊听消息
        /// </summary>
        /// <param name="channel">频道类型</param>
        public void RemoveChannelChatMessage(EMChatChannelType channel)
        {
            var msg = m_messageList.First;

            while (msg != null)
            {
                var nextMsg = msg.Next;
                if (msg.Value.channel == channel)
                {
                    m_messageList.Remove(msg);
                }
                msg = nextMsg;
            }
        }
示例#4
0
文件: GameUtil.cs 项目: zwong91/Titan
    // 发送聊天消息
    // @param isDetectTextRepeat: 是否做相似度检查
    public static void SendChatMessage(EMChatChannelType channel, string msg, bool isDetectTextRepeat = false)
    {
        if (channel == EMChatChannelType.CHAT_CHANNEL_WORLD || channel == EMChatChannelType.CHAT_CHANNEL_ZONE)
        {
            isDetectTextRepeat = true;
        }

        gameview_send_chat_message msgInfo = new gameview_send_chat_message();

        msgInfo.channel            = (int)channel;
        msgInfo.message            = msg;
        msgInfo.isDetectTextRepeat = isDetectTextRepeat;

        ViewEventHelper.Instance.SendCommand <gameview_send_chat_message>(GameLogicDef.GVIEWCMD_SEND_CHAT_MESSAGE, ref msgInfo);
    }
示例#5
0
        //private void ClearKinMemberFrame()
        //{
        //    // 清空KinMemberFrame
        //    int nCount = KinMemberListFrame.childCount;
        //    for (int i = nCount - 1; i >= 0; --i)
        //    {
        //        Transform childTrans = KinMemberListFrame.GetChild(i);
        //        if (childTrans)
        //        {
        //            var temp = childTrans.gameObject;
        //            ResNode.DestroyRes(ref temp);
        //        }
        //    }
        //}

        public void OnClickInviteLegendCupBtn()
        {
            cmd_legendcup_recv_cuplist_node cupBaseData = LogicDataCenter.legendCupDataManager.GetSingleLegendCupNode(nLegendCupID);

            if (cupBaseData.nLegendCupID == 0)
            {
                return;
            }

            string strContent = "";

            if (cupBaseData.nRegistGold > 0)
            {
                strContent = String.Format("杯赛【{0}】({1}/{2})正在火热进行中,报名费用金币{3},{4}[clickinvitelegendcup color=255+255+255 cupid={5}]点击报名[/clickinvitelegendcup]",
                                           cupBaseData.szCupName,
                                           cupBaseData.nCurrentKinNum,
                                           cupBaseData.nMaxKinNum,
                                           cupBaseData.nRegistGold,
                                           ChatMessageManager.ChatItemFlag,
                                           cupBaseData.nLegendCupID
                                           );
            }
            else
            {
                strContent = String.Format("杯赛【{0}】({1}/{2})正在火热进行中,{3}[clickinvitelegendcup color=255+255+255 cupid={4}]点击报名[/clickinvitelegendcup]",
                                           cupBaseData.szCupName,
                                           cupBaseData.nCurrentKinNum,
                                           cupBaseData.nMaxKinNum,
                                           ChatMessageManager.ChatItemFlag,
                                           cupBaseData.nLegendCupID
                                           );
            }

            EMChatChannelType channelType = EMChatChannelType.CHAT_CHANNEL_WORLD;

            if (cupBaseData.byCreateCupType == (int)ELegendCupType.emCupType_Clan)
            {
                channelType = EMChatChannelType.CHAT_CHANNEL_CLAN;
            }
            UIUtil.SendChatMessage(channelType, strContent);

            UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_CHATBOX_TOGGLE, null);
        }
示例#6
0
        public void OnSendBtnClick()
        {
            string strInput = inputField.GetCharString(0, -1);

            if (strInput == "")
            {
                return;
            }

            //替换表情字符
            ChatEmoticonConfig.Instance.ReplaceChatEmoticonChar(ref strInput);

            if (strInput.StartsWith("/"))  // 私聊
            {
                string targetName;
                string msg;
                parsePrivateChat(strInput, out targetName, out msg);
                if (targetName.Length > 0)
                {
                    if (msg.Length > 0)
                    {
                        UIUtil.SendChatMessage(EMChatChannelType.CHAT_CHANNEL_PRIVATE, msg, targetName, 0);
                    }

                    LogicDataCenter.chatMessageManager.LastPrivateChatName = targetName;
                }
            }
            else
            {
                EMChatChannelType channelType = m_dropDownIndexToChannel[channelDropdown.value];
                if (channelType != EMChatChannelType.CHAT_CHANNEL_PRIVATE)
                {
                    UIUtil.SendChatMessage(channelType, strInput);
                }
            }

            inputField.ClearContent();
        }
示例#7
0
        public void onSendChatMessage(USendChatMessage uiMsgData)
        {
            EMChatChannelType channelType = m_dropDownIndexToChannel [channelDropdown.value];

            UIUtil.SendChatMessage(channelType, uiMsgData.chatMsg);
        }
示例#8
0
        // 切换频道响应
        public void OnChannelChanged()
        {
            EMChatChannelType newChannel = m_dropDownIndexToChannel[channelDropdown.value];
            bool bBan = false;

            switch (newChannel)
            {
            case EMChatChannelType.CHAT_CHANNEL_WORLD:
                break;

            case EMChatChannelType.CHAT_CHANNEL_MATCHROOM:
            {
                if (StageManager.Instance.getCurrentState() != EStage_State.ESS_MATCHROOM)
                {
                    bBan = true;
                    UIUtil.ShowSystemMessage(EMChatTipID.CHAT_TIP_CHAT_BAN_MATCHROOM_CHANNEL);
                }
            }
            break;

            case EMChatChannelType.CHAT_CHANNEL_TEAMMATE:
            {
                //if (EntityFactory.MainHeroView == null || EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_TEAMID) <= 0)
                if (GameLogicAPI.getTeamID() <= 0)
                {
                    bBan = true;
                    UIUtil.ShowSystemMessage(EMChatTipID.CHAT_TIP_CHAT_BAN_TEAMMATE_CHANNEL);
                }
            }
            break;

            case EMChatChannelType.CHAT_CHANNEL_CAMP:
            {
                if (StageManager.Instance.getCurrentState() != EStage_State.ESS_BATTLE &&
                    StageManager.Instance.getCurrentState() != EStage_State.ESS_MATCHROOM &&
                    StageManager.Instance.getCurrentState() != EStage_State.ESS_LOADSCENE)
                {
                    bBan = true;
                    UIUtil.ShowSystemMessage(EMChatTipID.CHAT_TIP_CHAT_BAN_CAMP_CHANNEL);
                }
            }
            break;

            case EMChatChannelType.CHAT_CHANNEL_WARSCENE:
            {
                if (StageManager.Instance.getCurrentState() != EStage_State.ESS_BATTLE)
                {
                    bBan = true;
                    UIUtil.ShowSystemMessage(EMChatTipID.CHAT_TIP_CHAT_BAN_WARSCENE_CHANNEL);
                }
            }
            break;

            case EMChatChannelType.CHAT_CHANNEL_KIN:
            {
                if (EntityFactory.MainHeroView == null || EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_KIN) <= 0)
                {
                    bBan = true;
                    UIUtil.ShowSystemMessage(EMChatTipID.CHAT_TIP_CHAT_BAN_KIN_CHANNEL);
                }
            }
            break;

            case EMChatChannelType.CHAT_CHANNEL_CLAN:
            {
                if (EntityFactory.MainHeroView == null || EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_CLAN) <= 0)
                {
                    bBan = true;
                    UIUtil.ShowSystemMessage(EMChatTipID.CHAT_TIP_CHAT_BAN_CLAN_CHANNEL);
                }
            }
            break;

            case EMChatChannelType.CHAT_CHANNEL_PRIVATE:
            {
                addPrivateChatToInputField(LogicDataCenter.chatMessageManager.LastPrivateChatName);
            }
            break;

            default:
                break;
            }

            if (bBan)
            {
                StartCoroutine(DelayRevertChannel());
            }
            else
            {
                m_curSelChannel = channelDropdown.value;
            }
        }
示例#9
0
        public override bool Init(IUIWnd wnd)
        {
            base.Init(wnd);

            // 从脚本配置中获取各个频道名字,缓存起来,与频道宏定义做个映射,方便读取
            string[] channelName = { "SystemChannelName",
                                     "WorldChannelName",
                                     "MatchroomChannelName",
                                     "TeammateChannelName",
                                     "WarSceneChannelName",
                                     "PrivateChannelName",
                                     "KinChannelName",
                                     "ClanChannelName",
                                     "NearbyChannelName",
                                     "ZoneChannelName",
                                     "CampChannelName", };
            for (EMChatChannelType type = EMChatChannelType.CHAT_CHANNEL_SYSTEM; type < EMChatChannelType.CHAT_CHANNEL_MAX; ++type)
            {
                m_dicChannnelName[type] = ULocalizationService.Instance.Get("UIView", "ChatBox", channelName[(int)type]);
            }



            canDrag = false;

            //如果游戏限制输入法,则初始化相关界面
            if (ImeManager.ForbidIme)
            {
                List <string> imeList = ImeManager.GetImeNameList();
                if (imeList != null)
                {
                    foreach (var temp in imeList)
                    {
                        imeDropdown.options.Add(new Dropdown.OptionData()
                        {
                            text = temp
                        });
                    }
                }
                imeDropdown.value = 0;
                chineseIcon.gameObject.SetActive(false);
                enIcon.gameObject.SetActive(true);
            }
            else//否则隐藏
            {
                imeDropdown.interactable = false;
                chineseIcon.gameObject.SetActive(false);
                enIcon.gameObject.SetActive(false);
            }

            inputField.onEndEdit.AddListener(delegate { OnEndEdit(); });

            resizer.SetWndView(this);

            minimumIcon.SetChatWndView(this);
            minimunCanvasGroup       = minimumIcon.GetComponent <CanvasGroup>();
            channelMaskItemPrefabRes = AssetBundleManager.GetAssets(AssetType.Asset_Prefab, "UI/Prefabs/Chat/ChatChannelGroupItem");

            m_DiyChannelMask = ChatSettingConfig.Instance.GetChatSettingIntValue(ChatSettingIndex.DiyChannelMask);

            m_DiyChannelGroup.setWndView(this);
            m_DiyChannelGroup.Init();

            emoticonPanel.SetChatWndView(this);
            emoticonPanel.Init();
            emoticonBtn.onClick.AddListener(delegate { emoticonPanel.SwitchEmotionPanelActiveState(); });

            // 设置消息显示定时器
            TimerManager.SetTimer(this, (int)EChatTimer.EChatTimer_ShowChatMsg, 0.5f);
#if FUNCTION_AUTO_ADD_CHAT_OPEN
            TimerManager.SetTimer(this, (int)EChatTimer.EChatTimer_AddChatMsg, 1f);
#endif

            // 计算聊天框位置
            m_DownPos = GetTransform().anchoredPosition;
            m_UpPos   = new Vector3(m_DownPos.x, m_DownPos.y + 300, m_DownPos.z);

            // 初始化大小
            m_InitSize = new Vector2(GetTransform().sizeDelta.x, GetTransform().sizeDelta.y);


            m_isMin = false;

            inputField.onFocusChange.AddListener(OnFocus);

            fpsHintInitPosition = fpsSwitchHint.GetComponent <RectTransform>().anchoredPosition;


            m_PopupWndStatus = new Dictionary <int, bool>();

            m_fullWndStatus = new Dictionary <int, bool>();
            //m_ModalKey = 0;

            m_ChatBoxState = new ChatBoxBase(this);

            return(true);
        }