7 protected string m_sEntryList;
9 protected Widget m_wEntryList;
12 protected string m_sEntryLayout;
14 protected Widget m_wEntryLayout;
16 protected ref array<SCR_MapJournalUIButton> m_aEntries = {};
17 protected int m_iCurrentEntryId = -1;
20 protected string m_sRootWidgetName;
22 protected Widget m_wJournalFrame;
24 [
Attribute(
"exclamationCircle",
desc:
"Toolmenu imageset quad name")]
25 protected string m_sToolMenuIconName;
32 [
Attribute(
"MapTaskListFrame",
desc:
"Map task list frame widget name")]
33 protected string m_sMapTaskListFrame;
35 [
Attribute(
"faction",
desc:
"Map task list imageset quad name")]
36 protected string m_sTaskListToolMenuIconName;
39 protected bool m_bFirstOpening =
true;
44 SCR_RespawnBriefingComponent briefingComp = SCR_RespawnBriefingComponent.GetInstance();
48 if (!briefingComp.LoadJournalConfig())
51 m_JournalConfig = briefingComp.GetJournalSetup();
65 override void OnMapOpen(MapConfiguration config)
67 super.OnMapOpen(config);
72 m_wJournalFrame =
m_RootWidget.FindAnyWidget(m_sRootWidgetName);
78 m_wEntryLayout =
m_RootWidget.FindAnyWidget(m_sEntryLayout);
82 PlayerController pc =
GetGame().GetPlayerController();
92 GetJournalForPlayer();
99 ShowEntryByID(m_JournalConfig.GetJournalEntryToBeShown());
100 m_bFirstOpening =
false;
105 ShowEntryByID(m_iCurrentEntryId);
114 m_wEntryLayout.SetVisible(
false);
115 GetJournalForPlayer();
121 protected void ToggleVisible()
123 if (!m_wJournalFrame || !m_ToolMenu)
126 array<ref SCR_MapToolEntry> menuEntries = {};
127 menuEntries = m_ToolMenu.GetMenuEntries();
128 if (!menuEntries && menuEntries.IsEmpty())
133 if (toolEntry.GetImageSet() != m_sTaskListToolMenuIconName)
136 Widget mapTaskListFrame =
m_RootWidget.FindAnyWidget(m_sMapTaskListFrame);
137 if (mapTaskListFrame && mapTaskListFrame.IsVisible())
139 mapTaskListFrame.SetVisible(
false);
140 toolEntry.SetActive(
false);
144 m_UITaskManager.Action_TasksClose();
148 bool visible = m_wJournalFrame.IsVisible();
149 m_wJournalFrame.SetVisible(!visible);
155 protected void GetJournalForPlayer()
157 Widget child = m_wEntryList.GetChildren();
160 Widget sibling = child.GetSibling();
165 m_iCurrentEntryId = -1;
167 FactionKey factionKey = FactionKey.Empty;
172 factionKey = plyFaction.GetFactionKey();
179 array<ref SCR_JournalEntry> journalEntries = factionJournal.GetEntries();
182 SCR_MapJournalUIButton entryBtn;
183 WorkspaceWidget workspace =
GetGame().GetWorkspace();
184 for (
int entryId = 0; entryId < journalEntries.Count(); ++entryId)
186 entry = journalEntries[entryId];
187 e = workspace.CreateWidgets(entry.GetEntryButtonLayout(), m_wEntryList);
188 entryBtn = SCR_MapJournalUIButton.Cast(e.FindHandler(SCR_MapJournalUIButton));
189 entryBtn.SetContent(entry.GetEntryName());
190 entryBtn.SetEntry(entry, entryId);
191 entryBtn.m_OnClicked.Insert(ShowEntry);
199 protected void ShowEntryByID(
int id)
203 SCR_MapJournalUIButton entryBtn;
204 Widget child = m_wEntryList.GetChildren();
207 entryBtn = SCR_MapJournalUIButton.Cast(child.FindHandler(SCR_MapJournalUIButton));
211 if (entryBtn.GetId() ==
id)
217 child = child.GetSibling();
222 protected void ShowEntry(SCR_MapJournalUIButton journalBtn)
224 if (journalBtn.GetId() == m_iCurrentEntryId)
226 m_wEntryLayout.SetVisible(!m_wEntryLayout.IsVisible());
230 Widget child = m_wEntryLayout.GetChildren();
234 m_iCurrentEntryId = journalBtn.GetId();
235 journalBtn.ShowEntry(m_wEntryLayout);
236 m_wEntryLayout.SetVisible(
true);
260 m_Entry.SetEntryLayoutTo(target);