메뉴판 Ui 수정

This commit is contained in:
NTG_Lenovo 2025-02-18 18:35:13 +09:00
parent 8171828657
commit f02195615d
16 changed files with 149 additions and 502 deletions

View File

@ -15871,8 +15871,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 65.805, y: -30}
m_SizeDelta: {x: 39.61, y: 50}
m_AnchoredPosition: {x: 64.925, y: -30}
m_SizeDelta: {x: 37.85, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &330426820
MonoBehaviour:
@ -15971,7 +15971,7 @@ MonoBehaviour:
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -29725,8 +29725,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 66.020004, y: -30}
m_SizeDelta: {x: 40.04, y: 50}
m_AnchoredPosition: {x: 65.14, y: -30}
m_SizeDelta: {x: 38.28, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &612258070
MonoBehaviour:
@ -29825,7 +29825,7 @@ MonoBehaviour:
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -43318,7 +43318,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &912420264
RectTransform:
m_ObjectHideFlags: 0
@ -43435,7 +43435,7 @@ MonoBehaviour:
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -54359,7 +54359,7 @@ MonoBehaviour:
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -56727,8 +56727,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 281.63, y: -28}
m_SizeDelta: {x: 86.04, y: 60}
m_AnchoredPosition: {x: 278.99, y: -28}
m_SizeDelta: {x: 84.28, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1228430065
MonoBehaviour:
@ -57302,7 +57302,7 @@ MonoBehaviour:
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -63193,7 +63193,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 6986260927099744818, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_SizeDelta.x
value: 70.490005
value: 66.17
objectReference: {fileID: 0}
- target: {fileID: 6986260927099744818, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_SizeDelta.y
@ -63257,7 +63257,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 7293599405324962370, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_SizeDelta.x
value: 60.49
value: 56.17
objectReference: {fileID: 0}
- target: {fileID: 7293599405324962370, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_SizeDelta.y
@ -63265,7 +63265,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 7293599405324962370, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 35.245003
value: 33.085
objectReference: {fileID: 0}
- target: {fileID: 7293599405324962370, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_AnchoredPosition.y
@ -75333,8 +75333,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 107.805, y: -28}
m_SizeDelta: {x: 85.61, y: 60}
m_AnchoredPosition: {x: 106.925, y: -28}
m_SizeDelta: {x: 83.85, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1649553802
MonoBehaviour:
@ -98065,7 +98065,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &2131966572
RectTransform:
m_ObjectHideFlags: 0
@ -104644,11 +104644,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2714078972907850707, guid: 664d4f34aaf687c4d9e8e35ac362fbdf, type: 3}
propertyPath: m_SizeDelta.x
value: 44.29
value: 54.69
objectReference: {fileID: 0}
- target: {fileID: 2714078972907850707, guid: 664d4f34aaf687c4d9e8e35ac362fbdf, type: 3}
propertyPath: m_AnchoredPosition.x
value: 42.145
value: 52.345
objectReference: {fileID: 0}
- target: {fileID: 2714078972907850707, guid: 664d4f34aaf687c4d9e8e35ac362fbdf, type: 3}
propertyPath: m_AnchoredPosition.y
@ -104740,19 +104740,23 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 7726472343166326851, guid: 664d4f34aaf687c4d9e8e35ac362fbdf, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7726472343166326851, guid: 664d4f34aaf687c4d9e8e35ac362fbdf, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7726472343166326851, guid: 664d4f34aaf687c4d9e8e35ac362fbdf, type: 3}
propertyPath: m_SizeDelta.x
value: 66.17
objectReference: {fileID: 0}
- target: {fileID: 7726472343166326851, guid: 664d4f34aaf687c4d9e8e35ac362fbdf, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 33.085
objectReference: {fileID: 0}
- target: {fileID: 7726472343166326851, guid: 664d4f34aaf687c4d9e8e35ac362fbdf, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -25
objectReference: {fileID: 0}
- target: {fileID: 7995521978843963443, guid: 664d4f34aaf687c4d9e8e35ac362fbdf, type: 3}
propertyPath: m_AnchorMax.y
@ -104780,7 +104784,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8236092965151418880, guid: 664d4f34aaf687c4d9e8e35ac362fbdf, type: 3}
propertyPath: m_SizeDelta.x
value: 64.29
value: 79.69
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
@ -108234,27 +108238,67 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3052867414842223236, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_SizeDelta.x
value: 44.29
value: 40.45
objectReference: {fileID: 0}
- target: {fileID: 3052867414842223236, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_AnchoredPosition.x
value: 42.145
value: 45.225
objectReference: {fileID: 0}
- target: {fileID: 3052867414842223236, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_AnchoredPosition.y
value: -15
objectReference: {fileID: 0}
- target: {fileID: 4094634187693511333, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4094634187693511333, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4094634187693511333, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4094634187693511333, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4094634187693511333, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4094634187693511333, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4147497152936243760, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_Name
value: ReverseTodayMenu
objectReference: {fileID: 0}
- target: {fileID: 5936542226941747005, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5936542226941747005, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5936542226941747005, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5936542226941747005, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7387777620824983328, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_fontSize
value: 34
objectReference: {fileID: 0}
- target: {fileID: 8058913099656260157, guid: 3aed33066aabbdc4f83c25d66f333b12, type: 3}
propertyPath: m_SizeDelta.x
value: 64.29
value: 65.45
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []

View File

@ -37,7 +37,7 @@ MonoBehaviour:
- <Key>k__BackingField: CraftRecipe002
<Value>k__BackingField:
<Idx>k__BackingField: CraftRecipe002
<Name>k__BackingField: "\uBA54\uAC08\uB85C\uB3C8 \uBA38\uB9AC \uD280\uAE40"
<Name>k__BackingField: "\uB9DD\uCE58\uC0C1\uC5B4 \uBA38\uB9AC \uD280\uAE40"
<Description>k__BackingField: CraftRecipeDescription002
<Price>k__BackingField: 50
<IngredientIdx1>k__BackingField: Ingredient002
@ -95,7 +95,7 @@ MonoBehaviour:
<IngredientCount2>k__BackingField: 2
<IngredientIdx3>k__BackingField: Ingredient008
<IngredientCount3>k__BackingField: 1
<CraftOrder>k__BackingField: 23
<CraftOrder>k__BackingField: 34
<HashTag>k__BackingField: HashTag006, HashTag007, HashTag008
<Sprite>k__BackingField: {fileID: 21300000, guid: 12a978bb397d4194a9795a3daf6fad84, type: 3}
<ValidIngredients>k__BackingField:
@ -121,7 +121,7 @@ MonoBehaviour:
<IngredientCount2>k__BackingField: 0
<IngredientIdx3>k__BackingField:
<IngredientCount3>k__BackingField: 0
<CraftOrder>k__BackingField: 32
<CraftOrder>k__BackingField: 12
<HashTag>k__BackingField: HashTag009, HashTag010
<Sprite>k__BackingField: {fileID: 21300000, guid: 1002a5b83127f3c43a8cfdf2f8567473, type: 3}
<ValidIngredients>k__BackingField:
@ -142,7 +142,7 @@ MonoBehaviour:
<IngredientCount2>k__BackingField: 2
<IngredientIdx3>k__BackingField:
<IngredientCount3>k__BackingField: 0
<CraftOrder>k__BackingField: 2
<CraftOrder>k__BackingField: 3
<HashTag>k__BackingField: HashTag011, HashTag012
<Sprite>k__BackingField: {fileID: 21300000, guid: 1921548edfb697e4c813502ad856e15d, type: 3}
<ValidIngredients>k__BackingField:
@ -156,7 +156,7 @@ MonoBehaviour:
- <Key>k__BackingField: CraftRecipe007
<Value>k__BackingField:
<Idx>k__BackingField: CraftRecipe007
<Name>k__BackingField: "\uC774\uC0C1\uD55C \uBA54\uAC08\uB85C\uB3C8 \uBA38\uB9AC
<Name>k__BackingField: "\uC774\uC0C1\uD55C \uB9DD\uCE58\uC0C1\uC5B4 \uBA38\uB9AC
\uD280\uAE40"
<Description>k__BackingField: CraftRecipeDescription002
<Price>k__BackingField: 100

View File

@ -1,215 +0,0 @@
using System.Collections.Generic;
using DDD.ScriptableObjects;
using Sirenix.OdinInspector;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
namespace DDD.Uis.Tycoon
{
public class AddIngredientUi : PopupUi
{
[Title("프리팹")]
[SerializeField]
private SelectedCraftRecipeIngredient _selectedCraftRecipeIngredientPrefab;
[Title("컴포넌트")]
[SerializeField]
private GameObject _panel;
[SerializeField]
private RectTransform _panelRect;
[SerializeField]
private GameObject _ingredientsLocation;
[SerializeField]
private TMP_Text _countText;
[SerializeField]
private Image _image;
[SerializeField]
private TMP_Text _nameText;
[SerializeField]
private Button _confirmButton;
private List<SelectedCraftRecipeIngredient> _ingredients = new(3);
public CraftRecipeData CurrentCraftRecipeData { get; private set; }
public int CraftableCount { get; private set; }
private UnityAction _clickAction;
private void Awake()
{
foreach (Transform element in _ingredientsLocation.transform)
{
Destroy(element.gameObject);
}
}
private void Start()
{
for (int i = 0; i < 3; i++)
{
SelectedCraftRecipeIngredient selectedCraftRecipeIngredient = Instantiate(_selectedCraftRecipeIngredientPrefab, _ingredientsLocation.transform);
_ingredients.Add(selectedCraftRecipeIngredient);
selectedCraftRecipeIngredient.HideUi();
}
_panel.SetActive(false);
}
private void OnDestroy()
{
UnregisterButtonListener();
}
public override void Open()
{
base.Open();
_panel.SetActive(true);
}
public override void Close()
{
for (int i = 0; i < 3; i++)
{
_ingredients[i].HideUi();
}
_panel.SetActive(false);
base.Close();
}
public void RegisterButtonListener(UnityAction clickAction)
{
_clickAction = clickAction;
_confirmButton.onClick.AddListener(_clickAction);
}
private void UnregisterButtonListener()
{
if (_clickAction == null) return;
_confirmButton.onClick.RemoveListener(_clickAction);
_clickAction = null;
}
public void OnClicked(CraftRecipeData craftRecipeData)
{
CurrentCraftRecipeData = craftRecipeData;
CraftableCount = 1;
_countText.text = CraftableCount.ToString();
_nameText.text = CurrentCraftRecipeData.Name;
_image.sprite = CurrentCraftRecipeData.Sprite;
for (int i = 0; i < 3; i++)
{
if (i < CurrentCraftRecipeData.ValidIngredients.Count)
{
_ingredients[i].UpdateIngredients(CurrentCraftRecipeData.ValidIngredients[i]);
_ingredients[i].ShowUi();
}
else
{
_ingredients[i].HideUi();
}
}
Open();
// content size fitter 즉시 적용
LayoutRebuilder.ForceRebuildLayoutImmediate(_panelRect);
}
public void MaxButton()
{
if (CurrentCraftRecipeData == null)
{
Debug.LogWarning("현재 선택된 레시피가 없습니다.");
return;
}
int maxCraftCount = int.MaxValue;
foreach (CraftingIngredient craftingIngredient in CurrentCraftRecipeData.ValidIngredients)
{
var slot = DataManager.Instance.Inventory.GetItemByIdx(craftingIngredient.Idx);
int available = slot != null ? slot.Count : 0;
int possible = available / craftingIngredient.Count;
if (possible < maxCraftCount)
{
maxCraftCount = possible;
}
}
CraftableCount = maxCraftCount;
_countText.text = CraftableCount.ToString();
for (int i = 0; i < CurrentCraftRecipeData.ValidIngredients.Count; i++)
{
_ingredients[i].UpdateCraftableCount(CraftableCount);
}
}
public void IncreaseButton()
{
if (CurrentCraftRecipeData == null)
{
Debug.LogWarning("현재 선택된 레시피가 없습니다.");
return;
}
int newCount = CraftableCount + 1;
foreach (var ingredient in CurrentCraftRecipeData.ValidIngredients)
{
var slot = DataManager.Instance.Inventory.GetItemByIdx(ingredient.Idx);
int available = slot != null ? slot.Count : 0;
if (available < newCount * ingredient.Count) return;
}
CraftableCount = newCount;
_countText.text = CraftableCount.ToString();
for (int i = 0; i < CurrentCraftRecipeData.ValidIngredients.Count; i++)
{
_ingredients[i].UpdateCraftableCount(CraftableCount);
}
}
public void DecreaseButton()
{
if (CraftableCount <= 1) return;
CraftableCount--;
_countText.text = CraftableCount.ToString();
for (int i = 0; i < CurrentCraftRecipeData.ValidIngredients.Count; i++)
{
_ingredients[i].UpdateCraftableCount(CraftableCount);
}
}
public void AddMenuButton()
{
if (CurrentCraftRecipeData == null)
{
Debug.LogWarning("현재 선택된 레시피가 없습니다.");
return;
}
foreach (var ingredient in CurrentCraftRecipeData.ValidIngredients)
{
var slot = DataManager.Instance.Inventory.GetItemByIdx(ingredient.Idx);
DataManager.Instance.Inventory.RemoveItem(slot, CraftableCount * ingredient.Count);
}
Close();
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 1487837df19d9a0418c015483a00a747

View File

@ -353,7 +353,7 @@ namespace DDD.Uis.Tycoon
}
_menuButtonImage.sprite = AddedCraftRecipeData.Sprite;
_nameText.text = AddedCraftRecipeData.Name;
_nameText.text = Utils.GetLocalizedString(AddedCraftRecipeData.Idx);
_descriptionText.text = Utils.GetLocalizedString(AddedCraftRecipeData.Description);
_countText.text = $"{AddedCount}/{_maxCraftingCount}";

View File

@ -1,221 +0,0 @@
using System.Collections.Generic;
using DDD.Managers;
using DDD.ScriptableObjects;
using Sirenix.OdinInspector;
using UnityEngine;
namespace DDD.Uis.Tycoon
{
public class CookMenuUi : PopupUi
{
[Title("프리팹")]
[SerializeField]
private TodayMenuButton _todayMenuButtonPrefab;
[SerializeField]
private CraftRecipeButton _craftRecipeButtonPrefab;
[Title("컴포넌트")]
[SerializeField]
private GameObject _panel;
[SerializeField]
private GameObject _todayMenus;
[SerializeField]
private GameObject _unlockedCraftRecipes;
[Title("클래스")]
[SerializeField]
private SelectedCraftRecipe _selectedCraftRecipe;
[SerializeField]
private AddIngredientUi _addIngredientUi;
[Title("오늘의 메뉴")]
[SerializeField]
private int _maxTodayMenuCount = 6;
[Title("실시간 데이터")]
[SerializeField]
private List<TodayMenuButton> _todayMenuButtons;
[SerializeField]
private List<CraftRecipeButton> _craftRecipeButtons;
[SerializeField]
private TodayMenuButton _currentTodayMenuButton;
[SerializeField]
private CraftRecipeButton _currentCraftRecipeButton;
private void Awake()
{
// 더미 데이터 삭제
foreach (Transform element in _todayMenus.transform)
{
if (element)
{
Destroy(element.gameObject);
}
}
foreach (Transform element in _unlockedCraftRecipes.transform)
{
if (element)
{
Destroy(element.gameObject);
}
}
}
private void Start()
{
_todayMenuButtons = new List<TodayMenuButton>(_maxTodayMenuCount);
for (int i = 0; i < _maxTodayMenuCount; i++)
{
TodayMenuButton todayMenuButton = Instantiate(_todayMenuButtonPrefab, _todayMenus.transform);
todayMenuButton.RegisterButtonListener(() => OnClickedTodayMenu(todayMenuButton));
_todayMenuButtons.Add(todayMenuButton);
}
_craftRecipeButtons = new List<CraftRecipeButton>(ItemManager.Instance.CraftRecipeDataSo.GetDataCount());
foreach (CraftRecipeData craftRecipeData in ItemManager.Instance.AcquiredCraftRecipeDatas.Values)
{
CraftRecipeButton craftRecipeButton = Instantiate(_craftRecipeButtonPrefab, _unlockedCraftRecipes.transform);
craftRecipeButton.RegisterButtonListener(() => OnClickedCraftRecipe(craftRecipeData));
craftRecipeButton.SetCraftRecipeData(craftRecipeData);
_craftRecipeButtons.Add(craftRecipeButton);
}
_selectedCraftRecipe.RegisterButtonListener(() => OnClickedAddIngredient(_selectedCraftRecipe.CurrentCraftRecipeData));
_addIngredientUi.RegisterButtonListener(() => OnAddedTodayMenu());
_panel.SetActive(false);
}
public override void Open()
{
if (_todayMenuButtons.Count > 0)
{
_currentTodayMenuButton = _todayMenuButtons[0];
}
base.Open();
_panel.SetActive(true);
if (_craftRecipeButtons.Count > 0)
{
UpdateCraftRecipeButton();
}
}
public override void Close()
{
_panel.SetActive(false);
base.Close();
}
private void OnClickedTodayMenu(TodayMenuButton clickedTodayMenuButton)
{
_currentTodayMenuButton = clickedTodayMenuButton;
UpdateAddIngredientButton();
UpdateCraftRecipeButton();
}
private void OnAddedTodayMenu()
{
_currentTodayMenuButton.AddedMenu(_addIngredientUi.CurrentCraftRecipeData, _addIngredientUi.CraftableCount);
UpdateAddIngredientButton();
UpdateCraftRecipeButton();
}
private void OnClickedCraftRecipe(CraftRecipeData craftRecipeData)
{
_selectedCraftRecipe.OnSelected(craftRecipeData);
UpdateAddIngredientButton();
}
private void OnClickedAddIngredient(CraftRecipeData craftRecipeData)
{
_addIngredientUi.OnClicked(craftRecipeData);
}
private void UpdateCraftRecipeButton()
{
_currentCraftRecipeButton = null;
foreach (CraftRecipeButton craftRecipeButton in _craftRecipeButtons)
{
if (craftRecipeButton.gameObject.activeInHierarchy)
{
_currentCraftRecipeButton = craftRecipeButton;
break;
}
}
_currentCraftRecipeButton?.OnClicked();
}
private void UpdateAddIngredientButton()
{
if (_currentTodayMenuButton.IsAddedMenu)
{
if (_currentTodayMenuButton.AddedCraftRecipeData.Idx == _selectedCraftRecipe.CurrentCraftRecipeData.Idx
&& _selectedCraftRecipe.IsCraftable)
{
_selectedCraftRecipe.EnableInteractableAddIngredientButton();
}
else
{
_selectedCraftRecipe.DisableInteractableAddIngredientButton();
}
// 추가된 메뉴에서는 추가 재료 버튼 비활성화
// 현재 메뉴에 등록된 레시피의 Idx를 가져옵니다.
string currentRecipeIdx = _currentTodayMenuButton.AddedCraftRecipeData.Idx;
// _craftRecipeButtons 중에서 현재 메뉴의 레시피와 동일한 Idx를 가진 버튼만 표시하고, 나머지는 숨깁니다.
foreach (CraftRecipeButton button in _craftRecipeButtons)
{
bool shouldShow = (button.CraftRecipeData.Idx == currentRecipeIdx);
button.gameObject.SetActive(shouldShow);
}
}
else
{
if (_currentCraftRecipeButton == null)
{
_selectedCraftRecipe.DisableInteractableAddIngredientButton();
}
else
{
// 현재 TodayMenuButton이 등록되지 않은 경우,
// 선택된 레시피가 제작 가능한지 여부에 따라 추가 재료 버튼의 활성화 여부를 결정합니다.
if (_selectedCraftRecipe.IsCraftable)
{
_selectedCraftRecipe.EnableInteractableAddIngredientButton();
}
else
{
_selectedCraftRecipe.DisableInteractableAddIngredientButton();
}
}
// 이미 등록된 레시피의 Idx를 수집합니다.
HashSet<string> addedRecipeIdxSet = new HashSet<string>();
foreach (TodayMenuButton todayMenuButton in _todayMenuButtons)
{
if (todayMenuButton.IsAddedMenu)
{
addedRecipeIdxSet.Add(todayMenuButton.AddedCraftRecipeData.Idx);
}
}
// _craftRecipeButtons 중에서 등록되지 않은 레시피만 표시합니다.
foreach (CraftRecipeButton button in _craftRecipeButtons)
{
bool shouldShow = !addedRecipeIdxSet.Contains(button.CraftRecipeData.Idx);
button.gameObject.SetActive(shouldShow);
}
}
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: fbba27e78b388da4aae29a31e26a3c2f

View File

@ -1,5 +1,6 @@
using System.Collections.Generic;
using DDD.ScriptableObjects;
using DDD.Utility;
using Sirenix.OdinInspector;
using TMPro;
using UnityEngine;
@ -133,7 +134,7 @@ namespace DDD.Uis.Tycoon
{
AddedCraftRecipeData = craftRecipeData;
AddedCount = count;
_nameText.text = AddedCraftRecipeData.Name;
_nameText.text = Utils.GetLocalizedString(AddedCraftRecipeData.Idx);
_menuButtonImage.sprite = AddedCraftRecipeData.Sprite;
IsAddedMenu = true;
}

View File

@ -234,7 +234,7 @@ MonoBehaviour:
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0

View File

@ -205,7 +205,7 @@ MonoBehaviour:
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -310,7 +310,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -137.5, y: -50}
m_AnchoredPosition: {x: -137.5, y: -80}
m_SizeDelta: {x: -315, y: 50}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &4345404381910915522
@ -378,7 +378,7 @@ MonoBehaviour:
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -639,7 +639,7 @@ MonoBehaviour:
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4281028460
rgba: 4278329916
m_fontColor: {r: 0.23529412, g: 0.13333334, b: 0.007843138, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
@ -667,7 +667,7 @@ MonoBehaviour:
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -804,7 +804,9 @@ MonoBehaviour:
_nameText: {fileID: 6735428485454845020}
_menuHashTagsPanel: {fileID: 1300612880210618845}
_emptySprite: {fileID: 997973047, guid: 363650e9e56ecab4e97f7852b16ed109, type: 3}
_maxHashTagCount: 3
_isAddedMenu: 0
_menuHashTags: []
--- !u!1 &4818393310497793642
GameObject:
m_ObjectHideFlags: 0
@ -817,6 +819,7 @@ GameObject:
- component: {fileID: 6615748462132663433}
- component: {fileID: 548449130937258113}
- component: {fileID: 1110286073863712629}
- component: {fileID: 8031521768308737558}
m_Layer: 5
m_Name: GoldImage
m_TagString: Untagged
@ -901,6 +904,21 @@ MonoBehaviour:
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &8031521768308737558
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4818393310497793642}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e19747de3f5aca642ab2be37e372fb86, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0.2784314, g: 0.18823531, b: 0.14117648, a: 1}
m_EffectDistance: {x: 1, y: -1}
m_UseGraphicAlpha: 1
--- !u!1 &6021650030166034215
GameObject:
m_ObjectHideFlags: 0
@ -1005,7 +1023,7 @@ MonoBehaviour:
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -1658,7 +1676,7 @@ MonoBehaviour:
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 4
m_Spacing: 0
m_Spacing: 5
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1

View File

@ -102,7 +102,7 @@ MonoBehaviour:
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0

View File

@ -57,7 +57,7 @@ MonoBehaviour:
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 4
m_Spacing: 0
m_Spacing: 5
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1
@ -219,9 +219,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: '250
'
m_text: 9999
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: b676b9137f325de46a17dab74724a2fb, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: ec0fe2e4dac0b294e848bab264b4d69a, type: 2}
@ -258,7 +256,7 @@ MonoBehaviour:
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -379,6 +377,7 @@ GameObject:
- component: {fileID: 175936885161783845}
- component: {fileID: 6104830265402710049}
- component: {fileID: 2123336425096292203}
- component: {fileID: 4834253906824443229}
m_Layer: 5
m_Name: GoldImage
m_TagString: Untagged
@ -463,6 +462,21 @@ MonoBehaviour:
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &4834253906824443229
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4795916869938783775}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e19747de3f5aca642ab2be37e372fb86, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0.2784314, g: 0.18823531, b: 0.14117648, a: 1}
m_EffectDistance: {x: 1, y: -1}
m_UseGraphicAlpha: 1
--- !u!1 &4941310351381671391
GameObject:
m_ObjectHideFlags: 0
@ -498,7 +512,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 137.5, y: -50}
m_AnchoredPosition: {x: 137.5, y: -80}
m_SizeDelta: {x: -315, y: 50}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &2737639810765038546
@ -566,7 +580,7 @@ MonoBehaviour:
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -780,7 +794,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 25
m_text: 99
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: b676b9137f325de46a17dab74724a2fb, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: ad0123299e1136f43b6253bd14abb68c, type: 2}
@ -817,7 +831,7 @@ MonoBehaviour:
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -954,7 +968,9 @@ MonoBehaviour:
_nameText: {fileID: 1344998493127823879}
_menuHashTagsPanel: {fileID: 8111539781854767348}
_emptySprite: {fileID: 997973047, guid: 363650e9e56ecab4e97f7852b16ed109, type: 3}
_maxHashTagCount: 3
_isAddedMenu: 0
_menuHashTags: []
--- !u!1 &7070170423333099714
GameObject:
m_ObjectHideFlags: 0
@ -1226,7 +1242,7 @@ MonoBehaviour:
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4281028460
rgba: 4278329916
m_fontColor: {r: 0.23529413, g: 0.13333334, b: 0.007843138, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
@ -1254,7 +1270,7 @@ MonoBehaviour:
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterSpacing: -8
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@ -1465,7 +1481,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 6986260927099744818, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_SizeDelta.x
value: 71.380005
value: 66.17
objectReference: {fileID: 0}
- target: {fileID: 6986260927099744818, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_SizeDelta.y
@ -1501,7 +1517,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 6986260927099744818, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 35.690002
value: 33.085
objectReference: {fileID: 0}
- target: {fileID: 6986260927099744818, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_AnchoredPosition.y
@ -1529,7 +1545,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 7293599405324962370, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_SizeDelta.x
value: 61.38
value: 56.17
objectReference: {fileID: 0}
- target: {fileID: 7293599405324962370, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_SizeDelta.y
@ -1537,7 +1553,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 7293599405324962370, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 35.690002
value: 33.085
objectReference: {fileID: 0}
- target: {fileID: 7293599405324962370, guid: 071ba7c2801647b4c8efb6c0bd07c9e6, type: 3}
propertyPath: m_AnchoredPosition.y

View File

@ -719,6 +719,10 @@ MonoBehaviour:
m_Key: CraftRecipe006
m_Metadata:
m_Items: []
- m_Id: 36515327505137664
m_Key: CraftRecipe007
m_Metadata:
m_Items: []
- m_Id: 35010075077443584
m_Key: Ingredient001
m_Metadata:

View File

@ -781,7 +781,7 @@ MonoBehaviour:
m_Metadata:
m_Items: []
- m_Id: 35009870261190656
m_Localized: "\uBA54\uAC08\uB85C\uB3C8 \uBA38\uB9AC \uD280\uAE40"
m_Localized: "\uB9DD\uCE58\uC0C1\uC5B4 \uBA38\uB9AC \uD280\uAE40"
m_Metadata:
m_Items: []
- m_Id: 35009872932962304
@ -938,6 +938,10 @@ MonoBehaviour:
m_Localized: "\uC11C\uBE59\uD558\uAE30"
m_Metadata:
m_Items: []
- m_Id: 36515327505137664
m_Localized: "\uC774\uC0C1\uD55C \uB9DD\uCE58\uC0C1\uC5B4 \uBA38\uB9AC \uD280\uAE40"
m_Metadata:
m_Items: []
references:
version: 2
RefIds: []

View File

@ -15,7 +15,7 @@
},
{
"Idx": "CraftRecipe002",
"Name": "메갈로돈 머리 튀김",
"Name": "망치상어 머리 튀김",
"Description": "CraftRecipeDescription002",
"Price": 50,
"IngredientIdx1": "Ingredient002",
@ -85,7 +85,7 @@
},
{
"Idx": "CraftRecipe007",
"Name": "이상한 메갈로돈 머리 튀김",
"Name": "이상한 망치상어 머리 튀김",
"Description": "CraftRecipeDescription002",
"Price": 100,
"IngredientIdx1": "Ingredient008",