Fix ui issues
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -10,7 +12,7 @@ public class JobSelectorUI : MonoBehaviour
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _title;
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _description;
|
||||
private TextMeshProUGUI _subTitle;
|
||||
[SerializeField]
|
||||
private Button _btnCancel;
|
||||
[SerializeField]
|
||||
@@ -28,27 +30,26 @@ public class JobSelectorUI : MonoBehaviour
|
||||
private List<JobsListSO> _jobs;
|
||||
|
||||
private JobTabUITemplate _selectedTab;
|
||||
public void ShowJobSelectionDialog(string title, string description, Action onCancel, Action onConfirm)
|
||||
public void ShowJobSelectionDialog(string title, Action onCancel, Action onConfirm)
|
||||
{
|
||||
UIManager.Instance.Freeze();
|
||||
|
||||
gameObject.SetActive(true);
|
||||
_title.text = title;
|
||||
_description.text = description;
|
||||
|
||||
//Create Tabs
|
||||
foreach (var job in _jobs)
|
||||
for (int count = 0; count < _jobs.Count; count++)
|
||||
{
|
||||
JobsListSO job = _jobs[count];
|
||||
var itemUI = Instantiate(_jobTabUItemplate, _tabsContainer);
|
||||
itemUI.gameObject.SetActive(true);
|
||||
itemUI.GetComponent<JobTabUITemplate>().SetItem(this,job);
|
||||
var template = itemUI.GetComponent<JobTabUITemplate>();
|
||||
template.SetItem(this, job);
|
||||
if (count== 0) {
|
||||
OnTabSelected(template);
|
||||
}
|
||||
}
|
||||
//foreach (var job in _jobs.JobPositionsList)
|
||||
//{
|
||||
// var itemUI = Instantiate(_jobItemUItemplate, _container);
|
||||
// itemUI.gameObject.SetActive(true);
|
||||
// itemUI.GetComponent<JobItemUITemplate>().SetItem((job));
|
||||
//}
|
||||
|
||||
|
||||
_btnCancel.onClick.AddListener(() =>
|
||||
{
|
||||
onCancel?.Invoke();
|
||||
@@ -68,6 +69,7 @@ public class JobSelectorUI : MonoBehaviour
|
||||
public void OnTabSelected(JobTabUITemplate button)
|
||||
{
|
||||
_selectedTab = button;
|
||||
_subTitle.text = _selectedTab.JobListItem.Place;
|
||||
while (_itemsContainer.childCount > 0)
|
||||
{
|
||||
DestroyImmediate(_itemsContainer.GetChild(0).gameObject);
|
||||
|
||||
Reference in New Issue
Block a user