diff --git a/Assets/Scripts/Ally/AllyUpgrade.cs b/Assets/Scripts/Ally/AllyUpgrade.cs index b166f4d..a3a6bb8 100644 --- a/Assets/Scripts/Ally/AllyUpgrade.cs +++ b/Assets/Scripts/Ally/AllyUpgrade.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; +using UnityEngine.UI; public class AllyUpgrade : MonoBehaviour, IPointerClickHandler { @@ -28,8 +29,9 @@ public class AllyUpgrade : MonoBehaviour, IPointerClickHandler { _instance = Instantiate(_upgradeUI, Camera.main.WorldToScreenPoint(transform.position), Quaternion.identity, canvas.transform); AssignUpgrades(canvas); - EventSystem.current.SetSelectedGameObject(_instance); - _instance.AddComponent(); + //EventSystem.current.SetSelectedGameObject(_instance); + //_instance.GetComponent().Select(); + //_instance.AddComponent(); } } } @@ -51,6 +53,8 @@ public class AllyUpgrade : MonoBehaviour, IPointerClickHandler GameObject upgradeEnfant = _instance.transform.Find("Upgrade" + (i + 1)).gameObject; if (upgradeEnfant.TryGetComponent(out UpgradePlacementButton button)) { + button.GetComponent().Select(); + button.gameObject.AddComponent(); button.Initialize(_upgradeList[i], gameObject, canvas); } //UpgradePlacementButton button = upgradeEnfant.GetComponent(); diff --git a/Assets/Scripts/Ally/UpgradeBackgroundInteraction.cs b/Assets/Scripts/Ally/UpgradeBackgroundInteraction.cs deleted file mode 100644 index 6deb9e7..0000000 --- a/Assets/Scripts/Ally/UpgradeBackgroundInteraction.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.EventSystems; - -public class UpgradeBackgroundInteraction : MonoBehaviour, IPointerClickHandler -{ - [SerializeField] - private GameObject _upgradeUI; - - public void OnPointerClick(PointerEventData eventData) - { - if (_upgradeUI != null) - { - Destroy(_upgradeUI); - } - } -} diff --git a/Assets/Scripts/Ally/UpgradeBackgroundInteraction.cs.meta b/Assets/Scripts/Ally/UpgradeBackgroundInteraction.cs.meta deleted file mode 100644 index 4a743c3..0000000 --- a/Assets/Scripts/Ally/UpgradeBackgroundInteraction.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a21c0b3dd4bba9043b861395aef68445 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/UnitTree/DeselectedAction.cs b/Assets/Scripts/UnitTree/DeselectedAction.cs index d384fd7..f989891 100644 --- a/Assets/Scripts/UnitTree/DeselectedAction.cs +++ b/Assets/Scripts/UnitTree/DeselectedAction.cs @@ -5,9 +5,18 @@ using UnityEngine.EventSystems; public class DeselectedAction : MonoBehaviour, IDeselectHandler { + public delegate void OnPointerClick(PointerEventData eventData); + private OnPointerClick _onPointerClick; + + public DeselectedAction(OnPointerClick ooga) + { + _onPointerClick = ooga; + } + public void OnDeselect(BaseEventData eventData) { Debug.Log("Called to deselect"); + //_onPointerClick.Invoke((PointerEventData)eventData); Destroy(gameObject); } } \ No newline at end of file