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.
61 lines
1.5 KiB
61 lines
1.5 KiB
3 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
public class TreeOneLevel : MonoBehaviour
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 一级节点脚本
|
||
|
/// </summary>
|
||
|
private Toggle button;
|
||
|
public TreeViewData arrie;
|
||
|
[HideInInspector]
|
||
|
public Text Name;
|
||
|
private void Awake()
|
||
|
{
|
||
|
button = this.GetComponent<Toggle>();
|
||
|
button.onValueChanged.AddListener(ClickThis);
|
||
|
Name = this.transform.Find("Text").GetComponent<Text>();
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 点击事件
|
||
|
/// </summary>
|
||
|
public void ClickThis(bool flag)
|
||
|
{
|
||
|
if (flag)
|
||
|
{
|
||
|
Max = true;
|
||
|
HorizontalTreeSet.instance_.Operation(this.gameObject);
|
||
|
Name.text = ShowNum+"."+arrie.Name;
|
||
|
NodeSecondLevelControl.Instance.GenerateNodeAccordingFirstLevelID(arrie.ID);
|
||
|
TempDataManager.Instance.CurNodeID = arrie.ID;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Max = false;
|
||
|
Name.text = ShowNum;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 生成节点时候获取数据
|
||
|
/// </summary>
|
||
|
public bool Max = false;
|
||
|
public string ShowNum;
|
||
|
public void GetMessage(TreeViewData arrie,bool flag,string Num)
|
||
|
{
|
||
|
this.arrie = arrie;
|
||
|
Max = flag;
|
||
|
ShowNum = Num;
|
||
|
}
|
||
|
public void SetNumber(string Num)
|
||
|
{
|
||
|
ShowNum = Num;
|
||
|
Name.text = ShowNum;
|
||
|
}
|
||
|
public void DeleteSetNumber()
|
||
|
{
|
||
|
Name.text = ShowNum + "." + arrie.Name;
|
||
|
}
|
||
|
}
|