using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; using UnityEngine.UI; using System; public class PostsItem : MonoBehaviour { public Toggle M_Toggle; public TMP_Text M_ShowText; public Posts M_BindData; public PostsLoadPanel M_OpPanel; void Start() { M_Toggle.onValueChanged.AddListener(M_Toggle_ValueChanged); } private void M_Toggle_ValueChanged(bool IsOn) { if (M_OpPanel) { M_OpPanel.OnSelect(M_BindData, IsOn); } } public void DataBind(Posts data, PostsLoadPanel panel) { this.M_BindData = data; this.M_OpPanel = panel; M_ShowText.text = data.Name; } }