Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
missionloader.c
Go to the documentation of this file.
1
class
JsonMissionLoaderData
2
{
3
ref
TStringArray
MissionPaths
;
4
5
static
JsonMissionLoaderData
GetData
()
6
{
7
JsonMissionLoaderData
data;
8
9
string
path
;
10
string
errorMessage;
11
12
if
(
GetCLIParam
(
"missionLoaderPath"
,
path
) ==
false
)
13
{
14
path
=
CFG_FILE_MISSION_LIST
;
15
}
16
17
if
(!
FileExist
(
path
))
18
{
19
DayZGame dzg =
GetDayZGame
();
20
21
data =
new
JsonMissionLoaderData
();
22
data.
MissionPaths
= {dzg.GetMissionFolderPath()};
23
if
(!JsonFileLoader<JsonMissionLoaderData>.SaveFile(
path
, data, errorMessage))
24
ErrorEx
(errorMessage);
25
}
26
else
27
{
28
if
(!JsonFileLoader<JsonMissionLoaderData>.LoadFile(
path
, data, errorMessage))
29
ErrorEx
(errorMessage);
30
}
31
32
return
data;
33
}
34
}
35
36
class
MissionLoader :
UIScriptedMenu
37
{
38
39
protected
TextListboxWidget
m_WgtLstMsnList
;
40
protected
ButtonWidget
m_WgtBtnMsnPlay
;
41
protected
ButtonWidget
m_WgtBtnMsnClose
;
42
protected
ref
TStringArray
m_ListMissionsNames
;
43
protected
ref
JsonMissionLoaderData
m_MissionData
;
44
45
override
Widget
Init
()
46
{
47
m_MissionData
=
JsonMissionLoaderData
.
GetData
();
48
49
layoutRoot =
g_Game
.GetWorkspace().CreateWidgets(
"gui/layouts/day_z_mission_loader.layout"
);
50
51
m_WgtLstMsnList
= TextListboxWidget.Cast( layoutRoot.FindAnyWidget(
"wgt_lst_missions"
) );
52
m_WgtBtnMsnPlay
= ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"wgt_btn_mission_play"
) );
53
m_WgtBtnMsnClose
= ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"wgt_btn_mission_close"
) );
54
55
foreach
(
string
path
:
m_MissionData
.MissionPaths)
56
{
57
m_WgtLstMsnList
.AddItem(
path
, NULL, 0);
58
}
59
60
return
layoutRoot;
61
}
62
63
override
bool
OnClick
(
Widget
w,
int
x
,
int
y
,
int
button)
64
{
65
super.OnClick(w,
x
,
y
, button);
66
67
if
( w ==
m_WgtBtnMsnClose
)
68
{
69
Close
();
70
71
return
true
;
72
}
73
else
if
( w ==
m_WgtBtnMsnPlay
)
74
{
75
int
rowIndex =
m_WgtLstMsnList
.GetSelectedRow();
76
string
missionPath =
m_MissionData
.MissionPaths.Get(rowIndex);
77
g_Game
.PlayMission(missionPath);
78
return
true
;
79
}
80
return
false
;
81
}
82
83
84
override
bool
OnDoubleClick
(
Widget
w,
int
x
,
int
y
,
int
button)
85
{
86
super.OnClick(w,
x
,
y
, button);
87
88
if
(w ==
m_WgtLstMsnList
)
89
{
90
int
rowIndex =
m_WgtLstMsnList
.GetSelectedRow();
91
string
missionPath =
m_MissionData
.MissionPaths.Get(rowIndex);
92
g_Game
.PlayMission(missionPath);
93
}
94
return
false
;
95
}
96
97
override
bool
OnKeyDown
(
Widget
w,
int
x
,
int
y
,
int
key)
98
{
99
super.OnKeyDown(w,
x
,
y
,key);
100
switch
(key)
101
{
102
case
KeyCode
.KC_ESCAPE:
103
{
104
Close
();
105
return
true
;
106
}
107
}
108
return
false
;
109
}
110
111
}
JsonMissionLoaderData
Definition
missionloader.c:2
JsonMissionLoaderData::GetData
static JsonMissionLoaderData GetData()
Definition
missionloader.c:5
JsonMissionLoaderData::MissionPaths
ref TStringArray MissionPaths
Definition
missionloader.c:3
UIScriptedMenu
Xbox menu.
Definition
dayzgame.c:64
UIScriptedMenu::OnKeyDown
override bool OnKeyDown(Widget w, int x, int y, int key)
Definition
scriptconsole.c:227
UIScriptedMenu::OnDoubleClick
override bool OnDoubleClick(Widget w, int x, int y, int button)
Definition
sceneeditormenu.c:487
UIScriptedMenu::Init
override Widget Init()
Definition
bookmenu.c:11
UIScriptedMenu::OnClick
override bool OnClick(Widget w, int x, int y, int button)
Definition
bookmenu.c:34
Widget
Definition
enwidgets.c:190
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
GetDayZGame
DayZGame GetDayZGame()
Definition
dayzgame.c:3944
CFG_FILE_MISSION_LIST
const string CFG_FILE_MISSION_LIST
Definition
constants.c:250
ErrorEx
enum ShapeType ErrorEx
TStringArray
array< string > TStringArray
Definition
enscript.c:712
FileExist
proto bool FileExist(string name)
Check existence of file.
KeyCode
KeyCode
Definition
ensystem.c:157
GetCLIParam
proto bool GetCLIParam(string param, out string val)
Returns command line argument.
x
Icon x
y
Icon y
Close
void Close()
m_MissionData
ref JsonMissionLoaderData m_MissionData
Definition
missionloader.c:43
m_WgtBtnMsnPlay
ButtonWidget m_WgtBtnMsnPlay
Definition
missionloader.c:40
m_ListMissionsNames
ref TStringArray m_ListMissionsNames
Definition
missionloader.c:42
m_WgtBtnMsnClose
ButtonWidget m_WgtBtnMsnClose
Definition
missionloader.c:41
m_WgtLstMsnList
class JsonMissionLoaderData m_WgtLstMsnList
path
string path
Definition
optionselectormultistate.c:142
Games
Dayz
scripts
5_mission
gui
scriptedwindows
missionloader.c
Generated by
1.17.0