using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; public enum CardState { Library,Deck } public class ClickCard : MonoBehaviour, IPointerDownHandler { private DeckManager deckManager; public CardState state; // Start is called before the first frame update void Start() { deckManager = GameObject.Find("DeckManager").GetComponent(); //测试是否获取到deckmanager,获取成功 //if (deckManager == null) //{ // Debug.LogError("DeckManager not found!"); //} //PlayerData = GameObject.Find("DataManager").GetComponent(); } // Update is called once per frame void Update() { } public void OnPointerDown(PointerEventData eventData) { int id =this.GetComponent().card.id; //测试是否获取到id,获取成功 //if (id == 0) //{ // Debug.LogError("id not found!"); //} deckManager.UpdateCard(state,id); } }