try to fix tabs
This commit is contained in:
@@ -39,7 +39,7 @@ public class JobSelectorUI : MonoBehaviour
|
||||
{
|
||||
var itemUI = Instantiate(_jobTabUItemplate, _tabsContainer);
|
||||
itemUI.gameObject.SetActive(true);
|
||||
itemUI.GetComponent<JobTabUITemplate>().SetItem(this,(job.name));
|
||||
itemUI.GetComponent<JobTabUITemplate>().SetItem(this,job);
|
||||
}
|
||||
//foreach (var job in _jobs.JobPositionsList)
|
||||
//{
|
||||
@@ -62,16 +62,16 @@ public class JobSelectorUI : MonoBehaviour
|
||||
|
||||
public void OnTabEnter(JobTabUITemplate button)
|
||||
{
|
||||
print($"enter to {button.name}");
|
||||
print($"enter to {button._jobListItem.name}");
|
||||
}
|
||||
public void OnTabSelected(JobTabUITemplate button)
|
||||
{
|
||||
print($"selected {button.name}");
|
||||
print($"selected {button._jobListItem.name}");
|
||||
}
|
||||
|
||||
public void OnTabExit(JobTabUITemplate button)
|
||||
{
|
||||
print($"exit {button.name}");
|
||||
print($"exit {button._jobListItem.name}");
|
||||
}
|
||||
|
||||
private void CloseDialog()
|
||||
|
||||
@@ -9,18 +9,20 @@ public class JobTabUITemplate : MonoBehaviour, IPointerEnterHandler,IPointerClic
|
||||
private TextMeshProUGUI _description;
|
||||
[SerializeField]
|
||||
private Image _icon;
|
||||
public JobsListSO _jobListItem;
|
||||
|
||||
private JobSelectorUI _parent;
|
||||
public void SetItem(JobSelectorUI parent,string name)
|
||||
public void SetItem(JobSelectorUI parent, JobsListSO jobListItem)
|
||||
{
|
||||
_parent= parent;
|
||||
_description.text = name;
|
||||
_jobListItem = jobListItem;
|
||||
_parent = parent;
|
||||
_description.text = jobListItem.name;
|
||||
//_icon.sprite = item.Icon;
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
_parent.OnTabSelected(this);
|
||||
_parent.OnTabSelected(this);
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
@@ -30,7 +32,7 @@ public class JobTabUITemplate : MonoBehaviour, IPointerEnterHandler,IPointerClic
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
_parent.OnTabExit(this);
|
||||
_parent.OnTabExit(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,15 +18,9 @@ public class TimeSliderUI : MonoBehaviour
|
||||
|
||||
private TimeSpan _time;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void ShowTimeSliderDialog(string title, string description, Action onCancel, Action<TimeSpan> onConfirm)
|
||||
{
|
||||
TimeManager.Instance.OnFastForwardEnd += CloseDialog;
|
||||
TimeManager.Instance.OnMinuteChanged += UpdateTime;
|
||||
TimeManager.Instance.Pause();
|
||||
UIManager.Instance.Freeze();
|
||||
|
||||
@@ -45,11 +39,9 @@ public class TimeSliderUI : MonoBehaviour
|
||||
Hide();
|
||||
});
|
||||
|
||||
_slider.onValueChanged.AddListener(x=>SliderValueChanger(x));
|
||||
}
|
||||
|
||||
private void UpdateTime()
|
||||
{
|
||||
}
|
||||
|
||||
private void CloseDialog()
|
||||
{
|
||||
@@ -57,17 +49,18 @@ public class TimeSliderUI : MonoBehaviour
|
||||
Destroy(this);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
private void SliderValueChanger(float time)
|
||||
{
|
||||
if (gameObject.activeSelf)
|
||||
{
|
||||
_time = TimeSpan.FromHours(_slider.value);
|
||||
_time = TimeSpan.FromHours(time);
|
||||
_description.text = $"{_time.Hours} hours";
|
||||
}
|
||||
}
|
||||
|
||||
private void Hide()
|
||||
{
|
||||
_slider.onValueChanged.RemoveListener(x=>SliderValueChanger(x));
|
||||
gameObject.SetActive(false);
|
||||
TimeManager.Instance.Resume();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user