Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_OnlineServiceWorkshop.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
2 class SCR_ScriptPlatformRequestCallback : ScriptPlatformRequestCallback
3 {
4  ref ScriptInvoker m_OnResult = new ScriptInvoker; // (UserPrivilege privilege, UserPrivilegeResult result)
5 
6 
7  //------------------------------------------------------------------------------------------------
8  override void OnPrivilegeResult(UserPrivilege privilege, UserPrivilegeResult result)
9  {
10  m_OnResult.Invoke(privilege, result);
11  }
12 };
13 
14 
15 //------------------------------------------------------------------------------------------------
17 {
18  ref ScriptInvoker m_OnDownloading = new ScriptInvoker();
19  ref ScriptInvoker m_OnSuccess = new ScriptInvoker();
20  ref ScriptInvoker m_OnItem = new ScriptInvoker();
21  ref ScriptInvoker m_OnDownloadSuccess = new ScriptInvoker();
22  ref ScriptInvoker m_OnUnsubscribe = new ScriptInvoker();
23  ref ScriptInvoker m_OnScenarios = new ScriptInvoker();
24  ref ScriptInvoker m_OnImage = new ScriptInvoker();
25  ref ScriptInvoker m_OnDependencies = new ScriptInvoker();
26 
27  ref ScriptInvoker m_OnError = new ScriptInvoker();
28  ref ScriptInvoker m_OnTimeout = new ScriptInvoker();
29 
30  //------------------------------------------------------------------------------------------------
32  {
33  m_OnDownloading = null;
34  m_OnSuccess = null;
35  m_OnItem = null;
36  m_OnDownloadSuccess = null;
37  m_OnUnsubscribe = null;
38  m_OnDependencies = null;
39  m_OnImage = null;
40 
41  }
42 
43  //------------------------------------------------------------------------------------------------
44  override void OnSuccess(int code)
45  {
46  switch (code)
47  {
48  case EBackendRequest.EBREQ_WORKSHOP_GetDownloadURL:
49  m_OnDownloading.Invoke();
50  break;
51 
52  case EBackendRequest.EBREQ_WORKSHOP_GetAsset:
53  m_OnItem.Invoke(code);
54  break;
55 
56  case EBackendRequest.EBREQ_WORKSHOP_DownloadAsset:
57  m_OnDownloadSuccess.Invoke(code);
58  break;
59 
60  case EBackendRequest.EBREQ_WORKSHOP_DeleteSubscriptions:
61  m_OnUnsubscribe.Invoke();
62  break;
63 
64  case EBackendRequest.EBREQ_WORKSHOP_GetDependencyTree:
65  m_OnDependencies.Invoke(code);
66  break;
67 
68  case EBackendRequest.EBREQ_WORKSHOP_DownloadImage:
69  m_OnImage.Invoke(code);
70  break;
71 
72  case EBackendRequest.EBREQ_WORKSHOP_GetAssetScenarios:
73  m_OnScenarios.Invoke(code);
74  break;
75 
76 
77  }
78 
79  }
80 
81  //------------------------------------------------------------------------------------------------
82  override void OnError( EBackendError code, int restCode, int apiCode )
83  {
84  Print("[BackendCallback] OnError: "+ g_Game.GetBackendApi().GetErrorCode(code) + " RestCode: " + restCode + " ApiCode: "+apiCode);
85  m_OnError.Invoke(code);
86  }
87 
88  override void OnTimeout()
89  {
90  Print("[BackendCallback] OnTimeout");
91  m_OnTimeout.Invoke();
92  }
93 };
94 
95 
97 // Callbacks for specific workshop requests
99 
100 //-----------------------------------------------------------------------------------------------
102 {
103  // Script invokers for generic results
104  ref ScriptInvoker m_OnError = new ScriptInvoker;
105  ref ScriptInvoker m_OnTimeout = new ScriptInvoker;
106  ref ScriptInvoker m_OnSuccess = new ScriptInvoker;
107 
108  //------------------------------------------------------------------------------------------------
110  {
111  #ifdef WORKSHOP_DEBUG
112  Print(string.Format("%1 new", this), LogLevel.DEBUG);
113  #endif
114  }
115 
116  //------------------------------------------------------------------------------------------------
118  {
119  #ifdef WORKSHOP_DEBUG
120  Print(string.Format("%1 Delete", this), LogLevel.DEBUG);
121  #endif
122  }
123 
124  //------------------------------------------------------------------------------------------------
125  override void OnSuccess( int code )
126  {
127  #ifdef WORKSHOP_DEBUG
128  Print(string.Format("%1 OnSuccess: %2", this, typename.EnumToString(EBackendRequest, code)), LogLevel.DEBUG);
129  #endif
130  m_OnSuccess.Invoke(this, code);
131  }
132 
133  //------------------------------------------------------------------------------------------------
134  override void OnError(EBackendError code, int restCode, int apiCode )
135  {
136  Print(string.Format("%1 OnError: %2 %3 %4", this, typename.EnumToString(EBackendError, code), restCode, apiCode), LogLevel.ERROR);
137  m_OnError.Invoke(this, code, restCode, apiCode);
138  }
139 
140  //------------------------------------------------------------------------------------------------
141  override void OnTimeout()
142  {
143  Print(string.Format("%1 OnTimeout", this), LogLevel.ERROR);
144  m_OnTimeout.Invoke(this);
145  }
146 };
147 
148 
149 //-----------------------------------------------------------------------------------------------
151 {
152 
153 };
154 
155 //-----------------------------------------------------------------------------------------------
157 {
158 
159 };
160 
161 
162 //-----------------------------------------------------------------------------------------------
163 // WorkshopApi.RequestPage
165 {
166  int m_iPageId;
167 
168  ref ScriptInvoker m_OnDownloadImage = new ScriptInvoker;
169  ref ScriptInvoker m_OnGetAssets = new ScriptInvoker;
170 
171 
172  void SCR_WorkshopApiCallback_RequestPage(int pageId)
173  {
174  m_iPageId = pageId;
175 
176  #ifdef WORKSHOP_DEBUG
177  Print(string.Format("%1 New: page: %2", this, this.m_iPageId), LogLevel.DEBUG);
178  #endif
179  }
180 
181  void ~SCR_WorkshopApiCallback_RequestPage(ContentBrowserUI contentBrowser, int tabId, int pageId)
182  {
183  #ifdef WORKSHOP_DEBUG
184  Print(string.Format("%1 Delete: page: %2", this, this.m_iPageId), LogLevel.DEBUG);
185  #endif
186  }
187 
188  //------------------------------------------------------------------------------------------------
189  override void OnSuccess(int code)
190  {
191  super.OnSuccess(code);
192 
193  switch (code)
194  {
195  case EBackendRequest.EBREQ_WORKSHOP_GetAssetList:
196  m_OnGetAssets.Invoke(this);
197  break;
198 
199  case EBackendRequest.EBREQ_WORKSHOP_DownloadImage:
200  m_OnDownloadImage.Invoke(this);
201  break;
202  }
203  }
204 };
205 
206 
207 
208 //-----------------------------------------------------------------------------------------------
209 // WorkshopItem.AskDetails
211 {
212  WorkshopItem m_Item;
213  ref ScriptInvoker m_OnGetAsset = new ScriptInvoker;
214  ref ScriptInvoker m_OnGetDependencyTree = new ScriptInvoker;
215  ref ScriptInvoker m_OnDownloadImage = new ScriptInvoker;
216  ref ScriptInvoker m_OnGetAssetScenarios = new ScriptInvoker; // outdated
217 
218  //-----------------------------------------------------------------------------------------------
219  void SCR_WorkshopItemCallback_AskDetails(WorkshopItem item)
220  {
221  m_Item = item;
222  }
223 
224  //-----------------------------------------------------------------------------------------------
225  override void OnSuccess(int code)
226  {
227  super.OnSuccess(code);
228 
229  switch (code)
230  {
231  case EBackendRequest.EBREQ_WORKSHOP_GetAsset: //
232  m_OnGetAsset.Invoke(this);
233  break;
234 
235  case EBackendRequest.EBREQ_WORKSHOP_GetDependencyTree: //
236  m_OnGetDependencyTree.Invoke(this);
237  break;
238 
239  case EBackendRequest.EBREQ_WORKSHOP_DownloadImage: //
240  m_OnDownloadImage.Invoke(this);
241  break;
242 
243  case EBackendRequest.EBREQ_WORKSHOP_GetAssetScenarios: //
244  m_OnGetAssetScenarios.Invoke(this);
245  break;
246  }
247  }
248 };
249 
250 
251 
252 //-----------------------------------------------------------------------------------------------
253 // WorkshopItem.Rate, WorkshopItem.ResetRating
255 {
256 
257 };
258 
259 //-----------------------------------------------------------------------------------------------
260 // WorkshopItem.LoadMyReport
262 {
263 };
264 
265 //-----------------------------------------------------------------------------------------------
266 // ImageScale.Download
268 {
269  ImageScale m_Scale;
270 };
SCR_OnlineServiceBackendCallbacks
Definition: SCR_OnlineServiceWorkshop.c:16
SCR_WorkshopApiCallback_RequestPage
Definition: SCR_OnlineServiceWorkshop.c:164
m_Item
NewsFeedItem m_Item
Definition: SCR_NewsSubMenu.c:2
SCR_WorkshopItemCallback_LoadScenarios
Definition: SCR_OnlineServiceWorkshop.c:156
SCR_ScriptPlatformRequestCallback
Definition: SCR_OnlineServiceWorkshop.c:2
SCR_WorkshopItemCallback_LoadDependencies
Definition: SCR_OnlineServiceWorkshop.c:150
SCR_WorkshopItemCallback_LoadMyReport
Definition: SCR_OnlineServiceWorkshop.c:261
SCR_WorkshopCallbackBase
Definition: SCR_OnlineServiceWorkshop.c:101
SCR_WorkshopItemCallback_Rate
Definition: SCR_OnlineServiceWorkshop.c:254
BackendCallback
Base server browser callback.
Definition: SCR_ServerListComponent.c:4
SCR_WorkshopItemCallback_AskDetails
Definition: SCR_OnlineServiceWorkshop.c:210
SCR_WorkshopItemCallback_DownloadImage
Definition: SCR_OnlineServiceWorkshop.c:267