DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
MissionLoader.c
См. документацию.
2{
4
6 {
8
9 string path;
10 string errorMessage;
11
12 if (GetCLIParam("missionLoaderPath", path) == false)
13 {
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
36class MissionLoader : UIScriptedMenu
37{
38
39 protected TextListboxWidget m_WgtLstMsnList;
40 protected ButtonWidget m_WgtBtnMsnPlay;
41 protected ButtonWidget m_WgtBtnMsnClose;
44
45 override Widget Init()
46 {
48
49 layoutRoot = GetGame().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 GetGame().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 GetGame().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}
DayZGame GetDayZGame()
Определения DayZGame.c:3870
Icon x
Icon y
void Close()
ref JsonMissionLoaderData m_MissionData
Определения MissionLoader.c:43
ButtonWidget m_WgtBtnMsnPlay
Определения MissionLoader.c:40
ref TStringArray m_ListMissionsNames
Определения MissionLoader.c:42
ButtonWidget m_WgtBtnMsnClose
Определения MissionLoader.c:41
class JsonMissionLoaderData m_WgtLstMsnList
string path
Определения OptionSelectorMultistate.c:142
proto native void PlayMission(string path)
Starts mission (equivalent for SQF playMission). You MUST use double slash \.
proto native WorkspaceWidget GetWorkspace()
static JsonMissionLoaderData GetData()
Определения MissionLoader.c:5
ref TStringArray MissionPaths
Определения MissionLoader.c:3
override bool OnDoubleClick(Widget w, int x, int y, int button)
Определения SceneEditorMenu.c:487
override bool OnKeyDown(Widget w, int x, int y, int key)
Определения ScriptConsole.c:218
override Widget Init()
Определения BookMenu.c:11
override bool OnClick(Widget w, int x, int y, int button)
Определения BookMenu.c:34
Определения DayZGame.c:64
Определения EnWidgets.c:190
proto native CGame GetGame()
const string CFG_FILE_MISSION_LIST
Определения constants.c:250
enum ShapeType ErrorEx
array< string > TStringArray
Определения EnScript.c:685
proto bool FileExist(string name)
Check existence of file.
KeyCode
Определения EnSystem.c:157
proto bool GetCLIParam(string param, out string val)
Returns command line argument.
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.