일부 아이템 사용버튼 추가
This commit is contained in:
parent
8cf05ebad8
commit
96225a1ef0
|
|
@ -6444,7 +6444,7 @@ MonoBehaviour:
|
||||||
invenItemContent: {fileID: 1881783529}
|
invenItemContent: {fileID: 1881783529}
|
||||||
selectItemImg: {fileID: 1477127751}
|
selectItemImg: {fileID: 1477127751}
|
||||||
selectItemInfo: {fileID: 1626158705}
|
selectItemInfo: {fileID: 1626158705}
|
||||||
selectItemButton: {fileID: 1620665316}
|
selectItemButton: {fileID: 1620665318}
|
||||||
--- !u!1 &440143453
|
--- !u!1 &440143453
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -17316,7 +17316,7 @@ MonoBehaviour:
|
||||||
m_SelectOnDown: {fileID: 0}
|
m_SelectOnDown: {fileID: 0}
|
||||||
m_SelectOnLeft: {fileID: 0}
|
m_SelectOnLeft: {fileID: 0}
|
||||||
m_SelectOnRight: {fileID: 0}
|
m_SelectOnRight: {fileID: 0}
|
||||||
m_Transition: 1
|
m_Transition: 0
|
||||||
m_Colors:
|
m_Colors:
|
||||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class BagUICtrl : SingletonMonoBehaviour<BagUICtrl>
|
public class BagUICtrl : SingletonMonoBehaviour<BagUICtrl>
|
||||||
|
|
@ -9,7 +10,7 @@ public class BagUICtrl : SingletonMonoBehaviour<BagUICtrl>
|
||||||
[SerializeField] Transform invenItemContent;
|
[SerializeField] Transform invenItemContent;
|
||||||
[SerializeField] Image selectItemImg;
|
[SerializeField] Image selectItemImg;
|
||||||
[SerializeField] TMP_Text selectItemInfo;
|
[SerializeField] TMP_Text selectItemInfo;
|
||||||
[SerializeField] GameObject selectItemButton;
|
[SerializeField] Button selectItemButton;
|
||||||
|
|
||||||
List<InvenItemPrefab> invenItemList;
|
List<InvenItemPrefab> invenItemList;
|
||||||
private InvenItemPrefab selectItem;
|
private InvenItemPrefab selectItem;
|
||||||
|
|
@ -43,16 +44,25 @@ public class BagUICtrl : SingletonMonoBehaviour<BagUICtrl>
|
||||||
selectItemImg.sprite = null;
|
selectItemImg.sprite = null;
|
||||||
selectItemImg.color = Color.clear;
|
selectItemImg.color = Color.clear;
|
||||||
selectItemInfo.text = string.Empty;
|
selectItemInfo.text = string.Empty;
|
||||||
selectItemButton.SetActive(false);
|
selectItemButton.gameObject.SetActive(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SelectButton(InvenItemPrefab selectItem)
|
public void SelectButton(InvenItemPrefab selectItem, UnityAction action)
|
||||||
{
|
{
|
||||||
this.selectItem = selectItem;
|
this.selectItem = selectItem;
|
||||||
//selectItemImg.sprite = selectItem.GetConsumableItemData;
|
//selectItemImg.sprite = selectItem.GetConsumableItemData;
|
||||||
selectItemImg.color = Color.white;
|
selectItemImg.color = Color.white;
|
||||||
selectItemInfo.text = selectItem.GetConsumableItemData.name;
|
selectItemInfo.text = selectItem.GetConsumableItemData.name;
|
||||||
selectItemButton.SetActive(false);
|
if(action == null)
|
||||||
|
selectItemButton.gameObject.SetActive(false);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selectItemButton.gameObject.SetActive(true);
|
||||||
|
selectItemButton.onClick.RemoveAllListeners();
|
||||||
|
selectItemButton.onClick.AddListener(action);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class InvenItemPrefab : MonoBehaviour
|
public class InvenItemPrefab : MonoBehaviour
|
||||||
|
|
@ -9,6 +10,8 @@ public class InvenItemPrefab : MonoBehaviour
|
||||||
|
|
||||||
ConsumableItemData consumableItemData;
|
ConsumableItemData consumableItemData;
|
||||||
|
|
||||||
|
UnityAction action = null;
|
||||||
|
|
||||||
public ConsumableItemData GetConsumableItemData { get { return consumableItemData; } }
|
public ConsumableItemData GetConsumableItemData { get { return consumableItemData; } }
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
|
|
@ -32,6 +35,16 @@ public class InvenItemPrefab : MonoBehaviour
|
||||||
this.count = consumableItem.count;
|
this.count = consumableItem.count;
|
||||||
gameObject.SetActive(this.count != 0);
|
gameObject.SetActive(this.count != 0);
|
||||||
countText.text = this.count.ToString();
|
countText.text = this.count.ToString();
|
||||||
|
switch (consumableItem.consumable_item_data_id)
|
||||||
|
{
|
||||||
|
case 100001://신규 케릭터 가챠
|
||||||
|
case 100002://케릭터 가챠
|
||||||
|
case 100003://장비 가챠
|
||||||
|
action = new UnityAction(() => {
|
||||||
|
Debug.Log("가챠 시작" + consumableItem.consumable_item_data_id);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -42,6 +55,6 @@ public class InvenItemPrefab : MonoBehaviour
|
||||||
|
|
||||||
public void SelectButton()
|
public void SelectButton()
|
||||||
{
|
{
|
||||||
BagUICtrl.Instance.SelectButton(this);
|
BagUICtrl.Instance.SelectButton(this, action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue