Newer
Older
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
using UnityEngine;
using UnityEngine.UI;
public class Notiz : MonoBehaviour
{
public Button Antworteins;
public Button Antwortzwei; // Richtige Antwort
public Button Antwortdrei;
public Color correctAnswerColor = Color.green;
public Color falseAnswerColor = Color.red;
void Start()
{
Antwortzwei.onClick.AddListener(OnAntwortzweiClicked);
Antworteins.onClick.AddListener(OnAntworteinsClicked);
}
private void OnAntwortzweiClicked()
{
Debug.Log("Antwort zwei Button geklickt");
Transform frontPlateTransform = Antwortzwei.transform.Find("ButtonContent/CompressableButtonVisuals/FrontPlate");
if (frontPlateTransform != null)
{
Image frontPlateImage = frontPlateTransform.GetComponent<Image>();
if (frontPlateImage != null)
{
frontPlateImage.color = correctAnswerColor;
Debug.Log("Farbe gendert zu Grn");
}
else
{
Debug.LogError("Image component not found on FrontPlate!");
}
}
else
{
Debug.LogError("FrontPlate not found!");
}
}
private void OnAntworteinsClicked()
{
Debug.Log("Antwort eins Button geklickt");
Transform frontPlateTransform = Antworteins.transform.Find("ButtonContent/CompressableButtonVisuals/FrontPlate");
if (frontPlateTransform != null)
{
Image frontPlateImage = frontPlateTransform.GetComponent<Image>();
if (frontPlateImage != null)
{
frontPlateImage.color = falseAnswerColor;
Debug.Log("Farbe gendert zu Rot");
}
else
{
Debug.LogError("Image component not found on FrontPlate!");
}
}
else
{
Debug.LogError("FrontPlate not found!");
}
}
}