+ Item관련 Excel, Json, So 수정 + DropItemTable 로직 수정 + 아이템 프리팹에서 Enable Interaction 체크하면 직접 룻팅, 해제하면 자동 룻팅 + 체력회복 아이템 추가 + 개발자 메뉴 상호작용 "F1" 키를 통해 접근 가능 + 보스 맵은 마법진을 상호작용하면 보스전 시작 + 맵 안에서 교전 중일 때, 투명 벽 쉐이더 추가 + 맵 마다의 통로를 통해서 이동 가능 + 선형적인 맵 구조에 맞게 리소스 및 위치 수정 + 타이틀 화면으로 이동할 때 나타나는 오류 수정(CombatUiManager OnDisable 싱글톤 문제) Closes #25, #26
61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
using BlueWater.Items;
|
|
using Sirenix.OdinInspector;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace BlueWater.Uis
|
|
{
|
|
public class ItemSlotUi : MonoBehaviour
|
|
{
|
|
[field: SerializeField]
|
|
public ItemSlot ItemSlot { get; private set; }
|
|
|
|
[SerializeField, Required]
|
|
private Toggle _itemSelectToggle;
|
|
|
|
[SerializeField, Required]
|
|
private Image _image;
|
|
|
|
[SerializeField, Required]
|
|
private TMP_Text _nameText;
|
|
|
|
[SerializeField, Required]
|
|
private TMP_Text _weightText;
|
|
|
|
[SerializeField, Required]
|
|
private TMP_Text _countText;
|
|
|
|
public bool ToggleIsOn => _itemSelectToggle.isOn;
|
|
|
|
[Button("컴포넌트 초기화")]
|
|
private void InitializeComponents()
|
|
{
|
|
_itemSelectToggle = transform.Find("ItemSelectToggle").GetComponent<Toggle>();
|
|
_image = transform.Find("Image").GetComponent<Image>();
|
|
_nameText = transform.Find("NameText").GetComponent<TMP_Text>();
|
|
_weightText = transform.Find("WeightText").GetComponent<TMP_Text>();
|
|
_countText = transform.Find("CountText").GetComponent<TMP_Text>();
|
|
}
|
|
|
|
public void InitializeData(ItemSlot itemSlot)
|
|
{
|
|
ItemSlot = itemSlot;
|
|
|
|
UpdateData(itemSlot);
|
|
}
|
|
|
|
public void UpdateData(ItemSlot itemSlot)
|
|
{
|
|
var item = ItemManager.Instance.GetItemDataByIdx(itemSlot.Idx);
|
|
_image.sprite = item.Sprite;
|
|
_nameText.text = item.Name;
|
|
_weightText.text = item.Weight * ItemSlot.Count + "kg";
|
|
_countText.text = "x" + ItemSlot.Count;
|
|
}
|
|
|
|
public void ToggleOn() => _itemSelectToggle.isOn = true;
|
|
public void ToggleOff() => _itemSelectToggle.isOn = false;
|
|
public void ClickToggle() => _itemSelectToggle.isOn = !_itemSelectToggle.isOn;
|
|
}
|
|
} |