2017-10-10 14:25:37 +08:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
<PropertyList>
|
|
|
|
<name>mission-browser</name>
|
|
|
|
<layout>vbox</layout>
|
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<empty><stretch>1</stretch></empty>
|
|
|
|
<text>
|
|
|
|
<label>Mission browser</label>
|
|
|
|
</text>
|
|
|
|
<empty><stretch>1</stretch></empty>
|
|
|
|
<button>
|
|
|
|
<legend> </legend>
|
|
|
|
<halign>right</halign>
|
|
|
|
<pref-width>20</pref-width>
|
|
|
|
<pref-height>20</pref-height>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-close</command>
|
|
|
|
</binding>
|
|
|
|
</button>
|
|
|
|
</group>
|
|
|
|
|
|
|
|
<hrule/>
|
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<list>
|
|
|
|
<name>mission_list</name>
|
|
|
|
<pref-width>300</pref-width>
|
|
|
|
<pref-height>250</pref-height>
|
|
|
|
<halign>fill</halign>
|
|
|
|
<valign>fill</valign>
|
|
|
|
<stretch>true</stretch>
|
|
|
|
<padding>6</padding>
|
|
|
|
<property>/sim/mission/gui/selected-mission</property>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
|
|
|
</binding>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>
|
|
|
|
select_mission();
|
|
|
|
</script>
|
|
|
|
</binding>
|
|
|
|
<value>...</value>
|
|
|
|
<value>...</value>
|
|
|
|
</list>
|
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>vbox</layout>
|
|
|
|
<canvas>
|
|
|
|
<name>mission-image</name>
|
|
|
|
<valign>fill</valign>
|
|
|
|
<halign>fill</halign>
|
|
|
|
<pref-width>250</pref-width>
|
|
|
|
<pref-height>250</pref-height>
|
|
|
|
<nasal>
|
|
|
|
<load> <![CDATA[
|
|
|
|
var myCanvas1 = canvas.get( cmdarg() );
|
|
|
|
myCanvas1.setColorBackground(1,1,1,0);
|
|
|
|
var img = myCanvas1.createGroup().createChild("image");
|
|
|
|
]]> </load>
|
|
|
|
</nasal>
|
|
|
|
</canvas>
|
|
|
|
</group>
|
|
|
|
</group>
|
|
|
|
|
|
|
|
<textbox>
|
|
|
|
<name>mission_description</name>
|
|
|
|
<halign>fill</halign>
|
|
|
|
<valign>fill</valign>
|
|
|
|
<stretch>true</stretch>
|
|
|
|
<pref-width>600</pref-width>
|
|
|
|
<pref-height>200</pref-height>
|
|
|
|
<padding>6</padding>
|
|
|
|
<slider>20</slider>
|
|
|
|
<editable>false</editable>
|
|
|
|
<wrap>false</wrap>
|
|
|
|
<property>/sim/mission/gui/data/description</property>
|
|
|
|
</textbox>
|
|
|
|
|
|
|
|
<hrule/>
|
|
|
|
|
|
|
|
<button>
|
|
|
|
<legend>Start mission</legend>
|
|
|
|
<pref-height>30</pref-height>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
2017-10-20 05:24:56 +08:00
|
|
|
<script>
|
|
|
|
fgcommand("dialog-close", {"dialog-name" : "mission-browser"});
|
|
|
|
mission.start_mission(selected_mission);
|
|
|
|
</script>
|
2017-10-10 14:25:37 +08:00
|
|
|
</binding>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<nasal>
|
|
|
|
<open> <![CDATA[
|
|
|
|
var list = cmdarg().getNode("group[1]/list");
|
|
|
|
var mission_root = "";
|
|
|
|
var selected_mission = "";
|
|
|
|
var data_node = props.getNode("sim/mission/gui/data", 1);
|
|
|
|
data_node.setValues({description: ""});
|
|
|
|
|
|
|
|
var dialog_update = func () {
|
|
|
|
forindex (var i; arg) {
|
|
|
|
var hash = {
|
|
|
|
"object-name" : arg[i],
|
|
|
|
"dialog-name" : "mission-browser"
|
|
|
|
};
|
|
|
|
fgcommand( "dialog-update", props.Node.new(hash) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var update_list = func {
|
|
|
|
list.removeChildren("value");
|
|
|
|
|
2017-10-20 05:24:56 +08:00
|
|
|
var mission_path = getprop("/sim/mission/root_path") ~ "/Missions";
|
|
|
|
foreach (var a; directory(mission_path)) {
|
|
|
|
if (a != "." and a != ".." and a != "Generic") {
|
|
|
|
foreach (var b; directory(mission_path ~ "/" ~ a)) {
|
|
|
|
if (b != "." and b != "..") {
|
|
|
|
list.addChild("value").setValue(a ~ "/" ~ b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-10-10 14:25:37 +08:00
|
|
|
|
|
|
|
dialog_update("mission_list");
|
|
|
|
}
|
|
|
|
|
|
|
|
var select_mission = func {
|
|
|
|
selected_mission = getprop("/sim/mission/gui/selected-mission");
|
2017-10-10 15:35:13 +08:00
|
|
|
mission_root = getprop("/sim/mission/root_path") ~ "/Missions/" ~ selected_mission;
|
2017-10-10 14:25:37 +08:00
|
|
|
|
|
|
|
data_node.setValues({description: ""});
|
|
|
|
io.read_properties(mission_root ~ "/metadata.xml", data_node);
|
|
|
|
dialog_update("mission_description");
|
|
|
|
|
|
|
|
img.set("src", mission_root ~ "/image.png").setSize(250, 250);
|
|
|
|
}
|
|
|
|
|
|
|
|
update_list();
|
|
|
|
]]> </open>
|
|
|
|
|
|
|
|
<close>
|
|
|
|
#
|
|
|
|
</close>
|
|
|
|
</nasal>
|
|
|
|
|
|
|
|
</PropertyList>
|