summaryrefslogtreecommitdiff
path: root/Thronefall_v1.0/Decompile/QuestTagUI.cs
blob: 0930a9ce22c9591fc3343c57683b5a5a89df80a3 (plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class QuestTagUI : MonoBehaviour
{
	[Header("Setup")]
	public Image completeImage;

	public Color completeColor;

	public Color incompleteColor;

	public TMP_Text description;

	public Image icon1;

	public GameObject crossedOut1;

	public Image icon2;

	public GameObject crossedOut2;

	public Image icon3;

	public GameObject crossedOut3;

	public TMP_Text goalNumber;

	[Header("Quest Texts")]
	public string completeLevel = "Achieve a victory.";

	public string achieveScoreOf = "Achieve score:";

	public string winWith = "Win with:";

	public string winWithout = "Win without:";

	public void UpdateVisualization(Quest _quest, LevelData _levelData)
	{
		if (_quest == null || _levelData == null)
		{
			base.gameObject.SetActive(value: false);
			return;
		}
		base.gameObject.SetActive(value: true);
		bool flag = _quest.CheckBeaten(_levelData);
		completeImage.color = (flag ? completeColor : incompleteColor);
		crossedOut1.SetActive(value: false);
		crossedOut2.SetActive(value: false);
		crossedOut3.SetActive(value: false);
		icon1.gameObject.SetActive(value: false);
		icon2.gameObject.SetActive(value: false);
		icon3.gameObject.SetActive(value: false);
		goalNumber.gameObject.SetActive(value: false);
		switch (_quest.questType)
		{
		case Quest.EType.BeatTheLevel:
			description.text = completeLevel;
			break;
		case Quest.EType.AchieveScoreOf:
			description.text = achieveScoreOf;
			goalNumber.gameObject.SetActive(value: true);
			goalNumber.text = _quest.achieveScoreOf.ToString();
			break;
		case Quest.EType.BeatTheLevelWith:
			icon1.gameObject.SetActive(_quest.beatTheLevelWith.Count > 0);
			icon2.gameObject.SetActive(_quest.beatTheLevelWith.Count > 1);
			icon3.gameObject.SetActive(_quest.beatTheLevelWith.Count > 2);
			if (_quest.beatTheLevelWith.Count > 0)
			{
				icon1.sprite = _quest.beatTheLevelWith[0].icon;
			}
			if (_quest.beatTheLevelWith.Count > 1)
			{
				icon2.sprite = _quest.beatTheLevelWith[1].icon;
			}
			if (_quest.beatTheLevelWith.Count > 2)
			{
				icon3.sprite = _quest.beatTheLevelWith[2].icon;
			}
			description.text = winWith;
			break;
		case Quest.EType.BeatTheLevelWithout:
			description.text = winWithout;
			crossedOut1.SetActive(value: true);
			crossedOut2.SetActive(value: true);
			crossedOut3.SetActive(value: true);
			icon1.gameObject.SetActive(_quest.beatTheLevelWithout.Count > 0);
			icon2.gameObject.SetActive(_quest.beatTheLevelWithout.Count > 1);
			icon3.gameObject.SetActive(_quest.beatTheLevelWithout.Count > 2);
			if (_quest.beatTheLevelWithout.Count > 0)
			{
				icon1.sprite = _quest.beatTheLevelWithout[0].icon;
			}
			if (_quest.beatTheLevelWithout.Count > 1)
			{
				icon3.sprite = _quest.beatTheLevelWithout[1].icon;
			}
			if (_quest.beatTheLevelWithout.Count > 2)
			{
				icon3.sprite = _quest.beatTheLevelWithout[2].icon;
			}
			break;
		}
	}
}