/// <summary> /// 给频道增加tooltips /// </summary> /// <param name="ob"></param> private void addTooltipsForChannelGroup(ref GameObject ob, ChatChannelGroupType groupType) { if (groupType < ChatChannelGroupType.ChatChannel_All || groupType > ChatChannelGroupType.ChatChannel_WarScene) { return; } string[] channelTipsName = { "AllTips", "ClanTips", "KinTips", "TeamTips", "AreaTips", "RoomTips", "PersonalTips", "PublicTips", "DiyTips", "WarSceneTips" }; string tooltipsText = ULocalizationService.Instance.Get("UIView", "ChatBox", channelTipsName[(int)groupType]); UTooltipTrigger channelTooltipTrigger = ob.AddComponent <UTooltipTrigger>(ETooltipStyle.ETS_Default); channelTooltipTrigger.SetText(UTooltipParamName.BodyText, tooltipsText); channelTooltipTrigger.backgroundTint = Color.cyan; }
private ChatChannelGroupItem AddChannelMaskItem(ChatChannelGroupType type) { GameObject itemObj = channelMaskItemPrefabRes.InstanceMainRes(); if (itemObj == null) { return(null); } ChatChannelGroupItem item = itemObj.GetComponent <ChatChannelGroupItem>(); if (item == null) { return(null); } item.Init(this, type); // 增加Tooltips addTooltipsForChannelGroup(ref itemObj, type); return(item); }
public void Init(ChatBoxWndView wndView, ChatChannelGroupType nType) { m_wndView = wndView; m_ChannelGroupType = nType; transform.SetParent(wndView.channelMaskButtonFrame, false); m_buttonGroupItem = GetComponent <UButtonGroupItem>(); if (m_buttonGroupItem == null) { Debug.LogError("ChatBoxWndView::Init::m_buttonGroupItem == null"); return; } m_buttonGroupItem.Group = wndView.channelMaskButtonGroup; m_buttonGroupItem.onSelectedChanged.AddListener(onSelectedChanged); m_buttonGroupItem.onDoubleClick.AddListener(onDoubleClick); m_buttonGroupItem.onRightClick.AddListener(onRightClick); m_nChannelMask = 0; switch (nType) { case ChatChannelGroupType.ChatChannel_Clan: itemText.text = ULocalizationService.Instance.Get("UIView", "ChatBox", "ClanChannelName"); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_CLAN); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_SYSTEM); break; case ChatChannelGroupType.ChatChannel_Kin: itemText.text = ULocalizationService.Instance.Get("UIView", "ChatBox", "KinChannelName"); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_KIN); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_SYSTEM); break; case ChatChannelGroupType.ChatChannel_Team: itemText.text = ULocalizationService.Instance.Get("UIView", "ChatBox", "TeammateChannelName"); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_TEAMMATE); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_SYSTEM); break; case ChatChannelGroupType.ChatChannel_Zone: itemText.text = ULocalizationService.Instance.Get("UIView", "ChatBox", "WarSceneChannelName"); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_TEAMMATE); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_ZONE); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_SYSTEM); break; case ChatChannelGroupType.ChatChannel_Room: itemText.text = ULocalizationService.Instance.Get("UIView", "ChatBox", "MatchroomChannelName"); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_MATCHROOM); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_CAMP); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_SYSTEM); break; case ChatChannelGroupType.ChatChannel_Personal: itemText.text = "个人"; m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_CLAN); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_KIN); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_PRIVATE); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_TEAMMATE); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_CAMP); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_SYSTEM); break; case ChatChannelGroupType.ChatChannel_Public: itemText.text = "公共"; m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_WORLD); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_ZONE); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_NEARBY); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_SYSTEM); break; case ChatChannelGroupType.ChatChannel_Diy: itemText.text = "自定义"; break; case ChatChannelGroupType.ChatChannel_WarScene: itemText.text = "战场"; m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_CAMP); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_WARSCENE); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_NEARBY); m_nChannelMask |= (1 << (int)EMChatChannelType.CHAT_CHANNEL_SYSTEM); break; default: itemText.text = ULocalizationService.Instance.Get("UIView", "ChatBox", "ChatChannelGroupAll"); m_nChannelMask = ~0; break; } }