培训考核三期,新版培训,网页版培训登录器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

85 lines
2.2 KiB

using System;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class OrgItem : MonoBehaviour
{
public Toggle M_Toggle;
public Toggle ShowChild;
public Image ShowChildNormal;
public Image ShowChildOn;
public TMP_Text M_ShowText;
public OrgItemData M_BindData;
public OrganizationsLoadPanel M_OpPanel;
public GameObject HaChildObj;
public List<OrgItem> M_Children = new List<OrgItem>();
void Start()
{
M_Toggle.onValueChanged.AddListener(M_Toggle_ValueChanged);
ShowChild.onValueChanged.AddListener(ShowChild_ValueChanged);
}
private void M_Toggle_ValueChanged(bool IsOn)
{
if (M_OpPanel)
M_OpPanel.OrgSelect(M_BindData, IsOn);
}
private void ShowChild_ValueChanged(bool IsOn)
{
ShowChildNormal.gameObject.SetActive(!IsOn);
ShowChildOn.gameObject.SetActive(IsOn);
foreach (var item in M_Children)
{
item.gameObject.SetActive(IsOn);
if (!IsOn)
{
item.HideChild();
if (item.M_Children.Count > 0)
{
foreach (var item1 in item.M_Children)
{
item1.HideChild();
}
}
}
}
if (M_OpPanel)
M_OpPanel.AutoHeight();
}
public void HideChild()
{
ShowChildNormal.gameObject.SetActive(true);
ShowChildOn.gameObject.SetActive(false);
foreach (var item in M_Children)
{
item.gameObject.SetActive(false);
}
}
public void ShowChildUI()
{
ShowChild.isOn = true;
}
public void DataBind(OrgItemData bindData, OrganizationsLoadPanel bindPanel, int level)
{
this.M_ShowText.text = "";
for (int i = 0; i <= level * 3; i++)
{
this.M_ShowText.text += " ";
}
ShowChildNormal.color = bindPanel.IndexColor[level];
ShowChildOn.color = bindPanel.IndexColor[level];
this.M_ShowText.text += bindData.name;
this.M_BindData = bindData;
this.M_OpPanel = bindPanel;
this.M_Toggle.group = bindPanel.Group;
}
}