Semi works. Console issues
This commit is contained in:
parent
637257610f
commit
25308695e2
@ -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<DeselectedAction>();
|
||||
//EventSystem.current.SetSelectedGameObject(_instance);
|
||||
//_instance.GetComponent<Selectable>().Select();
|
||||
//_instance.AddComponent<DeselectedAction>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -51,6 +53,8 @@ public class AllyUpgrade : MonoBehaviour, IPointerClickHandler
|
||||
GameObject upgradeEnfant = _instance.transform.Find("Upgrade" + (i + 1)).gameObject;
|
||||
if (upgradeEnfant.TryGetComponent<UpgradePlacementButton>(out UpgradePlacementButton button))
|
||||
{
|
||||
button.GetComponent<Selectable>().Select();
|
||||
button.gameObject.AddComponent<DeselectedAction>();
|
||||
button.Initialize(_upgradeList[i], gameObject, canvas);
|
||||
}
|
||||
//UpgradePlacementButton button = upgradeEnfant.GetComponent<UpgradePlacementButton>();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a21c0b3dd4bba9043b861395aef68445
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user