items menu WIP
This commit is contained in:
@@ -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