Player can select job position now
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -30,7 +27,9 @@ public class JobSelectorUI : MonoBehaviour
|
||||
private List<JobsListSO> _jobs;
|
||||
|
||||
private JobTabUITemplate _selectedTab;
|
||||
public void ShowJobSelectionDialog(string title, Action onCancel, Action onConfirm)
|
||||
private JobItemUITemplate _selectedItem;
|
||||
|
||||
public void ShowJobSelectionDialog(string title, Action onCancel, Action<JobInfoSO> onConfirm)
|
||||
{
|
||||
UIManager.Instance.Freeze();
|
||||
|
||||
@@ -57,7 +56,7 @@ public class JobSelectorUI : MonoBehaviour
|
||||
});
|
||||
_btnOk.onClick.AddListener(() =>
|
||||
{
|
||||
onConfirm?.Invoke();
|
||||
onConfirm?.Invoke(_selectedItem.Item);
|
||||
Hide();
|
||||
});
|
||||
}
|
||||
@@ -78,7 +77,7 @@ public class JobSelectorUI : MonoBehaviour
|
||||
{
|
||||
var itemUI = Instantiate(_jobItemUItemplate, _itemsContainer);
|
||||
itemUI.gameObject.SetActive(true);
|
||||
itemUI.GetComponent<JobItemUITemplate>().SetItem((job));
|
||||
itemUI.GetComponent<JobItemUITemplate>().SetItem(this,job);
|
||||
}
|
||||
print($"selected {button.JobListItem.name}");
|
||||
}
|
||||
@@ -88,6 +87,12 @@ public class JobSelectorUI : MonoBehaviour
|
||||
print($"exit {button.JobListItem.name}");
|
||||
}
|
||||
|
||||
public void OnItemSelected(JobItemUITemplate button)
|
||||
{
|
||||
print($"selected job {button.Item.name}");
|
||||
_selectedItem = button;
|
||||
}
|
||||
|
||||
private void CloseDialog()
|
||||
{
|
||||
UIManager.Instance.Unfreeze();
|
||||
|
||||
Reference in New Issue
Block a user