Files
JJBB/Assets/Project/Script/GUI/Master/MasterRelationMapRoot.cs

107 lines
2.6 KiB
C#
Raw Normal View History

2024-08-23 15:49:34 +08:00

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using Games.GlobeDefine;
using GCGame.Table;
using GCGame;
public class MasterRelationMapRoot : UIControllerBase<MasterRelationMapRoot>
{
void OnEnable()
{
SetInstance(this);
}
void OnDisable()
{
SetInstance(null);
}
#region static
public static void ShowRelationMap()
{
Hashtable hash = new Hashtable();
UIManager.ShowUI(UIInfo.MasterRelationMapRoot, OnMasterRelationShow, hash);
}
static void OnMasterRelationShow(bool bSuccess, object param)
{
Hashtable hash = param as Hashtable;
if (!bSuccess)
{
return;
}
if (hash == null)
{
return;
}
if (MasterRelationMapRoot.Instance() != null)
{
MasterRelationMapRoot.Instance().Show();
}
}
#endregion
#region
public MasterRelationInfo _MasterInfo;
public MasterRelationInfo _MyInfo;
public MasterRelationInfo _MarrayInfo;
public MasterRelationInfo[] _Apprentices;
public MasterRelationInfo[] _SwornBrother;
public void Show()
{
if (GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyMaster != null)
{
_MasterInfo.gameObject.SetActive(true);
_MasterInfo.SetMaster(GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyMaster);
}
else
{
_MasterInfo.gameObject.SetActive(false);
}
for (int i = 0; i < _Apprentices.Length; ++i)
{
if (GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyApprentices.Count <= i)
{
_Apprentices[i].gameObject.SetActive(false);
}
else
{
_Apprentices[i].gameObject.SetActive(true);
_Apprentices[i].SetApprentice(GameManager.gameManager.PlayerDataPool.m_MasterInfo._MyApprentices[i]);
}
}
for (int i = 0; i < _SwornBrother.Length; ++i)
{
if (GameManager.gameManager.PlayerDataPool._SwornBrother._MyBrothers.Count <= i)
{
_Apprentices[i].gameObject.SetActive(false);
}
else
{
_Apprentices[i].gameObject.SetActive(true);
_Apprentices[i].SetSwornBrother(GameManager.gameManager.PlayerDataPool._SwornBrother._MyBrothers[i]);
}
}
_MyInfo.SetMyInfo();
}
public void CloseWindow()
{
UIManager.CloseUI(UIInfo.MasterRelationMapRoot);
}
#endregion
}