154 lines
4.7 KiB
C#
154 lines
4.7 KiB
C#
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System;
|
|||
|
using GCGame.Table;
|
|||
|
using Games.LogicObj;
|
|||
|
using Games.ImpactModle;
|
|||
|
|
|||
|
public class GuildWine : MonoBehaviour
|
|||
|
{
|
|||
|
public GameObject[] btns;
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.FreshImpactInfo, ShowBtn);
|
|||
|
Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.GuildWine, ShowBtn);
|
|||
|
}
|
|||
|
|
|||
|
private void OnDestroy()
|
|||
|
{
|
|||
|
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.FreshImpactInfo, ShowBtn);
|
|||
|
Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.GuildWine, ShowBtn);
|
|||
|
}
|
|||
|
|
|||
|
private void OnEnable()
|
|||
|
{
|
|||
|
checkCollect();
|
|||
|
checkDrink();
|
|||
|
}
|
|||
|
|
|||
|
public void checkCollect()
|
|||
|
{
|
|||
|
btns[0].SetActive(GameManager.gameManager.PlayerDataPool.GuildInfo.GuildWineCollectState == 1);
|
|||
|
}
|
|||
|
|
|||
|
public void checkDrink()
|
|||
|
{
|
|||
|
if (Singleton<ObjManager>.Instance.MainPlayer != null)
|
|||
|
{
|
|||
|
ClientImpactInfo impact = Singleton<ObjManager>.Instance.MainPlayer.GetInpact(Games.GlobeDefine.GlobeVar.GuildDrinkBuffid); //喝酒的BUFFid
|
|||
|
if (impact != null && impact.IsVaild() && btns[3].activeSelf)
|
|||
|
{
|
|||
|
btns[3].SetActive(false);
|
|||
|
GameManager.gameManager.PlayerDataPool.GuildInfo.GuildWineDrinkState = 0;
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
btns[3].SetActive(GameManager.gameManager.PlayerDataPool.GuildInfo.GuildWineDrinkState == 1);
|
|||
|
}
|
|||
|
|
|||
|
void ShowBtn(object param)
|
|||
|
{
|
|||
|
checkDrink();
|
|||
|
checkCollect();
|
|||
|
}
|
|||
|
|
|||
|
void MoveTo(float posX,float posY,int roleId,float DialogRadius)
|
|||
|
{
|
|||
|
//组队跟随,不响应
|
|||
|
if (GameManager.gameManager.PlayerDataPool.IsFollowTeam)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{5128}"));
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
AutoSearchPoint point = new AutoSearchPoint(6, posX, posY, -1, AutoSearchPoint.ChangeMap_Type.WORLDMAP, GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid);
|
|||
|
if (GameManager.gameManager && GameManager.gameManager.AutoSearch)
|
|||
|
{
|
|||
|
Tab_RoleBaseAttr RoleBase = TableManager.GetRoleBaseAttrByID(roleId, 0);
|
|||
|
if (null != RoleBase && null != GameManager.gameManager.AutoSearch.Path)
|
|||
|
{
|
|||
|
GameManager.gameManager.AutoSearch.BuildPath(point, false, RoleBase.Name, DialogRadius < 0 ? RoleBase.DialogRadius : DialogRadius);
|
|||
|
GameManager.gameManager.AutoSearch.Path.autoSearchRadius = (DialogRadius < 0 ? RoleBase.DialogRadius : DialogRadius);
|
|||
|
GameManager.gameManager.AutoSearch.Path.AutoSearchTargetName = RoleBase.Name;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
GameManager.gameManager.AutoSearch.BuildPath(point, false, "");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void Parse(float DialogRadius, string[] param)
|
|||
|
{
|
|||
|
float posX = -1;
|
|||
|
float posY = -1;
|
|||
|
int roleID = -1;
|
|||
|
int cout = 0;
|
|||
|
if (float.TryParse(param[0], out posX))
|
|||
|
{
|
|||
|
cout++;
|
|||
|
}
|
|||
|
if (float.TryParse(param[1], out posY))
|
|||
|
{
|
|||
|
cout++;
|
|||
|
}
|
|||
|
if (int.TryParse(param[2], out roleID))
|
|||
|
{
|
|||
|
cout++;
|
|||
|
}
|
|||
|
if (cout < 3)
|
|||
|
return;
|
|||
|
MoveTo(posX, posY, roleID, DialogRadius);
|
|||
|
}
|
|||
|
|
|||
|
//收集
|
|||
|
public void Click_Collect()
|
|||
|
{
|
|||
|
string[] collects = SystemParam.GetSystemParam_STRING(22).Split(',');
|
|||
|
if (collects.Length < 3)
|
|||
|
return;
|
|||
|
Parse(-1,collects);
|
|||
|
}
|
|||
|
|
|||
|
//喝酒
|
|||
|
public void Click_Drink()
|
|||
|
{
|
|||
|
string[] Drinks = SystemParam.GetSystemParam_STRING(23).Split(',');
|
|||
|
if (Drinks.Length < 3)
|
|||
|
return;
|
|||
|
Parse(1,Drinks);
|
|||
|
}
|
|||
|
|
|||
|
//保护
|
|||
|
public void Click_Save()
|
|||
|
{
|
|||
|
|
|||
|
//组队跟随,不响应
|
|||
|
if (GameManager.gameManager.PlayerDataPool.IsFollowTeam)
|
|||
|
{
|
|||
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{5128}"));
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (Singleton<ObjManager>.Instance.MainPlayer!=null)
|
|||
|
{
|
|||
|
Singleton<ObjManager>.Instance.MainPlayer.EnterAutoCombat();
|
|||
|
var send = (CG_REQ_NEAREST_NPC_POS)PacketDistributed.CreatePacket(MessageID
|
|||
|
.PACKET_CG_REQ_NEAREST_NPC_POS);
|
|||
|
send.SetNilparam(0);
|
|||
|
send.SendPacket();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void Click_Answer()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.ChatInfoRoot,delegate (bool bSuccess, object param)
|
|||
|
{
|
|||
|
if(ChatInfoLogic.Instance()!=null)
|
|||
|
{
|
|||
|
ChatInfoLogic.Instance().OnCannelSelect(StrDictionary.GetClientDictionaryString("#{4346}"));
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
}
|