123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- /****************************
- summary:
- ****************************/
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class AnchorBtnItem : MonoBehaviour,EventObserver
- {
- private Toggle m_Toggle;
- private Image m_Image;
- public Text m_Text;
- private GameObject m_AnchorObj;
- private Anchor m_Anchor;
- public GameObject AnchorObj
- {
- get { return m_AnchorObj; }
- set { m_AnchorObj = value; }
- }
- public Anchor Anchor
- {
- get { return m_Anchor; }
- set { m_Anchor = value; }
- }
- public void HandleEvent(EventData resp)
- {
-
- }
- private void Start()
- {
- EventManager.Instance.Register(this, EventID.EVENT_3);
- m_Toggle = GetComponent<Toggle>();
- // m_Image = transform.Find("Image").GetComponent<Image>();
- m_Text = transform.Find("Name").GetComponent<Text>();
- m_Text.text = Anchor.pictureName;
- m_Toggle.onValueChanged.AddListener((state) =>
- {
- if (state)
- {
- EventData1 data1 = new EventData1(EventID.EVENT_3, AnchorObj);
- data1.Send();
-
- }
- });
- }
- public void SetData(GameObject anchorObj ,Anchor anchor)
- {
- AnchorObj = anchorObj;
- Anchor = anchor;
-
- }
- }
|