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_ReportPlayerDialog.c
Go to the documentation of this file.
1
class
SCR_ReportPlayerDialog
:
SCR_ConfigurableDialogUi
2
{
3
protected
int
m_iReportedPlayedID
;
4
5
protected
ref array<SCR_ModularButtonComponent>
m_aReasonButtons
= {};
6
7
protected
SCR_EReportReason
m_eReason
;
8
9
//------------------------------------------------------------------------------------------------
10
void
SCR_ReportPlayerDialog
(
int
reportedPlayedID)
11
{
12
m_iReportedPlayedID
= reportedPlayedID;
13
SCR_ConfigurableDialogUi
.
CreateFromPreset
(
SCR_CommonDialogs
.DIALOGS_CONFIG,
"report_player"
,
this
);
14
}
15
16
//------------------------------------------------------------------------------------------------
17
override
void
OnMenuOpen
(
SCR_ConfigurableDialogUiPreset
preset)
18
{
19
super.OnMenuOpen(preset);
20
21
SCR_InputButtonComponent
confirm =
FindButton
(
"confirm_report"
);
22
if
(confirm)
23
confirm.
m_OnActivated
.Insert(
OnConfirmReport
);
24
25
Widget
reasonsLayout =
m_wRoot
.FindAnyWidget(
"ReasonsLayout"
);
26
if
(!reasonsLayout)
27
return
;
28
29
Widget
child = reasonsLayout.GetChildren();
30
if
(!child)
31
return
;
32
33
SCR_ModularButtonComponent modularComponent;
34
while
(child)
35
{
36
modularComponent = SCR_ModularButtonComponent.Cast(child.FindHandler(SCR_ModularButtonComponent));
37
if
(!modularComponent)
38
continue
;
39
40
modularComponent.m_OnToggled.Insert(
OnReasonToggled
);
41
modularComponent.m_OnFocus.Insert(
OnReasonFocused
);
42
m_aReasonButtons
.Insert(modularComponent);
43
44
child = child.GetSibling();
45
}
46
47
RichTextWidget
reportedPlayerName =
RichTextWidget
.Cast(
m_wRoot
.FindAnyWidget(
"ReportedPlayerName"
));
48
if
(!reportedPlayerName)
49
return
;
50
51
string
name =
SCR_PlayerNamesFilterCache
.GetInstance().GetPlayerDisplayName(
m_iReportedPlayedID
);
52
reportedPlayerName.SetText(name);
53
}
54
55
//------------------------------------------------------------------------------------------------
56
void
OnConfirmReport
()
57
{
58
SCR_PlayerController
controller =
SCR_PlayerController
.Cast(
GetGame
().
GetPlayerController
());
59
if
(!controller)
60
return
;
61
62
SocialComponent social = SocialComponent.Cast(controller.FindComponent(SocialComponent));
63
if
(!social)
64
return
;
65
66
social.m_OnReportPlayerFinishInvoker.Insert(
OnReportResult
);
67
social.ReportPlayer(
m_iReportedPlayedID
,
m_eReason
);
68
}
69
70
//------------------------------------------------------------------------------------------------
71
void
OnReasonToggled
(SCR_ModularButtonComponent component,
bool
isToggled)
72
{
73
if
(!isToggled)
74
return
;
75
76
foreach
(SCR_ModularButtonComponent comp :
m_aReasonButtons
)
77
{
78
if
(comp == component)
79
continue
;
80
81
comp.SetToggled(
false
);
82
}
83
84
Widget
reasonWidget = component.GetRootWidget();
85
if
(!reasonWidget)
86
return
;
87
88
SCR_ReportReasonComponent
reasonComponent =
SCR_ReportReasonComponent
.Cast(reasonWidget.FindHandler(
SCR_ReportReasonComponent
));
89
if
(!reasonComponent)
90
return
;
91
92
m_eReason
= reasonComponent.
GetReason
();
93
}
94
95
//------------------------------------------------------------------------------------------------
96
void
OnReasonFocused
(SCR_ModularButtonComponent component)
97
{
98
if
(
GetGame
().
GetInputManager
().GetLastUsedInputDevice() == EInputDeviceType.KEYBOARD)
99
return
;
100
101
Widget
reasonWidget = component.GetRootWidget();
102
if
(!reasonWidget)
103
return
;
104
105
SCR_ReportReasonComponent
reasonComponent =
SCR_ReportReasonComponent
.Cast(reasonWidget.FindHandler(
SCR_ReportReasonComponent
));
106
if
(!reasonComponent)
107
return
;
108
109
m_eReason
= reasonComponent.
GetReason
();
110
}
111
112
//------------------------------------------------------------------------------------------------
113
void
OnReportResult
(
int
playerID,
bool
success)
114
{
115
SCR_PlayerController
controller =
SCR_PlayerController
.Cast(
GetGame
().
GetPlayerController
());
116
if
(!controller)
117
return
;
118
119
SocialComponent social = SocialComponent.Cast(controller.FindComponent(SocialComponent));
120
if
(!social)
121
return
;
122
123
social.m_OnReportPlayerFinishInvoker.Remove(
OnReportResult
);
124
125
if
(success)
126
{
127
SCR_ConfigurableDialogUi
.
CreateFromPreset
(
SCR_CommonDialogs
.DIALOGS_CONFIG,
"report_player_confirmation"
);
128
Close
();
129
}
130
else
131
{
132
SCR_BlockedUsersDialogUI
dialog =
new
SCR_BlockedUsersDialogUI
();
133
SCR_ConfigurableDialogUi
.
CreateFromPreset
(
SCR_AccountWidgetComponent
.
BLOCKED_USER_DIALOG_CONFIG
,
"block_failed_general"
, dialog);
134
Close
();
135
}
136
}
137
};
138
139
class
SCR_ReportReasonComponent
:
ScriptedWidgetComponent
140
{
141
[
Attribute
(
SCR_EReportReason
.CHEATING.ToString(),
UIWidgets
.ComboBox, enums: ParamEnumArray.FromEnum(
SCR_EReportReason
))]
142
protected
SCR_EReportReason
m_eReason
;
143
144
[
Attribute
(
"Content"
,
UIWidgets
.EditBox,
"Widget in which the text of the reason is placed"
)]
145
protected
string
m_sReasonTextWidget
;
146
147
[
Attribute
(
""
,
UIWidgets
.EditBox,
"ID of the localized string for the report reason"
)]
148
protected
string
m_sReasonLocalizedTextID
;
149
150
//------------------------------------------------------------------------------------------------
151
override
void
HandlerAttached
(
Widget
w)
152
{
153
TextWidget
textWidget =
TextWidget
.Cast(w.FindAnyWidget(
m_sReasonTextWidget
));
154
if
(!textWidget)
155
return
;
156
textWidget.SetText(
m_sReasonLocalizedTextID
);
157
}
158
159
//------------------------------------------------------------------------------------------------
160
SCR_EReportReason
GetReason
()
161
{
162
return
m_eReason
;
163
}
164
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
GetInputManager
InputManager GetInputManager()
Definition
SCR_BaseManualCameraComponent.c:205
RichTextWidget
Definition
RichTextWidget.c:13
SCR_AccountWidgetComponent
Definition
SCR_AccountWidgetComponent.c:2
SCR_AccountWidgetComponent::BLOCKED_USER_DIALOG_CONFIG
static const ResourceName BLOCKED_USER_DIALOG_CONFIG
Definition
SCR_AccountWidgetComponent.c:47
SCR_BlockedUsersDialogUI
Definition
SCR_BlockedUsersDialogUI.c:2
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::m_wRoot
Widget m_wRoot
Definition
SCR_ConfigurableDialogUI.c:66
SCR_ConfigurableDialogUi::FindButton
SCR_InputButtonComponent FindButton(string tag)
Returns a button with given tag.
Definition
SCR_ConfigurableDialogUI.c:419
SCR_ConfigurableDialogUiPreset
Configuration for a dialog.
Definition
SCR_ConfigurableDialogUI.c:764
SCR_InputButtonComponent
Definition
SCR_InputButtonComponent.c:2
SCR_InputButtonComponent::m_OnActivated
ref ScriptInvoker m_OnActivated
Definition
SCR_InputButtonComponent.c:153
SCR_PlayerController
Definition
SCR_PlayerController.c:31
SCR_PlayerNamesFilterCache
Definition
SCR_PlayerNamesFilterCache.c:3
SCR_ReportPlayerDialog::SCR_ReportPlayerDialog
void SCR_ReportPlayerDialog(int reportedPlayedID)
Definition
SCR_ReportPlayerDialog.c:10
SCR_ReportPlayerDialog::m_iReportedPlayedID
int m_iReportedPlayedID
Definition
SCR_ReportPlayerDialog.c:3
SCR_ReportPlayerDialog::OnReasonToggled
void OnReasonToggled(SCR_ModularButtonComponent component, bool isToggled)
Definition
SCR_ReportPlayerDialog.c:71
SCR_ReportPlayerDialog::OnConfirmReport
void OnConfirmReport()
Definition
SCR_ReportPlayerDialog.c:56
SCR_ReportPlayerDialog::OnReportResult
void OnReportResult(int playerID, bool success)
Definition
SCR_ReportPlayerDialog.c:113
SCR_ReportPlayerDialog::m_aReasonButtons
ref array< SCR_ModularButtonComponent > m_aReasonButtons
Definition
SCR_ReportPlayerDialog.c:5
SCR_ReportPlayerDialog::OnReasonFocused
void OnReasonFocused(SCR_ModularButtonComponent component)
Definition
SCR_ReportPlayerDialog.c:96
SCR_ReportPlayerDialog::OnMenuOpen
override void OnMenuOpen(SCR_ConfigurableDialogUiPreset preset)
Definition
SCR_ReportPlayerDialog.c:17
SCR_ReportPlayerDialog::m_eReason
SCR_EReportReason m_eReason
Definition
SCR_ReportPlayerDialog.c:7
SCR_ReportReasonComponent
Definition
SCR_ReportPlayerDialog.c:140
SCR_ReportReasonComponent::m_sReasonTextWidget
string m_sReasonTextWidget
Definition
SCR_ReportPlayerDialog.c:145
SCR_ReportReasonComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_ReportPlayerDialog.c:151
SCR_ReportReasonComponent::m_eReason
SCR_EReportReason m_eReason
Definition
SCR_ReportPlayerDialog.c:142
SCR_ReportReasonComponent::m_sReasonLocalizedTextID
string m_sReasonLocalizedTextID
Definition
SCR_ReportPlayerDialog.c:148
SCR_ReportReasonComponent::GetReason
SCR_EReportReason GetReason()
Definition
SCR_ReportPlayerDialog.c:160
ScriptedWidgetComponent
Definition
ScriptedWidgetComponent.c:13
TextWidget
Definition
TextWidget.c:16
UIWidgets
Definition
attributes.c:40
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
GetPlayerController
proto external PlayerController GetPlayerController()
Definition
SCR_PlayerDeployMenuHandlerComponent.c:307
SCR_EReportReason
SCR_EReportReason
Player report reason.
Definition
SCR_EReportReason.c:14
scripts
Game
UI
Menu
Dialogs
SCR_ReportPlayerDialog.c
Generated by
1.17.0