51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using GCGame.Table;
|
|
|
|
public class PrivilegePerMissionAttrDescItem : MonoBehaviour {
|
|
|
|
public List<Sprite> _BGSpriteList;
|
|
public Image _BG;
|
|
private List<PrivilegePerMissionVipAttrItem> attrItemList;
|
|
public Text _TypeName;
|
|
public void InitItem(int _FuncId, int _Index)
|
|
{
|
|
_BG.overrideSprite = _BGSpriteList[_Index % 2];
|
|
if (attrItemList == null)
|
|
{
|
|
attrItemList = new List<PrivilegePerMissionVipAttrItem>();
|
|
for(int index = 0; index < gameObject.GetComponentsInChildren<PrivilegePerMissionVipAttrItem>().Length; index++)
|
|
{
|
|
attrItemList.Add(gameObject.GetComponentsInChildren<PrivilegePerMissionVipAttrItem>()[index]);
|
|
}
|
|
}
|
|
|
|
var funcTab = TableManager.GetPrivilegeFunctionByID(_FuncId, 0);
|
|
if(funcTab == null)
|
|
{
|
|
if(gameObject.activeInHierarchy)
|
|
gameObject.SetActive(false);
|
|
return;
|
|
}
|
|
|
|
var privilegeTypeNameTab = TableManager.GetPrivilegeTypeDescByID(funcTab.PrivilegeId, 0);
|
|
if(privilegeTypeNameTab == null)
|
|
{
|
|
if (gameObject.activeInHierarchy)
|
|
gameObject.SetActive(false);
|
|
return;
|
|
}
|
|
|
|
if (!gameObject.activeInHierarchy)
|
|
gameObject.SetActive(true);
|
|
|
|
_TypeName.text = privilegeTypeNameTab.Name;
|
|
for(int index = 0; index < attrItemList.Count; index++)
|
|
{
|
|
attrItemList[index].InitItem(funcTab.GetVipbyIndex(index), funcTab.PrivilegeId);
|
|
}
|
|
}
|
|
}
|