131 lines
3.6 KiB
C#
131 lines
3.6 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using GCGame.Table;
|
|
using System;
|
|
using Games.GlobeDefine;
|
|
using Games.ChatHistory;
|
|
|
|
public class MasterFriendRoot : MonoBehaviour
|
|
{
|
|
void Awake()
|
|
{
|
|
InitSwornTips();
|
|
}
|
|
|
|
void OnEnable()
|
|
{
|
|
if (GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyApprentices.Count == 0
|
|
&& GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyMaster == null)
|
|
{
|
|
_EmptyGO.SetActive(true);
|
|
_RelationGO.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
_EmptyGO.SetActive(false);
|
|
_RelationGO.SetActive(true);
|
|
InitSwornItems();
|
|
}
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
|
|
}
|
|
|
|
public void Close()
|
|
{
|
|
UIManager.CloseUI(UIInfo.FriendAndMail);
|
|
}
|
|
|
|
public Text _SwornTips;
|
|
public GameObject _EmptyGO;
|
|
public GameObject _RelationGO;
|
|
|
|
public void InitSwornTips()
|
|
{
|
|
_SwornTips.text = StrDictionary.GetClientDictionaryString("#{5223}");
|
|
}
|
|
|
|
|
|
#region relation
|
|
|
|
public MasterRelationInfo _MyInfo;
|
|
public MasterRelationInfo _MasterInfo;
|
|
public MasterRelationInfo[] _Apprentices;
|
|
public int _SwornSceneNPC = 517;
|
|
|
|
public void InitSwornItems()
|
|
{
|
|
|
|
_MasterInfo.SetMaster(GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyMaster);
|
|
|
|
for (int i = 0; i < _Apprentices.Length; ++i)
|
|
{
|
|
if (GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyApprentices.Count <= i)
|
|
{
|
|
_Apprentices[i].SetApprentice(null);
|
|
}
|
|
else
|
|
{
|
|
_Apprentices[i].SetApprentice(GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyApprentices[i]);
|
|
}
|
|
}
|
|
//_MyInfo.SetMyInfo();
|
|
}
|
|
|
|
public void OnBtnBeApprentices()
|
|
{
|
|
GameManager.gameManager.PlayerDataPool.m_MasterInfo.SelectMatchInfo(false);
|
|
}
|
|
|
|
public void OnBtnBeMaster()
|
|
{
|
|
GameManager.gameManager.PlayerDataPool.m_MasterInfo.SelectMatchInfo(true);
|
|
}
|
|
|
|
public void OnBtnGotoNpc()
|
|
{
|
|
var sceneNpcs = TableManager.GetSceneNpc().Values;
|
|
Tab_SceneNpc targetNpc = null;
|
|
foreach (var sceneNpc in sceneNpcs)
|
|
{
|
|
if (sceneNpc.DataID == _SwornSceneNPC)
|
|
{
|
|
targetNpc = sceneNpc;
|
|
}
|
|
}
|
|
if (targetNpc == null)
|
|
return;
|
|
|
|
AutoSearchPoint point = new AutoSearchPoint(targetNpc.SceneID, targetNpc.PosX, targetNpc.PosZ, -1, AutoSearchPoint.ChangeMap_Type.WORLDMAP);
|
|
if (GameManager.gameManager && GameManager.gameManager.AutoSearch)
|
|
{
|
|
GameManager.gameManager.AutoSearch.BuildPath(point);
|
|
Tab_RoleBaseAttr RoleBase = TableManager.GetRoleBaseAttrByID(targetNpc.DataID, 0);
|
|
if (null != RoleBase && null != GameManager.gameManager.AutoSearch.Path)
|
|
{
|
|
GameManager.gameManager.AutoSearch.Path.AutoSearchTargetName = RoleBase.Name;
|
|
GameManager.gameManager.AutoSearch.Path.autoSearchRadius = RoleBase.DialogRadius;
|
|
}
|
|
}
|
|
|
|
Close();
|
|
}
|
|
|
|
public void OnBtnTips(int idx)
|
|
{
|
|
if (idx == 0 && GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyMaster == null)
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{7309}"));
|
|
}
|
|
else if(idx > GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyApprentices.Count)
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{7310}"));
|
|
}
|
|
}
|
|
#endregion
|
|
}
|