items menu WIP
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
public enum JobPositions { Unemployed,Cashier, Clerk, ManagerAssistaint, Manager };
|
||||
public enum EducationSkill { NotEducated, School, HightSchool,University};
|
||||
|
||||
public enum PlayerStates { Awake, Sleeping, Eating,Working }
|
||||
public enum JobPositions { Unemployed, Cashier, Clerk, ManagerAssistaint, Manager };
|
||||
public enum EducationSkill { NotEducated, School, HightSchool, University };
|
||||
public enum ItemsMenuActions { Cancel, Sleep, Eat, Put, Take }
|
||||
public enum PlayerStates { Awake, Sleeping, Eating, Working }
|
||||
public enum StatsId { Money, RentAccount, Food, Energy, BankAccount, Job, }
|
||||
public enum Tasks { Move, Interact, Rotate };
|
||||
public enum TaskStatus { Waiting, InProgress, Complete };
|
||||
public enum InteractionStatus { Complete, WaitForChoose, InProgress, FarFromPlayer };
|
||||
public enum InteractionStatus { Complete, WaitForChoose, InProgress, FarFromPlayer };
|
||||
public enum AnimationStates
|
||||
{
|
||||
[EnumMember(Value = "Idle")]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class BaseInteractableObject : MonoBehaviour
|
||||
@@ -7,16 +7,17 @@ public class BaseInteractableObject : MonoBehaviour
|
||||
[SerializeField]
|
||||
public Transform _interactionPoint;
|
||||
[SerializeField]
|
||||
public PopupItemMenu _radialMenuPrefab;
|
||||
public List<ItemsMenuActionSO> _menuActions;
|
||||
|
||||
protected Player _player;
|
||||
private InteractionStatus _currentStatus=InteractionStatus.Complete;
|
||||
|
||||
|
||||
public InteractionStatus Interact(Player player)
|
||||
{
|
||||
_player=player;
|
||||
if (_currentStatus == InteractionStatus.Complete)
|
||||
if (_currentStatus == InteractionStatus.Complete && _menuActions.Any())
|
||||
{
|
||||
UIManager.Instance.ShowItemsMenu(PopupMenuCallback);
|
||||
UIManager.Instance.ShowItemsMenu(_menuActions,PopupMenuCallback);
|
||||
_currentStatus = InteractionStatus.WaitForChoose;
|
||||
}
|
||||
else if(_currentStatus!=InteractionStatus.WaitForChoose)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b38883be6b7fe74986201d6ade1f808
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,16 @@
|
||||
%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: 844a7de838b26b349aac023a7c8057d6, type: 3}
|
||||
m_Name: Cancel
|
||||
m_EditorClassIdentifier:
|
||||
ActionName: Cancel
|
||||
Action: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37a5860278daf904b976c61632085b3d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,16 @@
|
||||
%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: 844a7de838b26b349aac023a7c8057d6, type: 3}
|
||||
m_Name: Sleep
|
||||
m_EditorClassIdentifier:
|
||||
ActionName: Sleep
|
||||
Action: 1
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a45b050119410f149b0a257098cdaec5
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu()]
|
||||
public class ItemsMenuActionSO : ScriptableObject
|
||||
{
|
||||
public string ActionName;
|
||||
public ItemsMenuActions Action;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 844a7de838b26b349aac023a7c8057d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -8,12 +10,19 @@ public class PopupItemMenu : MonoBehaviour
|
||||
[SerializeField]
|
||||
private Button _popupMenuItemButtonPrefab;
|
||||
|
||||
public void ShowButtons(Action menuButtonClick)
|
||||
public void ShowButtons(List<ItemsMenuActionSO> actions, Action menuButtonClick)
|
||||
{
|
||||
var button=Instantiate(_popupMenuItemButtonPrefab) as Button;
|
||||
button.transform.SetParent(transform,false);
|
||||
var button = Instantiate(_popupMenuItemButtonPrefab) as Button;
|
||||
button.transform.SetParent(transform, false);
|
||||
button.transform.localPosition = new Vector3(0, 100f, 0);
|
||||
|
||||
var textMeshPro = button.GetComponent<TextMeshPro>();
|
||||
if (textMeshPro != null)
|
||||
{
|
||||
textMeshPro.text = actions[0].ActionName;
|
||||
}
|
||||
|
||||
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
menuButtonClick?.Invoke();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIManager : MonoBehaviour
|
||||
@@ -40,12 +41,12 @@ public class UIManager : MonoBehaviour
|
||||
jobSelector.ShowJobSelectionDialog(title, onCancel, onConfirm);
|
||||
}
|
||||
|
||||
public void ShowItemsMenu(Action itemsMenuCallback)
|
||||
public void ShowItemsMenu(List<ItemsMenuActionSO> actions,Action itemsMenuCallback)
|
||||
{
|
||||
var popupMenu = Instantiate(_itemPopupMenuPrefab) as PopupItemMenu;
|
||||
popupMenu.transform.transform.SetParent(transform, false);
|
||||
popupMenu.transform.position = Input.mousePosition;
|
||||
popupMenu.ShowButtons(itemsMenuCallback);
|
||||
popupMenu.ShowButtons(actions,itemsMenuCallback);
|
||||
}
|
||||
|
||||
public void Freeze()
|
||||
|
||||
Reference in New Issue
Block a user