58 lines
1.3 KiB
C#
58 lines
1.3 KiB
C#
using Invector.vItemManager;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
public class WeaponPanelController : MonoBehaviour //, IBeginDragHandler, IEndDragHandler, IDragHandler
|
|
{
|
|
[SerializeField]
|
|
private Image image;
|
|
|
|
[SerializeField]
|
|
private Sprite defaultSprite;
|
|
|
|
[SerializeField]
|
|
private Button button;
|
|
|
|
private Color transparentColor = new Color(1, 1, 1, 0.5f);
|
|
private Color fullyVisibleColor = new Color(1, 1, 1);
|
|
|
|
public void SetPanelToWeaponImage(vItem item)
|
|
{
|
|
image.sprite = item.icon;
|
|
}
|
|
|
|
public void SetPanelToDefaultImage(vItem removedItem)
|
|
{
|
|
image.sprite = defaultSprite;
|
|
}
|
|
|
|
public void DisableButtonInteraction()
|
|
{
|
|
button.interactable = false;
|
|
image.color = transparentColor;
|
|
}
|
|
|
|
public void EnableButtonInteraction()
|
|
{
|
|
button.interactable = true;
|
|
image.color = fullyVisibleColor;
|
|
}
|
|
|
|
public void OnBeginDrag(PointerEventData eventData)
|
|
{
|
|
// Debug.Log("drag begin");
|
|
}
|
|
|
|
public void OnEndDrag(PointerEventData eventData)
|
|
{
|
|
// Debug.Log("drag end");
|
|
}
|
|
|
|
public void OnDrag(PointerEventData eventData)
|
|
{
|
|
// Debug.Log("drag something");
|
|
}
|
|
} |