-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathV2CardManager.cs
49 lines (41 loc) · 1.22 KB
/
V2CardManager.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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Demo
{
public class V2CardManager : CardEase.CardManager<V2CardModel>
{
Image cardImage;
[SerializeField] GameObject selected;
void Awake()
{
cardImage = GetComponent<Image>();
}
public void ToggleSelection()
{
this.UpdateSelection(!this.isSelected);
}
public override void SetData(V2CardModel 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);
}
else
{
cardImage.color = new Color(cardImage.color.r, cardImage.color.g, cardImage.color.b, cardImage.color.a) / 0.8f;
selected.SetActive(false);
}
}
}
}