fix tabs ui

This commit is contained in:
2023-04-16 16:07:14 +03:00
parent 8947182bb4
commit 92e21df9bf
3 changed files with 32 additions and 18 deletions
+15 -3
View File
@@ -27,6 +27,7 @@ public class JobSelectorUI : MonoBehaviour
[SerializeField]
private List<JobsListSO> _jobs;
private JobTabUITemplate _selectedTab;
public void ShowJobSelectionDialog(string title, string description, Action onCancel, Action onConfirm)
{
UIManager.Instance.Freeze();
@@ -62,16 +63,27 @@ public class JobSelectorUI : MonoBehaviour
public void OnTabEnter(JobTabUITemplate button)
{
print($"enter to {button._jobListItem.name}");
print($"enter to {button.JobListItem.name}");
}
public void OnTabSelected(JobTabUITemplate button)
{
print($"selected {button._jobListItem.name}");
_selectedTab = button;
while (_itemsContainer.childCount > 0)
{
DestroyImmediate(_itemsContainer.GetChild(0).gameObject);
}
foreach (var job in _selectedTab.JobListItem.JobPositionsList)
{
var itemUI = Instantiate(_jobItemUItemplate, _itemsContainer);
itemUI.gameObject.SetActive(true);
itemUI.GetComponent<JobItemUITemplate>().SetItem((job));
}
print($"selected {button.JobListItem.name}");
}
public void OnTabExit(JobTabUITemplate button)
{
print($"exit {button._jobListItem.name}");
print($"exit {button.JobListItem.name}");
}
private void CloseDialog()