2022-10-19 13:51:46 +00:00
using System.Collections ;
using System.Collections.Generic ;
using UnityEngine ;
using UnityEngine.UI ;
using UnityEngine.EventSystems ;
using System ;
using static SimpleInventorySystem . GridUI ;
namespace SimpleInventorySystem
{
2022-10-29 19:56:00 +00:00
public class SlotUI : MonoBehaviour , IPointerEnterHandler , IPointerExitHandler
2022-10-19 13:51:46 +00:00
{
2022-12-23 03:50:16 +00:00
[Header("Slot Attributes")]
2022-10-19 13:51:46 +00:00
public int width ;
public int height ;
public Image image ;
2022-12-23 03:50:16 +00:00
public bool useImageAsSlotHolder ;
public bool EquipSlot ;
public bool FitItemImageInSlotImage = false ;
[Header("Slot-to-Item Compatibility")]
public bool IgnoreItemSize ;
public List < ItemTags > AllowedItemTags ;
public List < ItemTags > DisallowedItemTags ;
public List < SlotUI > HasSlotsBelongingToItem ;
// Hidden In Inspector
[HideInInspector] public Stack < ItemUI > stackedItems = new Stack < ItemUI > ( ) ; // WARNING: Stack can give some odd troubles with the raycast, consider revision or consideration.
[HideInInspector] public LimitStackSlot limitStackSlot ;
[HideInInspector] public LimitStackSlotManager limitStackSlotManager ;
[HideInInspector] public bool DroppedOnFrame ;
[HideInInspector] public List < SlotUI > LinkedSlots = new List < SlotUI > ( ) ;
[HideInInspector] public List < GroupSlotUI > groupSlots ;
[HideInInspector] public GridUI grid ;
[HideInInspector] public GridUI . Cell cell ;
2023-01-15 11:39:47 +00:00
[HideInInspector] public ChangeSlotTitle changeSlotTitle ;
public bool CellInUse ;
2022-12-23 03:50:16 +00:00
[HideInInspector] public float imageScale = 1f ; // TODO: See if this is still necessary
[HideInInspector] public bool StackItemsOnSlot ; // TODO: Figure out if this should be kept hidden
// private variables
2022-11-06 02:28:29 +00:00
[SerializeField]
private ItemUI itemUI
{
get
{
if ( stackedItems . Count = = 0 )
{
return null ;
}
2023-01-15 11:39:47 +00:00
//Debug.Log("Peek: " + stackedItems.Peek().gameObject.name);
2022-11-06 02:28:29 +00:00
return stackedItems . Peek ( ) ;
}
}
2022-10-19 13:51:46 +00:00
private AppendUI appendUI ;
2022-10-29 19:56:00 +00:00
private LinkedSlotUI linkedSlotUI ;
private bool droppedStackOntoEmptySlot ;
2022-11-06 02:28:29 +00:00
private RenderItemUIProperty renderProp ;
private SlotUI BelongsToItemInSlot ;
2022-10-19 13:51:46 +00:00
2022-12-23 03:50:16 +00:00
// public variables
public bool PointerIsHoveredOver { get { return InventorySystem . IsMouseOverUI ( gameObject ) ; } }
public ItemUI GetItemUI ( )
2022-10-19 13:51:46 +00:00
{
return itemUI ;
}
2022-10-29 19:56:00 +00:00
/ * public void OnDrop ( PointerEventData eventData )
2022-10-19 13:51:46 +00:00
{
//
//("OnDrop");
if ( eventData . pointerDrag ! = null & & AllowedDraggable ( eventData . pointerDrag ) )
{
DropOntoSlot ( eventData . pointerDrag ) ;
}
2022-10-29 19:56:00 +00:00
} * /
2023-01-15 11:39:47 +00:00
2022-10-19 13:51:46 +00:00
public bool AllowedDraggable ( GameObject gameObject )
{
return gameObject . GetComponent < ItemUI > ( ) ! = null ;
}
2022-10-29 19:56:00 +00:00
public bool IsLinkedSlot ( )
{
return linkedSlotUI ! = null ;
}
public bool DropOntoSlot ( GameObject item , bool dropStack = true )
2022-10-19 13:51:46 +00:00
{
ItemUI itemDrop = item . GetComponent < ItemUI > ( ) ;
2022-11-06 02:28:29 +00:00
ItemTags itemTag = itemDrop . ItemTag ;
bool allowed = AllowedItemTags = = null | | AllowedItemTags . Count = = 0 | | AllowedItemTags . Contains ( ItemTags . Any ) | | AllowedItemTags . Contains ( itemTag ) ;
2022-11-15 22:58:54 +00:00
bool disallowed = DisallowedItemTags . Contains ( itemTag ) ;
2022-11-06 02:28:29 +00:00
2022-11-15 22:58:54 +00:00
if ( ! allowed | | disallowed )
2022-11-06 02:28:29 +00:00
{
return false ;
}
if ( itemDrop . Stackable & & StackItemsOnSlot )
{
Debug . LogWarning ( "Item stacks are incompattible with slot stacking." ) ;
return false ;
}
if ( limitStackSlot ! = null & & limitStackSlot . HasReachedLimit ( ) )
{
return false ;
}
2022-10-29 19:56:00 +00:00
if ( IsLinkedSlot ( ) )
{
2022-11-06 02:28:29 +00:00
/ * GameObject newItemDrop = Instantiate ( item ) ;
2022-10-29 19:56:00 +00:00
itemDrop = newItemDrop . GetComponent < ItemUI > ( ) ;
2022-11-06 02:28:29 +00:00
itemDrop . IsLinkedSlotClone = true ; * /
2022-10-29 19:56:00 +00:00
}
2022-10-19 13:51:46 +00:00
List < Cell > occupiedCells = new List < Cell > ( ) ;
2022-10-29 19:56:00 +00:00
2022-11-06 02:28:29 +00:00
/// STACKING
/// This section concerns item stacks, not slot stacking
2023-01-25 07:14:16 +00:00
if ( ! itemDrop . IsLinkedSlotClone & & ( ( HasStack ( ) & & itemUI ! = null /*&& itemUI.itemPrefab == itemDrop.itemPrefab*/ & & itemUI . itemName = = GetItemUI ( ) . itemName ) | | ! dropStack ) )
2022-10-29 19:56:00 +00:00
{
Debug . Log ( "Handling Stack" ) ;
int maxStackDrop = 1 ;
if ( dropStack )
{
maxStackDrop = itemDrop . Count ;
if ( maxStackDrop > itemUI . StackLimit - itemUI . Count )
{
maxStackDrop = itemDrop . Count - itemUI . Count ;
}
}
2022-11-06 02:28:29 +00:00
if ( itemUI ! = null )
2022-10-29 19:56:00 +00:00
{
if ( itemUI . AddToStack ( maxStackDrop ) )
{
Debug . Log ( "Add to stack" ) ;
itemDrop . RemoveFromStack ( maxStackDrop ) ;
2022-11-06 02:28:29 +00:00
if ( appendUI ! = null & & appendUI . StackAppend )
{
appendUI . AppendUIToTransform ( itemDrop ) ;
}
2022-10-29 19:56:00 +00:00
return true ;
}
}
else
{
2022-11-06 02:28:29 +00:00
Debug . Log ( "Stack handling" ) ;
2022-10-29 19:56:00 +00:00
GameObject GO = Instantiate ( item , transform , false ) ;
GO . transform . localPosition = new Vector3 ( 0 , 0 , 0 ) ;
ItemUI oldItemDrop = itemDrop ;
itemDrop = GO . GetComponent < ItemUI > ( ) ;
if ( itemDrop . AddToStack ( maxStackDrop ) )
{
oldItemDrop . RemoveFromStack ( maxStackDrop ) ;
}
else
{
return false ;
}
}
}
2023-01-15 11:39:47 +00:00
Debug . Log ( grid ) ;
2022-11-15 22:58:54 +00:00
bool dropCheck = ( grid ! = null & & grid . CanMoveInCells ( itemDrop , this , occupiedCells ) ) | |
( grid = = null & & ! cell . inUse & & ( IgnoreItemSize | | ( cell . slot . width > = itemDrop . SizeAfterOrientation ( ) . Width & & ! cell . inUse & & cell . slot . height > = itemDrop . SizeAfterOrientation ( ) . Height ) ) ) ;
2023-01-15 11:39:47 +00:00
Debug . Log ( "Drop Check: " + dropCheck ) ;
//Debug.Log("DropCheck" + (grid == null && !cell.inUse && (IgnoreItemSize || (cell.slot.width >= itemDrop.SizeAfterOrientation().Width && !cell.inUse && cell.slot.height >= itemDrop.SizeAfterOrientation().Height))));
2022-10-19 13:51:46 +00:00
2022-10-29 19:56:00 +00:00
/ * Debug . Log ( "GridUI: DropOntoSlot(): " + gameObject . name + ": " + "dropCheck: " + dropCheck ) ;
Debug . Log ( "GridUI: DropOntoSlot(): " + gameObject . name + ": " + "allowed: " + allowed ) ; * /
2022-10-19 13:51:46 +00:00
2022-11-06 02:28:29 +00:00
if ( dropCheck )
2022-10-19 13:51:46 +00:00
{
2022-11-06 02:28:29 +00:00
if ( ( occupiedCells ! = null & & occupiedCells . Count > 1 ) | | StackItemsOnSlot )
2022-10-29 19:56:00 +00:00
{
2023-01-15 11:39:47 +00:00
Debug . Log ( "SlotUI: " + occupiedCells . Count ) ;
2022-10-29 19:56:00 +00:00
itemDrop . SetSlots ( occupiedCells ) ;
}
else
{
Debug . Log ( "In Use" ) ;
cell . inUse = true ;
CellInUse = cell . inUse ;
}
2022-10-19 13:51:46 +00:00
Transform parent = transform ;
if ( useImageAsSlotHolder & & image ! = null )
{
parent = image . gameObject . transform ;
}
item . GetComponent < Transform > ( ) . SetParent ( parent ) ;
item . GetComponent < RectTransform > ( ) . anchoredPosition = GetComponent < RectTransform > ( ) . anchoredPosition ;
//item.GetComponent<RectTransform>().pivot = new Vector2(0, 1);
2023-01-25 07:14:16 +00:00
2022-10-19 13:51:46 +00:00
itemDrop . SetSlot ( this ) ;
2022-11-06 02:28:29 +00:00
stackedItems . Push ( itemDrop ) ;
Debug . Log ( "SlotUI:Drop:" + itemUI + ", " + itemDrop ) ;
2022-10-29 19:56:00 +00:00
2023-01-25 07:14:16 +00:00
itemUI . DropItemOntoSlot ( FitItemImageInSlotImage ) ;
if ( FitItemImageInSlotImage )
itemDrop . FitImageInSlot ( new Vector2 ( Math . Abs ( image . GetComponent < RectTransform > ( ) . sizeDelta . x ) , Math . Abs ( image . GetComponent < RectTransform > ( ) . sizeDelta . y ) ) ) ;
2022-10-29 19:56:00 +00:00
if ( itemUI . Stackable )
{
droppedStackOntoEmptySlot = true ;
}
if ( ! IsLinkedSlot ( ) )
{
foreach ( SlotUI ls in LinkedSlots )
{
if ( ls = = this )
{
Debug . LogWarning ( "No self-referencing for this array ;)" ) ;
continue ;
}
//ls.DropOntoSlot(item);
}
}
if ( grid ! = null )
{
grid . HideSlotsOfItem ( itemDrop ) ;
}
2022-12-23 03:50:16 +00:00
if ( ! useImageAsSlotHolder )
{
HideImage ( ) ;
}
2022-10-19 13:51:46 +00:00
2022-11-15 22:58:54 +00:00
foreach ( GroupSlotUI groupSlot in groupSlots )
2022-10-19 13:51:46 +00:00
{
2022-11-15 22:58:54 +00:00
if ( groupSlot ! = null )
{
groupSlot . OnItemDropped ( ) ;
}
2022-10-19 13:51:46 +00:00
}
2022-11-15 22:58:54 +00:00
2022-10-19 13:51:46 +00:00
if ( appendUI ! = null )
{
2022-11-06 02:28:29 +00:00
Debug . Log ( "Test" ) ;
2022-10-29 19:56:00 +00:00
appendUI . AppendUIToTransform ( itemUI ) ;
2022-10-19 13:51:46 +00:00
}
2022-11-06 02:28:29 +00:00
if ( limitStackSlotManager ! = null )
{
limitStackSlotManager . SetStackSlotLimit ( itemUI ) ;
}
if ( limitStackSlot ! = null )
{
limitStackSlot . Increment ( ) ;
}
if ( BelongsToItemInSlot ! = null & & BelongsToItemInSlot . GetItemUI ( ) ! = null )
{
BelongsToItemInSlot . GetItemUI ( ) . AddToContainedItems ( itemUI ) ;
}
2023-01-15 11:39:47 +00:00
if ( changeSlotTitle ! = null )
{
changeSlotTitle . ChangeTitle ( itemDrop . ItemTag ) ;
}
2022-11-06 02:28:29 +00:00
if ( HasSlotsBelongingToItem ! = null )
{
foreach ( ItemUI i in itemUI . ContainedItems )
{
foreach ( SlotUI s in HasSlotsBelongingToItem )
{
if ( s . AllowedItemTags . Contains ( i . ItemTag ) )
{
s . AddContainedItemToSlot ( i ) ;
break ;
}
}
}
}
SetRenderItemUIPropertyValue ( ) ;
2022-10-19 13:51:46 +00:00
return true ;
}
else if ( itemDrop . previousSlot ! = this )
{
2022-10-29 19:56:00 +00:00
// TODO: See why this is outputting at beginning, probably from test objects in Loot
//Debug.LogWarning("SlotUI: Failed to drop. dropCheck: " + dropCheck + ", allowed: " + allowed);
2022-10-19 13:51:46 +00:00
// return item to previous parent
itemDrop . ReturnToSlot ( ) ;
return false ;
//Debug.Log("Resetting parent");
}
else
{
2022-10-29 19:56:00 +00:00
//Debug.LogWarning("SlotUI: Failed to drop. dropCheck: " + dropCheck + ", allowed: " + allowed);
2022-10-19 13:51:46 +00:00
Debug . LogError ( "SlotUI: Something wrong has happened." ) ;
return false ;
}
}
void Awake ( )
{
2023-01-15 11:39:47 +00:00
/ * if ( image = = null )
2022-10-19 13:51:46 +00:00
{
Image [ ] images = GetComponentsInChildren < Image > ( ) ; // This will retrieve the first instance of an image in the FIRST child with the component
//Debug.Log(images.Length);
2022-10-29 19:56:00 +00:00
if ( images . Length > 0 )
2022-10-19 13:51:46 +00:00
{
2022-10-29 19:56:00 +00:00
if ( images [ 0 ] . transform = = transform )
2022-10-19 13:51:46 +00:00
{
2022-10-29 19:56:00 +00:00
if ( images . Length > 1 )
2022-10-19 13:51:46 +00:00
{
image = images [ 1 ] ;
}
}
else
{
image = images [ 0 ] ;
}
}
2023-01-15 11:39:47 +00:00
} * /
2022-10-19 13:51:46 +00:00
2022-10-29 19:56:00 +00:00
if ( grid = = null )
2022-10-19 13:51:46 +00:00
grid = GetComponentInParent < GridUI > ( ) ;
2022-10-29 19:56:00 +00:00
// Check again
if ( grid = = null )
{
cell = new Cell ( 0 , 0 , this , true ) ;
}
if ( TryGetComponent ( out AppendUI aui ) )
2022-10-19 13:51:46 +00:00
{
appendUI = aui ;
}
2022-10-29 19:56:00 +00:00
if ( TryGetComponent ( out LinkedSlotUI lui ) )
{
linkedSlotUI = lui ;
}
2022-11-06 02:28:29 +00:00
if ( TryGetComponent ( out RenderItemUIProperty rp ) )
{
renderProp = GetComponent < RenderItemUIProperty > ( ) ;
SetRenderItemUIPropertyValue ( ) ;
}
if ( TryGetComponent ( out LimitStackSlot lss ) )
{
limitStackSlot = lss ;
}
if ( TryGetComponent ( out LimitStackSlotManager lssm ) )
{
limitStackSlotManager = lssm ;
}
2023-01-15 11:39:47 +00:00
if ( TryGetComponent ( out ChangeSlotTitle cst ) )
{
changeSlotTitle = cst ;
}
2022-11-06 02:28:29 +00:00
}
private void SetRenderItemUIPropertyValue ( )
{
if ( renderProp ! = null )
{
renderProp . value = stackedItems . Count . ToString ( ) ;
}
2022-10-19 13:51:46 +00:00
}
2022-11-06 02:28:29 +00:00
public void AddContainedItemToSlot ( ItemUI item )
{
HideImage ( ) ;
if ( limitStackSlot ! = null )
{
limitStackSlot . Increment ( ) ;
}
stackedItems . Push ( item ) ;
item . transform . SetParent ( transform , false ) ;
item . gameObject . SetActive ( true ) ;
/ *
foreach ( ItemUI item in )
{
itemUI . transform . SetParent ( itemUI . ParentContainer . transform , false ) ;
itemUI . gameObject . SetActive ( false ) ;
stackedItems . Pop ( ) ;
} * /
SetRenderItemUIPropertyValue ( ) ;
}
public void RemoveContainedItemsFromSlot ( )
2022-10-19 13:51:46 +00:00
{
ShowImage ( ) ;
2022-11-06 02:28:29 +00:00
while ( stackedItems . Count > 0 )
{
if ( limitStackSlot ! = null )
{
limitStackSlot . Decrement ( ) ;
}
if ( itemUI . ParentContainer = = null )
{
Debug . LogWarning ( "This should not be null" ) ;
}
if ( itemUI . ParentContainer ! = null )
itemUI . transform . SetParent ( itemUI . ParentContainer . transform , false ) ;
itemUI . gameObject . SetActive ( false ) ;
ItemUI oldItem = stackedItems . Pop ( ) ;
oldItem . SetSlot ( this ) ;
}
SetRenderItemUIPropertyValue ( ) ;
}
public void RemoveDragDropItem ( )
{
if ( BelongsToItemInSlot ! = null & & BelongsToItemInSlot . GetItemUI ( ) ! = null )
{
BelongsToItemInSlot . GetItemUI ( ) . RemoveFromContainedItems ( itemUI ) ;
}
if ( HasSlotsBelongingToItem ! = null )
{
foreach ( SlotUI s in HasSlotsBelongingToItem )
{
s . RemoveContainedItemsFromSlot ( ) ;
}
}
2022-10-29 19:56:00 +00:00
if ( appendUI ! = null )
2022-10-19 13:51:46 +00:00
{
2022-10-29 19:56:00 +00:00
appendUI . RemoveUIFromTransform ( itemUI ) ;
2022-10-19 13:51:46 +00:00
}
2022-11-06 02:28:29 +00:00
if ( limitStackSlot ! = null )
2022-10-19 13:51:46 +00:00
{
2022-11-06 02:28:29 +00:00
limitStackSlot . Decrement ( ) ;
2022-10-19 13:51:46 +00:00
}
2022-11-06 02:28:29 +00:00
if ( limitStackSlotManager ! = null )
{
limitStackSlotManager . UnsetStackSlotLimit ( ) ;
}
2022-10-29 19:56:00 +00:00
2023-01-15 11:39:47 +00:00
if ( changeSlotTitle ! = null )
{
changeSlotTitle . ResetTitle ( ) ;
}
2022-11-06 02:28:29 +00:00
foreach ( SlotUI linked in LinkedSlots )
2022-10-19 13:51:46 +00:00
{
2022-11-06 02:28:29 +00:00
linked . RemoveDragDropItem ( ) ;
2022-10-29 19:56:00 +00:00
}
2022-11-15 22:58:54 +00:00
stackedItems . Pop ( ) ;
foreach ( GroupSlotUI groupSlot in groupSlots )
2022-10-29 19:56:00 +00:00
{
groupSlot . OnItemRemoved ( ) ;
2022-10-19 13:51:46 +00:00
}
2022-11-06 02:28:29 +00:00
UnsetCell ( ) ;
SetRenderItemUIPropertyValue ( ) ;
}
public void UnsetCell ( )
{
if ( itemUI = = null )
{
ShowImage ( ) ;
if ( cell ! = null )
{
cell . inUse = false ;
CellInUse = cell . inUse ;
}
}
2022-10-19 13:51:46 +00:00
}
2023-01-25 07:14:16 +00:00
public bool CanDropOntoSlot ( )
{
bool groupSlotsCheck = false ;
if ( groupSlots . Count = = 0 )
groupSlotsCheck = true ;
else
{
foreach ( GroupSlotUI groupSlotUI in groupSlots )
{
if ( groupSlotUI . IsSlotInShowGameObjects ( this ) & & groupSlotUI . ConditionMet ( ) )
{
groupSlotsCheck = true ;
break ;
}
}
}
// TODO: add check for Limit Slot Stack here
return ( GetItemUI ( ) = = null | | IsStacking ( ) ) & & groupSlotsCheck ;
}
2022-10-19 13:51:46 +00:00
public bool IsSingleCellSlot ( )
{
return width = = 1 & & height = = 1 ;
}
2022-10-29 19:56:00 +00:00
public bool HasStack ( )
{
return itemUI ! = null & & itemUI . Stackable ;
}
2022-11-06 02:28:29 +00:00
public bool IsStacking ( )
{
return StackItemsOnSlot ;
}
2022-10-29 19:56:00 +00:00
2022-10-19 13:51:46 +00:00
// Start is called before the first frame update
void Start ( )
{
2022-11-06 02:28:29 +00:00
if ( HasSlotsBelongingToItem . Count > 0 )
{
foreach ( SlotUI s in HasSlotsBelongingToItem )
{
s . BelongsToItemInSlot = this ;
}
}
else
{
HasSlotsBelongingToItem = null ;
}
2022-10-19 13:51:46 +00:00
}
// Update is called once per frame
void Update ( )
{
2022-12-11 03:03:30 +00:00
if ( InventorySystem . instance . PressedDropItemKey ( false ) | | InventorySystem . instance . PressedEquipItemKey ( false ) )
{
2023-01-29 20:36:11 +00:00
//Debug.Log("pressed");
2022-12-11 03:03:30 +00:00
return ;
}
2022-10-29 19:56:00 +00:00
if ( PointerIsHoveredOver )
{
ItemUI droppedItem = InventorySystem . instance . DraggedItem ;
if ( droppedItem ! = null & & ! droppedItem . PickedUpOnFrame )
{
if ( Input . GetMouseButtonDown ( 0 ) )
{
2022-11-06 02:28:29 +00:00
DroppedOnFrame = true ;
2023-01-27 02:16:31 +00:00
ItemUI potentialContainerItem = cell . item ;
2022-11-06 02:28:29 +00:00
2023-01-27 02:16:31 +00:00
if ( potentialContainerItem ! = null & & potentialContainerItem . DropItemInStorageContainer ( droppedItem ) )
2022-10-29 19:56:00 +00:00
{
2023-01-27 02:16:31 +00:00
// todo: do something, or not, idk
Debug . Log ( "This should have dropped into a storage container" ) ;
}
else
{
bool callback = DropOntoSlot ( droppedItem . gameObject , true ) ;
if ( callback & & droppedItem . Stackable )
2022-10-29 19:56:00 +00:00
{
2023-01-27 02:16:31 +00:00
if ( droppedItem . Count < = 0 )
{
Destroy ( droppedItem . gameObject ) ;
}
else if ( itemUI . Count < droppedItem . Count & & ! droppedStackOntoEmptySlot )
{
InventorySystem . instance . DraggedItem = droppedItem ;
droppedStackOntoEmptySlot = false ;
}
2022-10-29 19:56:00 +00:00
}
}
}
else if ( Input . GetMouseButtonDown ( 1 ) & & droppedItem . Stackable )
{
2022-11-06 02:28:29 +00:00
DroppedOnFrame = true ;
2022-10-29 19:56:00 +00:00
Debug . Log ( "Right Click" ) ;
2022-11-06 02:28:29 +00:00
if ( DropOntoSlot ( droppedItem . gameObject , false ) )
2022-10-29 19:56:00 +00:00
{
if ( droppedItem . Count < = 0 )
2022-11-06 02:28:29 +00:00
{
2022-10-29 19:56:00 +00:00
Destroy ( droppedItem . gameObject ) ;
2022-11-06 02:28:29 +00:00
}
2022-10-29 19:56:00 +00:00
else
{
InventorySystem . instance . DraggedItem = droppedItem ;
droppedItem . transform . SetParent ( InventorySystem . instance . inventoryUI . transform ) ;
droppedStackOntoEmptySlot = false ;
}
}
}
}
}
2022-11-06 02:28:29 +00:00
// TODO: make sure the key combo works as expected
if ( Input . GetMouseButtonUp ( 0 ) )
{
DroppedOnFrame = false ;
}
2022-10-29 19:56:00 +00:00
}
2022-10-19 13:51:46 +00:00
2022-10-29 19:56:00 +00:00
public void SetCell ( Cell cell )
{
this . cell = cell ;
2022-10-19 13:51:46 +00:00
}
internal void HideImage ( )
{
2022-11-06 02:28:29 +00:00
if ( image ! = null )
2022-10-19 13:51:46 +00:00
{
2023-01-15 11:39:47 +00:00
image . color = new Color ( image . color . r , image . color . g , image . color . b , 0f ) ;
//image.enabled = false;
2022-12-23 03:50:16 +00:00
//image.color = new Color(image.color.r, image.color.g, image.color.b, 1);
2022-10-19 13:51:46 +00:00
}
}
internal void ShowImage ( )
{
if ( image ! = null )
{
2022-12-23 03:50:16 +00:00
//image.color = new Color(image.color.r, image.color.g, image.color.b, 0);
2022-10-19 13:51:46 +00:00
image . color = new Color ( image . color . r , image . color . g , image . color . b , 1 ) ;
}
}
2022-10-29 19:56:00 +00:00
public void OnPointerExit ( PointerEventData eventData )
{
2022-11-06 02:28:29 +00:00
//PointerIsHoveredOver = false;
2022-10-29 19:56:00 +00:00
}
public void OnPointerEnter ( PointerEventData eventData )
{
2022-11-06 02:28:29 +00:00
//PointerIsHoveredOver = true;
2022-10-29 19:56:00 +00:00
}
2022-10-19 13:51:46 +00:00
}
}