Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_WorkshopDialogs.c
Go to the documentation of this file.
1
/*
2
Common dialogs in Workshop
3
// TODO: Cleanup and update looks
4
*/
5
6
class
SCR_WorkshopDialogs
7
{
8
static
const
ResourceName
DIALOGS_CONFIG =
"{26F075E5D30629E5}Configs/ContentBrowser/ContentBrowserDialogs.conf"
;
9
static
const
string
WIDGET_LIST =
"AddonList"
;
10
11
//------------------------------------------------------------------------------------------------
12
static
SCR_ConfigurableDialogUi
CreateDialog(
string
presetName)
13
{
14
return
SCR_ConfigurableDialogUi
.
CreateFromPreset
(DIALOGS_CONFIG, presetName);
15
}
16
}
17
18
class
SCR_FailedModsDownloadDialog :
SCR_ConfigurableDialogUi
19
{
20
protected
static
const
string
FAILED_ADDON_LIST_DIALOG
=
"failed_dialogs_list"
;
21
protected
const
string
STR_AFFECTED_MODS
=
"#AR-Workshop_FailedModsDownload"
;
22
protected
const
string
FAILED_ADDON_FORMAT
=
"- %1 \n"
;
23
24
protected
const
string
MESSAGE_ERROR_UNKNOWN
=
"#AR-AddonValidate_Error_Unknown_UC"
;
25
protected
const
string
MESSAGE_ERROR_BUSY
=
"#AR-AddonValidate_Error_Busy_UC"
;
26
protected
const
string
MESSAGE_ERROR_AUTH
=
"#AR-AddonValidate_Error_NoInternet_UC"
;
27
protected
const
string
MESSAGE_ERROR_STORAGE
=
"#AR-AddonValidate_Error_AvailableSpace_UC"
;
28
29
protected
static
ref SCR_FailedModsDownloadDialog
m_Instance
;
30
31
protected
ref array<SCR_WorkshopItemActionDownload>
m_aDisplayedActions
= {};
32
33
//------------------------------------------------------------------------------------------
34
static
void
ShowFailedModsDialog(SCR_WorkshopItemActionDownload action,
int
reason
)
35
{
36
// Add failed addons to dialog
37
if
(
m_Instance
)
38
{
39
m_Instance
.UpdateFailedModsDialogContent(action,
false
);
40
return
;
41
}
42
43
string
message
;
44
45
// Choose message dialog
46
switch
(
reason
)
47
{
48
default
:
49
case
EBackendError
.EBERR_UNKNOWN:
message
=
MESSAGE_ERROR_UNKNOWN
;
break
;
// Unknown
50
case
EBackendError
.EBERR_BUSY:
message
=
MESSAGE_ERROR_BUSY
;
break
;
// Mod is busy doing something else
51
case
EBackendError
.EBERR_AUTH_FAILED:
message
=
MESSAGE_ERROR_AUTH
;
break
;
// Cant login ?
52
case
EBackendError
.EBERR_STORAGE_IS_FULL:
message
=
MESSAGE_ERROR_STORAGE
;
break
;
// No Available space
53
}
54
55
if
(!
message
.IsEmpty())
56
message
+=
"\n"
;
57
58
// Create dialog
59
m_Instance
=
new
SCR_FailedModsDownloadDialog();
60
61
CreateFromPreset
(SCR_WorkshopDialogs.DIALOGS_CONFIG,
FAILED_ADDON_LIST_DIALOG
,
m_Instance
);
62
m_Instance
.SetMessageFormat(
message
,
reason
);
63
m_Instance
.UpdateFailedModsDialogContent(action,
true
);
64
}
65
66
//------------------------------------------------------------------------------------------------
67
void
SetMessageFormat
(
string
text,
int
reason
)
68
{
69
if
(m_wMessage)
70
{
71
m_wMessage.SetVisible(
true
);
72
m_wMessage.SetTextFormat(text,
reason
);
73
}
74
}
75
76
//-----------------------------------------------------------------------------------------------
77
override
void
Close
()
78
{
79
super.Close();
80
81
m_Instance
= null;
82
}
83
84
//-----------------------------------------------------------------------------------------------
85
protected
void
UpdateFailedModsDialogContent
(
SCR_WorkshopItemActionDownload
action,
bool
initial)
86
{
87
if
(!action)
88
return
;
89
90
Widget
contentWidget =
GetContentLayoutRoot
();
91
if
(!contentWidget)
92
return
;
93
94
SCR_MessageDialogContent
content
=
SCR_MessageDialogContent
.Cast(contentWidget.FindHandler(
SCR_MessageDialogContent
));
95
if
(!
content
)
96
return
;
97
98
if
(
m_aDisplayedActions
.Contains(action))
99
return
;
100
101
m_aDisplayedActions
.Insert(action);
102
103
if
(initial)
104
content
.SetMessage(
STR_AFFECTED_MODS
+
"\n\n"
+
string
.Format(
FAILED_ADDON_FORMAT
, action.GetAddonName()));
105
else
106
content
.SetMessage(
content
.GetMessage() +
string
.Format(
FAILED_ADDON_FORMAT
, action.GetAddonName()));
107
}
108
}
109
111
class
SCR_NotEnoughStorageDialog
:
SCR_ConfigurableDialogUi
112
{
113
protected
float
m_fSizeBytes
;
114
115
protected
static
ref
SCR_NotEnoughStorageDialog
m_Instance
;
116
117
protected
ref array<SCR_WorkshopItemActionDownload>
m_aDisplayedActions
= {};
118
119
//------------------------------------------------------------------------------------------------
120
static
void
ShowNotEnoughStorageDialog
(
float
sizeBytes,
SCR_WorkshopItemActionDownload
action)
121
{
122
if
(
m_Instance
)
123
{
124
m_Instance
.AddToSize(sizeBytes, action);
125
return
;
126
}
127
128
m_Instance
=
new
SCR_NotEnoughStorageDialog
();
129
130
CreateFromPreset
(
SCR_CommonDialogs
.DIALOGS_CONFIG,
"error_not_enough_storage"
,
m_Instance
);
131
m_Instance
.AddToSize(sizeBytes, action);
132
}
133
134
//-----------------------------------------------------------------------------------------------
135
override
void
Close
()
136
{
137
super.Close();
138
139
m_Instance
= null;
140
}
141
142
//------------------------------------------------------------------------------------------------
144
void
AddToSize
(
float
sizeBytes,
SCR_WorkshopItemActionDownload
action)
145
{
146
if
(!action)
147
return
;
148
149
if
(
m_aDisplayedActions
.Contains(action))
150
return
;
151
152
m_aDisplayedActions
.Insert(action);
153
154
m_fSizeBytes
+= sizeBytes;
155
156
string
sizeStr =
SCR_ByteFormat
.GetReadableSize(
m_fSizeBytes
);
157
string
messageStr =
WidgetManager
.Translate(
m_DialogPreset
.m_sMessage, sizeStr);
158
159
SetMessage
(messageStr);
160
}
161
}
content
class RestAPIHelper< JsonApiStruct T > content
message
string message
Definition
PrefabImporter.c:17
m_Instance
SCR_PlayerListedAdminManagerComponentClass m_Instance
STR_AFFECTED_MODS
const string STR_AFFECTED_MODS
Definition
SCR_WorkshopDialogs.c:21
MESSAGE_ERROR_STORAGE
const string MESSAGE_ERROR_STORAGE
Definition
SCR_WorkshopDialogs.c:27
UpdateFailedModsDialogContent
void UpdateFailedModsDialogContent(SCR_WorkshopItemActionDownload action, bool initial)
Definition
SCR_WorkshopDialogs.c:85
MESSAGE_ERROR_BUSY
const string MESSAGE_ERROR_BUSY
Definition
SCR_WorkshopDialogs.c:25
MESSAGE_ERROR_AUTH
const string MESSAGE_ERROR_AUTH
Definition
SCR_WorkshopDialogs.c:26
m_aDisplayedActions
ref array< SCR_WorkshopItemActionDownload > m_aDisplayedActions
Definition
SCR_WorkshopDialogs.c:31
SetMessageFormat
void SetMessageFormat(string text, int reason)
Definition
SCR_WorkshopDialogs.c:67
MESSAGE_ERROR_UNKNOWN
const string MESSAGE_ERROR_UNKNOWN
Definition
SCR_WorkshopDialogs.c:24
FAILED_ADDON_LIST_DIALOG
class SCR_WorkshopDialogs FAILED_ADDON_LIST_DIALOG
FAILED_ADDON_FORMAT
const string FAILED_ADDON_FORMAT
Definition
SCR_WorkshopDialogs.c:22
reason
string reason
Definition
ServerBrowserMenuCallbacks.c:41
ResourceName
Definition
ResourceName.c:13
SCR_ByteFormat
Definition
SCR_ByteFormat.c:6
SCR_CommonDialogs
Definition
CommonDialogs.c:6
SCR_ConfigurableDialogUi
Definition
SCR_ConfigurableDialogUI.c:17
SCR_ConfigurableDialogUi::Close
void Close()
Definition
SCR_ConfigurableDialogUI.c:254
SCR_ConfigurableDialogUi::CreateFromPreset
static SCR_ConfigurableDialogUi CreateFromPreset(ResourceName presetsResourceName, string tag, SCR_ConfigurableDialogUi customDialogObj=null)
Creates a dialog from preset.
Definition
SCR_ConfigurableDialogUI.c:94
SCR_ConfigurableDialogUi::GetContentLayoutRoot
Widget GetContentLayoutRoot()
Returns the root of the content layout.
Definition
SCR_ConfigurableDialogUI.c:241
SCR_ConfigurableDialogUi::m_DialogPreset
ref SCR_ConfigurableDialogUiPreset m_DialogPreset
Definition
SCR_ConfigurableDialogUI.c:75
SCR_ConfigurableDialogUi::SetMessage
void SetMessage(string text)
Definition
SCR_ConfigurableDialogUI.c:274
SCR_MessageDialogContent
Definition
SCR_MessageDialogContent.c:5
SCR_NotEnoughStorageDialog
There is not enough storage on your hard drive. The space required is at least %1.
Definition
SCR_WorkshopDialogs.c:112
SCR_NotEnoughStorageDialog::m_Instance
static ref SCR_NotEnoughStorageDialog m_Instance
Definition
SCR_WorkshopDialogs.c:115
SCR_NotEnoughStorageDialog::m_fSizeBytes
float m_fSizeBytes
Definition
SCR_WorkshopDialogs.c:113
SCR_NotEnoughStorageDialog::Close
override void Close()
Definition
SCR_WorkshopDialogs.c:135
SCR_NotEnoughStorageDialog::AddToSize
void AddToSize(float sizeBytes, SCR_WorkshopItemActionDownload action)
Increase size displayed in dialog.
Definition
SCR_WorkshopDialogs.c:144
SCR_NotEnoughStorageDialog::ShowNotEnoughStorageDialog
static void ShowNotEnoughStorageDialog(float sizeBytes, SCR_WorkshopItemActionDownload action)
Definition
SCR_WorkshopDialogs.c:120
SCR_NotEnoughStorageDialog::m_aDisplayedActions
ref array< SCR_WorkshopItemActionDownload > m_aDisplayedActions
Definition
SCR_WorkshopDialogs.c:117
SCR_WorkshopDialogs
Definition
SCR_WorkshopDialogs.c:7
SCR_WorkshopItemActionDownload
Definition
SCR_WorkshopItemActionDownload.c:10
Widget
Definition
Widget.c:13
WidgetManager
Definition
WidgetManager.c:16
EBackendError
EBackendError
Backend error.
Definition
EBackendError.c:14
scripts
Game
UI
Menu
ContentBrowser
Common
Dialogs
SCR_WorkshopDialogs.c
Generated by
1.17.0