11 protected static float LOADING_DELAY = 500;
14 protected ref Revision m_ItemTargetRevision;
18 protected ref ScriptInvoker<> m_OnDownloadConfirmDisplayed =
new ScriptInvoker<>();
21 ScriptInvoker GetOnDownloadConfirmDisplayed()
23 return m_OnDownloadConfirmDisplayed;
34 if (previous && previous.m_bWaitingResponse)
43 protected void CreateLoadingOverlay()
46 if (!m_bWaitingResponse)
60 override protected void AllPatchSizeLoaded()
64 callback.GetEventOnResponse().Insert(OnItemPatchLoaded);
65 m_aPatchSizeCallbacks.Insert(
callback);
67 m_ItemTargetRevision.ComputePatchSize(
callback);
72 protected void HandleError()
74 if (m_bWaitingResponse || !m_bFailed)
88 GetGame().GetCallqueue().CallLater(SetupAddonFail, 0,
false, action);
93 m_bWaitingResponse =
false;
107 protected void ShowRestrictedItemDialog()
109 m_bWaitingResponse =
false;
120 protected void ShowConfirmationUI()
125 if (m_bRestrictedAddons)
132 array<ref SCR_WorkshopItem> dependenciesToLoad = {};
140 if (m_OnDownloadConfirmDisplayed)
141 m_OnDownloadConfirmDisplayed.Invoke(
this, confirmDialog);
150 if (!m_bSubscribeToAddons)
154 m_Item.SetSubscribed(
true);
158 dependency.SetSubscribed(
true);
172 super.OnItemError(item);
177 override protected void OnAllDependenciesDetailsLoaded()
183 GetOnRestrictedDependency().Insert(OnRestrictedDependenciesFound);
185 super.OnAllDependenciesDetailsLoaded();
189 protected void OnRestrictedDependenciesFound(
SCR_DownloadSequence sequence, array<ref SCR_WorkshopItem> dependencies)
191 ShowRestrictedDependenciesDialog();
192 GetOnRestrictedDependency().Remove(OnRestrictedDependenciesFound);
200 m_Item.m_OnDependenciesLoaded.Remove(OnItemDependenciesLoaded);
205 if (item.GetRestricted())
207 ShowRestrictedItemDialog();
214 OnAllDependenciesDetailsLoaded();
220 LoadDependenciesDetails();
227 if (!item.GetRequestFailed())
230 GetGame().GetCallqueue().Remove(CreateLoadingOverlay);
251 m_ItemTargetRevision.GetPatchSize(size);
252 m_Item.SetTargetRevisionPatchSize(size);
255 m_bWaitingResponse =
false;
260 m_OnReady.Invoke(
this);
262 ShowConfirmationUI();
275 m_ItemTargetRevision = itemTargetRevision;
276 m_Item.SetItemTargetRevision(itemTargetRevision);
278 m_bWaitingResponse =
true;
281 m_Item.m_OnDependenciesLoaded.Insert(OnItemDependenciesLoaded);
283 m_Item.m_OnGetAsset.Insert(OnItemGetAsset);
284 m_Item.m_OnError.Insert(OnItemError);
285 m_Item.m_OnTimeout.Insert(OnItemError);
289 GetGame().GetCallqueue().CallLater(CreateLoadingOverlay, LOADING_DELAY);
295 #ifdef WORKSHOP_DEBUG
296 ContentBrowserUI._print(
string.Format(
"SCR_WorkshopDownloadSequence: Delete for: %1",
m_Item.GetName()));
303 m_Item.m_OnDependenciesLoaded.Remove(OnItemDependenciesLoaded);