53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class LineItem : MonoBehaviour
|
|
{
|
|
public string id;
|
|
public Text info_text;
|
|
public Button delete_button;
|
|
|
|
bool do_init = false;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
if (!do_init)
|
|
Init();
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
do_init = true;
|
|
delete_button.onClick.AddListener(() =>
|
|
{
|
|
//删除确认
|
|
SecondConfirmPanel.DeleteConform((delete) =>
|
|
{
|
|
if (delete)
|
|
{
|
|
LineGroupItem lineGroup = transform.parent.parent.GetComponent<LineGroupItem>();
|
|
LineQuery.Inst.deleteCableName(lineGroup.info_text.text, info_text.text, (x) =>
|
|
{
|
|
if (!string.IsNullOrEmpty(x))
|
|
{
|
|
LineObjectPool.Instance.PushItemToPool(this);
|
|
}
|
|
|
|
});
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
/// 清除自身信息以供下次使用
|
|
/// </summary>
|
|
public void Clear()
|
|
{
|
|
id = string.Empty;
|
|
info_text.text = string.Empty;
|
|
}
|
|
}
|