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
+14 -14
View File
@@ -269,8 +269,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 155.935, y: 0}
m_SizeDelta: {x: 311.87, y: 0}
m_AnchoredPosition: {x: 275, y: 0}
m_SizeDelta: {x: 550, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &5677520149483722787
MonoBehaviour:
@@ -769,8 +769,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 155.935, y: 0}
m_SizeDelta: {x: 311.87, y: 0}
m_AnchoredPosition: {x: 275, y: 0}
m_SizeDelta: {x: 550, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1843006956921425075
MonoBehaviour:
@@ -847,8 +847,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 230.935, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchoredPosition: {x: 350, y: 0}
m_SizeDelta: {x: 400, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8585709775089406178
MonoBehaviour:
@@ -862,7 +862,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!114 &3101455637694641571
MonoBehaviour:
@@ -885,8 +885,8 @@ MonoBehaviour:
m_Spacing: 10
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 1
m_ChildScaleHeight: 1
m_ReverseArrangement: 0
@@ -927,8 +927,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 155.935, y: 0}
m_SizeDelta: {x: 311.87, y: 0}
m_AnchoredPosition: {x: 275, y: 0}
m_SizeDelta: {x: 550, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &6543732096769088935
MonoBehaviour:
@@ -1006,7 +1006,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 155.935, y: 0}
m_AnchoredPosition: {x: 275, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &6806840113668947922
@@ -1247,7 +1247,7 @@ PrefabInstance:
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 233.9025
value: 412.5
objectReference: {fileID: 0}
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
@@ -1577,7 +1577,7 @@ PrefabInstance:
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 77.9675
value: 137.5
objectReference: {fileID: 0}
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
+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()
@@ -9,7 +9,9 @@ public class JobTabUITemplate : MonoBehaviour, IPointerEnterHandler,IPointerClic
private TextMeshProUGUI _description;
[SerializeField]
private Image _icon;
public JobsListSO _jobListItem;
public JobsListSO JobListItem=> _jobListItem;
private JobsListSO _jobListItem;
private JobSelectorUI _parent;
public void SetItem(JobSelectorUI parent, JobsListSO jobListItem)