DayZ 1.24
Loading...
Searching...
No Matches
MissionLoader.c
Go to the documentation of this file.
2{
4
6 {
8
9 string path;
10 string errorMessage;
11
12 if (GetCLIParam("missionLoaderPath", path) == false)
14
15 if (!FileExist(path))
16 {
17 DayZGame dzg = GetDayZGame();
18
20 data.MissionPaths = {dzg.GetMissionFolderPath()};
23 }
24 else
25 {
28 }
29
30 return data;
31 }
32}
33
35{
36
42
43 override Widget Init()
44 {
46
47 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/day_z_mission_loader.layout");
48
49 m_WgtLstMsnList = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("wgt_lst_missions"));
50 m_WgtBtnMsnPlay = ButtonWidget.Cast(layoutRoot.FindAnyWidget("wgt_btn_mission_play"));
51 m_WgtBtnMsnClose = ButtonWidget.Cast(layoutRoot.FindAnyWidget("wgt_btn_mission_close"));
52
53 foreach (string path: m_MissionData.MissionPaths)
54 m_WgtLstMsnList.AddItem(path, NULL, 0);
55
56 return layoutRoot;
57 }
58
59 override bool OnClick(Widget w, int x, int y, int button)
60 {
61 super.OnClick(w, x, y, button);
62
63 if (w == m_WgtBtnMsnClose)
64 {
65 Close();
66
67 return true;
68 }
69 else if (w == m_WgtBtnMsnPlay)
70 {
71 int rowIndex = m_WgtLstMsnList.GetSelectedRow();
72 string missionPath = m_MissionData.MissionPaths.Get(rowIndex);
73 GetGame().PlayMission(missionPath);
74 return true;
75 }
76 return false;
77 }
78
79
80 override bool OnDoubleClick(Widget w, int x, int y, int button)
81 {
82 super.OnClick(w, x, y, button);
83
84 if (w == m_WgtLstMsnList)
85 {
86 int rowIndex = m_WgtLstMsnList.GetSelectedRow();
87 string missionPath = m_MissionData.MissionPaths.Get(rowIndex);
88 GetGame().PlayMission(missionPath);
89 }
90 return false;
91 }
92
93 override bool OnKeyDown(Widget w, int x, int y, int key)
94 {
95 super.OnKeyDown(w, x, y, key);
96 switch (key)
97 {
98 case KeyCode.KC_ESCAPE:
99 {
100 Close();
101 return true;
102 }
103 }
104 return false;
105 }
106
107}
override Widget Init()
Definition DayZGame.c:120
DayZGame GetDayZGame()
Definition DayZGame.c:3530
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Definition DayZGame.c:144
Icon x
Icon y
void Close()
override bool OnKeyDown(Widget w, int x, int y, int key)
override bool OnDoubleClick(Widget w, int x, int y, int button)
ref JsonMissionLoaderData m_MissionData
ButtonWidget m_WgtBtnMsnPlay
ref TStringArray m_ListMissionsNames
ButtonWidget m_WgtBtnMsnClose
class JsonMissionLoaderData m_WgtLstMsnList
static JsonMissionLoaderData GetData()
ref TStringArray MissionPaths
proto native CGame GetGame()
const string CFG_FILE_MISSION_LIST
Definition constants.c:240
enum ShapeType ErrorEx
proto bool FileExist(string name)
Check existence of file.
KeyCode
Definition EnSystem.c:157
proto bool GetCLIParam(string param, out string val)
Returns command line argument.