76 lines
2.3 KiB
C#
76 lines
2.3 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Games.Item;
|
|
using GCGame;
|
|
using GCGame.Table;
|
|
using Games.ChatHistory;
|
|
using Games.Fellow;
|
|
using Module.Log;
|
|
|
|
public class ChatLinkPet : ChatLinkItem
|
|
{
|
|
private string _PetName;
|
|
private ulong _PetGuid;
|
|
private int _PetDataID;
|
|
private int _Quality;
|
|
private ulong _SenderGuid;
|
|
|
|
private List<ChatInfoLinkMask> _LinkMasks = new List<ChatInfoLinkMask>();
|
|
|
|
public virtual void SetLinkItem(Fellow itemInfo)
|
|
{
|
|
_PetName = itemInfo.Name;
|
|
_Quality = (int)Utils.GetQualityIndex(itemInfo.Quality);
|
|
_PetGuid = itemInfo.Guid;
|
|
_PetDataID = itemInfo.DataId;
|
|
string linkStr = "[" + _PetName + "]";
|
|
|
|
|
|
StrInput = linkStr;
|
|
StrSend = StrSendStart + ((int)ChatLinkType.Pet).ToString() + StrSplit + itemInfo.Name + StrSplit + _PetGuid + StrSplit + _PetDataID + StrSplit + _Quality + StrSendEnd;
|
|
}
|
|
|
|
public override void SetLinkBySendStr(Text text, ChatHistoryItem chatHistory, string linkStr, string[] linkParams)
|
|
{
|
|
StrSend = linkStr;
|
|
StrInput = linkStr;
|
|
|
|
if (linkParams.Length != 5)
|
|
return;
|
|
|
|
_PetName = linkParams[1];
|
|
_PetGuid = ulong.Parse(linkParams[2]);
|
|
_PetDataID = int.Parse(linkParams[3]);
|
|
_Quality = int.Parse(linkParams[4]);
|
|
_SenderGuid = chatHistory.SenderGuid;
|
|
|
|
if (_ShowBlackColor)
|
|
{
|
|
StrShow = Utils.GetFellowNameColorInBlack(_Quality) + "[" + _PetName + "]</color>";
|
|
}
|
|
else
|
|
{
|
|
StrShow = Utils.GetFellowNameColor(_Quality) + "[" + _PetName + "]</color>";
|
|
}
|
|
|
|
}
|
|
|
|
protected override void LinkClick(int linkindex)
|
|
{
|
|
ShowChatPetTooltips(_PetGuid, _SenderGuid);
|
|
}
|
|
|
|
public static void ShowChatPetTooltips(ulong guid, ulong senderguid)
|
|
{
|
|
LogModule.DebugLog("CG_REQ_SHOW_CHAT_APPENDIX_INFO send");
|
|
CG_REQ_SHOW_CHAT_APPENDIX_INFO packet = (CG_REQ_SHOW_CHAT_APPENDIX_INFO)PacketDistributed.CreatePacket(MessageID.PACKET_CG_REQ_SHOW_CHAT_APPENDIX_INFO);
|
|
packet.SetAppendixtype((int)CG_REQ_SHOW_CHAT_APPENDIX_INFO.TYPE.PET);
|
|
packet.SetAppendixguid(guid);
|
|
packet.SetRoleguid(senderguid);
|
|
packet.SendPacket();
|
|
}
|
|
|
|
}
|