Survivalcraft API 1.8.2.3
v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
ReportCommunityContentDialog.cs
浏览该文件的文档.
1
using
System.Xml.Linq;
2
3
namespace
Game
{
4
public
class
ReportCommunityContentDialog
:
Dialog
{
5
public
string
m_address
;
6
7
public
string
m_userId
;
8
9
public
LabelWidget
m_nameLabel
;
10
11
public
ContainerWidget
m_container
;
12
13
public
ButtonWidget
m_reportButton
;
14
15
public
ButtonWidget
m_cancelButton
;
16
17
public
List<CheckboxWidget>
m_reasonWidgetsList
= [];
18
19
public
ReportCommunityContentDialog
(
string
address,
string
displayName,
string
userId) {
20
m_address
= address;
21
m_userId
= userId;
22
XElement node =
ContentManager
.
Get
<XElement>(
"Dialogs/ReportCommunityContentDialog"
);
23
LoadContents
(
this
, node);
24
m_nameLabel
=
Children
.Find<
LabelWidget
>(
"ReportCommunityContentDialog.Name"
);
25
m_container
=
Children
.Find<
ContainerWidget
>(
"ReportCommunityContentDialog.Container"
);
26
m_reportButton
=
Children
.Find<
ButtonWidget
>(
"ReportCommunityContentDialog.Report"
);
27
m_cancelButton
=
Children
.Find<
ButtonWidget
>(
"ReportCommunityContentDialog.Cancel"
);
28
m_reasonWidgetsList
.Add(
new
CheckboxWidget
{ Text =
"Cruelty"
,
Tag
=
"cruelty"
});
29
m_reasonWidgetsList
.Add(
new
CheckboxWidget
{ Text =
"Dating"
,
Tag
=
"dating"
});
30
m_reasonWidgetsList
.Add(
new
CheckboxWidget
{ Text =
"Drugs / Alcohol"
,
Tag
=
"drugs"
});
31
m_reasonWidgetsList
.Add(
new
CheckboxWidget
{ Text =
"Hate Speech"
,
Tag
=
"hate"
});
32
m_reasonWidgetsList
.Add(
new
CheckboxWidget
{ Text =
"Plagiarism"
,
Tag
=
"plagiarism"
});
33
m_reasonWidgetsList
.Add(
new
CheckboxWidget
{ Text =
"Racism"
,
Tag
=
"racism"
});
34
m_reasonWidgetsList
.Add(
new
CheckboxWidget
{ Text =
"Sex / Nudity"
,
Tag
=
"sex"
});
35
m_reasonWidgetsList
.Add(
new
CheckboxWidget
{ Text =
"Excessive Swearing"
,
Tag
=
"swearing"
});
36
Random
random =
new
();
37
m_reasonWidgetsList
.RandomShuffle(max => random.
Int
(0, max - 1));
38
m_reasonWidgetsList
.Add(
new
CheckboxWidget
{ Text =
"Other"
,
Tag
=
"other"
});
39
foreach
(
CheckboxWidget
reasonWidgets
in
m_reasonWidgetsList
) {
40
m_container
.Children.Add(reasonWidgets);
41
}
42
m_nameLabel.Text = displayName;
43
m_reportButton.IsEnabled =
false
;
44
}
45
46
public
override
void
Update
() {
47
m_reportButton.IsEnabled =
m_reasonWidgetsList
.Count(w => w.IsChecked) == 1;
48
if
(
m_reportButton
.IsClicked) {
49
DialogsManager
.
HideDialog
(
this
);
50
DialogsManager
.
ShowDialog
(
51
ParentWidget
,
52
new
MessageDialog
(
53
"Are you sure?"
,
54
"Reporting offensive content is a serious matter. Please make sure you checked the right box. Do not report content which is not offensive."
,
55
"Proceed"
,
56
"Cancel"
,
57
delegate(
MessageDialogButton
b) {
58
if
(b ==
MessageDialogButton
.Button1) {
59
string
report =
string
.Empty;
60
foreach
(
CheckboxWidget
reasonWidgets
in
m_reasonWidgetsList
) {
61
if
(reasonWidgets.
IsChecked
) {
62
report = (string)reasonWidgets.
Tag
;
63
break
;
64
}
65
}
66
CancellableBusyDialog
busyDialog =
new
(
"Sending Report"
,
false
);
67
DialogsManager
.
ShowDialog
(
ParentWidget
, busyDialog);
68
CommunityContentManager
.
Report
(
69
m_address
,
70
m_userId
,
71
report,
72
busyDialog.
Progress
,
73
delegate { DialogsManager.HideDialog(busyDialog); },
74
delegate { DialogsManager.HideDialog(busyDialog); }
75
);
76
}
77
}
78
)
79
);
80
}
81
if
(Input.Cancel
82
||
m_cancelButton
.IsClicked) {
83
DialogsManager
.
HideDialog
(
this
);
84
}
85
}
86
}
87
}
Game.ButtonWidget
定义
ButtonWidget.cs:5
Game.CancellableBusyDialog
定义
CancellableBusyDialog.cs:5
Game.CancellableBusyDialog.Progress
CancellableProgress Progress
定义
CancellableBusyDialog.cs:16
Game.CheckboxWidget
定义
CheckboxWidget.cs:6
Game.CheckboxWidget.IsChecked
bool IsChecked
定义
CheckboxWidget.cs:23
Game.CommunityContentManager
定义
CommunityContentManager.cs:11
Game.CommunityContentManager.Report
static void Report(string address, string userId, string report, CancellableProgress progress, Action success, Action< Exception > failure)
定义
CommunityContentManager.cs:279
Game.ContainerWidget
定义
ContainerWidget.cs:4
Game.ContainerWidget.Children
readonly WidgetsList Children
定义
ContainerWidget.cs:5
Game.ContentManager
定义
ContentManager.cs:50
Game.ContentManager.Get
static object Get(Type type, string name)
定义
ContentManager.cs:70
Game.Dialog.Dialog
Dialog()
定义
Dialog.cs:5
Game.DialogsManager
定义
DialogsManager.cs:4
Game.DialogsManager.HideDialog
static void HideDialog(Dialog dialog)
定义
DialogsManager.cs:58
Game.DialogsManager.ShowDialog
static void ShowDialog(ContainerWidget parentWidget, Dialog dialog)
定义
DialogsManager.cs:35
Game.LabelWidget
定义
LabelWidget.cs:4
Game.MessageDialog
定义
MessageDialog.cs:5
Game.Random
定义
Random.cs:5
Game.Random.Int
int Int()
定义
Random.cs:52
Game.ReportCommunityContentDialog.m_userId
string m_userId
定义
ReportCommunityContentDialog.cs:7
Game.ReportCommunityContentDialog.m_nameLabel
LabelWidget m_nameLabel
定义
ReportCommunityContentDialog.cs:9
Game.ReportCommunityContentDialog.m_container
ContainerWidget m_container
定义
ReportCommunityContentDialog.cs:11
Game.ReportCommunityContentDialog.m_address
string m_address
定义
ReportCommunityContentDialog.cs:5
Game.ReportCommunityContentDialog.Update
override void Update()
定义
ReportCommunityContentDialog.cs:46
Game.ReportCommunityContentDialog.m_reportButton
ButtonWidget m_reportButton
定义
ReportCommunityContentDialog.cs:13
Game.ReportCommunityContentDialog.m_cancelButton
ButtonWidget m_cancelButton
定义
ReportCommunityContentDialog.cs:15
Game.ReportCommunityContentDialog.ReportCommunityContentDialog
ReportCommunityContentDialog(string address, string displayName, string userId)
定义
ReportCommunityContentDialog.cs:19
Game.ReportCommunityContentDialog.m_reasonWidgetsList
List< CheckboxWidget > m_reasonWidgetsList
定义
ReportCommunityContentDialog.cs:17
Game.Widget.ParentWidget
ContainerWidget ParentWidget
定义
Widget.cs:468
Game.Widget.Tag
object Tag
定义
Widget.cs:353
Game.Widget.LoadContents
virtual void LoadContents(object eventsTarget, XElement node)
定义
Widget.cs:507
Game
定义
ContentFileBridge.cs:4
Game.MessageDialogButton
MessageDialogButton
定义
MessageDialogButton.cs:2
SurvivalcraftApi 1.8.2.3
Survivalcraft.Windows
Dialog
ReportCommunityContentDialog.cs
制作者
1.16.1