-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathV3CardManager.cs
65 lines (54 loc) · 1.8 KB
/
V3CardManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System.Collections;
using System.Collections.Generic;
using CardEase;
using UnityEngine;
using UnityEngine.UI;
namespace Demo
{
public class V3CardManager : CardEase.CardManager<V3CardModel>
{
Image cardImage;
public V3CardModel cardData;
[SerializeField] GameObject selected;
void Awake()
{
cardImage = GetComponent<Image>();
}
public void ToggleSelection()
{
this.UpdateSelection(!this.isSelected);
}
public override void SetData(V3CardModel cardModel)
{
this.cardData = cardModel;
if (cardModel.image != null)
{
this.cardImage.sprite = cardModel.image;
}
}
public override void UpdateSelection(bool isSelected)
{
this.isSelected = isSelected;
if (this.isSelected)
{
cardImage.color = new Color(cardImage.color.r, cardImage.color.g, cardImage.color.b, cardImage.color.a) * 0.8f;
selected.SetActive(true);
CardEase.EventManager<V3CardModel, V3CardManager>.CARD_SELECTED.Invoke(this);
}
else
{
cardImage.color = new Color(cardImage.color.r, cardImage.color.g, cardImage.color.b, cardImage.color.a) / 0.8f;
selected.SetActive(false);
CardEase.EventManager<V3CardModel, V3CardManager>.CARD_DESELECTED.Invoke(this);
}
}
public override void CardPicked()
{
CardEase.EventManager<V3CardModel, V3CardManager>.CARD_PICKED.Invoke(this);
}
public override void CardDropped()
{
CardEase.EventManager<V3CardModel, V3CardManager>.CARD_DROOPED.Invoke(this);
}
}
}