ui/CardTypePanelElement.razor
@using Sandbox;
@using Sandbox.UI;
@inherits Panel
@attribute [StyleSheet("CardTypePanelElement.razor.scss")]

<root style="width:@(Size)px; height:@(Size)px;">
	<div class="icon_container">
		@if(!Matched) 
		{
			<div class="icon" style="background-image:url(@Card.GetIconFilename(CardType)); left: -2px; bottom: -5px; filter: brightness(0) blur(3px); opacity: 0.7;"></div>
		}
		
		<div class="icon @(Matched ? "matched" : "normal")" style="background-image:url(@Card.GetIconFilename(CardType));"></div>
	</div>

	@if( !Matched && TypeIndexUnmatched == 0 && Manager.Instance.Bounties.ContainsKey(CardType) )
	{
		var bountyData = Manager.Instance.Bounties[CardType];
		var size = Size * 0.8f;
		var left = size * Utils.Map(Manager.Instance.NumPairs, 8, 20, 0.85f, 1f, EasingType.Linear);

		<BountyElement CardType=@CardType Size=@size Index=@Index TypeIndexUnmatched=@TypeIndexUnmatched BountyData=@bountyData style="left: -@(left)px; top: @(size * 0.12f)px;" />
	}
</root>

@code
{
	public CardType CardType { get; set; }
	public float Size { get; set; }
	public bool Matched { get; set; }
	public int Index { get; set; }
	public int TypeIndexUnmatched { get; set; }

	protected override void OnMouseOver(MousePanelEvent e)
	{
		base.OnMouseOver(e);

		Manager.Instance.HoveredPanelType = CardType;
		Manager.Instance.HoveredPanelIndex = Index;
		Manager.Instance.IsHoveringBounty = false;

		if(Manager.Instance.TimeSinceHoverSfx > 0.025f)
		{
			Manager.Instance.PlaySfx("click_1", new Vector3(100f, 0f, 0f), volume: (Matched ? 0.8f : 1f), pitch: (Matched ? 0.75f : 1f));
			Manager.Instance.TimeSinceHoverSfx = 0f;
		}
	}

	protected override void OnMouseOut(MousePanelEvent e)
	{
		base.OnMouseOut(e);

		if(Manager.Instance.HoveredPanelIndex == Index && !Manager.Instance.IsHoveringBounty)
		{
			Manager.Instance.HoveredPanelType = CardType.None;
			Manager.Instance.HoveredPanelIndex = -1;
		}
	}

	protected override int BuildHash()
	{
		return HashCode.Combine(
			CardType,
			Size,
			Matched,
			Manager.Instance.Bounties.Count()
		);
	}
}