using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using Games.Item;
using GCGame;
using GCGame.Table;
using Games.ChatHistory;
public class ChatLinkSelfPos : ChatLinkItem
{
private int _SceneID;
private int _CannelID;
private Vector3 _SelfPos;
private ulong _SenderGuid;
private string _GuildName = "-1";
private ulong _GuildUID = Games.GlobeDefine.GlobeVar.INVALID_GUID;
public void SetLinkSelfPos(int sceneID, int cannelID, Vector3 selfPos)
{
_SceneID = sceneID;
_CannelID = cannelID;
_SelfPos = selfPos;
//帮派地图的处理
Tab_GuildOther guildOther = TableManager.GetGuildOtherByID(0, 0);
if(guildOther!=null && guildOther.SceneId == sceneID)
{
if(SceneData.sceneGuildName == "" && GameManager.gameManager.PlayerDataPool.IsHaveGuild())
{
_GuildName = GameManager.gameManager.PlayerDataPool.GuildInfo.GuildName;
_GuildUID = GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid;
}
if (SceneData.sceneGuildName != "")
{
_GuildName = SceneData.sceneGuildName;
_GuildUID = SceneData.sceneGuildGuid;
}
}
StrInput = StrDictionary.GetClientDictionaryString("#{86709}");
StrSend = StrSendStart + ((int)ChatLinkType.SelfPos).ToString() + StrSplit + sceneID + StrSplit + cannelID
+ StrSplit + (int)_SelfPos.x + StrSplit + (int)_SelfPos.y + StrSplit + (int)_SelfPos.z +StrSplit + _GuildName +StrSplit +_GuildUID+ StrSendEnd;
}
public override void SetLinkBySendStr(Text text, ChatHistoryItem chatHistory, string linkStr, string[] linkParams)
{
StrSend = linkStr;
StrInput = linkStr;
if (linkParams.Length != 8)
return;
_SceneID = int.Parse(linkParams[1]);
_CannelID = int.Parse(linkParams[2]);
_SelfPos = new Vector3(int.Parse(linkParams[3]), int.Parse(linkParams[4]), int.Parse(linkParams[5]));
_GuildName = linkParams[6];
_GuildUID = ulong.Parse(linkParams[7]);
_SenderGuid = chatHistory.SenderGuid;
var sceneClass = TableManager.GetSceneClassByID(_SceneID, 0);
if (sceneClass != null)
{
if (_GuildName != "-1")
{
StrShow = string.Format("[{0},{1},{2},{3}]", sceneClass.Name, _SelfPos.x, _SelfPos.z, _GuildName);
}
else
{
StrShow = StrDictionary.GetClientDictionaryString("#{4900}", sceneClass.Name, _SelfPos.x, _SelfPos.z, _CannelID);
}
}
else
{
StrShow = StrDictionary.GetClientDictionaryString("#{86709}");
}
}
protected override void LinkClick(int linkindex)
{
var sceneClass = TableManager.GetSceneClassByID(_SceneID, 0);
if (_GuildName == "-1" && (sceneClass.Type == 2 || sceneClass.Type == 3))
{
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{4908}"));
return;
}
AutoSearchPoint point = new AutoSearchPoint(_SceneID, _SelfPos.x, _SelfPos.z, _CannelID-1,AutoSearchPoint.ChangeMap_Type.WORLDMAP,_GuildUID);
if (GameManager.gameManager && GameManager.gameManager.AutoSearch)
{
GameManager.gameManager.AutoSearch.BuildPath(point);
}
}
}