Implement player education parameter
Enable job offer according to Player education
This commit is contained in:
@@ -3,7 +3,7 @@ using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class JobItemUITemplate : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler
|
||||
public class JobItemUITemplate : MonoBehaviour, IPointerEnterHandler
|
||||
{
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _descreiption;
|
||||
@@ -12,6 +12,9 @@ public class JobItemUITemplate : MonoBehaviour, IPointerClickHandler, IPointerE
|
||||
[SerializeField]
|
||||
private Image _icon;
|
||||
|
||||
[SerializeField]
|
||||
private Button _button;
|
||||
|
||||
private JobSelectorUI _parent;
|
||||
private JobInfoSO _item;
|
||||
public JobInfoSO Item=> _item;
|
||||
@@ -23,23 +26,20 @@ public class JobItemUITemplate : MonoBehaviour, IPointerClickHandler, IPointerE
|
||||
_descreiption.text = item.Description;
|
||||
_sallary.text = $"{item.Salary}$";
|
||||
_icon.sprite = item.Icon;
|
||||
_button.enabled = Player.Instance.Education>=item.MinimumEducationSkill;
|
||||
}
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
_parent.OnItemSelected(this);
|
||||
}
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
_parent.OnItemSelected(this);
|
||||
}
|
||||
|
||||
|
||||
public void Click()
|
||||
{
|
||||
_parent.OnItemSelected(this);
|
||||
if (_button.enabled)
|
||||
{
|
||||
_parent.OnItemSelected(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (!_button.enabled) { print("Not enough education"); }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user