tutorial submodule, part #2: adapt script/GUI to load module on demand
tutorial.nas is now loaded (only) when "Start Tutorial" button is pressed.
This commit is contained in:
parent
f3ff41d3d4
commit
c3f8c1478a
4 changed files with 27 additions and 18 deletions
|
@ -1265,3 +1265,12 @@ _setlistener("/sim/signals/screenshot", func {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var do_welcome = 1;
|
||||||
|
_setlistener("/sim/signals/fdm-initialized", func {
|
||||||
|
var haveTutorials = size(props.globals.getNode("/sim/tutorials", 1).getChildren("tutorial"));
|
||||||
|
gui.menuEnable("tutorial-start", haveTutorials);
|
||||||
|
if (do_welcome and haveTutorials)
|
||||||
|
settimer(func { setprop("/sim/messages/copilot", "Welcome aboard! Need help? Use 'Help -> Tutorials'.");}, 5.0);
|
||||||
|
do_welcome = 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ var step_start_time = nil;
|
||||||
var step_iter_count = 0; # number or step loop iterations
|
var step_iter_count = 0; # number or step loop iterations
|
||||||
var last_step_time = nil; # for set_targets() eta calculation
|
var last_step_time = nil; # for set_targets() eta calculation
|
||||||
var audio_dir = nil;
|
var audio_dir = nil;
|
||||||
var do_welcome = 1;
|
|
||||||
|
|
||||||
# property nodes (to be initialized with listener)
|
# property nodes (to be initialized with listener)
|
||||||
var markerN = nil;
|
var markerN = nil;
|
||||||
|
@ -26,7 +25,7 @@ var last_messageN = nil;
|
||||||
var step_countN = nil;
|
var step_countN = nil;
|
||||||
var step_timeN = nil;
|
var step_timeN = nil;
|
||||||
|
|
||||||
_setlistener("/sim/signals/nasal-dir-initialized", func {
|
_setlistener("/nasal/tutorial/loaded", func {
|
||||||
markerN = props.globals.getNode("/sim/model/marker", 1);
|
markerN = props.globals.getNode("/sim/model/marker", 1);
|
||||||
headingN = props.globals.getNode("/orientation/heading-deg", 1);
|
headingN = props.globals.getNode("/orientation/heading-deg", 1);
|
||||||
slipN = props.globals.getNode("/orientation/side-slip-deg", 1);
|
slipN = props.globals.getNode("/orientation/side-slip-deg", 1);
|
||||||
|
@ -37,14 +36,6 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
|
||||||
setlistener("/sim/crashed", stopTutorial);
|
setlistener("/sim/crashed", stopTutorial);
|
||||||
});
|
});
|
||||||
|
|
||||||
_setlistener("/sim/signals/fdm-initialized", func {
|
|
||||||
var haveTutorials = size(props.globals.getNode("/sim/tutorials", 1).getChildren("tutorial"));
|
|
||||||
gui.menuEnable("tutorial-start", haveTutorials);
|
|
||||||
if (do_welcome and haveTutorials)
|
|
||||||
settimer(func { setprop("/sim/messages/copilot", "Welcome aboard! Need help? Use 'Help -> Tutorials'.");}, 5.0);
|
|
||||||
do_welcome = 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
var startTutorial = func {
|
var startTutorial = func {
|
||||||
var name = getprop("/sim/tutorials/current-tutorial");
|
var name = getprop("/sim/tutorials/current-tutorial");
|
||||||
if (name == nil) {
|
if (name == nil) {
|
||||||
|
|
|
@ -131,7 +131,10 @@
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>tutorial.startTutorial()</script>
|
<script>
|
||||||
|
setprop("/nasal/tutorial/enabled",1); # load module on demand
|
||||||
|
tutorial.startTutorial();
|
||||||
|
</script>
|
||||||
</binding>
|
</binding>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-close</command>
|
<command>dialog-close</command>
|
||||||
|
|
|
@ -1189,43 +1189,49 @@ Started September 2000 by David Megginson, david@megginson.com
|
||||||
|
|
||||||
<logging>
|
<logging>
|
||||||
<log n="0">
|
<log n="0">
|
||||||
<enabled>false</enabled>
|
<enabled type="bool">false</enabled>
|
||||||
<interval-ms>1000</interval-ms>
|
<interval-ms>1000</interval-ms>
|
||||||
<filename>fg_log.csv</filename>
|
<filename>fg_log.csv</filename>
|
||||||
<delimiter>,</delimiter>
|
<delimiter>,</delimiter>
|
||||||
<entry n="0">
|
<entry n="0">
|
||||||
<enabled>false</enabled>
|
<enabled type="bool">false</enabled>
|
||||||
<title>Longitude</title>
|
<title>Longitude</title>
|
||||||
<property>/position/longitude-deg</property>
|
<property>/position/longitude-deg</property>
|
||||||
</entry>
|
</entry>
|
||||||
<entry n="1">
|
<entry n="1">
|
||||||
<enabled>false</enabled>
|
<enabled type="bool">false</enabled>
|
||||||
<title>Latitude</title>
|
<title>Latitude</title>
|
||||||
<property>/position/latitude-deg</property>
|
<property>/position/latitude-deg</property>
|
||||||
</entry>
|
</entry>
|
||||||
<entry n="2">
|
<entry n="2">
|
||||||
<enabled>false</enabled>
|
<enabled type="bool">false</enabled>
|
||||||
<title>Altitude</title>
|
<title>Altitude</title>
|
||||||
<property>/position/altitude-ft</property>
|
<property>/position/altitude-ft</property>
|
||||||
</entry>
|
</entry>
|
||||||
<entry n="3">
|
<entry n="3">
|
||||||
<enabled>false</enabled>
|
<enabled type="bool">false</enabled>
|
||||||
<title>Roll</title>
|
<title>Roll</title>
|
||||||
<property>/orientation/roll-deg</property>
|
<property>/orientation/roll-deg</property>
|
||||||
</entry>
|
</entry>
|
||||||
<entry n="4">
|
<entry n="4">
|
||||||
<enabled>false</enabled>
|
<enabled type="bool">false</enabled>
|
||||||
<title>Pitch</title>
|
<title>Pitch</title>
|
||||||
<property>/orientation/pitch-deg</property>
|
<property>/orientation/pitch-deg</property>
|
||||||
</entry>
|
</entry>
|
||||||
<entry n="5">
|
<entry n="5">
|
||||||
<enabled>false</enabled>
|
<enabled type="bool">false</enabled>
|
||||||
<title>Heading</title>
|
<title>Heading</title>
|
||||||
<property>/orientation/heading-deg</property>
|
<property>/orientation/heading-deg</property>
|
||||||
</entry>
|
</entry>
|
||||||
</log>
|
</log>
|
||||||
</logging>
|
</logging>
|
||||||
|
|
||||||
|
<nasal>
|
||||||
|
<tutorial>
|
||||||
|
<enabled type="bool">false</enabled>
|
||||||
|
</tutorial>
|
||||||
|
</nasal>
|
||||||
|
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
||||||
<!-- end of preferences.xml -->
|
<!-- end of preferences.xml -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue