110 lines
3.5 KiB
C#
110 lines
3.5 KiB
C#
|
using UnityEngine;
|
|||
|
using System.Collections;
|
|||
|
using UnityEngine.UI;
|
|||
|
using GCGame.Table;
|
|||
|
/// <summary>
|
|||
|
/// 父类菜单按钮
|
|||
|
/// </summary>
|
|||
|
public class TitleMenuItem : MonoBehaviour {
|
|||
|
|
|||
|
//类型Class
|
|||
|
public int titleClass = -1;
|
|||
|
public Text menuItemName;
|
|||
|
public Text hlMenuItemName; // 选中高亮时的描述
|
|||
|
//public Text Text_TitleNumber; //子项的已经激活数量
|
|||
|
|
|||
|
public void InitMenuItem(int classId, string name)
|
|||
|
{
|
|||
|
titleClass = classId;
|
|||
|
menuItemName.text = name;
|
|||
|
if(hlMenuItemName != null)
|
|||
|
{
|
|||
|
hlMenuItemName.text = menuItemName.text;
|
|||
|
}
|
|||
|
//AllTitle();
|
|||
|
if (menuItemName.text == StrDictionary.GetClientDictionaryString("#{1977}"))
|
|||
|
{
|
|||
|
var aaa = GameManager.gameManager.PlayerDataPool.TitleInvestitive.AllTitleList.Count;
|
|||
|
if (aaa <= 0)
|
|||
|
return;
|
|||
|
menuItemName.text = name + "{" + aaa + "}";
|
|||
|
if (hlMenuItemName != null)
|
|||
|
hlMenuItemName.text = menuItemName.text;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
int classOwnTitleCnt = 0;
|
|||
|
for (int i = 0; i < GameManager.gameManager.PlayerDataPool.TitleInvestitive.AllTitleList.Count; i++)
|
|||
|
{
|
|||
|
var titleTab = TableManager.GetTitleDataByID(GameManager.gameManager.PlayerDataPool.TitleInvestitive.AllTitleList[i].TitleID);
|
|||
|
if (titleTab == null)
|
|||
|
continue;
|
|||
|
if (titleTab.TitileClass == titleClass)
|
|||
|
++classOwnTitleCnt;
|
|||
|
}
|
|||
|
if (classOwnTitleCnt > 0)
|
|||
|
{
|
|||
|
menuItemName.text = name + "(" + classOwnTitleCnt + ")";
|
|||
|
if (hlMenuItemName != null)
|
|||
|
hlMenuItemName.text = menuItemName.text;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
//private void Awake()
|
|||
|
//{
|
|||
|
// Text_TitleNumber.gameObject.SetActive(false);
|
|||
|
//}
|
|||
|
public void OnItemClick(bool isOn)
|
|||
|
{
|
|||
|
TitleNameViewCtr.Instace.OnMenuItemClick(titleClass);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//private void Update()
|
|||
|
//{
|
|||
|
// AllTitle();
|
|||
|
//}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 全部激數量
|
|||
|
/// </summary>
|
|||
|
//public void AllTitle()
|
|||
|
//{
|
|||
|
// if (menuItemName.text == StrDictionary.GetClientDictionaryString("#{1977}") && Text_TitleNumber.text != "{" + TitleNameViewCtr.Instace.m_AllOwnTileNameList.Count + "}")
|
|||
|
// {
|
|||
|
// //for (int i = 0; i < TitleNameViewCtr.Instace.m_AllOwnTileNameList.Count; i++)
|
|||
|
// {
|
|||
|
// var aaa = GameManager.gameManager.PlayerDataPool.TitleInvestitive.AllTitleList.Count;
|
|||
|
// Text_TitleNumber.gameObject.SetActive(true);
|
|||
|
// Text_TitleNumber.text = "{" + aaa + "}";
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// int classOwnTitleCnt = 0;
|
|||
|
// for (int i = 0; i < GameManager.gameManager.PlayerDataPool.TitleInvestitive.AllTitleList.Count; i++)
|
|||
|
// {
|
|||
|
// var titleTab = TableManager.GetTitleDataByID(GameManager.gameManager.PlayerDataPool.TitleInvestitive.AllTitleList[i].TitleID);
|
|||
|
// if (titleTab == null)
|
|||
|
// continue;
|
|||
|
|
|||
|
// if (titleTab.TitileClass == titleClass)
|
|||
|
// {
|
|||
|
// ++classOwnTitleCnt;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// if (classOwnTitleCnt > 0)
|
|||
|
// {
|
|||
|
// Text_TitleNumber.gameObject.SetActive(true);
|
|||
|
// Text_TitleNumber.text = "(" + classOwnTitleCnt + ")";
|
|||
|
// }
|
|||
|
// }
|
|||
|
//}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|