Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
WidgetQuestTracker.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine.UI;
3
5{
7
8 public List<ItemQuestTracker> items;
9
11
12 public LayoutGroup layout;
13
14 private void OnEnable()
15 {
16 InvokeRepeating("Refresh", 0.5f, 0.5f);
17 }
18
19 private void OnDisable()
20 {
21 CancelInvoke();
22 }
23
24 public override void OnActivate()
25 {
26 Instance = this;
27 Refresh();
28 }
29
30 public void Refresh()
31 {
32 if (EMono.game == null || (bool)LayerDrama.Instance)
33 {
34 return;
35 }
36 foreach (Quest item in EMono.game.quests.list)
37 {
38 if (!item.track)
39 {
40 continue;
41 }
42 ItemQuestTracker itemQuestTracker = null;
43 foreach (ItemQuestTracker item2 in items)
44 {
45 if (item2.quest == item)
46 {
47 itemQuestTracker = item2;
48 break;
49 }
50 }
51 if (!(itemQuestTracker != null))
52 {
53 itemQuestTracker = Util.Instantiate(mold, layout);
54 itemQuestTracker.SetActive(enable: false);
55 itemQuestTracker.quest = item;
56 items.Add(itemQuestTracker);
57 }
58 }
59 items.ForeachReverse(delegate(ItemQuestTracker i)
60 {
61 i.Refresh();
62 });
63 this.RebuildLayout();
64 if (items.Count == 0)
65 {
66 EMono.ui.widgets.DeactivateWidget(this);
67 }
68 else
69 {
70 EMono.player.questTracker = true;
71 }
72 }
73
74 public static void Show()
75 {
76 if (!EMono.ui.widgets.GetWidget("QuestTracker"))
77 {
78 EMono.ui.widgets.Toggle("QuestTracker");
79 }
80 }
81
82 public static bool TryShow()
83 {
84 bool flag = false;
85 foreach (Quest item in EMono.game.quests.list)
86 {
87 if (item.track)
88 {
89 flag = true;
90 }
91 }
92 if (flag || (bool)EMono.ui.widgets.GetWidget("QuestTracker"))
93 {
94 EMono.ui.widgets.Toggle("QuestTracker")?.SoundActivate();
95 return false;
96 }
97 if (!EMono.ui.GetLayer<LayerJournal>())
98 {
99 EMono.ui.ToggleLayer<LayerJournal>().SwitchContent(0, 0);
100 }
101 return true;
102 }
103}
Definition: EMono.cs:4
static Game game
Definition: EMono.cs:7
static UI ui
Definition: EMono.cs:15
QuestManager quests
Definition: Game.cs:179
static LayerDrama Instance
Definition: LayerDrama.cs:20
List< Quest > list
Definition: QuestManager.cs:11
Definition: Quest.cs:7
List< ItemQuestTracker > items
override void OnActivate()
ItemQuestTracker mold
static WidgetQuestTracker Instance
Definition: Widget.cs:7