1
0
Fork 0

Merge branch 'master' of git@gitorious.org:fg/fgdata

This commit is contained in:
Durk Talsma 2011-06-02 19:22:23 +02:00
commit 4715768478
4 changed files with 63 additions and 29 deletions

View file

@ -135,7 +135,6 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
}
menuEnable("autopilot", isAutopilotMenuEnabled() );
menuEnable("multiplayer", multiplayer.is_active());
menuEnable("tutorial-start", size(props.globals.getNode("/sim/tutorials", 1).getChildren("tutorial")));
menuEnable("joystick-info", size(props.globals.getNode("/input/joysticks").getChildren("js")));
# frame-per-second display

View file

@ -15,7 +15,7 @@ var step_start_time = nil;
var step_iter_count = 0; # number or step loop iterations
var last_step_time = nil; # for set_targets() eta calculation
var audio_dir = nil;
var do_welcome = 1;
# property nodes (to be initialized with listener)
var markerN = nil;
@ -37,7 +37,13 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
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 name = getprop("/sim/tutorials/current-tutorial");
@ -192,7 +198,15 @@ var step_tutorial = func(id) {
var exit = step.getNode("exit");
if (exit != nil) {
if (!props.condition(exit.getNode("condition")))
{
if (time_elapsedN.getValue() - step_start_time > 15.0)
{
# What's going on? Repeat last message.
last_messageN.setValue("");
is_first_step = 1;
}
return continue_after(exit, step_interval);
}
do_group(exit);
}
@ -363,7 +377,6 @@ var is_running = func(which = nil) {
var prop = "/sim/tutorials/running";
if (which != nil) {
setprop(prop, which);
gui.menuEnable("tutorial-stop", which);
}
return getprop(prop);
}

View file

@ -4,17 +4,37 @@
<name>tutorial</name>
<layout>vbox</layout>
<resizable>true</resizable>
<default-padding>4</default-padding>
<default-padding>3</default-padding>
<text>
<label>Select Tutorial</label>
</text>
<group>
<layout>hbox</layout>
<default-padding>1</default-padding>
<empty><stretch>true</stretch></empty>
<text>
<label>Select Tutorial</label>
</text>
<empty><stretch>true</stretch></empty>
<button>
<legend></legend>
<key>Esc</key>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<nasal>
<open>
var list = cmdarg().getNode("group[1]/group/list");
var list = cmdarg().getNode("group[2]/group/list");
var node = props.globals.getNode("/sim/tutorials", 1);
var tut = node.getChildren("tutorial");
var current = node.getNode("current-tutorial", 1);
@ -105,15 +125,6 @@
</binding>
</list>
<button>
<legend>Cancel</legend>
<equal>true</equal>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
<button>
<legend>Start Tutorial</legend>
<equal>true</equal>
@ -126,6 +137,27 @@
<command>dialog-close</command>
</binding>
</button>
<button>
<legend>Stop Tutorial</legend>
<equal>true</equal>
<binding>
<command>nasal</command>
<script>tutorial.stopTutorial()</script>
</binding>
<enable>
<property>/sim/tutorials/running</property>
</enable>
</button>
<button>
<legend>Cancel</legend>
<equal>true</equal>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
</group>
</PropertyList>

View file

@ -758,7 +758,7 @@
</item>
<item>
<label>Start Tutorial</label>
<label>Tutorials</label>
<name>tutorial-start</name>
<binding>
<command>dialog-show</command>
@ -766,16 +766,6 @@
</binding>
</item>
<item>
<label>End Tutorial</label>
<name>tutorial-stop</name>
<enabled>false</enabled>
<binding>
<command>nasal</command>
<script>tutorial.stopTutorial()</script>
</binding>
</item>
<item>
<label>About</label>
<binding>