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(); LineQuery.Inst.deleteCableName(lineGroup.info_text.text, info_text.text, (x) => { if (!string.IsNullOrEmpty(x)) { LineObjectPool.Instance.PushItemToPool(this); } }); } }); }); } /// /// 清除自身信息以供下次使用 /// public void Clear() { id = string.Empty; info_text.text = string.Empty; } }