using GameCore; using UnityEngine; public class Lucky3choose1Panel : MonoBehaviour { SupplyDropGameplayLureCtrl supplyDropGameCtrl; CanvasGroup canvasGroup; GameObject text_info; int layerMask; Camera ui3d; bool notClick = true; private void Awake() { layerMask = 1 << LayerMask.NameToLayer("UI3D"); ui3d = UIManager.Instance.UI3DCamera; canvasGroup = GetComponent(); text_info = transform.Find("root/text_info").gameObject; canvasGroup.alpha = 0f; // Start with the panel invisible } private void Start() { ShowPanel(); } public void Init(SupplyDropGameplayLureCtrl supplyDropGameCtrl) { this.supplyDropGameCtrl = supplyDropGameCtrl; } void ShowPanel() { notClick = false; canvasGroup.DOFadeAlpha(1f, 0.5f); } private void Update() { if (notClick) return; if (Input.GetMouseButtonUp(0)) { var ray = ui3d.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out var hit, 100, layerMask)) { //Debug.Log($"hit: {hit.collider.gameObject.layer}"); LurecardItem lurecardItem = hit.collider.transform.GetComponentInParent(); if (lurecardItem != null) { supplyDropGameCtrl.AddPlayerItem(lurecardItem.data); supplyDropGameCtrl.ShowAllItem(lurecardItem.index); notClick = true; text_info.SetActive(false); } else { Debug.LogWarning("Clicked on an invalid item."); } } } } }