DayZ
1.24
Loading...
Searching...
No Matches
CreditsLoader.c
Go to the documentation of this file.
1
class
CreditsLoader
2
{
3
protected
static
const
string
JSON_FILE_PATH
=
"scripts/data/credits.json"
;
4
5
static
void
CreateTestJson
()
6
{
7
string
nameDepartment
=
"Department"
;
8
string
nameSection
=
"Section"
;
9
string
nameLine
=
"Line"
;
10
11
JsonDataCredits
data
=
new
JsonDataCredits
();
12
data
.Departments =
new
array<ref JsonDataCreditsDepartment>
;
13
14
for
(
int
index_dep
= 0;
index_dep
< 3; ++
index_dep
)
15
{
16
JsonDataCreditsDepartment
department
=
new
JsonDataCreditsDepartment
();
17
department
.Sections =
new
array<ref JsonDataCreditsSection>
();
18
department
.DepartmentName = (
nameDepartment
+
" "
+
index_dep
);
19
20
for
(
int
index_sec
= 0;
index_sec
< 4; ++
index_sec
)
21
{
22
JsonDataCreditsSection
section
=
new
JsonDataCreditsSection
();
23
section
.SectionLines =
new
array<string>
;
24
section
.SectionName = (
nameSection
+
" "
+
index_sec
);
25
26
int
linesCount
=
Math
.
RandomInt
(3, 10);
27
for
(
int
i
= 0;
i
<
linesCount
; ++
i
)
28
section
.SectionLines.Insert(
nameLine
+
" "
+
i
);
29
30
department
.Sections.Insert(
section
);
31
}
32
33
data
.Departments.Insert(
department
);
34
}
35
36
string
errorMessage
;
37
if
(!
JsonFileLoader<ref JsonDataCredits>
.SaveFile(
JSON_FILE_PATH
,
data
,
errorMessage
))
38
ErrorEx
(
errorMessage
);
39
}
40
41
static
JsonDataCredits
GetData
()
42
{
43
string
errorMessage
;
44
JsonDataCredits
data
;
45
46
if
(!
JsonFileLoader<ref JsonDataCredits>
.LoadFile(
JSON_FILE_PATH
,
data
,
errorMessage
))
47
ErrorEx
(
errorMessage
);
48
49
return
data
;
50
}
51
}
CreditsLoader
Definition
CreditsLoader.c:2
CreditsLoader::CreateTestJson
static void CreateTestJson()
Definition
CreditsLoader.c:5
CreditsLoader::GetData
static JsonDataCredits GetData()
Definition
CreditsLoader.c:41
CreditsLoader::JSON_FILE_PATH
static const string JSON_FILE_PATH
Definition
CreditsLoader.c:3
JsonDataCreditsDepartment
Definition
JsonDataCreditsDepartment.c:2
JsonDataCredits
Definition
JsonDataCredits.c:2
JsonDataCreditsSection
Definition
JsonDataCreditsSection.c:2
Math
Definition
EnMath.c:7
Param3
Definition
EntityAI.c:95
ErrorEx
enum ShapeType ErrorEx
Math::RandomInt
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
scripts
3_Game
GUI
Credits
CreditsLoader.c
Generated by
1.10.0