Files
JJBB/Assets/Project/Script/GUI/Chat/ChatLinkName.cs
2024-08-23 15:49:34 +08:00

71 lines
2.4 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using Games.Item;
using GCGame;
using GCGame.Table;
using Games.ChatHistory;
using Module.Log;
public class ChatLinkName : ChatLinkItem
{
public const string CharNameShow = "[{0}]";
private string _CharName;
private string _ChatContent;
private ulong _CharGuid;
public void SetLinkCharName(string charName, ulong guid)
{
_CharName = charName;
StrInput = string.Format(CharNameShow, _CharName);
StrSend = StrSendStart + ((int)ChatLinkType.CharName).ToString() + StrSplit + _CharName + StrSplit + guid + StrSendEnd;
StrShow = string.Format(CharNameShow, _CharName);
}
public override void SetLinkBySendStr(Text text, ChatHistoryItem chatHistory, string linkStr, string[] linkParams)
{
StrSend = linkStr;
StrInput = linkStr;
if (chatHistory != null && linkParams == null && (chatHistory.EChannel != GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM && chatHistory.EChannel != GC_CHAT.CHATTYPE.CHAT_TYPE_BATTLE))
{
_CharGuid = chatHistory.SenderGuid;
_ChatContent = chatHistory.ChatInfo;
string charName = string.Format(CharNameShow, chatHistory.SenderName);
if (_CharGuid == GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid)
{
charName = StrDictionary.GetClientDictionaryString("#{5577}", charName);
}
else if (GCGame.Utils.GetProfessionGender(chatHistory.SenderPro) == GCGame.Utils.ChatGender.Female)
{
charName = StrDictionary.GetClientDictionaryString("#{5579}", charName);
}
else
{
charName = StrDictionary.GetClientDictionaryString("#{5578}", charName);
}
StrShow = charName + "";
}
else if (linkParams == null)
{
StrShow = "";
}
else if (linkParams.Length == 3)
{
_CharName = linkParams[1];
_CharGuid = ulong.Parse(linkParams[2]);
StrShow = string.Format(CharNameShow, _CharName);
}
}
protected override void LinkClick(int linkindex)
{
LogModule.DebugLog("CharNameLinkClick:" + linkindex);
PlayerTooltipsLogic.ShowPlayerTooltip(_CharGuid, _CharName, Vector3.zero, _ChatContent);
}
}