116 lines
3.9 KiB
C#
116 lines
3.9 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.Events;
|
|||
|
using Module.Log;
|
|||
|
|
|||
|
public class ChatLinkTeamAward : ChatLinkName
|
|||
|
{
|
|||
|
private ulong _MainGUID;
|
|||
|
private int _ItemDataID;
|
|||
|
private int _ItemNum;
|
|||
|
private int _Time;
|
|||
|
private ulong _SenderGuid;
|
|||
|
private string _SendName;
|
|||
|
|
|||
|
private static Stack<ChatInfoLinkMask> _IdleLinkMasks = new Stack<ChatInfoLinkMask>();
|
|||
|
private List<ChatInfoLinkMask> _LinkMasks = new List<ChatInfoLinkMask>();
|
|||
|
|
|||
|
public override void SetLinkBySendStr(Text text, ChatHistoryItem chatHistory, string linkStr, string[] linkParams)
|
|||
|
{
|
|||
|
StrSend = linkStr;
|
|||
|
StrInput = linkStr;
|
|||
|
|
|||
|
if (linkParams.Length != 5)
|
|||
|
return;
|
|||
|
|
|||
|
_MainGUID = ulong.Parse(linkParams[1]);
|
|||
|
_ItemDataID = int.Parse(linkParams[2]);
|
|||
|
_ItemNum = int.Parse(linkParams[3]);
|
|||
|
_Time = int.Parse(linkParams[4]);
|
|||
|
|
|||
|
_SenderGuid = chatHistory.SenderGuid;
|
|||
|
_SendName = chatHistory.SenderName;
|
|||
|
if(GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == _SenderGuid)
|
|||
|
{
|
|||
|
StrShow = "";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
StrShow = StrDictionary.GetClientDictionaryString("#{5133}");
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
protected override void LinkClick(int linkindex)
|
|||
|
{
|
|||
|
LogModule.DebugLog("LinkClick:" + _MainGUID + "," + _ItemDataID + "," + _ItemNum + "," + _Time);
|
|||
|
if (GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Guid == _SenderGuid)
|
|||
|
return;
|
|||
|
|
|||
|
if(_Time - GlobalData.ServerAnsiTime<=0)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(GCGame.Table.StrDictionary.GetClientDictionaryString("#{6365}"));
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
Hashtable calbackMoveparam1 = new Hashtable();
|
|||
|
calbackMoveparam1["itemId"] = _ItemDataID;
|
|||
|
calbackMoveparam1["itemCount"] = _ItemNum;
|
|||
|
calbackMoveparam1["time"] = _Time;
|
|||
|
calbackMoveparam1["sendId"] = _SenderGuid;
|
|||
|
calbackMoveparam1["sendname"] = _SendName;
|
|||
|
|
|||
|
calbackMoveparam1["name"] = "LinkTeamAward";
|
|||
|
MessageEventCallBack fun1 = LinkTeamAward;
|
|||
|
calbackMoveparam1.Add("callFun", fun1);
|
|||
|
Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.LinkTeamAward, calbackMoveparam1);
|
|||
|
|
|||
|
CG_CHECK_TEAMMATE_GIFT_VALID cmd = (CG_CHECK_TEAMMATE_GIFT_VALID)PacketDistributed.CreatePacket(MessageID.PACKET_CG_CHECK_TEAMMATE_GIFT_VALID);
|
|||
|
cmd.MailGuid = _MainGUID;
|
|||
|
cmd.SendPacket();
|
|||
|
}
|
|||
|
public void LinkTeamAward(Hashtable addParam, Hashtable sendParam)
|
|||
|
{
|
|||
|
if (sendParam == null || sendParam.Contains("mailGuid") == false || sendParam.Contains("valid")==false)
|
|||
|
return;
|
|||
|
int vaild = (int)sendParam["valid"];
|
|||
|
if(vaild==1)
|
|||
|
{
|
|||
|
Hashtable table = new Hashtable();
|
|||
|
table["mail"] = sendParam["mailGuid"];
|
|||
|
table["itemId"] = addParam["itemId"];
|
|||
|
table["itemCount"] = addParam["itemCount"];
|
|||
|
table["time"] = addParam["time"];
|
|||
|
table["sendId"] = addParam["sendId"];
|
|||
|
table["name"] = addParam["sendname"];
|
|||
|
|
|||
|
UIManager.ShowUI(UIInfo.GetGiftRoot, delegate(bool bSuccess, object param) {
|
|||
|
|
|||
|
if (bSuccess == false)
|
|||
|
return;
|
|||
|
Hashtable table1 = (Hashtable)param;
|
|||
|
Games.Events.EventDispatcher.Instance.SendMessage(Games.Events.EventId.OpenGetGiftItemWnd, table);
|
|||
|
},
|
|||
|
table);
|
|||
|
}
|
|||
|
Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.LinkTeamAward, "LinkTeamAward");
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public override void ClearLink()
|
|||
|
{
|
|||
|
base.ClearLink();
|
|||
|
foreach (var maskLink in _LinkMasks)
|
|||
|
{
|
|||
|
maskLink.gameObject.SetActive(false);
|
|||
|
_IdleLinkMasks.Push(maskLink);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|