58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
|
|
public class TitleNameItem : MonoBehaviour {
|
|
|
|
public Text gainTitleName;
|
|
public Text hideTitleName;
|
|
private int subClass = -1;
|
|
public int titleId = -1;
|
|
|
|
public Image dornIcon;
|
|
public Image activeIcon;
|
|
|
|
public void InitTitleNmaeItem(string name, int subClassId, int subTitleId, bool isGain)
|
|
{
|
|
subClass = subClassId;
|
|
titleId = subTitleId;
|
|
|
|
gainTitleName.text = name;
|
|
hideTitleName.text = name;
|
|
RefreshTitleState(isGain);
|
|
RefreshSubItemState();
|
|
}
|
|
|
|
public void RefreshTitleState(bool isGain)
|
|
{
|
|
gainTitleName.gameObject.SetActive(isGain);
|
|
hideTitleName.gameObject.SetActive(!isGain);
|
|
}
|
|
|
|
public void RefreshSubItemState()
|
|
{
|
|
dornIcon.gameObject.SetActive(GameManager.gameManager.PlayerDataPool.TitleInvestitive.GetCurrentTitleID() == titleId);
|
|
//activeIcon.gameObject.SetActive(GameManager.gameManager.PlayerDataPool.TitleInvestitive.IsTitleActived(titleId));
|
|
|
|
var titleRecord = GCGame.Table.TableManager.GetTitleDataByID(titleId);
|
|
|
|
if (GameManager.gameManager.PlayerDataPool.TitleInvestitive.IsTitleActived(titleId) && titleRecord.AttrId[0] >= 0)
|
|
{
|
|
activeIcon.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
activeIcon.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public void OnItemClick()
|
|
{
|
|
if (this.gameObject.GetComponentInChildren<Toggle>().isOn)
|
|
{
|
|
TitleNameViewCtr.Instace.OnSubItemClick(titleId);
|
|
}
|
|
}
|
|
|
|
}
|