Fix ui issues

This commit is contained in:
2023-04-20 19:09:53 +03:00
parent 1ffaa079e6
commit 18c8ba0f8c
4 changed files with 38 additions and 36 deletions
+21 -21
View File
@@ -51,7 +51,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_title: {fileID: 560729084887753269}
_description: {fileID: 3099305041142687452}
_subTitle: {fileID: 3099305041142687452}
_btnCancel: {fileID: 7013805291510916669}
_btnOk: {fileID: 8583321522316129160}
_itemsContainer: {fileID: 3731607605728727607}
@@ -75,7 +75,7 @@ GameObject:
- component: {fileID: 6204035961147597315}
- component: {fileID: 3099305041142687452}
m_Layer: 5
m_Name: Text
m_Name: SubtitleText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -98,8 +98,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: -0.0000019073486}
m_SizeDelta: {x: 0, y: 0.0000047683716}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6204035961147597315
CanvasRenderer:
@@ -138,8 +138,8 @@ MonoBehaviour:
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4286922509
m_fontColor: {r: 0.050980393, g: 0.24705882, b: 0.52156866, a: 1}
rgba: 4288645717
m_fontColor: {r: 0.33333334, g: 0.5411765, b: 0.62352943, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
@@ -231,9 +231,9 @@ RectTransform:
m_Father: {fileID: 7013805289888593173}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.13, y: 0.94}
m_AnchorMax: {x: 0.95, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0.133, y: 0.9}
m_AnchorMax: {x: 0.95, y: 0.98}
m_AnchoredPosition: {x: 0, y: 0.00000059604645}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2056774532309057503
@@ -256,7 +256,7 @@ GameObject:
- component: {fileID: 3221867121941074007}
- component: {fileID: 560729084887753269}
m_Layer: 5
m_Name: Text
m_Name: TitleText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -810,10 +810,10 @@ RectTransform:
m_Father: {fileID: 7013805289888593173}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.13, y: 0.85}
m_AnchorMin: {x: 0.133, y: 0.8317244}
m_AnchorMax: {x: 0.95, y: 0.9}
m_AnchoredPosition: {x: 0, y: 12}
m_SizeDelta: {x: 0, y: 2}
m_AnchoredPosition: {x: -0.5, y: 0.000015259}
m_SizeDelta: {x: 1, y: -0.000015259}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8242638213792927732
CanvasRenderer:
@@ -936,7 +936,7 @@ PrefabInstance:
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
@@ -946,7 +946,7 @@ PrefabInstance:
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
@@ -1011,12 +1011,12 @@ PrefabInstance:
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 262.8
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -21.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
@@ -1271,7 +1271,7 @@ PrefabInstance:
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
@@ -1281,7 +1281,7 @@ PrefabInstance:
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
@@ -1331,12 +1331,12 @@ PrefabInstance:
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 87.6
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -21.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910,
type: 3}
@@ -10,7 +10,7 @@ public class OfficeTable : BaseInteractableObject
public override void Interact(Player player)
{
base.Interact(player);
UIManager.Instance.ShowJobSelectionDialog("Job agency", "job offers", null, OnConfirm);
UIManager.Instance.ShowJobSelectionDialog("Job agency", null, OnConfirm);
}
private void OnConfirm()
+14 -12
View File
@@ -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);
+2 -2
View File
@@ -32,10 +32,10 @@ public class UIManager : MonoBehaviour
timeSlider.ShowTimeSliderDialog(title, description, onCancel, onConfirm);
}
public void ShowJobSelectionDialog(string title, string description, Action onCancel, Action onConfirm)
public void ShowJobSelectionDialog(string title, Action onCancel, Action onConfirm)
{
var jobSelector = Instantiate(_jobSelectorPrefab, transform);
jobSelector.ShowJobSelectionDialog(title, description, onCancel, onConfirm);
jobSelector.ShowJobSelectionDialog(title, onCancel, onConfirm);
}