using UnityEngine; using UnityEngine.UI; using System; using System.Collections; using System.Collections.Generic; using Games.ChatHistory; using GCGame.Table; using Games.GlobeDefine; using GCGame; using Module.Log; using Games.Item; public class ChatInfoLogItemInFrame : ChatInfoLogItem { public Image _ChatVoiceImg; public string _CannelTitle; private string non_breaking_space = "\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0"; public const string _ReplaceChannelStr = ""; public override float GetItemHeight() { return _ChatInfo.preferredHeight + 5; } void OnDisable() { //ClearChat(); } protected override bool SetDetailLog() { _ModifiedStr = ""; _ChatVoiceImg.gameObject.SetActive(false); bool isSystemInfo = false; var cannleSprite = GetCannelStr(_ChatHistory.EChannel); if (string.IsNullOrEmpty(cannleSprite)) { _CannelIcon.gameObject.SetActive(false); } else { _CannelIcon.gameObject.SetActive(true); LoadAssetBundle.Instance.SetImageSprite(_CannelIcon, cannleSprite); } ClearChat(); string vipIconStr = ""; if (GlobeVar.IsGUIDValid(_ChatHistory.SenderGuid) && !_ChatHistory.IsSystem) { string vipPrivilegeIcon = Utils.GetPrivilegeVipIcon(_ChatHistory.SenderPrivilegeVIP); string vipIcon = Utils.GetVipIcon(_ChatHistory.SenderVIPLevel); if (!string.IsNullOrEmpty(vipPrivilegeIcon)) { vipIconStr += ChatLinkImage.GetLinkImageStr(vipPrivilegeIcon, 24, 24); } if (!string.IsNullOrEmpty(vipIcon)) { vipIconStr += ChatLinkImage.GetLinkImageStr(vipIcon, 24, 24); } } _ModifiedStr += non_breaking_space; if (_ChatHistory.EChannel != GC_CHAT.CHATTYPE.CHAT_TYPE_BATTLE && _ChatHistory.EChannel != GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM) _ModifiedStr += vipIconStr; InsertCannelSpace(); _ModifiedStr += GetSenderNameLink(_ChatHistory); if (_ChatHistory.ChatInfo.StartsWith(ChatVoiceInputLogic._VoiceChatStart)) { //_ChatHistory.ChatInfo = _ChatHistory.ChatInfo; GetAllChatLinks(_ChatHistory); //_ModifiedStr = GetLinkedStr(_ChatHistory) + StrDictionary.GetClientDictionaryString("#{4931}"); var voiceInfo = ChatVoiceInfo.GetVoiceInfo(_ChatHistory.ChatInfo); if (voiceInfo == null) { _ModifiedStr = GetLinkedStr(_ChatHistory) + StrDictionary.GetClientDictionaryString("#{4931}"); } else { _ModifiedStr = GetLinkedStr(_ChatHistory) + voiceInfo.text; } _ChatInfo.text = _ModifiedStr; _ChatVoiceImg.gameObject.SetActive(false); _ChatVoiceImg.rectTransform.anchoredPosition = new Vector2(_ModifiedStr.Length * 25, 0); StartCoroutine(WaitLayout()); return true; } if (_ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM) //只要是系统信息都要显示 { isSystemInfo = true; } if ((_ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_LOUDSPEAKER || _ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_ALLSERSPEAKER || _ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_CROSSSERSPEAKER) && _ChatHistory.ChatInfo[0] == '#') { _ModifiedStr += StrDictionary.GetServerDictionaryFormatString(_ChatHistory.ChatInfo); } if ((_ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM || _ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_WORLD) && _ChatHistory.ChatInfo.StartsWith("#{")) { _ModifiedStr += StrDictionary.GetServerDictionaryFormatString(_ChatHistory.ChatInfo); } else if (_ChatHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_GUILD && _ChatHistory.SenderGuid == GlobeVar.INVALID_GUID && _ChatHistory.ChatInfo.StartsWith("#{")) { _ModifiedStr = non_breaking_space + StrDictionary.GetServerDictionaryFormatString(_ChatHistory.ChatInfo); } else { _ModifiedStr += _ChatHistory.ChatInfo; } GetAllChatLinks(_ChatHistory); _ModifiedStr = GetLinkedStr(_ChatHistory); _ChatInfo.text = _ModifiedStr; if (isSystemInfo) { isSystemInfo = false; if (PopNoticeLogic.Instance && PopNoticeLogic.Instance.isActiveAndEnabled) { PopNoticeLogic.Instance.PopStringInfo(_ModifiedStr.Substring(non_breaking_space.Length)); } else { GlobalData.PopNoticeList.Add(_ModifiedStr.Substring(non_breaking_space.Length)); UIManager.ShowUI(UIInfo.PopNotice, delegate (bool bSucess, object param) { if (bSucess) { for (int index = 0; index < GlobalData.PopNoticeList.Count; index++) { PopNoticeLogic.Instance.PopStringInfo(GlobalData.PopNoticeList[index]); } GlobalData.PopNoticeList.Clear(); } }); } _ModifiedStr = ""; } _ChatInfo.CalculateLayoutInputHorizontal(); _ChatInfo.CalculateLayoutInputVertical(); StartCoroutine(WaitLayout()); return true; } private void InsertCannelSpace() { string spaceEmotionItem = "";//string.Format(_ReplaceChannelStr, 1.5f, 0.5f); _ModifiedStr = spaceEmotionItem + _ModifiedStr; } }