add school
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
using Assets.Scripts.Interfaces;
|
||||
using UnityEngine;
|
||||
|
||||
public class OfficeTable : BaseInteractableObject
|
||||
{
|
||||
[SerializeField]
|
||||
private DialogCategorySO _dialogOptionsSO;
|
||||
[SerializeField]
|
||||
private DialogSO _dialogSO;
|
||||
protected override void PrepareMenuActions()
|
||||
@@ -16,9 +15,9 @@ public class OfficeTable : BaseInteractableObject
|
||||
GameManager.Instance.UI.ShowTabObtionsDialog(_dialogSO, null, OnConfirm);
|
||||
}
|
||||
|
||||
private void OnConfirm(JobInfoSO selectedJob)
|
||||
private void OnConfirm(IDialogOption selectedJob)
|
||||
{
|
||||
_player.JobPosition = selectedJob.JobPosition;
|
||||
_player.JobPosition = (selectedJob as JobInfoSO).JobPosition;
|
||||
print($"player selected position is {_player.JobPosition}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ public class SecretaryDesk : BaseInteractableObject
|
||||
{
|
||||
[SerializeField]
|
||||
private DialogSO _dialogSO;
|
||||
[SerializeField]
|
||||
private DialogCategorySO _dialogOptionsSO;
|
||||
|
||||
protected override void PrepareMenuActions()
|
||||
{
|
||||
@@ -21,6 +19,6 @@ public class SecretaryDesk : BaseInteractableObject
|
||||
private void OnConfirm(IDialogOption selectedOption)
|
||||
{
|
||||
//_player.JobPosition = (selectedOption as EducationInfoSO).JobPosition;
|
||||
print($"player selected position is {_player.JobPosition}");
|
||||
print($"player selected position is {(selectedOption as EducationInfoSO).Description}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Assets.Scripts.Interfaces
|
||||
{
|
||||
public interface IDialogItemUI
|
||||
{
|
||||
IDialogOption Item { get; }
|
||||
void SetItem(DialogOptionsUI parent, IDialogOption item);
|
||||
}
|
||||
public class IDialogOption: ScriptableObject
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 050d5c1f23823194b8c24759c2dc67d1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edc1273ddc4c788449fe69fe20d2c07f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f667daa0686227b49a9ca2ebd6326a98, type: 3}
|
||||
m_Name: HighSchool
|
||||
m_EditorClassIdentifier:
|
||||
Title: Hight School
|
||||
Icon: {fileID: 21300000, guid: aef64b4574ccbc74897f2d9cd98cdf12, type: 3}
|
||||
OptionsList: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4995fdc1159dde4f89ae0a1b1be42f8
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3ba71c02cddb93d408c7c1b2f9846099, type: 3}
|
||||
m_Name: Mathematics
|
||||
m_EditorClassIdentifier:
|
||||
Icon: {fileID: 21300000, guid: 03db7f2d5bccf674c95ce74426db7fbb, type: 3}
|
||||
Description: 'Mathematics '
|
||||
Duration: 5
|
||||
EnrollPrice: 10
|
||||
Skill: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2f41f944cd1f3f4f82130491c97d5da
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bf7ee1c503cbe524b8a52dc86566b3b6, type: 3}
|
||||
m_Name: School
|
||||
m_EditorClassIdentifier:
|
||||
Title: School
|
||||
UITemplate: {fileID: 9018781955098760075, guid: 4c9d1546155d57e45a5dc96e1772cad4,
|
||||
type: 3}
|
||||
CategoriesSO:
|
||||
- {fileID: 11400000, guid: f4995fdc1159dde4f89ae0a1b1be42f8, type: 2}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40d509fd76291394285fd38512792c46
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -5,6 +5,7 @@ using UnityEngine;
|
||||
public class EducationInfoSO : IDialogOption
|
||||
{
|
||||
public string Description;
|
||||
public float Price;
|
||||
public int Duration;
|
||||
public float EnrollPrice;
|
||||
public EducationSkill Skill;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Assets.Scripts.Interfaces;
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
@@ -24,10 +25,10 @@ public class DialogOptionsUI : MonoBehaviour
|
||||
private DialogTabUITemplate _dialogTabUI;
|
||||
|
||||
private DialogTabUITemplate _selectedTab;
|
||||
private JobItemUITemplate _selectedItem;
|
||||
private IDialogItemUI _selectedItem;
|
||||
private DialogSO _dialogSO;
|
||||
|
||||
public void ShowCategoriesDialog(DialogSO dialogSO, Action onCancel, Action<JobInfoSO> onConfirm)
|
||||
public void ShowCategoriesDialog(DialogSO dialogSO, Action onCancel, Action<IDialogOption> onConfirm)
|
||||
{
|
||||
GameManager.Instance.UI.Freeze();
|
||||
|
||||
@@ -78,7 +79,7 @@ public class DialogOptionsUI : MonoBehaviour
|
||||
{
|
||||
var itemUI = Instantiate(_dialogSO.UITemplate, _itemsContainer);
|
||||
itemUI.gameObject.SetActive(true);
|
||||
itemUI.GetComponent<JobItemUITemplate>().SetItem(this, job);
|
||||
itemUI.GetComponent<IDialogItemUI>().SetItem(this, job);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,9 +87,8 @@ public class DialogOptionsUI : MonoBehaviour
|
||||
{
|
||||
}
|
||||
|
||||
public void OnItemSelected(JobItemUITemplate button)
|
||||
public void OnItemSelected(IDialogItemUI button)
|
||||
{
|
||||
print($"selected job {button.Item.name}");
|
||||
_selectedItem = button;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using Assets.Scripts.Interfaces;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EducationItemUI : MonoBehaviour, IDialogItemUI ,IPointerEnterHandler
|
||||
{
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _description;
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _duration;
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _price;
|
||||
[SerializeField]
|
||||
private Image _icon;
|
||||
|
||||
[SerializeField]
|
||||
private Button _button;
|
||||
|
||||
private DialogOptionsUI _parent;
|
||||
private EducationInfoSO _item;
|
||||
public IDialogOption Item => _item;
|
||||
|
||||
public void SetItem(DialogOptionsUI parent,IDialogOption item)
|
||||
{
|
||||
_item= item as EducationInfoSO;
|
||||
_parent = parent;
|
||||
_duration.text = _item.Duration.ToString();
|
||||
_description.text = _item.Description;
|
||||
_price.text = $"{_item.EnrollPrice}$";
|
||||
_icon.sprite = item.Icon;
|
||||
_button.enabled = true;
|
||||
}
|
||||
|
||||
|
||||
public void Click()
|
||||
{
|
||||
if (_button.enabled)
|
||||
{
|
||||
_parent.OnItemSelected(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (!_button.enabled) { print("Not enough education"); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae4f157b0a61c52409c1c86ea3826ab1
|
||||
@@ -18,7 +18,7 @@ public class JobItemUITemplate : MonoBehaviour, IDialogItemUI ,IPointerEnterHan
|
||||
|
||||
private DialogOptionsUI _parent;
|
||||
private JobInfoSO _item;
|
||||
public JobInfoSO Item=> _item;
|
||||
public IDialogOption Item=> _item;
|
||||
|
||||
public void SetItem(DialogOptionsUI parent,IDialogOption item)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Assets.Scripts.Interfaces;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -27,7 +28,7 @@ public class UISystem : MonoBehaviour
|
||||
timeSlider.ShowTimeSliderDialog(title, description, onCancel, onConfirm);
|
||||
}
|
||||
|
||||
public void ShowTabObtionsDialog(DialogSO dialogSO, Action onCancel, Action<JobInfoSO> onConfirm)
|
||||
public void ShowTabObtionsDialog(DialogSO dialogSO, Action onCancel, Action<IDialogOption> onConfirm)
|
||||
{
|
||||
var dialog = Instantiate(_DialogUIPrefab, transform);
|
||||
dialog.ShowCategoriesDialog(dialogSO, onCancel, onConfirm);
|
||||
|
||||
Reference in New Issue
Block a user